repo stringclasses 235 values | path stringlengths 11 168 | func_name stringlengths 12 143 | original_string stringlengths 83 6.91k | language stringclasses 1 value | code stringlengths 83 6.91k | code_tokens listlengths 15 1.01k | docstring stringlengths 5 25.7k | docstring_tokens listlengths 1 427 | sha stringclasses 235 values | url stringlengths 99 268 | partition stringclasses 1 value | summary stringlengths 7 202 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.update_service | def update_service(service_id, service_update_description, timeout:60, custom_headers:nil)
response = update_service_async(service_id, service_update_description, timeout:timeout, custom_headers:custom_headers).value!
nil
end | ruby | def update_service(service_id, service_update_description, timeout:60, custom_headers:nil)
response = update_service_async(service_id, service_update_description, timeout:timeout, custom_headers:custom_headers).value!
nil
end | [
"def",
"update_service",
"(",
"service_id",
",",
"service_update_description",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"update_service_async",
"(",
"service_id",
",",
"service_update_description",
",",
"timeout",
":",
"tim... | Updates a Service Fabric service using the specified update description.
This API allows updating properties of a running Service Fabric service. The
set of properties that can be updated are a subset of the properties that
were specified at the time of creating the service. The current set of
properties can be obtained using `GetServiceDescription` API. Please note
that updating the properties of a running service is different than upgrading
your application using `StartApplicationUpgrade` API. The upgrade is a long
running background operation that involves moving the application from one
version to another, one upgrade domain at a time, whereas update applies the
new properties immediately to the service.
@param service_id [String] The identity of the service. This is typically the
full name of the service without the 'fabric:' URI scheme.
Starting from version 6.0, hierarchical names are delimited with the "~"
character.
For example, if the service name is "fabric:/myapp/app1/svc1", the service
identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
versions.
@param service_update_description [ServiceUpdateDescription] The information
necessary to update a service.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Updates",
"a",
"Service",
"Fabric",
"service",
"using",
"the",
"specified",
"update",
"description",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L10548-L10551 | train | Updates a service. | [
30522,
13366,
10651,
1035,
2326,
1006,
2326,
1035,
8909,
1010,
2326,
1035,
10651,
1035,
6412,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
10651,
1035,
2326,
1035,
2004,
6038,
2278,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activesupport/lib/active_support/time_with_zone.rb | ActiveSupport.TimeWithZone.to_s | def to_s(format = :default)
if format == :db
utc.to_s(format)
elsif formatter = ::Time::DATE_FORMATS[format]
formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
else
"#{time.strftime("%Y-%m-%d %H:%M:%S")} #{formatted_offset(false, 'UTC')}" # mimicking Ruby Time#to_s format
end
end | ruby | def to_s(format = :default)
if format == :db
utc.to_s(format)
elsif formatter = ::Time::DATE_FORMATS[format]
formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
else
"#{time.strftime("%Y-%m-%d %H:%M:%S")} #{formatted_offset(false, 'UTC')}" # mimicking Ruby Time#to_s format
end
end | [
"def",
"to_s",
"(",
"format",
"=",
":default",
")",
"if",
"format",
"==",
":db",
"utc",
".",
"to_s",
"(",
"format",
")",
"elsif",
"formatter",
"=",
"::",
"Time",
"::",
"DATE_FORMATS",
"[",
"format",
"]",
"formatter",
".",
"respond_to?",
"(",
":call",
"... | Returns a string of the object's date and time.
Accepts an optional <tt>format</tt>:
* <tt>:default</tt> - default value, mimics Ruby Time#to_s format.
* <tt>:db</tt> - format outputs time in UTC :db time. See Time#to_formatted_s(:db).
* Any key in <tt>Time::DATE_FORMATS</tt> can be used. See active_support/core_ext/time/conversions.rb. | [
"Returns",
"a",
"string",
"of",
"the",
"object",
"s",
"date",
"and",
"time",
".",
"Accepts",
"an",
"optional",
"<tt",
">",
"format<",
"/",
"tt",
">",
":",
"*",
"<tt",
">",
":",
"default<",
"/",
"tt",
">",
"-",
"default",
"value",
"mimics",
"Ruby",
... | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/time_with_zone.rb#L206-L214 | train | Returns the string representation of the time in the given format. | [
30522,
13366,
2000,
1035,
1055,
1006,
4289,
1027,
1024,
12398,
1007,
2065,
4289,
1027,
1027,
1024,
16962,
11396,
1012,
2000,
1035,
1055,
1006,
4289,
1007,
3449,
5332,
2546,
4289,
3334,
1027,
1024,
1024,
2051,
1024,
1024,
3058,
1035,
11630,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/sprockets | lib/sprockets/source_map_utils.rb | Sprockets.SourceMapUtils.concat_source_maps | def concat_source_maps(a, b)
return a || b unless a && b
a = make_index_map(a)
b = make_index_map(b)
offset = 0
if a["sections"].count != 0 && !a["sections"].last["map"]["mappings"].empty?
last_line_count = a["sections"].last["map"].delete("x_sprockets_linecount")
offset += last_line_count
last_offset = a["sections"].last["offset"]["line"]
offset += last_offset
end
a["sections"] += b["sections"].map do |section|
{
"offset" => section["offset"].merge({ "line" => section["offset"]["line"] + offset }),
"map" => section["map"].merge({
"sources" => section["map"]["sources"].map do |source|
PathUtils.relative_path_from(a["file"], PathUtils.join(File.dirname(b["file"]), source))
end
})
}
end
a
end | ruby | def concat_source_maps(a, b)
return a || b unless a && b
a = make_index_map(a)
b = make_index_map(b)
offset = 0
if a["sections"].count != 0 && !a["sections"].last["map"]["mappings"].empty?
last_line_count = a["sections"].last["map"].delete("x_sprockets_linecount")
offset += last_line_count
last_offset = a["sections"].last["offset"]["line"]
offset += last_offset
end
a["sections"] += b["sections"].map do |section|
{
"offset" => section["offset"].merge({ "line" => section["offset"]["line"] + offset }),
"map" => section["map"].merge({
"sources" => section["map"]["sources"].map do |source|
PathUtils.relative_path_from(a["file"], PathUtils.join(File.dirname(b["file"]), source))
end
})
}
end
a
end | [
"def",
"concat_source_maps",
"(",
"a",
",",
"b",
")",
"return",
"a",
"||",
"b",
"unless",
"a",
"&&",
"b",
"a",
"=",
"make_index_map",
"(",
"a",
")",
"b",
"=",
"make_index_map",
"(",
"b",
")",
"offset",
"=",
"0",
"if",
"a",
"[",
"\"sections\"",
"]",... | Public: Concatenate two source maps.
For an example, if two js scripts are concatenated, the individual source
maps for those files can be concatenated to map back to the originals.
Examples
script3 = "#{script1}#{script2}"
map3 = concat_source_maps(map1, map2)
a - Source map hash
b - Source map hash
Returns a new source map hash. | [
"Public",
":",
"Concatenate",
"two",
"source",
"maps",
"."
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/source_map_utils.rb#L73-L98 | train | Concat two source maps together. | [
30522,
13366,
9530,
11266,
1035,
3120,
1035,
7341,
1006,
1037,
1010,
1038,
1007,
2709,
1037,
1064,
1064,
1038,
4983,
1037,
1004,
1004,
1038,
1037,
1027,
2191,
1035,
5950,
30524,
1035,
4949,
1006,
1038,
1007,
16396,
1027,
1014,
2065,
1037,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-12-01/generated/azure_mgmt_network/virtual_network_peerings.rb | Azure::Network::Mgmt::V2018_12_01.VirtualNetworkPeerings.create_or_update | def create_or_update(resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers:nil)
response = create_or_update_async(resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_or_update(resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers:nil)
response = create_or_update_async(resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_or_update",
"(",
"resource_group_name",
",",
"virtual_network_name",
",",
"virtual_network_peering_name",
",",
"virtual_network_peering_parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_or_update_async",
"(",
"resource_group_name",
"... | Creates or updates a peering in the specified virtual network.
@param resource_group_name [String] The name of the resource group.
@param virtual_network_name [String] The name of the virtual network.
@param virtual_network_peering_name [String] The name of the peering.
@param virtual_network_peering_parameters [VirtualNetworkPeering] Parameters
supplied to the create or update virtual network peering operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [VirtualNetworkPeering] operation results. | [
"Creates",
"or",
"updates",
"a",
"peering",
"in",
"the",
"specified",
"virtual",
"network",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-12-01/generated/azure_mgmt_network/virtual_network_peerings.rb#L178-L181 | train | Creates or updates a virtual network. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7484,
1035,
2897,
1035,
2171,
1010,
7484,
1035,
2897,
1035,
16740,
1035,
2171,
1010,
7484,
1035,
2897,
1035,
16740,
1035,
11709,
1010,
7661,
1035,
20346,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aasm/aasm | lib/aasm/aasm.rb | AASM.ClassMethods.aasm | def aasm(*args, &block)
if args[0].is_a?(Symbol) || args[0].is_a?(String)
# using custom name
state_machine_name = args[0].to_sym
options = args[1] || {}
else
# using the default state_machine_name
state_machine_name = :default
options = args[0] || {}
end
AASM::StateMachineStore.fetch(self, true).register(state_machine_name, AASM::StateMachine.new(state_machine_name))
# use a default despite the DSL configuration default.
# this is because configuration hasn't been setup for the AASM class but we are accessing a DSL option already for the class.
aasm_klass = options[:with_klass] || AASM::Base
raise ArgumentError, "The class #{aasm_klass} must inherit from AASM::Base!" unless aasm_klass.ancestors.include?(AASM::Base)
@aasm ||= Concurrent::Map.new
if @aasm[state_machine_name]
# make sure to use provided options
options.each do |key, value|
@aasm[state_machine_name].state_machine.config.send("#{key}=", value)
end
else
# create a new base
@aasm[state_machine_name] = aasm_klass.new(
self,
state_machine_name,
AASM::StateMachineStore.fetch(self, true).machine(state_machine_name),
options
)
end
@aasm[state_machine_name].instance_eval(&block) if block # new DSL
@aasm[state_machine_name]
end | ruby | def aasm(*args, &block)
if args[0].is_a?(Symbol) || args[0].is_a?(String)
# using custom name
state_machine_name = args[0].to_sym
options = args[1] || {}
else
# using the default state_machine_name
state_machine_name = :default
options = args[0] || {}
end
AASM::StateMachineStore.fetch(self, true).register(state_machine_name, AASM::StateMachine.new(state_machine_name))
# use a default despite the DSL configuration default.
# this is because configuration hasn't been setup for the AASM class but we are accessing a DSL option already for the class.
aasm_klass = options[:with_klass] || AASM::Base
raise ArgumentError, "The class #{aasm_klass} must inherit from AASM::Base!" unless aasm_klass.ancestors.include?(AASM::Base)
@aasm ||= Concurrent::Map.new
if @aasm[state_machine_name]
# make sure to use provided options
options.each do |key, value|
@aasm[state_machine_name].state_machine.config.send("#{key}=", value)
end
else
# create a new base
@aasm[state_machine_name] = aasm_klass.new(
self,
state_machine_name,
AASM::StateMachineStore.fetch(self, true).machine(state_machine_name),
options
)
end
@aasm[state_machine_name].instance_eval(&block) if block # new DSL
@aasm[state_machine_name]
end | [
"def",
"aasm",
"(",
"*",
"args",
",",
"&",
"block",
")",
"if",
"args",
"[",
"0",
"]",
".",
"is_a?",
"(",
"Symbol",
")",
"||",
"args",
"[",
"0",
"]",
".",
"is_a?",
"(",
"String",
")",
"# using custom name",
"state_machine_name",
"=",
"args",
"[",
"0... | this is the entry point for all state and event definitions | [
"this",
"is",
"the",
"entry",
"point",
"for",
"all",
"state",
"and",
"event",
"definitions"
] | 6a1000b489c6b2e205a7b142478a4b4e207c3dbd | https://github.com/aasm/aasm/blob/6a1000b489c6b2e205a7b142478a4b4e207c3dbd/lib/aasm/aasm.rb#L28-L64 | train | Creates a new instance of the AASM class. | [
30522,
13366,
9779,
6491,
1006,
1008,
12098,
5620,
1010,
1004,
3796,
1007,
2065,
12098,
5620,
1031,
1014,
1033,
1012,
2003,
1035,
1037,
1029,
1006,
6454,
1007,
1064,
1064,
12098,
5620,
1031,
1014,
1033,
1012,
2003,
1035,
1037,
1029,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | frameit/lib/frameit/editor.rb | Frameit.Editor.resize_frame! | def resize_frame!
screenshot_width = self.screenshot.portrait? ? screenshot.size[0] : screenshot.size[1]
multiplicator = (screenshot_width.to_f / offset['width'].to_f) # by how much do we have to change this?
new_frame_width = multiplicator * frame.width # the new width for the frame
frame.resize("#{new_frame_width.round}x") # resize it to the calculated width
modify_offset(multiplicator) # modify the offset to properly insert the screenshot into the frame later
end | ruby | def resize_frame!
screenshot_width = self.screenshot.portrait? ? screenshot.size[0] : screenshot.size[1]
multiplicator = (screenshot_width.to_f / offset['width'].to_f) # by how much do we have to change this?
new_frame_width = multiplicator * frame.width # the new width for the frame
frame.resize("#{new_frame_width.round}x") # resize it to the calculated width
modify_offset(multiplicator) # modify the offset to properly insert the screenshot into the frame later
end | [
"def",
"resize_frame!",
"screenshot_width",
"=",
"self",
".",
"screenshot",
".",
"portrait?",
"?",
"screenshot",
".",
"size",
"[",
"0",
"]",
":",
"screenshot",
".",
"size",
"[",
"1",
"]",
"multiplicator",
"=",
"(",
"screenshot_width",
".",
"to_f",
"/",
"of... | Resize the frame as it's too low quality by default | [
"Resize",
"the",
"frame",
"as",
"it",
"s",
"too",
"low",
"quality",
"by",
"default"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/frameit/lib/frameit/editor.rb#L273-L280 | train | Resize the frame to the new width | [
30522,
13366,
24501,
4697,
1035,
4853,
999,
12117,
12326,
1035,
9381,
1027,
2969,
1012,
12117,
12326,
1012,
6533,
1029,
1029,
12117,
12326,
1012,
2946,
1031,
1014,
1033,
1024,
12117,
12326,
1012,
2946,
1031,
1015,
1033,
4800,
24759,
5555,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_dns/lib/2017-09-01/generated/azure_mgmt_dns/record_sets.rb | Azure::Dns::Mgmt::V2017_09_01.RecordSets.list_by_dns_zone_as_lazy | def list_by_dns_zone_as_lazy(resource_group_name, zone_name, top:nil, recordsetnamesuffix:nil, custom_headers:nil)
response = list_by_dns_zone_async(resource_group_name, zone_name, top:top, recordsetnamesuffix:recordsetnamesuffix, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_dns_zone_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_by_dns_zone_as_lazy(resource_group_name, zone_name, top:nil, recordsetnamesuffix:nil, custom_headers:nil)
response = list_by_dns_zone_async(resource_group_name, zone_name, top:top, recordsetnamesuffix:recordsetnamesuffix, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_dns_zone_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_by_dns_zone_as_lazy",
"(",
"resource_group_name",
",",
"zone_name",
",",
"top",
":",
"nil",
",",
"recordsetnamesuffix",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_dns_zone_async",
"(",
"resource_group_name",
",",
"zone... | Lists all record sets in a DNS zone.
@param resource_group_name [String] The name of the resource group. The name
is case insensitive.
@param zone_name [String] The name of the DNS zone (without a terminating
dot).
@param top [Integer] The maximum number of record sets to return. If not
specified, returns up to 100 record sets.
@param recordsetnamesuffix [String] The suffix label of the record set name
that has to be used to filter the record set enumerations. If this parameter
is specified, Enumeration will return only records that end with
.<recordSetNameSuffix>
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [RecordSetListResult] which provide lazy access to pages of the
response. | [
"Lists",
"all",
"record",
"sets",
"in",
"a",
"DNS",
"zone",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_dns/lib/2017-09-01/generated/azure_mgmt_dns/record_sets.rb#L1058-L1067 | train | Gets a list of all the records in a DNS zone. | [
30522,
13366,
2862,
1035,
2011,
1035,
1040,
3619,
1035,
4224,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4224,
1035,
2171,
1010,
2327,
1024,
9152,
2140,
1010,
2636,
3388,
18442,
6342,
26989,
2595,
1024,
9152,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Katello/katello | app/helpers/katello/application_helper.rb | Katello.ApplicationHelper.sort | def sort(field, options = {}, html_options = {})
unless options[:as]
id = field.to_s.downcase == "id"
options[:as] = id ? field.to_s.upcase : field.to_s.humanize
end
ascend = "#{field}|ASC"
descend = "#{field}|DESC"
ascending = params[:order] == ascend
new_sort = ascending ? descend : ascend
selected = [ascend, descend].include?(params[:order])
if selected
css_classes = html_options[:class] ? html_options[:class].split(" ") : []
if ascending
options[:as] = "▲ #{options[:as]}"
css_classes << "ascending"
else
options[:as] = "▼ #{options[:as]}"
css_classes << "descending"
end
html_options[:class] = css_classes.join(" ")
end
url_options = params.merge(:order => new_sort)
options[:as] = raw(options[:as]) if defined?(RailsXss)
a_link(options[:as], html_escape(url_for(url_options)), html_options)
end | ruby | def sort(field, options = {}, html_options = {})
unless options[:as]
id = field.to_s.downcase == "id"
options[:as] = id ? field.to_s.upcase : field.to_s.humanize
end
ascend = "#{field}|ASC"
descend = "#{field}|DESC"
ascending = params[:order] == ascend
new_sort = ascending ? descend : ascend
selected = [ascend, descend].include?(params[:order])
if selected
css_classes = html_options[:class] ? html_options[:class].split(" ") : []
if ascending
options[:as] = "▲ #{options[:as]}"
css_classes << "ascending"
else
options[:as] = "▼ #{options[:as]}"
css_classes << "descending"
end
html_options[:class] = css_classes.join(" ")
end
url_options = params.merge(:order => new_sort)
options[:as] = raw(options[:as]) if defined?(RailsXss)
a_link(options[:as], html_escape(url_for(url_options)), html_options)
end | [
"def",
"sort",
"(",
"field",
",",
"options",
"=",
"{",
"}",
",",
"html_options",
"=",
"{",
"}",
")",
"unless",
"options",
"[",
":as",
"]",
"id",
"=",
"field",
".",
"to_s",
".",
"downcase",
"==",
"\"id\"",
"options",
"[",
":as",
"]",
"=",
"id",
"?... | These 2 methods copied from scoped_search {https://github.com/wvanbergen/scoped_search}
which Katello used to use but no longer uses.
Creates a link that alternates between ascending and descending.
@example
sort @search, :by => :login
sort @search, :by => :created_at, :as => "Created"
@param [Hash] options This helper accepts the following options:
@option options [String] :by the name of the named scope. This helper will prepend this value with "ascend_by_" and "descend_by_"
@option options [String] :as the text used in the link, defaults to whatever is passed to :by | [
"These",
"2",
"methods",
"copied",
"from",
"scoped_search",
"{",
"https",
":",
"//",
"github",
".",
"com",
"/",
"wvanbergen",
"/",
"scoped_search",
"}",
"which",
"Katello",
"used",
"to",
"use",
"but",
"no",
"longer",
"uses",
"."
] | a1c9280067607999cae43bab89b53ba870856b76 | https://github.com/Katello/katello/blob/a1c9280067607999cae43bab89b53ba870856b76/app/helpers/katello/application_helper.rb#L27-L57 | train | Sort the results by a given field | [
30522,
13366,
4066,
1006,
2492,
1010,
7047,
1027,
1063,
1065,
1010,
16129,
1035,
7047,
1027,
1063,
1065,
1007,
4983,
7047,
1031,
1024,
2004,
1033,
8909,
1027,
2492,
1012,
2000,
1035,
1055,
1012,
2091,
18382,
1027,
1027,
1000,
8909,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activesupport/lib/active_support/hash_with_indifferent_access.rb | ActiveSupport.HashWithIndifferentAccess.update | def update(other_hash)
if other_hash.is_a? HashWithIndifferentAccess
super(other_hash)
else
other_hash.to_hash.each_pair do |key, value|
if block_given? && key?(key)
value = yield(convert_key(key), self[key], value)
end
regular_writer(convert_key(key), convert_value(value))
end
self
end
end | ruby | def update(other_hash)
if other_hash.is_a? HashWithIndifferentAccess
super(other_hash)
else
other_hash.to_hash.each_pair do |key, value|
if block_given? && key?(key)
value = yield(convert_key(key), self[key], value)
end
regular_writer(convert_key(key), convert_value(value))
end
self
end
end | [
"def",
"update",
"(",
"other_hash",
")",
"if",
"other_hash",
".",
"is_a?",
"HashWithIndifferentAccess",
"super",
"(",
"other_hash",
")",
"else",
"other_hash",
".",
"to_hash",
".",
"each_pair",
"do",
"|",
"key",
",",
"value",
"|",
"if",
"block_given?",
"&&",
... | Updates the receiver in-place, merging in the hash passed as argument:
hash_1 = ActiveSupport::HashWithIndifferentAccess.new
hash_1[:key] = 'value'
hash_2 = ActiveSupport::HashWithIndifferentAccess.new
hash_2[:key] = 'New Value!'
hash_1.update(hash_2) # => {"key"=>"New Value!"}
The argument can be either an
<tt>ActiveSupport::HashWithIndifferentAccess</tt> or a regular +Hash+.
In either case the merge respects the semantics of indifferent access.
If the argument is a regular hash with keys +:key+ and +"key"+ only one
of the values end up in the receiver, but which one is unspecified.
When given a block, the value for duplicated keys will be determined
by the result of invoking the block with the duplicated key, the value
in the receiver, and the value in +other_hash+. The rules for duplicated
keys follow the semantics of indifferent access:
hash_1[:key] = 10
hash_2['key'] = 12
hash_1.update(hash_2) { |key, old, new| old + new } # => {"key"=>22} | [
"Updates",
"the",
"receiver",
"in",
"-",
"place",
"merging",
"in",
"the",
"hash",
"passed",
"as",
"argument",
":"
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/hash_with_indifferent_access.rb#L124-L136 | train | Update the HashWithIndifferentAccess object with the other HashWithIndifferentAccess object. | [
30522,
13366,
10651,
1006,
2060,
1035,
23325,
1007,
2065,
2060,
1035,
23325,
1012,
2003,
1035,
1037,
1029,
23325,
24415,
22254,
13355,
7869,
12380,
9468,
7971,
3565,
1006,
2060,
1035,
23325,
1007,
2842,
2060,
1035,
23325,
1012,
2000,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hashicorp/vault-ruby | lib/vault/api/approle.rb | Vault.AppRole.set_role | def set_role(name, options = {})
headers = extract_headers!(options)
client.post("/v1/auth/approle/role/#{encode_path(name)}", JSON.fast_generate(options), headers)
return true
end | ruby | def set_role(name, options = {})
headers = extract_headers!(options)
client.post("/v1/auth/approle/role/#{encode_path(name)}", JSON.fast_generate(options), headers)
return true
end | [
"def",
"set_role",
"(",
"name",
",",
"options",
"=",
"{",
"}",
")",
"headers",
"=",
"extract_headers!",
"(",
"options",
")",
"client",
".",
"post",
"(",
"\"/v1/auth/approle/role/#{encode_path(name)}\"",
",",
"JSON",
".",
"fast_generate",
"(",
"options",
")",
"... | Creates a new AppRole or update an existing AppRole with the given name
and attributes.
@example
Vault.approle.set_role("testrole", {
secret_id_ttl: "10m",
token_ttl: "20m",
policies: "default",
period: 3600,
}) #=> true
@param [String] name
The name of the AppRole
@param [Hash] options
@option options [Boolean] :bind_secret_id
Require secret_id to be presented when logging in using this AppRole.
@option options [String] :bound_cidr_list
Comma-separated list of CIDR blocks. Specifies blocks of IP addresses
which can perform the login operation.
@option options [String] :policies
Comma-separated list of policies set on tokens issued via this AppRole.
@option options [String] :secret_id_num_uses
Number of times any particular SecretID can be used to fetch a token
from this AppRole, after which the SecretID will expire.
@option options [Fixnum, String] :secret_id_ttl
The number of seconds or a golang-formatted timestamp like "60m" after
which any SecretID expires.
@option options [Fixnum, String] :token_ttl
The number of seconds or a golang-formatted timestamp like "60m" to set
as the TTL for issued tokens and at renewal time.
@option options [Fixnum, String] :token_max_ttl
The number of seconds or a golang-formatted timestamp like "60m" after
which the issued token can no longer be renewed.
@option options [Fixnum, String] :period
The number of seconds or a golang-formatted timestamp like "60m".
If set, the token generated using this AppRole is a periodic token.
So long as it is renewed it never expires, but the TTL set on the token
at each renewal is fixed to the value specified here. If this value is
modified, the token will pick up the new value at its next renewal.
@return [true] | [
"Creates",
"a",
"new",
"AppRole",
"or",
"update",
"an",
"existing",
"AppRole",
"with",
"the",
"given",
"name",
"and",
"attributes",
"."
] | 02f0532a802ba1a2a0d8703a4585dab76eb9d864 | https://github.com/hashicorp/vault-ruby/blob/02f0532a802ba1a2a0d8703a4585dab76eb9d864/lib/vault/api/approle.rb#L59-L63 | train | Set the role of an approval | [
30522,
13366,
2275,
1035,
2535,
1006,
2171,
1010,
7047,
1027,
1063,
1065,
1007,
20346,
2015,
1027,
14817,
1035,
20346,
2015,
999,
1006,
7047,
1007,
7396,
1012,
2695,
1006,
1000,
1013,
1058,
2487,
1013,
8740,
2705,
1013,
10439,
13153,
2063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/sprockets | lib/sprockets/utils.rb | Sprockets.Utils.concat_javascript_sources | def concat_javascript_sources(buf, source)
return buf if source.bytesize <= 0
buf << source
# If the source contains non-ASCII characters, indexing on it becomes O(N).
# This will lead to O(N^2) performance in string_end_with_semicolon?, so we should use 32 bit encoding to make sure indexing stays O(1)
source = source.encode(Encoding::UTF_32LE) unless source.ascii_only?
return buf if string_end_with_semicolon?(source)
# If the last character in the string was whitespace,
# such as a newline, then we want to put the semicolon
# before the whitespace. Otherwise append a semicolon.
if whitespace = WHITESPACE_ORDINALS[source[-1].ord]
buf[-1] = ";#{whitespace}"
else
buf << ";"
end
buf
end | ruby | def concat_javascript_sources(buf, source)
return buf if source.bytesize <= 0
buf << source
# If the source contains non-ASCII characters, indexing on it becomes O(N).
# This will lead to O(N^2) performance in string_end_with_semicolon?, so we should use 32 bit encoding to make sure indexing stays O(1)
source = source.encode(Encoding::UTF_32LE) unless source.ascii_only?
return buf if string_end_with_semicolon?(source)
# If the last character in the string was whitespace,
# such as a newline, then we want to put the semicolon
# before the whitespace. Otherwise append a semicolon.
if whitespace = WHITESPACE_ORDINALS[source[-1].ord]
buf[-1] = ";#{whitespace}"
else
buf << ";"
end
buf
end | [
"def",
"concat_javascript_sources",
"(",
"buf",
",",
"source",
")",
"return",
"buf",
"if",
"source",
".",
"bytesize",
"<=",
"0",
"buf",
"<<",
"source",
"# If the source contains non-ASCII characters, indexing on it becomes O(N).",
"# This will lead to O(N^2) performance in stri... | Internal: Accumulate asset source to buffer and append a trailing
semicolon if necessary.
buf - String buffer to append to
source - String source to append
Returns buf String. | [
"Internal",
":",
"Accumulate",
"asset",
"source",
"to",
"buffer",
"and",
"append",
"a",
"trailing",
"semicolon",
"if",
"necessary",
"."
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/utils.rb#L100-L119 | train | Concatenates the given JavaScript source into the buffer. | [
30522,
13366,
9530,
11266,
1035,
9262,
22483,
1035,
4216,
1006,
20934,
2546,
1010,
3120,
1007,
2709,
20934,
2546,
2065,
3120,
1012,
27507,
4697,
1026,
1027,
1014,
20934,
2546,
1026,
1026,
3120,
1001,
2065,
1996,
3120,
3397,
2512,
1011,
2004... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
activeadmin/activeadmin | lib/active_admin/resource_dsl.rb | ActiveAdmin.ResourceDSL.csv | def csv(options = {}, &block)
options[:resource] = config
config.csv_builder = CSVBuilder.new(options, &block)
end | ruby | def csv(options = {}, &block)
options[:resource] = config
config.csv_builder = CSVBuilder.new(options, &block)
end | [
"def",
"csv",
"(",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"options",
"[",
":resource",
"]",
"=",
"config",
"config",
".",
"csv_builder",
"=",
"CSVBuilder",
".",
"new",
"(",
"options",
",",
"block",
")",
"end"
] | Configure the CSV format
For example:
csv do
column :name
column("Author") { |post| post.author.full_name }
end
csv col_sep: ";", force_quotes: true do
column :name
end | [
"Configure",
"the",
"CSV",
"format"
] | 0759c8dcf97865748c9344459162ac3c7e65a6cd | https://github.com/activeadmin/activeadmin/blob/0759c8dcf97865748c9344459162ac3c7e65a6cd/lib/active_admin/resource_dsl.rb#L110-L114 | train | Create a CSV file | [
30522,
13366,
20116,
2615,
1006,
7047,
1027,
1063,
1065,
1010,
1004,
3796,
1007,
7047,
1031,
1024,
7692,
1033,
1027,
9530,
8873,
2290,
9530,
8873,
2290,
1012,
20116,
2615,
1035,
12508,
1027,
20116,
26493,
19231,
4063,
1012,
2047,
1006,
7047... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/identity_provider.rb | Azure::ApiManagement::Mgmt::V2018_01_01.IdentityProvider.get_with_http_info | def get_with_http_info(resource_group_name, service_name, identity_provider_name, custom_headers:nil)
get_async(resource_group_name, service_name, identity_provider_name, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, service_name, identity_provider_name, custom_headers:nil)
get_async(resource_group_name, service_name, identity_provider_name, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"service_name",
",",
"identity_provider_name",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"service_name",
",",
"identity_provider_name",
",",
"custom_headers",
":custo... | Gets the configuration details of the identity Provider configured in
specified service instance.
@param resource_group_name [String] The name of the resource group.
@param service_name [String] The name of the API Management service.
@param identity_provider_name [IdentityProviderType] Identity Provider Type
identifier. Possible values include: 'facebook', 'google', 'microsoft',
'twitter', 'aad', 'aadB2C'
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"configuration",
"details",
"of",
"the",
"identity",
"Provider",
"configured",
"in",
"specified",
"service",
"instance",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/identity_provider.rb#L252-L254 | train | Gets the identity specification of the specified identity provider. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
4767,
1035,
10802,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
2004,
6038,
2278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
zendesk/ruby-kafka | lib/kafka/offset_manager.rb | Kafka.OffsetManager.next_offset_for | def next_offset_for(topic, partition)
offset = @processed_offsets.fetch(topic, {}).fetch(partition) {
committed_offset_for(topic, partition)
}
# A negative offset means that no offset has been committed, so we need to
# resolve the default offset for the topic.
if offset < 0
resolve_offset(topic, partition)
else
# The next offset is the last offset.
offset
end
end | ruby | def next_offset_for(topic, partition)
offset = @processed_offsets.fetch(topic, {}).fetch(partition) {
committed_offset_for(topic, partition)
}
# A negative offset means that no offset has been committed, so we need to
# resolve the default offset for the topic.
if offset < 0
resolve_offset(topic, partition)
else
# The next offset is the last offset.
offset
end
end | [
"def",
"next_offset_for",
"(",
"topic",
",",
"partition",
")",
"offset",
"=",
"@processed_offsets",
".",
"fetch",
"(",
"topic",
",",
"{",
"}",
")",
".",
"fetch",
"(",
"partition",
")",
"{",
"committed_offset_for",
"(",
"topic",
",",
"partition",
")",
"}",
... | Return the next offset that should be fetched for the specified partition.
@param topic [String] the name of the topic.
@param partition [Integer] the partition number.
@return [Integer] the next offset that should be fetched. | [
"Return",
"the",
"next",
"offset",
"that",
"should",
"be",
"fetched",
"for",
"the",
"specified",
"partition",
"."
] | 2a73471b6a607a52dc85c79301ba522acb4566b5 | https://github.com/zendesk/ruby-kafka/blob/2a73471b6a607a52dc85c79301ba522acb4566b5/lib/kafka/offset_manager.rb#L95-L108 | train | Returns the next offset for the topic and partition | [
30522,
13366,
2279,
1035,
16396,
1035,
2005,
1006,
8476,
1010,
13571,
1007,
16396,
1027,
1030,
13995,
1035,
16396,
2015,
1012,
18584,
1006,
8476,
1010,
1063,
1065,
1007,
1012,
18584,
1006,
13571,
1007,
1063,
5462,
1035,
16396,
1035,
2005,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
backup/backup | vagrant/spec/support/tar_file.rb | BackupSpec.TarFile.extracted_files | def extracted_files
@extracted_files ||= begin
base_path = File.dirname(path)
filename = File.basename(path)
Dir.chdir(base_path) do
%x[#{ utility(:tar) } -xf #{ filename } 2>/dev/null]
end
Hash[
contents.keys.map {|manifest_path|
path = File.join(base_path, manifest_path.sub(/^\//, ''))
if path =~ /\.tar.*$/
[manifest_path, self.class.new(path)]
else
[manifest_path, path]
end
}
]
end
end | ruby | def extracted_files
@extracted_files ||= begin
base_path = File.dirname(path)
filename = File.basename(path)
Dir.chdir(base_path) do
%x[#{ utility(:tar) } -xf #{ filename } 2>/dev/null]
end
Hash[
contents.keys.map {|manifest_path|
path = File.join(base_path, manifest_path.sub(/^\//, ''))
if path =~ /\.tar.*$/
[manifest_path, self.class.new(path)]
else
[manifest_path, path]
end
}
]
end
end | [
"def",
"extracted_files",
"@extracted_files",
"||=",
"begin",
"base_path",
"=",
"File",
".",
"dirname",
"(",
"path",
")",
"filename",
"=",
"File",
".",
"basename",
"(",
"path",
")",
"Dir",
".",
"chdir",
"(",
"base_path",
")",
"do",
"%x[",
"#{",
"utility",
... | Return a Hash with the paths from #contents mapped to either another
TarFile object (for tar files) or the full path to the extracted file. | [
"Return",
"a",
"Hash",
"with",
"the",
"paths",
"from",
"#contents",
"mapped",
"to",
"either",
"another",
"TarFile",
"object",
"(",
"for",
"tar",
"files",
")",
"or",
"the",
"full",
"path",
"to",
"the",
"extracted",
"file",
"."
] | 64370f925e859f858766b674717a3dbee0de7a26 | https://github.com/backup/backup/blob/64370f925e859f858766b674717a3dbee0de7a26/vagrant/spec/support/tar_file.rb#L44-L62 | train | Returns the extracted files | [
30522,
13366,
15901,
1035,
6764,
1030,
15901,
1035,
6764,
1064,
1064,
1027,
4088,
2918,
1035,
4130,
1027,
5371,
1012,
16101,
18442,
1006,
4130,
1007,
5371,
18442,
1027,
5371,
1012,
2918,
18442,
1006,
4130,
1007,
16101,
1012,
10381,
4305,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_monitor/lib/2017-11-01-preview/generated/azure_mgmt_monitor/metric_baseline.rb | Azure::Monitor::Mgmt::V2017_11_01_preview.MetricBaseline.calculate_baseline | def calculate_baseline(resource_uri, time_series_information, custom_headers:nil)
response = calculate_baseline_async(resource_uri, time_series_information, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def calculate_baseline(resource_uri, time_series_information, custom_headers:nil)
response = calculate_baseline_async(resource_uri, time_series_information, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"calculate_baseline",
"(",
"resource_uri",
",",
"time_series_information",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"calculate_baseline_async",
"(",
"resource_uri",
",",
"time_series_information",
",",
"custom_headers",
":custom_headers",
")",
".",
... | **Lists the baseline values for a resource**.
@param resource_uri [String] The identifier of the resource. It has the
following structure:
subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}.
For example:
subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1
@param time_series_information [TimeSeriesInformation] Information that need
to be specified to calculate a baseline on a time series.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [CalculateBaselineResponse] operation results. | [
"**",
"Lists",
"the",
"baseline",
"values",
"for",
"a",
"resource",
"**",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_monitor/lib/2017-11-01-preview/generated/azure_mgmt_monitor/metric_baseline.rb#L176-L179 | train | Calculate the baseline of the resource. | [
30522,
13366,
18422,
1035,
26163,
1006,
7692,
1035,
24471,
2072,
1010,
2051,
1035,
2186,
1035,
2592,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
30524,
1012,
3643,
999,
3433,
1012,
2303,
4983,
3433,
1012,
9152,
2140,
1029,
2203,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
anycable/anycable | lib/anycable/config.rb | AnyCable.Config.to_redis_params | def to_redis_params
{ url: redis_url }.tap do |params|
next if redis_sentinels.nil?
raise ArgumentError, "redis_sentinels must be an array; got #{redis_sentinels}" unless
redis_sentinels.is_a?(Array)
next if redis_sentinels.empty?
params[:sentinels] = redis_sentinels.map(&method(:parse_sentinel))
end
end | ruby | def to_redis_params
{ url: redis_url }.tap do |params|
next if redis_sentinels.nil?
raise ArgumentError, "redis_sentinels must be an array; got #{redis_sentinels}" unless
redis_sentinels.is_a?(Array)
next if redis_sentinels.empty?
params[:sentinels] = redis_sentinels.map(&method(:parse_sentinel))
end
end | [
"def",
"to_redis_params",
"{",
"url",
":",
"redis_url",
"}",
".",
"tap",
"do",
"|",
"params",
"|",
"next",
"if",
"redis_sentinels",
".",
"nil?",
"raise",
"ArgumentError",
",",
"\"redis_sentinels must be an array; got #{redis_sentinels}\"",
"unless",
"redis_sentinels",
... | Build Redis parameters | [
"Build",
"Redis",
"parameters"
] | d7515e8e034d42e86ebeb09786a92aad2a11b25f | https://github.com/anycable/anycable/blob/d7515e8e034d42e86ebeb09786a92aad2a11b25f/lib/anycable/config.rb#L73-L84 | train | Returns a hash of the parameters to be sent in the Redis connection. | [
30522,
13366,
2000,
1035,
2417,
2483,
1035,
11498,
5244,
1063,
24471,
2140,
1024,
2417,
2483,
1035,
24471,
2140,
1065,
1012,
11112,
2079,
1064,
11498,
5244,
1064,
2279,
2065,
2417,
2483,
1035,
16074,
2015,
1012,
9152,
2140,
1029,
5333,
6685... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
puppetlabs/puppet | lib/puppet/pops/loaders.rb | Puppet::Pops.Loaders.load_main_manifest | def load_main_manifest
parser = Parser::EvaluatingParser.singleton
parsed_code = Puppet[:code]
program = if parsed_code != ""
parser.parse_string(parsed_code, 'unknown-source-location')
else
file = @environment.manifest
# if the manifest file is a reference to a directory, parse and combine
# all .pp files in that directory
if file == Puppet::Node::Environment::NO_MANIFEST
nil
elsif File.directory?(file)
raise Puppet::Error, "manifest of environment '#{@environment.name}' appoints directory '#{file}'. It must be a file"
elsif File.exists?(file)
parser.parse_file(file)
else
raise Puppet::Error, "manifest of environment '#{@environment.name}' appoints '#{file}'. It does not exist"
end
end
instantiate_definitions(program, public_environment_loader) unless program.nil?
program
rescue Puppet::ParseErrorWithIssue => detail
detail.environment = @environment.name
raise
rescue => detail
msg = _('Could not parse for environment %{env}: %{detail}') % { env: @environment, detail: detail }
error = Puppet::Error.new(msg)
error.set_backtrace(detail.backtrace)
raise error
end | ruby | def load_main_manifest
parser = Parser::EvaluatingParser.singleton
parsed_code = Puppet[:code]
program = if parsed_code != ""
parser.parse_string(parsed_code, 'unknown-source-location')
else
file = @environment.manifest
# if the manifest file is a reference to a directory, parse and combine
# all .pp files in that directory
if file == Puppet::Node::Environment::NO_MANIFEST
nil
elsif File.directory?(file)
raise Puppet::Error, "manifest of environment '#{@environment.name}' appoints directory '#{file}'. It must be a file"
elsif File.exists?(file)
parser.parse_file(file)
else
raise Puppet::Error, "manifest of environment '#{@environment.name}' appoints '#{file}'. It does not exist"
end
end
instantiate_definitions(program, public_environment_loader) unless program.nil?
program
rescue Puppet::ParseErrorWithIssue => detail
detail.environment = @environment.name
raise
rescue => detail
msg = _('Could not parse for environment %{env}: %{detail}') % { env: @environment, detail: detail }
error = Puppet::Error.new(msg)
error.set_backtrace(detail.backtrace)
raise error
end | [
"def",
"load_main_manifest",
"parser",
"=",
"Parser",
"::",
"EvaluatingParser",
".",
"singleton",
"parsed_code",
"=",
"Puppet",
"[",
":code",
"]",
"program",
"=",
"if",
"parsed_code",
"!=",
"\"\"",
"parser",
".",
"parse_string",
"(",
"parsed_code",
",",
"'unknow... | Load the main manifest for the given environment
There are two sources that can be used for the initial parse:
1. The value of `Puppet[:code]`: Puppet can take a string from
its settings and parse that as a manifest. This is used by various
Puppet applications to read in a manifest and pass it to the
environment as a side effect. This is attempted first.
2. The contents of the environment's +manifest+ attribute: Puppet will
try to load the environment manifest. The manifest must be a file.
@return [Model::Program] The manifest parsed into a model object | [
"Load",
"the",
"main",
"manifest",
"for",
"the",
"given",
"environment"
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/pops/loaders.rb#L272-L302 | train | Load the main manifest of the environment | [
30522,
13366,
7170,
1035,
2364,
1035,
19676,
11968,
8043,
1027,
11968,
8043,
1024,
1024,
23208,
19362,
8043,
1012,
28159,
11968,
6924,
1035,
3642,
1027,
13997,
1031,
1024,
3642,
1033,
2565,
1027,
2065,
11968,
6924,
1035,
3642,
999,
1027,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sporkmonger/addressable | lib/addressable/uri.rb | Addressable.URI.userinfo= | def userinfo=(new_userinfo)
if new_userinfo && !new_userinfo.respond_to?(:to_str)
raise TypeError, "Can't convert #{new_userinfo.class} into String."
end
new_user, new_password = if new_userinfo
[
new_userinfo.to_str.strip[/^(.*):/, 1],
new_userinfo.to_str.strip[/:(.*)$/, 1]
]
else
[nil, nil]
end
# Password assigned first to ensure validity in case of nil
self.password = new_password
self.user = new_user
# Reset dependent values
remove_instance_variable(:@authority) if defined?(@authority)
remove_composite_values
# Ensure we haven't created an invalid URI
validate()
end | ruby | def userinfo=(new_userinfo)
if new_userinfo && !new_userinfo.respond_to?(:to_str)
raise TypeError, "Can't convert #{new_userinfo.class} into String."
end
new_user, new_password = if new_userinfo
[
new_userinfo.to_str.strip[/^(.*):/, 1],
new_userinfo.to_str.strip[/:(.*)$/, 1]
]
else
[nil, nil]
end
# Password assigned first to ensure validity in case of nil
self.password = new_password
self.user = new_user
# Reset dependent values
remove_instance_variable(:@authority) if defined?(@authority)
remove_composite_values
# Ensure we haven't created an invalid URI
validate()
end | [
"def",
"userinfo",
"=",
"(",
"new_userinfo",
")",
"if",
"new_userinfo",
"&&",
"!",
"new_userinfo",
".",
"respond_to?",
"(",
":to_str",
")",
"raise",
"TypeError",
",",
"\"Can't convert #{new_userinfo.class} into String.\"",
"end",
"new_user",
",",
"new_password",
"=",
... | Sets the userinfo component for this URI.
@param [String, #to_str] new_userinfo The new userinfo component. | [
"Sets",
"the",
"userinfo",
"component",
"for",
"this",
"URI",
"."
] | 5894c95a7768435cb46d1355954611dbd194832e | https://github.com/sporkmonger/addressable/blob/5894c95a7768435cb46d1355954611dbd194832e/lib/addressable/uri.rb#L1060-L1083 | train | Sets the user and password for this URI. | [
30522,
13366,
5310,
2378,
14876,
1027,
1006,
2047,
1035,
5310,
2378,
14876,
1007,
2065,
2047,
1035,
5310,
2378,
14876,
1004,
1004,
999,
2047,
1035,
5310,
2378,
14876,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
2000,
1035,
2358,
2099,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adimichele/hubspot-ruby | lib/hubspot/blog.rb | Hubspot.Blog.posts | def posts(params = {})
default_params = {
content_group_id: self["id"],
order_by: '-created',
created__gt: Time.now - 2.month,
state: 'PUBLISHED'
}
raise Hubspot::InvalidParams.new('params must be passed as a hash') unless params.is_a?(Hash)
params = default_params.merge(params)
raise Hubspot::InvalidParams.new('State parameter was invalid') unless [false, 'PUBLISHED', 'DRAFT'].include?(params[:state])
params.each { |k, v| params.delete(k) if v == false }
response = Hubspot::Connection.get_json(BLOG_POSTS_PATH, params)
response['objects'].map { |p| BlogPost.new(p) }
end | ruby | def posts(params = {})
default_params = {
content_group_id: self["id"],
order_by: '-created',
created__gt: Time.now - 2.month,
state: 'PUBLISHED'
}
raise Hubspot::InvalidParams.new('params must be passed as a hash') unless params.is_a?(Hash)
params = default_params.merge(params)
raise Hubspot::InvalidParams.new('State parameter was invalid') unless [false, 'PUBLISHED', 'DRAFT'].include?(params[:state])
params.each { |k, v| params.delete(k) if v == false }
response = Hubspot::Connection.get_json(BLOG_POSTS_PATH, params)
response['objects'].map { |p| BlogPost.new(p) }
end | [
"def",
"posts",
"(",
"params",
"=",
"{",
"}",
")",
"default_params",
"=",
"{",
"content_group_id",
":",
"self",
"[",
"\"id\"",
"]",
",",
"order_by",
":",
"'-created'",
",",
"created__gt",
":",
"Time",
".",
"now",
"-",
"2",
".",
"month",
",",
"state",
... | Returns the posts for this blog instance.
defaults to returning the last 2 months worth of published blog posts
in date descending order (i.e. most recent first)
{https://developers.hubspot.com/docs/methods/blogv2/get_blog_posts}
@return [Hubspot::BlogPost] | [
"Returns",
"the",
"posts",
"for",
"this",
"blog",
"instance",
".",
"defaults",
"to",
"returning",
"the",
"last",
"2",
"months",
"worth",
"of",
"published",
"blog",
"posts",
"in",
"date",
"descending",
"order",
"(",
"i",
".",
"e",
".",
"most",
"recent",
"... | 8eb0a64dd0c14c79e631e81bfdc169583e775a46 | https://github.com/adimichele/hubspot-ruby/blob/8eb0a64dd0c14c79e631e81bfdc169583e775a46/lib/hubspot/blog.rb#L45-L60 | train | Get the posts for this content group | [
30522,
13366,
8466,
1006,
11498,
5244,
1027,
1063,
1065,
1007,
12398,
1035,
11498,
5244,
1027,
1063,
4180,
1035,
2177,
1035,
8909,
1024,
2969,
1031,
1000,
8909,
1000,
1033,
1010,
2344,
1035,
2011,
1024,
1005,
1011,
2580,
1005,
1010,
2580,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_videosearch/lib/1.0/generated/azure_cognitiveservices_videosearch/videos_operations.rb | Azure::CognitiveServices::VideoSearch::V1_0.VideosOperations.search | def search(query, accept_language:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, country_code:nil, count:nil, freshness:nil, id:nil, length:nil, market:nil, offset:nil, pricing:nil, resolution:nil, safe_search:nil, set_lang:nil, text_decorations:nil, text_format:nil, custom_headers:nil)
response = search_async(query, accept_language:accept_language, user_agent:user_agent, client_id:client_id, client_ip:client_ip, location:location, country_code:country_code, count:count, freshness:freshness, id:id, length:length, market:market, offset:offset, pricing:pricing, resolution:resolution, safe_search:safe_search, set_lang:set_lang, text_decorations:text_decorations, text_format:text_format, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def search(query, accept_language:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, country_code:nil, count:nil, freshness:nil, id:nil, length:nil, market:nil, offset:nil, pricing:nil, resolution:nil, safe_search:nil, set_lang:nil, text_decorations:nil, text_format:nil, custom_headers:nil)
response = search_async(query, accept_language:accept_language, user_agent:user_agent, client_id:client_id, client_ip:client_ip, location:location, country_code:country_code, count:count, freshness:freshness, id:id, length:length, market:market, offset:offset, pricing:pricing, resolution:resolution, safe_search:safe_search, set_lang:set_lang, text_decorations:text_decorations, text_format:text_format, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"search",
"(",
"query",
",",
"accept_language",
":",
"nil",
",",
"user_agent",
":",
"nil",
",",
"client_id",
":",
"nil",
",",
"client_ip",
":",
"nil",
",",
"location",
":",
"nil",
",",
"country_code",
":",
"nil",
",",
"count",
":",
"nil",
",",
... | The Video Search API lets you send a search query to Bing and get back a list
of videos that are relevant to the search query. This section provides
technical details about the query parameters and headers that you use to
request videos and the JSON response objects that contain them. For examples
that show how to make requests, see [Searching the Web for
Videos](https://docs.microsoft.com/azure/cognitive-services/bing-video-search/search-the-web).
@param query [String] The user's search query string. The query string cannot
be empty. The query string may contain [Bing Advanced
Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to
limit videos to a specific domain, use the
[site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. Use this
parameter only with the Video Search API. Do not specify this parameter when
calling the Trending Videos API.
@param accept_language [String] A comma-delimited list of one or more
languages to use for user interface strings. The list is in decreasing order
of preference. For additional information, including expected format, see
[RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
header and the
[setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#setlang)
query parameter are mutually exclusive; do not specify both. If you set this
header, you must also specify the
[cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#cc)
query parameter. To determine the market to return results for, Bing uses the
first supported language it finds from the list and combines it with the cc
parameter value. If the list does not include a supported language, Bing
finds the closest language and market that supports the request or it uses an
aggregated or default market for the results. To determine the market that
Bing used, see the BingAPIs-Market header. Use this header and the cc query
parameter only if you specify multiple languages. Otherwise, use the
[mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#mkt)
and
[setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#setlang)
query parameters. A user interface string is a string that's used as a label
in a user interface. There are few user interface strings in the JSON
response objects. Any links to Bing.com properties in the response objects
apply the specified language.
@param user_agent [String] The user agent originating the request. Bing uses
the user agent to provide mobile users with an optimized experience. Although
optional, you are encouraged to always specify this header. The user-agent
should be the same string that any commonly used browser sends. For
information about user agents, see [RFC
2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
/ 7.0 Mobile / 11A465 Safari / 9537.53
@param client_id [String] Bing uses this header to provide users with
consistent behavior across Bing API calls. Bing often flights new features
and improvements, and it uses the client ID as a key for assigning traffic on
different flights. If you do not use the same client ID for a user across
multiple requests, then Bing may assign the user to multiple conflicting
flights. Being assigned to multiple conflicting flights can lead to an
inconsistent user experience. For example, if the second request has a
different flight assignment than the first, the experience may be unexpected.
Also, Bing can use the client ID to tailor web results to that client ID’s
search history, providing a richer experience for the user. Bing also uses
this header to help improve result rankings by analyzing the activity
generated by a client ID. The relevance improvements help with better quality
of results delivered by Bing APIs and in turn enables higher click-through
rates for the API consumer. IMPORTANT: Although optional, you should consider
this header required. Persisting the client ID across multiple requests for
the same end user and device combination enables 1) the API consumer to
receive a consistent user experience, and 2) higher click-through rates via
better quality of results from the Bing APIs. Each user that uses your
application on the device must have a unique, Bing generated client ID. If
you do not include this header in the request, Bing generates an ID and
returns it in the X-MSEdge-ClientID response header. The only time that you
should NOT include this header in a request is the first time the user uses
your app on that device. Use the client ID for each Bing API request that
your app makes for this user on the device. Persist the client ID. To persist
the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
used across all sessions. Do not use a session cookie. For other apps such as
mobile apps, use the device's persistent storage to persist the ID. The next
time the user uses your app on that device, get the client ID that you
persisted. Bing responses may or may not include this header. If the response
includes this header, capture the client ID and use it for all subsequent
Bing requests for the user on that device. If you include the
X-MSEdge-ClientID, you must not include cookies in the request.
@param client_ip [String] The IPv4 or IPv6 address of the client device. The
IP address is used to discover the user's location. Bing uses the location
information to determine safe search behavior. Although optional, you are
encouraged to always specify this header and the X-Search-Location header. Do
not obfuscate the address (for example, by changing the last octet to 0).
Obfuscating the address results in the location not being anywhere near the
device's actual location, which may result in Bing serving erroneous results.
@param location [String] A semicolon-delimited list of key/value pairs that
describe the client's geographical location. Bing uses the location
information to determine safe search behavior and to return relevant local
content. Specify the key/value pair as <key>:<value>. The following are the
keys that you use to specify the user's location. lat (required): The
latitude of the client's location, in degrees. The latitude must be greater
than or equal to -90.0 and less than or equal to +90.0. Negative values
indicate southern latitudes and positive values indicate northern latitudes.
long (required): The longitude of the client's location, in degrees. The
longitude must be greater than or equal to -180.0 and less than or equal to
+180.0. Negative values indicate western longitudes and positive values
indicate eastern longitudes. re (required): The radius, in meters, which
specifies the horizontal accuracy of the coordinates. Pass the value returned
by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
(optional): The UTC UNIX timestamp of when the client was at the location.
(The UNIX timestamp is the number of seconds since January 1, 1970.) head
(optional): The client's relative heading or direction of travel. Specify the
direction of travel as degrees from 0 through 360, counting clockwise
relative to true north. Specify this key only if the sp key is nonzero. sp
(optional): The horizontal velocity (speed), in meters per second, that the
client device is traveling. alt (optional): The altitude of the client
device, in meters. are (optional): The radius, in meters, that specifies the
vertical accuracy of the coordinates. Specify this key only if you specify
the alt key. Although many of the keys are optional, the more information
that you provide, the more accurate the location results are. Although
optional, you are encouraged to always specify the user's geographical
location. Providing the location is especially important if the client's IP
address does not accurately reflect the user's physical location (for
example, if the client uses VPN). For optimal results, you should include
this header and the X-MSEdge-ClientIP header, but at a minimum, you should
include this header.
@param country_code [String] A 2-character country code of the country where
the results come from. This API supports only the United States market. If
you specify this query parameter, it must be set to us. If you set this
parameter, you must also specify the Accept-Language header. Bing uses the
first supported language it finds from the languages list, and combine that
language with the country code that you specify to determine the market to
return results for. If the languages list does not include a supported
language, Bing finds the closest language and market that supports the
request, or it may use an aggregated or default market for the results
instead of a specified one. You should use this query parameter and the
Accept-Language query parameter only if you specify multiple languages;
otherwise, you should use the mkt and setLang query parameters. This
parameter and the mkt query parameter are mutually exclusive—do not specify
both.
@param count [Integer] The number of videos to return in the response. The
actual number delivered may be less than requested. The default is 35. The
maximum is 105. You may use this parameter along with the offset parameter to
page results. For example, if your user interface presents 20 videos per
page, set count to 20 and offset to 0 to get the first page of results. For
each subsequent page, increment offset by 20 (for example, 0, 20, 40). Use
this parameter only with the Video Search API. Do not specify this parameter
when calling the Trending Videos API or the Web Search API.
@param freshness [Freshness] Filter videos by the date and time that Bing
discovered the video. The following are the possible filter values. Day:
Return videos discovered within the last 24 hours. Week: Return videos
discovered within the last 7 days. Month: Return videos discovered within the
last 30 days. Possible values include: 'Day', 'Week', 'Month'
@param id [String] An ID that uniquely identifies a video. The
[Video](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#video)
object's videoId field contains the ID that you set this parameter to. You
use this parameter to ensure that the specified video is the first video in
the list of videos that Bing returns.
@param length [VideoLength] Filter videos by the following lengths: Short:
Return videos that are less than 5 minutes. Medium: Return videos that are
between 5 and 20 minutes, inclusive. Long: Return videos that are longer than
20 minutes. All: Do not filter by length.Specifying this value is the same as
not specifying the videoLength parameter. Possible values include: 'All',
'Short', 'Medium', 'Long'
@param market [String] The market where the results come from. Typically, mkt
is the country where the user is making the request from. However, it could
be a different country if the user is not located in a country where Bing
delivers results. The market must be in the form <language code>-<country
code>. For example, en-US. The string is case insensitive. For a list of
possible market values, see [Market
Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#market-codes).
NOTE: If known, you are encouraged to always specify the market. Specifying
the market helps Bing route the request and return an appropriate and optimal
response. If you specify a market that is not listed in [Market
Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#market-codes),
Bing uses a best fit market code based on an internal mapping that is subject
to change. This parameter and the
[cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#cc)
query parameter are mutually exclusive—do not specify both.
@param offset [Integer] The zero-based offset that indicates the number of
videos to skip before returning videos. The default is 0. The offset should
be less than
([totalEstimatedMatches](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#videos-totalmatches)
- count). Use this parameter along with the count parameter to page results.
For example, if your user interface displays 20 videos per page, set count to
20 and offset to 0 to get the first page of results. For each subsequent
page, increment offset by 20 (for example, 0, 20, 40). It is possible for
multiple pages to include some overlap in results. To prevent duplicates, see
[nextOffset](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#videos-nextoffset).
Use this parameter only with the Video Search API.
@param pricing [VideoPricing] Filter videos by the following pricing options:
Free: Return videos that are free to view. Paid: Return videos that require a
subscription or payment to view. All: Do not filter by pricing.Specifying
this value is the same as not specifying the pricing parameter. Possible
values include: 'All', 'Free', 'Paid'
@param resolution [VideoResolution] Filter videos by the following
resolutions: SD480p: Return videos with a 480p or higher resolution. HD720p:
Return videos with a 720p or higher resolution. HD1080p: Return videos with a
1080p or higher resolution. All: Do not filter by resolution.Specifying this
value is the same as not specifying the resolution parameter. Possible values
include: 'All', 'SD480p', 'HD720p', 'HD1080p'
@param safe_search [SafeSearch] Filter videos for adult content. The
following are the possible filter values. Off: If the request is through the
Video Search API, the response includes adult videos and the thumbnail images
of the videos are clear (non-fuzzy). If the request is through the Web Search
API, the response includes adult videos but the thumbnail images of the
videos are pixelated (fuzzy). Moderate: If the request is through the Video
Search API, the response does not include videos with adult content. If the
request is through the Web Search API, the response may include videos with
adult content but the thumbnail images of the videos are pixelated (fuzzy).
Strict: Does not return videos with adult content. The default is Moderate.
If the request comes from a market that Bing's adult policy requires that
safeSearch is set to Strict, Bing ignores the safeSearch value and uses
Strict. If you use the site: query operator, there is the chance that the
response may contain adult content regardless of what the safeSearch query
parameter is set to. Use site: only if you are aware of the content on the
site and your scenario supports the possibility of adult content. Possible
values include: 'Off', 'Moderate', 'Strict'
@param set_lang [String] The language to use for user interface strings.
Specify the language using the ISO 639-1 2-letter language code. For example,
the language code for English is EN. The default is EN (English). Although
optional, you should always specify the language. Typically, you set setLang
to the same language specified by mkt unless the user wants the user
interface strings displayed in a different language. This parameter and the
[Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#acceptlanguage)
header are mutually exclusive; do not specify both. A user interface string
is a string that's used as a label in a user interface. There are few user
interface strings in the JSON response objects. Also, any links to Bing.com
properties in the response objects apply the specified language.
@param text_decorations [Boolean] A Boolean value that determines whether
display strings contain decoration markers such as hit highlighting
characters. If true, the strings may include markers. The default is false.
To specify whether to use Unicode characters or HTML tags as the markers, see
the
[textFormat](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#textformat)
query parameter. For information about hit highlighting, see [Hit
Highlighting](https://docs.microsoft.com/azure/cognitive-services/bing-news-search/hit-highlighting).
@param text_format [TextFormat] The type of markers to use for text
decorations (see the textDecorations query parameter). Possible values are
Raw—Use Unicode characters to mark content that needs special formatting. The
Unicode characters are in the range E000 through E019. For example, Bing uses
E000 and E001 to mark the beginning and end of query terms for hit
highlighting. HTML—Use HTML tags to mark content that needs special
formatting. For example, use <b> tags to highlight query terms in display
strings. The default is Raw. For display strings that contain escapable HTML
characters such as <, >, and &, if textFormat is set to HTML, Bing escapes
the characters as appropriate (for example, < is escaped to <). Possible
values include: 'Raw', 'Html'
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Videos] operation results. | [
"The",
"Video",
"Search",
"API",
"lets",
"you",
"send",
"a",
"search",
"query",
"to",
"Bing",
"and",
"get",
"back",
"a",
"list",
"of",
"videos",
"that",
"are",
"relevant",
"to",
"the",
"search",
"query",
".",
"This",
"section",
"provides",
"technical",
"... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_videosearch/lib/1.0/generated/azure_cognitiveservices_videosearch/videos_operations.rb#L282-L285 | train | Search for a given search term. | [
30522,
13366,
3945,
1006,
23032,
1010,
5138,
1035,
2653,
1024,
9152,
2140,
1010,
5310,
1035,
4005,
1024,
9152,
2140,
1010,
7396,
1035,
8909,
1024,
9152,
2140,
1010,
7396,
1035,
12997,
1024,
9152,
2140,
1010,
3295,
1024,
9152,
2140,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jekyll/jekyll | lib/jekyll/utils.rb | Jekyll.Utils.slugify | def slugify(string, mode: nil, cased: false)
mode ||= "default"
return nil if string.nil?
unless SLUGIFY_MODES.include?(mode)
return cased ? string : string.downcase
end
# Drop accent marks from latin characters. Everything else turns to ?
if mode == "latin"
I18n.config.available_locales = :en if I18n.config.available_locales.empty?
string = I18n.transliterate(string)
end
slug = replace_character_sequence_with_hyphen(string, :mode => mode)
# Remove leading/trailing hyphen
slug.gsub!(%r!^\-|\-$!i, "")
slug.downcase! unless cased
Jekyll.logger.warn("Warning:", "Empty `slug` generated for '#{string}'.") if slug.empty?
slug
end | ruby | def slugify(string, mode: nil, cased: false)
mode ||= "default"
return nil if string.nil?
unless SLUGIFY_MODES.include?(mode)
return cased ? string : string.downcase
end
# Drop accent marks from latin characters. Everything else turns to ?
if mode == "latin"
I18n.config.available_locales = :en if I18n.config.available_locales.empty?
string = I18n.transliterate(string)
end
slug = replace_character_sequence_with_hyphen(string, :mode => mode)
# Remove leading/trailing hyphen
slug.gsub!(%r!^\-|\-$!i, "")
slug.downcase! unless cased
Jekyll.logger.warn("Warning:", "Empty `slug` generated for '#{string}'.") if slug.empty?
slug
end | [
"def",
"slugify",
"(",
"string",
",",
"mode",
":",
"nil",
",",
"cased",
":",
"false",
")",
"mode",
"||=",
"\"default\"",
"return",
"nil",
"if",
"string",
".",
"nil?",
"unless",
"SLUGIFY_MODES",
".",
"include?",
"(",
"mode",
")",
"return",
"cased",
"?",
... | rubocop: enable PredicateName
Slugify a filename or title.
string - the filename or title to slugify
mode - how string is slugified
cased - whether to replace all uppercase letters with their
lowercase counterparts
When mode is "none", return the given string.
When mode is "raw", return the given string,
with every sequence of spaces characters replaced with a hyphen.
When mode is "default" or nil, non-alphabetic characters are
replaced with a hyphen too.
When mode is "pretty", some non-alphabetic characters (._~!$&'()+,;=@)
are not replaced with hyphen.
When mode is "ascii", some everything else except ASCII characters
a-z (lowercase), A-Z (uppercase) and 0-9 (numbers) are not replaced with hyphen.
When mode is "latin", the input string is first preprocessed so that
any letters with accents are replaced with the plain letter. Afterwards,
it follows the "default" mode of operation.
If cased is true, all uppercase letters in the result string are
replaced with their lowercase counterparts.
Examples:
slugify("The _config.yml file")
# => "the-config-yml-file"
slugify("The _config.yml file", "pretty")
# => "the-_config.yml-file"
slugify("The _config.yml file", "pretty", true)
# => "The-_config.yml file"
slugify("The _config.yml file", "ascii")
# => "the-config-yml-file"
slugify("The _config.yml file", "latin")
# => "the-config-yml-file"
Returns the slugified string. | [
"rubocop",
":",
"enable",
"PredicateName",
"Slugify",
"a",
"filename",
"or",
"title",
"."
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/utils.rb#L198-L220 | train | Returns a slug for the given string. | [
30522,
13366,
23667,
8757,
1006,
5164,
1010,
5549,
1024,
9152,
2140,
1010,
2553,
2094,
1024,
6270,
1007,
5549,
1064,
1064,
1027,
1000,
12398,
1000,
2709,
9152,
2140,
2065,
5164,
1012,
9152,
2140,
1029,
4983,
23667,
8757,
1035,
11583,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jekyll/jekyll | lib/jekyll/renderer.rb | Jekyll.Renderer.render_document | def render_document
info = {
:registers => { :site => site, :page => payload["page"] },
:strict_filters => liquid_options["strict_filters"],
:strict_variables => liquid_options["strict_variables"],
}
output = document.content
if document.render_with_liquid?
Jekyll.logger.debug "Rendering Liquid:", document.relative_path
output = render_liquid(output, payload, info, document.path)
end
Jekyll.logger.debug "Rendering Markup:", document.relative_path
output = convert(output.to_s)
document.content = output
if document.place_in_layout?
Jekyll.logger.debug "Rendering Layout:", document.relative_path
output = place_in_layouts(output, payload, info)
end
output
end | ruby | def render_document
info = {
:registers => { :site => site, :page => payload["page"] },
:strict_filters => liquid_options["strict_filters"],
:strict_variables => liquid_options["strict_variables"],
}
output = document.content
if document.render_with_liquid?
Jekyll.logger.debug "Rendering Liquid:", document.relative_path
output = render_liquid(output, payload, info, document.path)
end
Jekyll.logger.debug "Rendering Markup:", document.relative_path
output = convert(output.to_s)
document.content = output
if document.place_in_layout?
Jekyll.logger.debug "Rendering Layout:", document.relative_path
output = place_in_layouts(output, payload, info)
end
output
end | [
"def",
"render_document",
"info",
"=",
"{",
":registers",
"=>",
"{",
":site",
"=>",
"site",
",",
":page",
"=>",
"payload",
"[",
"\"page\"",
"]",
"}",
",",
":strict_filters",
"=>",
"liquid_options",
"[",
"\"strict_filters\"",
"]",
",",
":strict_variables",
"=>"... | Render the document.
Returns String rendered document output
rubocop: disable AbcSize | [
"Render",
"the",
"document",
"."
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/renderer.rb#L70-L93 | train | Render the document | [
30522,
13366,
17552,
1035,
6254,
18558,
1027,
1063,
1024,
18687,
1027,
1028,
1063,
1024,
2609,
1027,
1028,
2609,
1010,
1024,
3931,
1027,
1028,
18093,
1031,
1000,
3931,
1000,
1033,
1065,
1010,
1024,
9384,
1035,
17736,
1027,
1028,
6381,
1035,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/devices.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.Devices.failover | def failover(source_device_name, parameters, resource_group_name, manager_name, custom_headers:nil)
response = failover_async(source_device_name, parameters, resource_group_name, manager_name, custom_headers:custom_headers).value!
nil
end | ruby | def failover(source_device_name, parameters, resource_group_name, manager_name, custom_headers:nil)
response = failover_async(source_device_name, parameters, resource_group_name, manager_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"failover",
"(",
"source_device_name",
",",
"parameters",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"failover_async",
"(",
"source_device_name",
",",
"parameters",
",",
"resource_group_name",
",",
... | Failovers a set of volume containers from a specified source device to a
target device.
@param source_device_name [String] The source device name on which failover
is performed.
@param parameters [FailoverRequest] FailoverRequest containing the source
device and the list of volume containers to be failed over.
@param resource_group_name [String] The resource group name
@param manager_name [String] The manager name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Failovers",
"a",
"set",
"of",
"volume",
"containers",
"from",
"a",
"specified",
"source",
"device",
"to",
"a",
"target",
"device",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/devices.rb#L1053-L1056 | train | Failover the source device to the current primary container. | [
30522,
13366,
8246,
7840,
1006,
3120,
1035,
5080,
1035,
2171,
1010,
11709,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
8246,
7840,
1035,
2004,
6038,
2278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
tongueroo/ufo | lib/ufo/tasks/register.rb | Ufo.Tasks::Register.register | def register
data = JSON.parse(IO.read(@template_definition_path))
data = rubyize_format(data)
message = "#{data[:family]} task definition registered."
if @options[:noop]
message = "NOOP: #{message}"
else
register_task_definition(data)
end
unless @options[:mute]
puts "Equivalent aws cli command:"
file_path = "file://#{@template_definition_path.sub(/^\.\//,'')}"
puts " aws ecs register-task-definition --cli-input-json #{file_path}".color(:green)
puts message
end
end | ruby | def register
data = JSON.parse(IO.read(@template_definition_path))
data = rubyize_format(data)
message = "#{data[:family]} task definition registered."
if @options[:noop]
message = "NOOP: #{message}"
else
register_task_definition(data)
end
unless @options[:mute]
puts "Equivalent aws cli command:"
file_path = "file://#{@template_definition_path.sub(/^\.\//,'')}"
puts " aws ecs register-task-definition --cli-input-json #{file_path}".color(:green)
puts message
end
end | [
"def",
"register",
"data",
"=",
"JSON",
".",
"parse",
"(",
"IO",
".",
"read",
"(",
"@template_definition_path",
")",
")",
"data",
"=",
"rubyize_format",
"(",
"data",
")",
"message",
"=",
"\"#{data[:family]} task definition registered.\"",
"if",
"@options",
"[",
... | aws ecs register-task-definition --cli-input-json file://.ufo/output/demo-web-prod.json | [
"aws",
"ecs",
"register",
"-",
"task",
"-",
"definition",
"--",
"cli",
"-",
"input",
"-",
"json",
"file",
":",
"//",
".",
"ufo",
"/",
"output",
"/",
"demo",
"-",
"web",
"-",
"prod",
".",
"json"
] | 16ac3dad28edcab2693c0e7d89a1971aca65b8f9 | https://github.com/tongueroo/ufo/blob/16ac3dad28edcab2693c0e7d89a1971aca65b8f9/lib/ufo/tasks/register.rb#L24-L41 | train | Register a task definition | [
30522,
13366,
4236,
2951,
1027,
1046,
3385,
1012,
11968,
3366,
1006,
22834,
1012,
3191,
1006,
1030,
23561,
1035,
6210,
1035,
4130,
1007,
1007,
2951,
1027,
10090,
4697,
1035,
4289,
1006,
2951,
1007,
4471,
1027,
1000,
1001,
1063,
2951,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb | Azure::SQL::Mgmt::V2017_03_01_preview.LongTermRetentionBackups.list_by_server_as_lazy | def list_by_server_as_lazy(location_name, long_term_retention_server_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
response = list_by_server_async(location_name, long_term_retention_server_name, only_latest_per_database:only_latest_per_database, database_state:database_state, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_server_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_by_server_as_lazy(location_name, long_term_retention_server_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
response = list_by_server_async(location_name, long_term_retention_server_name, only_latest_per_database:only_latest_per_database, database_state:database_state, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_server_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_by_server_as_lazy",
"(",
"location_name",
",",
"long_term_retention_server_name",
",",
"only_latest_per_database",
":",
"nil",
",",
"database_state",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_server_async",
"(",
"location... | Lists the long term retention backups for a given server.
@param location_name [String] The location of the database
@param long_term_retention_server_name [String] The name of the server
@param only_latest_per_database [Boolean] Whether or not to only get the
latest backup for each database.
@param database_state [LongTermRetentionDatabaseState] Whether to query
against just live databases, just deleted databases, or all databases.
Possible values include: 'All', 'Live', 'Deleted'
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [LongTermRetentionBackupListResult] which provide lazy access to
pages of the response. | [
"Lists",
"the",
"long",
"term",
"retention",
"backups",
"for",
"a",
"given",
"server",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb#L913-L922 | train | Gets the list of long term retention policies for a server. | [
30522,
13366,
2862,
1035,
2011,
1035,
8241,
1035,
2004,
1035,
13971,
1006,
3295,
1035,
2171,
1010,
2146,
1035,
2744,
1035,
20125,
1035,
8241,
1035,
2171,
1010,
2069,
1035,
6745,
1035,
2566,
1035,
7809,
1024,
9152,
2140,
1010,
7809,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_policy_insights/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/policy_tracked_resources.rb | Azure::PolicyInsights::Mgmt::V2018_07_01_preview.PolicyTrackedResources.list_query_results_for_resource | def list_query_results_for_resource(resource_id, query_options:nil, custom_headers:nil)
first_page = list_query_results_for_resource_as_lazy(resource_id, query_options:query_options, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_query_results_for_resource(resource_id, query_options:nil, custom_headers:nil)
first_page = list_query_results_for_resource_as_lazy(resource_id, query_options:query_options, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_query_results_for_resource",
"(",
"resource_id",
",",
"query_options",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_query_results_for_resource_as_lazy",
"(",
"resource_id",
",",
"query_options",
":query_options",
",",
"custom_h... | Queries policy tracked resources under the resource.
@param resource_id [String] Resource ID.
@param query_options [QueryOptions] Additional parameters for the operation
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<PolicyTrackedResource>] operation results. | [
"Queries",
"policy",
"tracked",
"resources",
"under",
"the",
"resource",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_policy_insights/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/policy_tracked_resources.rb#L330-L333 | train | Gets all the items in a resource. | [
30522,
13366,
2862,
1035,
23032,
1035,
3463,
1035,
2005,
1035,
7692,
1006,
7692,
1035,
8909,
1010,
23032,
1035,
7047,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2862,
1035,
23032,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/sprockets | lib/sprockets/http_utils.rb | Sprockets.HTTPUtils.match_mime_type? | def match_mime_type?(value, matcher)
v1, v2 = value.split('/'.freeze, 2)
m1, m2 = matcher.split('/'.freeze, 2)
(m1 == '*'.freeze || v1 == m1) && (m2.nil? || m2 == '*'.freeze || m2 == v2)
end | ruby | def match_mime_type?(value, matcher)
v1, v2 = value.split('/'.freeze, 2)
m1, m2 = matcher.split('/'.freeze, 2)
(m1 == '*'.freeze || v1 == m1) && (m2.nil? || m2 == '*'.freeze || m2 == v2)
end | [
"def",
"match_mime_type?",
"(",
"value",
",",
"matcher",
")",
"v1",
",",
"v2",
"=",
"value",
".",
"split",
"(",
"'/'",
".",
"freeze",
",",
"2",
")",
"m1",
",",
"m2",
"=",
"matcher",
".",
"split",
"(",
"'/'",
".",
"freeze",
",",
"2",
")",
"(",
"... | Public: Test mime type against mime range.
match_mime_type?('text/html', 'text/*') => true
match_mime_type?('text/plain', '*') => true
match_mime_type?('text/html', 'application/json') => false
Returns true if the given value is a mime match for the given mime match
specification, false otherwise. | [
"Public",
":",
"Test",
"mime",
"type",
"against",
"mime",
"range",
"."
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/http_utils.rb#L16-L20 | train | Returns true if the value matches the matcher | [
30522,
13366,
2674,
1035,
2771,
4168,
1035,
2828,
1029,
1006,
3643,
1010,
2674,
2121,
1007,
1058,
2487,
1010,
1058,
2475,
1027,
3643,
1012,
3975,
1006,
1005,
1013,
1005,
1012,
13184,
1010,
1016,
1007,
23290,
1010,
25525,
1027,
2674,
2121,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/scss-lint | lib/scss_lint/linter.rb | SCSSLint.Linter.run | def run(engine, config)
@lints = []
@config = config
@engine = engine
@comment_processor = ControlCommentProcessor.new(self)
visit(engine.tree)
@lints = @comment_processor.filter_lints(@lints)
end | ruby | def run(engine, config)
@lints = []
@config = config
@engine = engine
@comment_processor = ControlCommentProcessor.new(self)
visit(engine.tree)
@lints = @comment_processor.filter_lints(@lints)
end | [
"def",
"run",
"(",
"engine",
",",
"config",
")",
"@lints",
"=",
"[",
"]",
"@config",
"=",
"config",
"@engine",
"=",
"engine",
"@comment_processor",
"=",
"ControlCommentProcessor",
".",
"new",
"(",
"self",
")",
"visit",
"(",
"engine",
".",
"tree",
")",
"@... | Create a linter.
Run this linter against a parsed document with the given configuration,
returning the lints that were found.
@param engine [Engine]
@param config [Config]
@return [Array<Lint>] | [
"Create",
"a",
"linter",
".",
"Run",
"this",
"linter",
"against",
"a",
"parsed",
"document",
"with",
"the",
"given",
"configuration",
"returning",
"the",
"lints",
"that",
"were",
"found",
"."
] | e99afe4ede041a431a06e585c12ce82f6ad50116 | https://github.com/sds/scss-lint/blob/e99afe4ede041a431a06e585c12ce82f6ad50116/lib/scss_lint/linter.rb#L36-L43 | train | Run the linters | [
30522,
13366,
2448,
1006,
3194,
1010,
9530,
8873,
2290,
1007,
1030,
11409,
3215,
1027,
1031,
1033,
1030,
9530,
8873,
2290,
1027,
9530,
8873,
2290,
1030,
3194,
1027,
3194,
1030,
7615,
1035,
13151,
1027,
2491,
9006,
3672,
21572,
9623,
21748,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
decidim/decidim | decidim-core/lib/decidim/form_builder.rb | Decidim.FormBuilder.label_for | def label_for(attribute)
if object.class.respond_to?(:human_attribute_name)
object.class.human_attribute_name(attribute)
else
attribute.to_s.humanize
end
end | ruby | def label_for(attribute)
if object.class.respond_to?(:human_attribute_name)
object.class.human_attribute_name(attribute)
else
attribute.to_s.humanize
end
end | [
"def",
"label_for",
"(",
"attribute",
")",
"if",
"object",
".",
"class",
".",
"respond_to?",
"(",
":human_attribute_name",
")",
"object",
".",
"class",
".",
"human_attribute_name",
"(",
"attribute",
")",
"else",
"attribute",
".",
"to_s",
".",
"humanize",
"end"... | Public: Returns the translated name for the given attribute.
attribute - The String name of the attribute to return the name. | [
"Public",
":",
"Returns",
"the",
"translated",
"name",
"for",
"the",
"given",
"attribute",
"."
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/lib/decidim/form_builder.rb#L397-L403 | train | Returns the label for the given attribute | [
30522,
13366,
3830,
1035,
2005,
1006,
17961,
1007,
2065,
4874,
1012,
2465,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
2529,
1035,
17961,
1035,
2171,
1007,
4874,
1012,
2465,
1012,
2529,
1035,
17961,
1035,
2171,
1006,
17961,
1007,
2842,
17961,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ai/autoprefixer-rails | lib/autoprefixer-rails/processor.rb | AutoprefixerRails.Processor.read_js | def read_js
@@js ||= begin
root = Pathname(File.dirname(__FILE__))
path = root.join("../../vendor/autoprefixer.js")
path.read
end
end | ruby | def read_js
@@js ||= begin
root = Pathname(File.dirname(__FILE__))
path = root.join("../../vendor/autoprefixer.js")
path.read
end
end | [
"def",
"read_js",
"@@js",
"||=",
"begin",
"root",
"=",
"Pathname",
"(",
"File",
".",
"dirname",
"(",
"__FILE__",
")",
")",
"path",
"=",
"root",
".",
"join",
"(",
"\"../../vendor/autoprefixer.js\"",
")",
"path",
".",
"read",
"end",
"end"
] | Cache autoprefixer.js content | [
"Cache",
"autoprefixer",
".",
"js",
"content"
] | 22543372b33c688c409b46adfef4d1763041961f | https://github.com/ai/autoprefixer-rails/blob/22543372b33c688c409b46adfef4d1763041961f/lib/autoprefixer-rails/processor.rb#L165-L171 | train | Reads the JS file for the autoprefixer. js file. | [
30522,
13366,
3191,
1035,
1046,
2015,
1030,
1030,
1046,
2015,
1064,
1064,
1027,
4088,
7117,
1027,
4130,
18442,
1006,
5371,
1012,
16101,
18442,
1006,
1035,
1035,
5371,
1035,
1035,
1007,
1007,
4130,
1027,
7117,
1012,
3693,
1006,
1000,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rocketjob/symmetric-encryption | lib/symmetric_encryption/header.rb | SymmetricEncryption.Header.parse! | def parse!(buffer)
offset = parse(buffer)
return if offset.zero?
buffer.slice!(0..offset - 1)
buffer
end | ruby | def parse!(buffer)
offset = parse(buffer)
return if offset.zero?
buffer.slice!(0..offset - 1)
buffer
end | [
"def",
"parse!",
"(",
"buffer",
")",
"offset",
"=",
"parse",
"(",
"buffer",
")",
"return",
"if",
"offset",
".",
"zero?",
"buffer",
".",
"slice!",
"(",
"0",
"..",
"offset",
"-",
"1",
")",
"buffer",
"end"
] | Returns [String] the encrypted data without header
Returns nil if no header is present
The supplied buffer will be updated directly and
its header will be stripped if present.
Parameters
buffer
String to extract the header from | [
"Returns",
"[",
"String",
"]",
"the",
"encrypted",
"data",
"without",
"header",
"Returns",
"nil",
"if",
"no",
"header",
"is",
"present"
] | 064ba8d57ffac44a3ed80f5e76fa1a54d660ff98 | https://github.com/rocketjob/symmetric-encryption/blob/064ba8d57ffac44a3ed80f5e76fa1a54d660ff98/lib/symmetric_encryption/header.rb#L113-L119 | train | Parse the buffer and return the resulting array. | [
30522,
13366,
11968,
3366,
999,
1006,
17698,
1007,
16396,
1027,
11968,
3366,
1006,
17698,
1007,
2709,
2065,
16396,
1012,
5717,
1029,
17698,
1012,
14704,
999,
1006,
1014,
1012,
1012,
16396,
1011,
1015,
1007,
17698,
2203,
102,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
samvera/hyrax | app/controllers/hyrax/file_sets_controller.rb | Hyrax.FileSetsController.destroy | def destroy
parent = curation_concern.parent
actor.destroy
redirect_to [main_app, parent], notice: 'The file has been deleted.'
end | ruby | def destroy
parent = curation_concern.parent
actor.destroy
redirect_to [main_app, parent], notice: 'The file has been deleted.'
end | [
"def",
"destroy",
"parent",
"=",
"curation_concern",
".",
"parent",
"actor",
".",
"destroy",
"redirect_to",
"[",
"main_app",
",",
"parent",
"]",
",",
"notice",
":",
"'The file has been deleted.'",
"end"
] | DELETE /concern/file_sets/:id | [
"DELETE",
"/",
"concern",
"/",
"file_sets",
"/",
":",
"id"
] | e2b4f56e829a53b1f11296324736e9d5b8c9ee5f | https://github.com/samvera/hyrax/blob/e2b4f56e829a53b1f11296324736e9d5b8c9ee5f/app/controllers/hyrax/file_sets_controller.rb#L48-L52 | train | destroy the file | [
30522,
13366,
6033,
6687,
1027,
12731,
8156,
1035,
5142,
1012,
6687,
3364,
1012,
6033,
2417,
7442,
6593,
1035,
2000,
1031,
2364,
1035,
10439,
1010,
6687,
1033,
1010,
5060,
1024,
1005,
1996,
5371,
2038,
2042,
17159,
1012,
1005,
2203,
102,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machines.rb | Azure::Compute::Mgmt::V2016_04_30_preview.VirtualMachines.get_extensions_with_http_info | def get_extensions_with_http_info(resource_group_name, vm_name, expand:nil, custom_headers:nil)
get_extensions_async(resource_group_name, vm_name, expand:expand, custom_headers:custom_headers).value!
end | ruby | def get_extensions_with_http_info(resource_group_name, vm_name, expand:nil, custom_headers:nil)
get_extensions_async(resource_group_name, vm_name, expand:expand, custom_headers:custom_headers).value!
end | [
"def",
"get_extensions_with_http_info",
"(",
"resource_group_name",
",",
"vm_name",
",",
"expand",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"get_extensions_async",
"(",
"resource_group_name",
",",
"vm_name",
",",
"expand",
":",
"expand",
",",
"custom_head... | The operation to get all extensions of a Virtual Machine.
@param resource_group_name [String] The name of the resource group.
@param vm_name [String] The name of the virtual machine containing the
extension.
@param expand [String] The expand expression to apply on the operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"The",
"operation",
"to",
"get",
"all",
"extensions",
"of",
"a",
"Virtual",
"Machine",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machines.rb#L53-L55 | train | Gets the extensions of the virtual machine. | [
30522,
13366,
2131,
1035,
14305,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
2171,
1010,
7818,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
14305,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
plataformatec/simple_form | lib/simple_form/form_builder.rb | SimpleForm.FormBuilder.error | def error(attribute_name, options = {})
options = options.dup
options[:error_html] = options.except(:error_tag, :error_prefix, :error_method)
column = find_attribute_column(attribute_name)
input_type = default_input_type(attribute_name, column, options)
wrapper.find(:error).
render(SimpleForm::Inputs::Base.new(self, attribute_name, column, input_type, options))
end | ruby | def error(attribute_name, options = {})
options = options.dup
options[:error_html] = options.except(:error_tag, :error_prefix, :error_method)
column = find_attribute_column(attribute_name)
input_type = default_input_type(attribute_name, column, options)
wrapper.find(:error).
render(SimpleForm::Inputs::Base.new(self, attribute_name, column, input_type, options))
end | [
"def",
"error",
"(",
"attribute_name",
",",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"dup",
"options",
"[",
":error_html",
"]",
"=",
"options",
".",
"except",
"(",
":error_tag",
",",
":error_prefix",
",",
":error_method",
")",
"column... | Creates an error tag based on the given attribute, only when the attribute
contains errors. All the given options are sent as :error_html.
== Examples
f.error :name
f.error :name, id: "cool_error" | [
"Creates",
"an",
"error",
"tag",
"based",
"on",
"the",
"given",
"attribute",
"only",
"when",
"the",
"attribute",
"contains",
"errors",
".",
"All",
"the",
"given",
"options",
"are",
"sent",
"as",
":",
"error_html",
"."
] | 4dd9261ebb392e46a9beeefe8d83081e7c6e56b5 | https://github.com/plataformatec/simple_form/blob/4dd9261ebb392e46a9beeefe8d83081e7c6e56b5/lib/simple_form/form_builder.rb#L255-L263 | train | Render an error field | [
30522,
13366,
7561,
1006,
17961,
1035,
2171,
1010,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
4241,
2361,
7047,
1031,
1024,
7561,
1035,
16129,
1033,
1027,
7047,
1012,
3272,
1006,
1024,
7561,
1035,
6415,
1010,
1024,
7561,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
httprb/http | lib/http/redirector.rb | HTTP.Redirector.redirect_to | def redirect_to(uri)
raise StateError, "no Location header in redirect" unless uri
verb = @request.verb
code = @response.status.code
if UNSAFE_VERBS.include?(verb) && STRICT_SENSITIVE_CODES.include?(code)
raise StateError, "can't follow #{@response.status} redirect" if @strict
verb = :get
end
verb = :get if !SEE_OTHER_ALLOWED_VERBS.include?(verb) && 303 == code
@request.redirect(uri, verb)
end | ruby | def redirect_to(uri)
raise StateError, "no Location header in redirect" unless uri
verb = @request.verb
code = @response.status.code
if UNSAFE_VERBS.include?(verb) && STRICT_SENSITIVE_CODES.include?(code)
raise StateError, "can't follow #{@response.status} redirect" if @strict
verb = :get
end
verb = :get if !SEE_OTHER_ALLOWED_VERBS.include?(verb) && 303 == code
@request.redirect(uri, verb)
end | [
"def",
"redirect_to",
"(",
"uri",
")",
"raise",
"StateError",
",",
"\"no Location header in redirect\"",
"unless",
"uri",
"verb",
"=",
"@request",
".",
"verb",
"code",
"=",
"@response",
".",
"status",
".",
"code",
"if",
"UNSAFE_VERBS",
".",
"include?",
"(",
"v... | Redirect policy for follow
@return [Request] | [
"Redirect",
"policy",
"for",
"follow"
] | f37a10ea4fab3ee411907ea2e4251ddf0ca33a93 | https://github.com/httprb/http/blob/f37a10ea4fab3ee411907ea2e4251ddf0ca33a93/lib/http/redirector.rb#L84-L98 | train | redirect to URI | [
30522,
13366,
2417,
7442,
6593,
1035,
2000,
1006,
24471,
2072,
1007,
5333,
2110,
2121,
29165,
1010,
1000,
2053,
3295,
20346,
1999,
2417,
7442,
6593,
1000,
4983,
24471,
2072,
12034,
1027,
1030,
5227,
1012,
12034,
3642,
1027,
1030,
3433,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-rds/lib/aws-sdk-rds/db_instance.rb | Aws::RDS.DBInstance.promote | def promote(options = {})
options = options.merge(db_instance_identifier: @id)
resp = @client.promote_read_replica(options)
DBInstance.new(
id: resp.data.db_instance.db_instance_identifier,
data: resp.data.db_instance,
client: @client
)
end | ruby | def promote(options = {})
options = options.merge(db_instance_identifier: @id)
resp = @client.promote_read_replica(options)
DBInstance.new(
id: resp.data.db_instance.db_instance_identifier,
data: resp.data.db_instance,
client: @client
)
end | [
"def",
"promote",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"db_instance_identifier",
":",
"@id",
")",
"resp",
"=",
"@client",
".",
"promote_read_replica",
"(",
"options",
")",
"DBInstance",
".",
"new",
"(",
"id",
... | @example Request syntax with placeholder values
dbinstance = db_instance.promote({
backup_retention_period: 1,
preferred_backup_window: "String",
})
@param [Hash] options ({})
@option options [Integer] :backup_retention_period
The number of days to retain automated backups. Setting this parameter
to a positive number enables backups. Setting this parameter to 0
disables automated backups.
Default: 1
Constraints:
* Must be a value from 0 to 8
^
@option options [String] :preferred_backup_window
The daily time range during which automated backups are created if
automated backups are enabled, using the `BackupRetentionPeriod`
parameter.
The default is a 30-minute window selected at random from an 8-hour
block of time for each AWS Region. To see the time blocks available,
see [ Adjusting the Preferred Maintenance Window][1] in the *Amazon
RDS User Guide.*
Constraints:
* Must be in the format `hh24:mi-hh24:mi`.
* Must be in Universal Coordinated Time (UTC).
* Must not conflict with the preferred maintenance window.
* Must be at least 30 minutes.
[1]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/AdjustingTheMaintenanceWindow.html
@return [DBInstance] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-rds/lib/aws-sdk-rds/db_instance.rb#L2463-L2471 | train | Promote a read replica to a read replica. | [
30522,
13366,
5326,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
16962,
1035,
6013,
1035,
8909,
4765,
18095,
1024,
1030,
8909,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
5326,
1035,
3191,
1035,
15059,
1006,
7047,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | runtime/ms_rest_azure/lib/ms_rest_azure/polling_state.rb | MsRestAzure.PollingState.update_response | def update_response(response)
@response = response
unless response.nil?
@azure_async_operation_header_link = response.headers['Azure-AsyncOperation'] unless response.headers['Azure-AsyncOperation'].nil?
@location_header_link = response.headers['Location'] unless response.headers['Location'].nil?
end
end | ruby | def update_response(response)
@response = response
unless response.nil?
@azure_async_operation_header_link = response.headers['Azure-AsyncOperation'] unless response.headers['Azure-AsyncOperation'].nil?
@location_header_link = response.headers['Location'] unless response.headers['Location'].nil?
end
end | [
"def",
"update_response",
"(",
"response",
")",
"@response",
"=",
"response",
"unless",
"response",
".",
"nil?",
"@azure_async_operation_header_link",
"=",
"response",
".",
"headers",
"[",
"'Azure-AsyncOperation'",
"]",
"unless",
"response",
".",
"headers",
"[",
"'A... | Updates the polling state from the fields of given response object.
@param response [Net::HTTPResponse] the HTTP response. | [
"Updates",
"the",
"polling",
"state",
"from",
"the",
"fields",
"of",
"given",
"response",
"object",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/runtime/ms_rest_azure/lib/ms_rest_azure/polling_state.rb#L87-L94 | train | Update the response object | [
30522,
13366,
10651,
1035,
3433,
1006,
3433,
1007,
1030,
3433,
1027,
3433,
4983,
3433,
1012,
9152,
2140,
1029,
1030,
24296,
1035,
2004,
6038,
2278,
1035,
3169,
1035,
20346,
1035,
4957,
1027,
3433,
1012,
20346,
2015,
1031,
1005,
24296,
30524... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/haml-lint | lib/haml_lint/reporter/disabled_config_reporter.rb | HamlLint.Reporter::DisabledConfigReporter.finished_file | def finished_file(file, lints)
super
if lints.any?
lints.each do |lint|
linters_with_lints[lint.linter.name] |= [lint.filename]
linters_lint_count[lint.linter.name] += 1
end
end
end | ruby | def finished_file(file, lints)
super
if lints.any?
lints.each do |lint|
linters_with_lints[lint.linter.name] |= [lint.filename]
linters_lint_count[lint.linter.name] += 1
end
end
end | [
"def",
"finished_file",
"(",
"file",
",",
"lints",
")",
"super",
"if",
"lints",
".",
"any?",
"lints",
".",
"each",
"do",
"|",
"lint",
"|",
"linters_with_lints",
"[",
"lint",
".",
"linter",
".",
"name",
"]",
"|=",
"[",
"lint",
".",
"filename",
"]",
"l... | Prints the standard progress report marks and tracks files with lint.
@param file [String]
@param lints [Array<HamlLint::Lint>]
@return [void] | [
"Prints",
"the",
"standard",
"progress",
"report",
"marks",
"and",
"tracks",
"files",
"with",
"lint",
"."
] | 024c773667e54cf88db938c2b368977005d70ee8 | https://github.com/sds/haml-lint/blob/024c773667e54cf88db938c2b368977005d70ee8/lib/haml_lint/reporter/disabled_config_reporter.rb#L71-L80 | train | Returns the number of lines that have been processed. | [
30522,
13366,
2736,
1035,
5371,
1006,
5371,
1010,
11409,
3215,
1007,
3565,
2065,
11409,
3215,
1012,
2151,
1029,
11409,
3215,
1012,
2169,
2079,
1064,
11409,
2102,
1064,
11409,
7747,
1035,
2007,
1035,
11409,
3215,
1031,
11409,
2102,
1012,
114... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.update_closed_list | def update_closed_list(app_id, version_id, cl_entity_id, closed_list_model_update_object, custom_headers:nil)
response = update_closed_list_async(app_id, version_id, cl_entity_id, closed_list_model_update_object, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def update_closed_list(app_id, version_id, cl_entity_id, closed_list_model_update_object, custom_headers:nil)
response = update_closed_list_async(app_id, version_id, cl_entity_id, closed_list_model_update_object, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"update_closed_list",
"(",
"app_id",
",",
"version_id",
",",
"cl_entity_id",
",",
"closed_list_model_update_object",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"update_closed_list_async",
"(",
"app_id",
",",
"version_id",
",",
"cl_entity_id",
",",... | Updates the list entity in a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param cl_entity_id The list model ID.
@param closed_list_model_update_object [ClosedListModelUpdateObject] The new
list entity name and words list.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OperationStatus] operation results. | [
"Updates",
"the",
"list",
"entity",
"in",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L3129-L3132 | train | Updates the entity Id of a closed list in a version of the application. | [
30522,
13366,
10651,
1035,
2701,
1035,
2862,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
18856,
1035,
9178,
1035,
8909,
1010,
2701,
1035,
2862,
1035,
2944,
1035,
10651,
1035,
4874,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/api_client.rb | SquareConnect.ApiClient.select_header_content_type | def select_header_content_type(content_types)
# use application/json by default
return 'application/json' if content_types.nil? || content_types.empty?
# use JSON when present, otherwise use the first one
json_content_type = content_types.find { |s| json_mime?(s) }
return json_content_type || content_types.first
end | ruby | def select_header_content_type(content_types)
# use application/json by default
return 'application/json' if content_types.nil? || content_types.empty?
# use JSON when present, otherwise use the first one
json_content_type = content_types.find { |s| json_mime?(s) }
return json_content_type || content_types.first
end | [
"def",
"select_header_content_type",
"(",
"content_types",
")",
"# use application/json by default",
"return",
"'application/json'",
"if",
"content_types",
".",
"nil?",
"||",
"content_types",
".",
"empty?",
"# use JSON when present, otherwise use the first one",
"json_content_type"... | Return Content-Type header based on an array of content types provided.
@param [Array] content_types array for Content-Type
@return [String] the Content-Type header (e.g. application/json) | [
"Return",
"Content",
"-",
"Type",
"header",
"based",
"on",
"an",
"array",
"of",
"content",
"types",
"provided",
"."
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api_client.rb#L332-L338 | train | select the header content type | [
30522,
13366,
7276,
1035,
20346,
1035,
4180,
1035,
2828,
1006,
4180,
1035,
4127,
1007,
1001,
2224,
4646,
1013,
1046,
3385,
2011,
12398,
2709,
1005,
4646,
1013,
1046,
3385,
1005,
2065,
4180,
1035,
4127,
1012,
9152,
2140,
1029,
1064,
1064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
puppetlabs/puppet | lib/puppet/pops/evaluator/runtime3_converter.rb | Puppet::Pops::Evaluator.Runtime3Converter.catalog_type_to_split_type_title | def catalog_type_to_split_type_title(catalog_type)
split_type = catalog_type.is_a?(Puppet::Pops::Types::PTypeType) ? catalog_type.type : catalog_type
case split_type
when Puppet::Pops::Types::PClassType
class_name = split_type.class_name
['class', class_name.nil? ? nil : class_name.sub(/^::/, '')]
when Puppet::Pops::Types::PResourceType
type_name = split_type.type_name
title = split_type.title
if type_name =~ /^(::)?[Cc]lass$/
['class', title.nil? ? nil : title.sub(/^::/, '')]
else
# Ensure that title is '' if nil
# Resources with absolute name always results in error because tagging does not support leading ::
[type_name.nil? ? nil : type_name.sub(/^::/, '').downcase, title.nil? ? '' : title]
end
else
#TRANSLATORS 'PClassType' and 'PResourceType' are Puppet types and should not be translated
raise ArgumentError, _("Cannot split the type %{class_name}, it represents neither a PClassType, nor a PResourceType.") %
{ class_name: catalog_type.class }
end
end | ruby | def catalog_type_to_split_type_title(catalog_type)
split_type = catalog_type.is_a?(Puppet::Pops::Types::PTypeType) ? catalog_type.type : catalog_type
case split_type
when Puppet::Pops::Types::PClassType
class_name = split_type.class_name
['class', class_name.nil? ? nil : class_name.sub(/^::/, '')]
when Puppet::Pops::Types::PResourceType
type_name = split_type.type_name
title = split_type.title
if type_name =~ /^(::)?[Cc]lass$/
['class', title.nil? ? nil : title.sub(/^::/, '')]
else
# Ensure that title is '' if nil
# Resources with absolute name always results in error because tagging does not support leading ::
[type_name.nil? ? nil : type_name.sub(/^::/, '').downcase, title.nil? ? '' : title]
end
else
#TRANSLATORS 'PClassType' and 'PResourceType' are Puppet types and should not be translated
raise ArgumentError, _("Cannot split the type %{class_name}, it represents neither a PClassType, nor a PResourceType.") %
{ class_name: catalog_type.class }
end
end | [
"def",
"catalog_type_to_split_type_title",
"(",
"catalog_type",
")",
"split_type",
"=",
"catalog_type",
".",
"is_a?",
"(",
"Puppet",
"::",
"Pops",
"::",
"Types",
"::",
"PTypeType",
")",
"?",
"catalog_type",
".",
"type",
":",
"catalog_type",
"case",
"split_type",
... | Produces an array with [type, title] from a PCatalogEntryType
This method is used to produce the arguments for creation of reference resource instances
(used when 3x is operating on a resource).
Ensures that resources are *not* absolute. | [
"Produces",
"an",
"array",
"with",
"[",
"type",
"title",
"]",
"from",
"a",
"PCatalogEntryType",
"This",
"method",
"is",
"used",
"to",
"produce",
"the",
"arguments",
"for",
"creation",
"of",
"reference",
"resource",
"instances",
"(",
"used",
"when",
"3x",
"is... | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/pops/evaluator/runtime3_converter.rb#L132-L153 | train | Returns the split type title | [
30522,
13366,
12105,
1035,
2828,
1035,
2000,
1035,
3975,
1035,
2828,
1035,
2516,
1006,
12105,
1035,
2828,
1007,
3975,
1035,
2828,
1027,
12105,
1035,
2828,
1012,
2003,
1035,
1037,
1029,
1006,
13997,
1024,
1024,
16949,
1024,
1024,
4127,
1024,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/recommendations.rb | Azure::Web::Mgmt::V2018_02_01.Recommendations.list_history_for_web_app_with_http_info | def list_history_for_web_app_with_http_info(resource_group_name, site_name, expired_only:nil, filter:nil, custom_headers:nil)
list_history_for_web_app_async(resource_group_name, site_name, expired_only:expired_only, filter:filter, custom_headers:custom_headers).value!
end | ruby | def list_history_for_web_app_with_http_info(resource_group_name, site_name, expired_only:nil, filter:nil, custom_headers:nil)
list_history_for_web_app_async(resource_group_name, site_name, expired_only:expired_only, filter:filter, custom_headers:custom_headers).value!
end | [
"def",
"list_history_for_web_app_with_http_info",
"(",
"resource_group_name",
",",
"site_name",
",",
"expired_only",
":",
"nil",
",",
"filter",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"list_history_for_web_app_async",
"(",
"resource_group_name",
",",
"site_n... | Get past recommendations for an app, optionally specified by the time range.
Get past recommendations for an app, optionally specified by the time range.
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param site_name [String] Name of the app.
@param expired_only [Boolean] Specify <code>false</code> to return all
recommendations. The default is <code>true</code>, which returns only expired
recommendations.
@param filter [String] Filter is specified by using OData syntax. Example:
$filter=channel eq 'Api' or channel eq 'Notification' and startTime eq
2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq
duration'[PT1H|PT1M|P1D]
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Get",
"past",
"recommendations",
"for",
"an",
"app",
"optionally",
"specified",
"by",
"the",
"time",
"range",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/recommendations.rb#L349-L351 | train | Gets the history for the specified App Service Environment. | [
30522,
13366,
2862,
1035,
2381,
1035,
2005,
1035,
4773,
1035,
10439,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2609,
1035,
2171,
1010,
13735,
1035,
2069,
1024,
9152,
2140,
1010,
11307,
1024,
9152,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ruby/psych | lib/psych/tree_builder.rb | Psych.TreeBuilder.end_document | def end_document implicit_end = !streaming?
@last.implicit_end = implicit_end
n = pop
set_end_location(n)
n
end | ruby | def end_document implicit_end = !streaming?
@last.implicit_end = implicit_end
n = pop
set_end_location(n)
n
end | [
"def",
"end_document",
"implicit_end",
"=",
"!",
"streaming?",
"@last",
".",
"implicit_end",
"=",
"implicit_end",
"n",
"=",
"pop",
"set_end_location",
"(",
"n",
")",
"n",
"end"
] | Handles end_document events with +version+, +tag_directives+,
and +implicit+ styling.
See Psych::Handler#start_document | [
"Handles",
"end_document",
"events",
"with",
"+",
"version",
"+",
"+",
"tag_directives",
"+",
"and",
"+",
"implicit",
"+",
"styling",
"."
] | f3a37e6bc1c2a98bfc9fafc389ea05622c744af9 | https://github.com/ruby/psych/blob/f3a37e6bc1c2a98bfc9fafc389ea05622c744af9/lib/psych/tree_builder.rb#L77-L82 | train | End a document. | [
30522,
13366,
2203,
1035,
6254,
24655,
1035,
2203,
1027,
999,
11058,
1029,
1030,
2197,
1012,
24655,
1035,
2203,
1027,
24655,
1035,
2203,
1050,
1027,
3769,
2275,
1035,
2203,
1035,
3295,
1006,
1050,
1007,
1050,
2203,
102,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | actionview/lib/action_view/lookup_context.rb | ActionView.LookupContext.formats= | def formats=(values)
if values
values = values.dup
values.concat(default_formats) if values.delete "*/*"
values.uniq!
invalid_values = (values - Template::Types.symbols)
unless invalid_values.empty?
raise ArgumentError, "Invalid formats: #{invalid_values.map(&:inspect).join(", ")}"
end
if values == [:js]
values << :html
@html_fallback_for_js = true
end
end
super(values)
end | ruby | def formats=(values)
if values
values = values.dup
values.concat(default_formats) if values.delete "*/*"
values.uniq!
invalid_values = (values - Template::Types.symbols)
unless invalid_values.empty?
raise ArgumentError, "Invalid formats: #{invalid_values.map(&:inspect).join(", ")}"
end
if values == [:js]
values << :html
@html_fallback_for_js = true
end
end
super(values)
end | [
"def",
"formats",
"=",
"(",
"values",
")",
"if",
"values",
"values",
"=",
"values",
".",
"dup",
"values",
".",
"concat",
"(",
"default_formats",
")",
"if",
"values",
".",
"delete",
"\"*/*\"",
"values",
".",
"uniq!",
"invalid_values",
"=",
"(",
"values",
... | Override formats= to expand ["*/*"] values and automatically
add :html as fallback to :js. | [
"Override",
"formats",
"=",
"to",
"expand",
"[",
"*",
"/",
"*",
"]",
"values",
"and",
"automatically",
"add",
":",
"html",
"as",
"fallback",
"to",
":",
"js",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/actionview/lib/action_view/lookup_context.rb#L280-L297 | train | Returns the formats for this template. | [
30522,
13366,
11630,
1027,
1006,
5300,
1007,
2065,
5300,
5300,
1027,
5300,
1012,
4241,
2361,
5300,
1012,
9530,
11266,
1006,
12398,
1035,
11630,
1007,
2065,
5300,
1012,
3972,
12870,
1000,
1008,
1013,
1008,
1000,
5300,
1012,
4895,
18515,
999,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
gocardless/business | lib/business/calendar.rb | Business.Calendar.business_days_between | def business_days_between(date1, date2)
date1, date2 = date1.to_date, date2.to_date
# To optimise this method we split the range into full weeks and a
# remaining period.
#
# We then calculate business days in the full weeks period by
# multiplying number of weeks by number of working days in a week and
# removing holidays one by one.
# For the remaining period, we just loop through each day and check
# whether it is a business day.
# Calculate number of full weeks and remaining days
num_full_weeks, remaining_days = (date2 - date1).to_i.divmod(7)
# First estimate for full week range based on # biz days in a week
num_biz_days = num_full_weeks * working_days.length
full_weeks_range = (date1...(date2 - remaining_days))
num_biz_days -= holidays.count do |holiday|
in_range = full_weeks_range.cover?(holiday)
# Only pick a holiday if its on a working day (e.g., not a weekend)
on_biz_day = working_days.include?(holiday.strftime('%a').downcase)
in_range && on_biz_day
end
remaining_range = (date2-remaining_days...date2)
# Loop through each day in remaining_range and count if a business day
num_biz_days + remaining_range.count { |a| business_day?(a) }
end | ruby | def business_days_between(date1, date2)
date1, date2 = date1.to_date, date2.to_date
# To optimise this method we split the range into full weeks and a
# remaining period.
#
# We then calculate business days in the full weeks period by
# multiplying number of weeks by number of working days in a week and
# removing holidays one by one.
# For the remaining period, we just loop through each day and check
# whether it is a business day.
# Calculate number of full weeks and remaining days
num_full_weeks, remaining_days = (date2 - date1).to_i.divmod(7)
# First estimate for full week range based on # biz days in a week
num_biz_days = num_full_weeks * working_days.length
full_weeks_range = (date1...(date2 - remaining_days))
num_biz_days -= holidays.count do |holiday|
in_range = full_weeks_range.cover?(holiday)
# Only pick a holiday if its on a working day (e.g., not a weekend)
on_biz_day = working_days.include?(holiday.strftime('%a').downcase)
in_range && on_biz_day
end
remaining_range = (date2-remaining_days...date2)
# Loop through each day in remaining_range and count if a business day
num_biz_days + remaining_range.count { |a| business_day?(a) }
end | [
"def",
"business_days_between",
"(",
"date1",
",",
"date2",
")",
"date1",
",",
"date2",
"=",
"date1",
".",
"to_date",
",",
"date2",
".",
"to_date",
"# To optimise this method we split the range into full weeks and a",
"# remaining period.",
"#",
"# We then calculate busines... | Count the number of business days between two dates.
This method counts from start of date1 to start of date2. So,
business_days_between(mon, weds) = 2 (assuming no holidays) | [
"Count",
"the",
"number",
"of",
"business",
"days",
"between",
"two",
"dates",
".",
"This",
"method",
"counts",
"from",
"start",
"of",
"date1",
"to",
"start",
"of",
"date2",
".",
"So",
"business_days_between",
"(",
"mon",
"weds",
")",
"=",
"2",
"(",
"ass... | 62a2a09008095403bafa78033a8be1afe6debbf6 | https://github.com/gocardless/business/blob/62a2a09008095403bafa78033a8be1afe6debbf6/lib/business/calendar.rb#L130-L160 | train | Calculate the number of business days between two dates | [
30522,
13366,
2449,
1035,
2420,
1035,
2090,
1006,
3058,
2487,
1010,
3058,
2475,
1007,
3058,
2487,
1010,
3058,
2475,
1027,
3058,
2487,
1012,
2000,
1035,
3058,
1010,
3058,
2475,
1012,
2000,
1035,
3058,
1001,
2000,
23569,
27605,
3366,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hashicorp/vagrant | lib/vagrant/environment.rb | Vagrant.Environment.active_machines | def active_machines
# We have no active machines if we have no data path
return [] if !@local_data_path
machine_folder = @local_data_path.join("machines")
# If the machine folder is not a directory then we just return
# an empty array since no active machines exist.
return [] if !machine_folder.directory?
# Traverse the machines folder accumulate a result
result = []
machine_folder.children(true).each do |name_folder|
# If this isn't a directory then it isn't a machine
next if !name_folder.directory?
name = name_folder.basename.to_s.to_sym
name_folder.children(true).each do |provider_folder|
# If this isn't a directory then it isn't a provider
next if !provider_folder.directory?
# If this machine doesn't have an ID, then ignore
next if !provider_folder.join("id").file?
provider = provider_folder.basename.to_s.to_sym
result << [name, provider]
end
end
# Return the results
result
end | ruby | def active_machines
# We have no active machines if we have no data path
return [] if !@local_data_path
machine_folder = @local_data_path.join("machines")
# If the machine folder is not a directory then we just return
# an empty array since no active machines exist.
return [] if !machine_folder.directory?
# Traverse the machines folder accumulate a result
result = []
machine_folder.children(true).each do |name_folder|
# If this isn't a directory then it isn't a machine
next if !name_folder.directory?
name = name_folder.basename.to_s.to_sym
name_folder.children(true).each do |provider_folder|
# If this isn't a directory then it isn't a provider
next if !provider_folder.directory?
# If this machine doesn't have an ID, then ignore
next if !provider_folder.join("id").file?
provider = provider_folder.basename.to_s.to_sym
result << [name, provider]
end
end
# Return the results
result
end | [
"def",
"active_machines",
"# We have no active machines if we have no data path",
"return",
"[",
"]",
"if",
"!",
"@local_data_path",
"machine_folder",
"=",
"@local_data_path",
".",
"join",
"(",
"\"machines\"",
")",
"# If the machine folder is not a directory then we just return",
... | Returns a list of machines that this environment is currently
managing that physically have been created.
An "active" machine is a machine that Vagrant manages that has
been created. The machine itself may be in any state such as running,
suspended, etc. but if a machine is "active" then it exists.
Note that the machines in this array may no longer be present in
the Vagrantfile of this environment. In this case the machine can
be considered an "orphan." Determining which machines are orphan
and which aren't is not currently a supported feature, but will
be in a future version.
@return [Array<String, Symbol>] | [
"Returns",
"a",
"list",
"of",
"machines",
"that",
"this",
"environment",
"is",
"currently",
"managing",
"that",
"physically",
"have",
"been",
"created",
"."
] | c22a145c59790c098f95d50141d9afb48e1ef55f | https://github.com/hashicorp/vagrant/blob/c22a145c59790c098f95d50141d9afb48e1ef55f/lib/vagrant/environment.rb#L233-L265 | train | Returns an array of the active machines | [
30522,
13366,
3161,
1035,
6681,
1001,
2057,
2031,
2053,
3161,
6681,
2065,
2057,
2031,
2053,
2951,
4130,
2709,
1031,
1033,
2065,
999,
1030,
2334,
1035,
2951,
1035,
4130,
3698,
1035,
19622,
1027,
1030,
2334,
1035,
2951,
1035,
4130,
1012,
36... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_datalake_analytics/lib/2015-10-01-preview/generated/azure_mgmt_datalake_analytics/account.rb | Azure::DataLakeAnalytics::Mgmt::V2015_10_01_preview.Account.add_data_lake_store_account | def add_data_lake_store_account(resource_group_name, account_name, data_lake_store_account_name, parameters, custom_headers:nil)
response = add_data_lake_store_account_async(resource_group_name, account_name, data_lake_store_account_name, parameters, custom_headers:custom_headers).value!
nil
end | ruby | def add_data_lake_store_account(resource_group_name, account_name, data_lake_store_account_name, parameters, custom_headers:nil)
response = add_data_lake_store_account_async(resource_group_name, account_name, data_lake_store_account_name, parameters, custom_headers:custom_headers).value!
nil
end | [
"def",
"add_data_lake_store_account",
"(",
"resource_group_name",
",",
"account_name",
",",
"data_lake_store_account_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"add_data_lake_store_account_async",
"(",
"resource_group_name",
",",
"acc... | Updates the specified Data Lake Analytics account to include the additional
Data Lake Store account.
@param resource_group_name [String] The name of the Azure resource group that
contains the Data Lake Analytics account.
@param account_name [String] The name of the Data Lake Analytics account to
which to add the Data Lake Store account.
@param data_lake_store_account_name [String] The name of the Data Lake Store
account to add.
@param parameters [AddDataLakeStoreParameters] The details of the Data Lake
Store account.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Updates",
"the",
"specified",
"Data",
"Lake",
"Analytics",
"account",
"to",
"include",
"the",
"additional",
"Data",
"Lake",
"Store",
"account",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_datalake_analytics/lib/2015-10-01-preview/generated/azure_mgmt_datalake_analytics/account.rb#L1010-L1013 | train | Adds the specified Data Lake Store account to the specified Data Lake Store account. | [
30522,
13366,
5587,
1035,
2951,
1035,
2697,
1035,
3573,
1035,
4070,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
2951,
1035,
2697,
1035,
3573,
1035,
4070,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/event_subscriptions.rb | Azure::EventGrid::Mgmt::V2018_01_01.EventSubscriptions.list_global_by_subscription | def list_global_by_subscription(custom_headers:nil)
response = list_global_by_subscription_async(custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_global_by_subscription(custom_headers:nil)
response = list_global_by_subscription_async(custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_global_by_subscription",
"(",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_global_by_subscription_async",
"(",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"response",
".",
"nil?",
"end"
] | Get an aggregated list of all global event subscriptions under an Azure
subscription
List all aggregated global event subscriptions under a specific Azure
subscription
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [EventSubscriptionsListResult] operation results. | [
"Get",
"an",
"aggregated",
"list",
"of",
"all",
"global",
"event",
"subscriptions",
"under",
"an",
"Azure",
"subscription"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/event_subscriptions.rb#L485-L488 | train | Gets all the global information about the resource groups. | [
30522,
13366,
2862,
1035,
3795,
1035,
2011,
1035,
15002,
1006,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
3795,
1035,
2011,
1035,
15002,
1035,
2004,
6038,
2278,
1006,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_datalake_analytics/lib/2016-11-01/generated/azure_mgmt_datalake_analytics/accounts.rb | Azure::DataLakeAnalytics::Mgmt::V2016_11_01.Accounts.list | def list(filter:nil, top:nil, skip:nil, select:nil, orderby:nil, count:nil, custom_headers:nil)
first_page = list_as_lazy(filter:filter, top:top, skip:skip, select:select, orderby:orderby, count:count, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list(filter:nil, top:nil, skip:nil, select:nil, orderby:nil, count:nil, custom_headers:nil)
first_page = list_as_lazy(filter:filter, top:top, skip:skip, select:select, orderby:orderby, count:count, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list",
"(",
"filter",
":",
"nil",
",",
"top",
":",
"nil",
",",
"skip",
":",
"nil",
",",
"select",
":",
"nil",
",",
"orderby",
":",
"nil",
",",
"count",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_as_lazy",
"... | Gets the first page of Data Lake Analytics accounts, if any, within the
current subscription. This includes a link to the next page, if any.
@param filter [String] OData filter. Optional.
@param top [Integer] The number of items to return. Optional.
@param skip [Integer] The number of items to skip over before returning
elements. Optional.
@param select [String] OData Select statement. Limits the properties on each
entry to just those requested, e.g.
Categories?$select=CategoryName,Description. Optional.
@param orderby [String] OrderBy clause. One or more comma-separated
expressions with an optional "asc" (the default) or "desc" depending on the
order you'd like the values sorted, e.g. Categories?$orderby=CategoryName
desc. Optional.
@param count [Boolean] The Boolean value of true or false to request a count
of the matching resources included with the resources in the response, e.g.
Categories?$count=true. Optional.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<DataLakeAnalyticsAccountBasic>] operation results. | [
"Gets",
"the",
"first",
"page",
"of",
"Data",
"Lake",
"Analytics",
"accounts",
"if",
"any",
"within",
"the",
"current",
"subscription",
".",
"This",
"includes",
"a",
"link",
"to",
"the",
"next",
"page",
"if",
"any",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_datalake_analytics/lib/2016-11-01/generated/azure_mgmt_datalake_analytics/accounts.rb#L47-L50 | train | Gets all the items in a product. | [
30522,
13366,
2862,
1006,
11307,
1024,
9152,
2140,
1010,
2327,
1024,
9152,
2140,
1010,
13558,
1024,
9152,
2140,
1010,
7276,
1024,
9152,
2140,
1010,
2344,
3762,
1024,
9152,
2140,
1010,
4175,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
oauth-xx/oauth2 | lib/oauth2/access_token.rb | OAuth2.AccessToken.refresh | def refresh(params = {}, access_token_opts = {}, access_token_class = self.class)
raise('A refresh_token is not available') unless refresh_token
params[:grant_type] = 'refresh_token'
params[:refresh_token] = refresh_token
new_token = @client.get_token(params, access_token_opts, access_token_class)
new_token.options = options
new_token.refresh_token = refresh_token unless new_token.refresh_token
new_token
end | ruby | def refresh(params = {}, access_token_opts = {}, access_token_class = self.class)
raise('A refresh_token is not available') unless refresh_token
params[:grant_type] = 'refresh_token'
params[:refresh_token] = refresh_token
new_token = @client.get_token(params, access_token_opts, access_token_class)
new_token.options = options
new_token.refresh_token = refresh_token unless new_token.refresh_token
new_token
end | [
"def",
"refresh",
"(",
"params",
"=",
"{",
"}",
",",
"access_token_opts",
"=",
"{",
"}",
",",
"access_token_class",
"=",
"self",
".",
"class",
")",
"raise",
"(",
"'A refresh_token is not available'",
")",
"unless",
"refresh_token",
"params",
"[",
":grant_type",
... | Refreshes the current Access Token
@return [AccessToken] a new AccessToken
@note options should be carried over to the new AccessToken | [
"Refreshes",
"the",
"current",
"Access",
"Token"
] | f08ff9da169136ab133aa2faab0d74a4407deffb | https://github.com/oauth-xx/oauth2/blob/f08ff9da169136ab133aa2faab0d74a4407deffb/lib/oauth2/access_token.rb#L85-L93 | train | Refresh a token | [
30522,
13366,
25416,
21898,
1006,
11498,
5244,
1027,
1063,
1065,
1010,
3229,
1035,
19204,
1035,
23569,
2015,
1027,
1063,
1065,
1010,
3229,
1035,
19204,
1035,
2465,
1027,
2969,
1012,
2465,
1007,
5333,
1006,
1005,
1037,
25416,
21898,
1035,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb | Azure::KeyVault::V2016_10_01.KeyVaultClient.get_certificate_with_http_info | def get_certificate_with_http_info(vault_base_url, certificate_name, certificate_version, custom_headers:nil)
get_certificate_async(vault_base_url, certificate_name, certificate_version, custom_headers:custom_headers).value!
end | ruby | def get_certificate_with_http_info(vault_base_url, certificate_name, certificate_version, custom_headers:nil)
get_certificate_async(vault_base_url, certificate_name, certificate_version, custom_headers:custom_headers).value!
end | [
"def",
"get_certificate_with_http_info",
"(",
"vault_base_url",
",",
"certificate_name",
",",
"certificate_version",
",",
"custom_headers",
":",
"nil",
")",
"get_certificate_async",
"(",
"vault_base_url",
",",
"certificate_name",
",",
"certificate_version",
",",
"custom_hea... | Gets information about a certificate.
Gets information about a specific certificate. This operation requires the
certificates/get permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param certificate_name [String] The name of the certificate in the given
vault.
@param certificate_version [String] The version of the certificate.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"information",
"about",
"a",
"certificate",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb#L5964-L5966 | train | Gets the certificate. | [
30522,
13366,
2131,
1035,
8196,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
8196,
1035,
2171,
1010,
8196,
1035,
2544,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
8196,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
gollum/gollum | lib/gollum/app.rb | Precious.App.wiki_page | def wiki_page(name, path = nil, version = nil, exact = true)
wiki = wiki_new
path = name if path.nil?
name = extract_name(name) || wiki.index_page
path = extract_path(path)
path = '/' if exact && path.nil?
OpenStruct.new(:wiki => wiki, :page => wiki.paged(name, path, exact, version),
:name => name, :path => path)
end | ruby | def wiki_page(name, path = nil, version = nil, exact = true)
wiki = wiki_new
path = name if path.nil?
name = extract_name(name) || wiki.index_page
path = extract_path(path)
path = '/' if exact && path.nil?
OpenStruct.new(:wiki => wiki, :page => wiki.paged(name, path, exact, version),
:name => name, :path => path)
end | [
"def",
"wiki_page",
"(",
"name",
",",
"path",
"=",
"nil",
",",
"version",
"=",
"nil",
",",
"exact",
"=",
"true",
")",
"wiki",
"=",
"wiki_new",
"path",
"=",
"name",
"if",
"path",
".",
"nil?",
"name",
"=",
"extract_name",
"(",
"name",
")",
"||",
"wik... | path is set to name if path is nil.
if path is 'a/b' and a and b are dirs, then
path must have a trailing slash 'a/b/' or
extract_path will trim path to 'a'
name, path, version | [
"path",
"is",
"set",
"to",
"name",
"if",
"path",
"is",
"nil",
".",
"if",
"path",
"is",
"a",
"/",
"b",
"and",
"a",
"and",
"b",
"are",
"dirs",
"then",
"path",
"must",
"have",
"a",
"trailing",
"slash",
"a",
"/",
"b",
"/",
"or",
"extract_path",
"will... | f44367c31baac5c154888a9e09b2833fa62e1c61 | https://github.com/gollum/gollum/blob/f44367c31baac5c154888a9e09b2833fa62e1c61/lib/gollum/app.rb#L118-L127 | train | Returns a new page object for the given name | [
30522,
13366,
15536,
3211,
1035,
3931,
1006,
2171,
1010,
4130,
1027,
9152,
2140,
1010,
2544,
1027,
9152,
2140,
1010,
6635,
1027,
2995,
1007,
15536,
3211,
1027,
15536,
3211,
1035,
2047,
4130,
1027,
2171,
2065,
4130,
1012,
9152,
2140,
1029,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2015-08-01/generated/azure_mgmt_web/app_service_certificate_orders.rb | Azure::Web::Mgmt::V2015_08_01.AppServiceCertificateOrders.get_certificate | def get_certificate(resource_group_name, certificate_order_name, name, custom_headers:nil)
response = get_certificate_async(resource_group_name, certificate_order_name, name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_certificate(resource_group_name, certificate_order_name, name, custom_headers:nil)
response = get_certificate_async(resource_group_name, certificate_order_name, name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_certificate",
"(",
"resource_group_name",
",",
"certificate_order_name",
",",
"name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_certificate_async",
"(",
"resource_group_name",
",",
"certificate_order_name",
",",
"name",
",",
"custom_heade... | Get the certificate associated with a certificate order.
Get the certificate associated with a certificate order.
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param certificate_order_name [String] Name of the certificate order.
@param name [String] Name of the certificate.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [AppServiceCertificateResource] operation results. | [
"Get",
"the",
"certificate",
"associated",
"with",
"a",
"certificate",
"order",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2015-08-01/generated/azure_mgmt_web/app_service_certificate_orders.rb#L803-L806 | train | Gets the certificate for the specified certificate order. | [
30522,
13366,
2131,
1035,
8196,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8196,
1035,
2344,
1035,
2171,
1010,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
8196,
1035,
2004,
6038,
2278,
1006,
7692,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
puppetlabs/bolt | lib/plan_executor/executor.rb | PlanExecutor.Executor.log_action | def log_action(description, targets)
# When running a plan, info messages like starting a task are promoted to notice.
log_method = @plan_logging ? :notice : :info
target_str = if targets.length > 5
"#{targets.count} targets"
else
targets.map(&:uri).join(', ')
end
@logger.send(log_method, "Starting: #{description} on #{target_str}")
start_time = Time.now
results = yield
duration = Time.now - start_time
failures = results.error_set.length
plural = failures == 1 ? '' : 's'
@logger.send(log_method, "Finished: #{description} with #{failures} failure#{plural} in #{duration.round(2)} sec")
results
end | ruby | def log_action(description, targets)
# When running a plan, info messages like starting a task are promoted to notice.
log_method = @plan_logging ? :notice : :info
target_str = if targets.length > 5
"#{targets.count} targets"
else
targets.map(&:uri).join(', ')
end
@logger.send(log_method, "Starting: #{description} on #{target_str}")
start_time = Time.now
results = yield
duration = Time.now - start_time
failures = results.error_set.length
plural = failures == 1 ? '' : 's'
@logger.send(log_method, "Finished: #{description} with #{failures} failure#{plural} in #{duration.round(2)} sec")
results
end | [
"def",
"log_action",
"(",
"description",
",",
"targets",
")",
"# When running a plan, info messages like starting a task are promoted to notice.",
"log_method",
"=",
"@plan_logging",
"?",
":notice",
":",
":info",
"target_str",
"=",
"if",
"targets",
".",
"length",
">",
"5"... | BOLT-1098 | [
"BOLT",
"-",
"1098"
] | 50689a33699939d262ea7c822a4b24fd8c4f8d8a | https://github.com/puppetlabs/bolt/blob/50689a33699939d262ea7c822a4b24fd8c4f8d8a/lib/plan_executor/executor.rb#L41-L62 | train | Log the action | [
30522,
13366,
8833,
1035,
2895,
1006,
6412,
1010,
7889,
1007,
1001,
2043,
2770,
1037,
2933,
1010,
18558,
7696,
2066,
3225,
1037,
4708,
2024,
3755,
2000,
5060,
1012,
8833,
1035,
4118,
1027,
1030,
2933,
1035,
15899,
1029,
1024,
5060,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
vcr/vcr | lib/vcr/configuration.rb | VCR.Configuration.define_cassette_placeholder | def define_cassette_placeholder(placeholder, tag = nil, &block)
before_record(tag) do |interaction|
orig_text = call_block(block, interaction)
log "before_record: replacing #{orig_text.inspect} with #{placeholder.inspect}"
interaction.filter!(orig_text, placeholder)
end
before_playback(tag) do |interaction|
orig_text = call_block(block, interaction)
log "before_playback: replacing #{orig_text.inspect} with #{placeholder.inspect}"
interaction.filter!(placeholder, orig_text)
end
end | ruby | def define_cassette_placeholder(placeholder, tag = nil, &block)
before_record(tag) do |interaction|
orig_text = call_block(block, interaction)
log "before_record: replacing #{orig_text.inspect} with #{placeholder.inspect}"
interaction.filter!(orig_text, placeholder)
end
before_playback(tag) do |interaction|
orig_text = call_block(block, interaction)
log "before_playback: replacing #{orig_text.inspect} with #{placeholder.inspect}"
interaction.filter!(placeholder, orig_text)
end
end | [
"def",
"define_cassette_placeholder",
"(",
"placeholder",
",",
"tag",
"=",
"nil",
",",
"&",
"block",
")",
"before_record",
"(",
"tag",
")",
"do",
"|",
"interaction",
"|",
"orig_text",
"=",
"call_block",
"(",
"block",
",",
"interaction",
")",
"log",
"\"before... | Sets up a {#before_record} and a {#before_playback} hook that will
insert a placeholder string in the cassette in place of another string.
You can use this as a generic way to interpolate a variable into the
cassette for a unique string. It's particularly useful for unique
sensitive strings like API keys and passwords.
@example
VCR.configure do |c|
# Put "<GITHUB_API_KEY>" in place of the actual API key in
# our cassettes so we don't have to commit to source control.
c.filter_sensitive_data('<GITHUB_API_KEY>') { GithubClient.api_key }
# Put a "<USER_ID>" placeholder variable in our cassettes tagged with
# :user_cassette since it can be different for different test runs.
c.define_cassette_placeholder('<USER_ID>', :user_cassette) { User.last.id }
end
@param placeholder [String] The placeholder string.
@param tag [Symbol] Set this to apply this only to cassettes
with a matching tag; otherwise it will apply to every cassette.
@yield block that determines what string to replace
@yieldparam interaction [(optional) VCR::HTTPInteraction::HookAware] the HTTP interaction
@yieldreturn the string to replace | [
"Sets",
"up",
"a",
"{",
"#before_record",
"}",
"and",
"a",
"{",
"#before_playback",
"}",
"hook",
"that",
"will",
"insert",
"a",
"placeholder",
"string",
"in",
"the",
"cassette",
"in",
"place",
"of",
"another",
"string",
".",
"You",
"can",
"use",
"this",
... | 945ca793a4b25c7ffc406b9fd7da1e94cbbb8141 | https://github.com/vcr/vcr/blob/945ca793a4b25c7ffc406b9fd7da1e94cbbb8141/lib/vcr/configuration.rb#L225-L237 | train | Define a placeholder for a given interaction. | [
30522,
13366,
9375,
1035,
13903,
1035,
2173,
14528,
1006,
2173,
14528,
1010,
6415,
1027,
9152,
2140,
1010,
1004,
3796,
1007,
2077,
1035,
2501,
1006,
6415,
1007,
2079,
1064,
8290,
1064,
2030,
8004,
1035,
3793,
1027,
2655,
1035,
3796,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/device_settings.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.DeviceSettings.begin_update_network_settings_with_http_info | def begin_update_network_settings_with_http_info(device_name, parameters, resource_group_name, manager_name, custom_headers:nil)
begin_update_network_settings_async(device_name, parameters, resource_group_name, manager_name, custom_headers:custom_headers).value!
end | ruby | def begin_update_network_settings_with_http_info(device_name, parameters, resource_group_name, manager_name, custom_headers:nil)
begin_update_network_settings_async(device_name, parameters, resource_group_name, manager_name, custom_headers:custom_headers).value!
end | [
"def",
"begin_update_network_settings_with_http_info",
"(",
"device_name",
",",
"parameters",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"begin_update_network_settings_async",
"(",
"device_name",
",",
"parameters",
",",
"resourc... | Updates the network settings on the specified device.
@param device_name [String] The device name
@param parameters [NetworkSettingsPatch] The network settings to be updated.
@param resource_group_name [String] The resource group name
@param manager_name [String] The manager name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Updates",
"the",
"network",
"settings",
"on",
"the",
"specified",
"device",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/device_settings.rb#L780-L782 | train | Updates network settings of the specified device. | [
30522,
13366,
4088,
1035,
10651,
1035,
2897,
1035,
10906,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
5080,
1035,
2171,
1010,
11709,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb | Azure::Compute::Mgmt::V2016_04_30_preview.VirtualMachineScaleSets.begin_deallocate_with_http_info | def begin_deallocate_with_http_info(resource_group_name, vm_scale_set_name, vm_instance_ids:nil, custom_headers:nil)
begin_deallocate_async(resource_group_name, vm_scale_set_name, vm_instance_ids:vm_instance_ids, custom_headers:custom_headers).value!
end | ruby | def begin_deallocate_with_http_info(resource_group_name, vm_scale_set_name, vm_instance_ids:nil, custom_headers:nil)
begin_deallocate_async(resource_group_name, vm_scale_set_name, vm_instance_ids:vm_instance_ids, custom_headers:custom_headers).value!
end | [
"def",
"begin_deallocate_with_http_info",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"vm_instance_ids",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"begin_deallocate_async",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"vm_instance_ids"... | Deallocates specific virtual machines in a VM scale set. Shuts down the
virtual machines and releases the compute resources. You are not billed for
the compute resources that this virtual machine scale set deallocates.
@param resource_group_name [String] The name of the resource group.
@param vm_scale_set_name [String] The name of the VM scale set.
@param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] A list of
virtual machine instance IDs from the VM scale set.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Deallocates",
"specific",
"virtual",
"machines",
"in",
"a",
"VM",
"scale",
"set",
".",
"Shuts",
"down",
"the",
"virtual",
"machines",
"and",
"releases",
"the",
"compute",
"resources",
".",
"You",
"are",
"not",
"billed",
"for",
"the",
"compute",
"resources",
... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb#L1175-L1177 | train | Deallocate virtual machines from a VM scale set. | [
30522,
13366,
4088,
1035,
3066,
4135,
16280,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
4094,
1035,
2275,
1035,
2171,
1010,
1058,
2213,
1035,
6013,
1035,
8909,
2015,
1024,
9152,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
chaps-io/public_activity | lib/public_activity/common.rb | PublicActivity.Common.prepare_parameters | def prepare_parameters(options)
params = {}
params.merge!(self.class.activity_params_global)
params.merge!(self.activity_params) if self.activity_params
params.merge!([options.delete(:parameters), options.delete(:params), {}].compact.first)
params.each { |k, v| params[k] = PublicActivity.resolve_value(self, v) }
end | ruby | def prepare_parameters(options)
params = {}
params.merge!(self.class.activity_params_global)
params.merge!(self.activity_params) if self.activity_params
params.merge!([options.delete(:parameters), options.delete(:params), {}].compact.first)
params.each { |k, v| params[k] = PublicActivity.resolve_value(self, v) }
end | [
"def",
"prepare_parameters",
"(",
"options",
")",
"params",
"=",
"{",
"}",
"params",
".",
"merge!",
"(",
"self",
".",
"class",
".",
"activity_params_global",
")",
"params",
".",
"merge!",
"(",
"self",
".",
"activity_params",
")",
"if",
"self",
".",
"activi... | Prepares i18n parameters that will
be serialized into the Activity#parameters column
@private | [
"Prepares",
"i18n",
"parameters",
"that",
"will",
"be",
"serialized",
"into",
"the",
"Activity#parameters",
"column"
] | e4357cd14db67299e0cbbd656300f51b7069ea9b | https://github.com/chaps-io/public_activity/blob/e4357cd14db67299e0cbbd656300f51b7069ea9b/lib/public_activity/common.rb#L319-L325 | train | Prepare parameters for the activity | [
30522,
13366,
7374,
1035,
11709,
1006,
7047,
1007,
11498,
5244,
1027,
1063,
1065,
11498,
5244,
1012,
13590,
999,
1006,
2969,
1012,
2465,
1012,
4023,
1035,
11498,
5244,
1035,
3795,
1007,
11498,
5244,
1012,
13590,
999,
1006,
2969,
1012,
4023,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
danger/danger | lib/danger/danger_core/plugins/dangerfile_messaging_plugin.rb | Danger.DangerfileMessagingPlugin.violation_report | def violation_report
{
errors: @errors.clone.freeze,
warnings: @warnings.clone.freeze,
messages: @messages.clone.freeze
}
end | ruby | def violation_report
{
errors: @errors.clone.freeze,
warnings: @warnings.clone.freeze,
messages: @messages.clone.freeze
}
end | [
"def",
"violation_report",
"{",
"errors",
":",
"@errors",
".",
"clone",
".",
"freeze",
",",
"warnings",
":",
"@warnings",
".",
"clone",
".",
"freeze",
",",
"messages",
":",
"@messages",
".",
"clone",
".",
"freeze",
"}",
"end"
] | @!group Reporting
A list of all violations passed to Danger, we don't
anticipate users of Danger needing to use this.
@visibility hidden
@return [Hash] | [
"@!group",
"Reporting",
"A",
"list",
"of",
"all",
"violations",
"passed",
"to",
"Danger",
"we",
"don",
"t",
"anticipate",
"users",
"of",
"Danger",
"needing",
"to",
"use",
"this",
"."
] | 0d6d09f2d949c287fe75202d947374042b0679f4 | https://github.com/danger/danger/blob/0d6d09f2d949c287fe75202d947374042b0679f4/lib/danger/danger_core/plugins/dangerfile_messaging_plugin.rb#L204-L210 | train | Report the violation report for the current object. | [
30522,
13366,
11371,
1035,
3189,
1063,
10697,
1024,
1030,
10697,
1012,
17598,
1012,
13184,
1010,
16234,
1024,
1030,
16234,
1012,
17598,
1012,
13184,
1010,
7696,
1024,
1030,
7696,
1012,
17598,
1012,
13184,
1065,
2203,
102,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb | Azure::KeyVault::V2016_10_01.KeyVaultClient.delete_secret | def delete_secret(vault_base_url, secret_name, custom_headers:nil)
response = delete_secret_async(vault_base_url, secret_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def delete_secret(vault_base_url, secret_name, custom_headers:nil)
response = delete_secret_async(vault_base_url, secret_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"delete_secret",
"(",
"vault_base_url",
",",
"secret_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_secret_async",
"(",
"vault_base_url",
",",
"secret_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".... | Deletes a secret from a specified key vault.
The DELETE operation applies to any secret stored in Azure Key Vault. DELETE
cannot be applied to an individual version of a secret. This operation
requires the secrets/delete permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param secret_name [String] The name of the secret.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [DeletedSecretBundle] operation results. | [
"Deletes",
"a",
"secret",
"from",
"a",
"specified",
"key",
"vault",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb#L2798-L2801 | train | Deletes the specified secret. | [
30522,
13366,
3972,
12870,
1035,
3595,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
3595,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
1035,
3595,
1035,
2004,
6038,
2278,
1006,
11632,
1035... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_mixedreality/lib/2019-02-28-preview/generated/azure_mgmt_mixedreality/spatial_anchors_accounts.rb | Azure::MixedReality::Mgmt::V2019_02_28_preview.SpatialAnchorsAccounts.delete | def delete(resource_group_name, spatial_anchors_account_name, custom_headers:nil)
response = delete_async(resource_group_name, spatial_anchors_account_name, custom_headers:custom_headers).value!
nil
end | ruby | def delete(resource_group_name, spatial_anchors_account_name, custom_headers:nil)
response = delete_async(resource_group_name, spatial_anchors_account_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"delete",
"(",
"resource_group_name",
",",
"spatial_anchors_account_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_async",
"(",
"resource_group_name",
",",
"spatial_anchors_account_name",
",",
"custom_headers",
":custom_headers",
")",
".",
... | Delete a Spatial Anchors Account.
@param resource_group_name [String] Name of an Azure resource group.
@param spatial_anchors_account_name [String] Name of an Mixed Reality Spatial
Anchors Account.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Delete",
"a",
"Spatial",
"Anchors",
"Account",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_mixedreality/lib/2019-02-28-preview/generated/azure_mgmt_mixedreality/spatial_anchors_accounts.rb#L209-L212 | train | Deletes a spatial anchor. | [
30522,
13366,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
13589,
1035,
24674,
1035,
4070,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
30524,
1035,
20346,
2015,
1024,
7661,
1035,
203... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
plataformatec/simple_form | lib/simple_form/form_builder.rb | SimpleForm.FormBuilder.input | def input(attribute_name, options = {}, &block)
options = @defaults.deep_dup.deep_merge(options) if @defaults
input = find_input(attribute_name, options, &block)
wrapper = find_wrapper(input.input_type, options)
wrapper.render input
end | ruby | def input(attribute_name, options = {}, &block)
options = @defaults.deep_dup.deep_merge(options) if @defaults
input = find_input(attribute_name, options, &block)
wrapper = find_wrapper(input.input_type, options)
wrapper.render input
end | [
"def",
"input",
"(",
"attribute_name",
",",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"options",
"=",
"@defaults",
".",
"deep_dup",
".",
"deep_merge",
"(",
"options",
")",
"if",
"@defaults",
"input",
"=",
"find_input",
"(",
"attribute_name",
",",
... | Basic input helper, combines all components in the stack to generate
input html based on options the user define and some guesses through
database column information. By default a call to input will generate
label + input + hint (when defined) + errors (when exists), and all can
be configured inside a wrapper html.
If a block is given, the contents of the block will replace the input
field that would otherwise be generated automatically. The content will
be given a label and wrapper div to make it consistent with the other
elements in the form.
== Examples
# Imagine @user has error "can't be blank" on name
simple_form_for @user do |f|
f.input :name, hint: 'My hint'
end
This is the output html (only the input portion, not the form):
<label class="string required" for="user_name">
<abbr title="required">*</abbr> Super User Name!
</label>
<input class="string required" id="user_name" maxlength="100"
name="user[name]" type="text" value="Carlos" />
<span class="hint">My hint</span>
<span class="error">can't be blank</span>
Each database type will render a default input, based on some mappings and
heuristic to determine which is the best option.
You have some options for the input to enable/disable some functions:
as: allows you to define the input type you want, for instance you
can use it to generate a text field for a date column.
required: defines whether this attribute is required or not. True
by default.
The fact SimpleForm is built in components allow the interface to be unified.
So, for instance, if you need to disable :hint for a given input, you can pass
hint: false. The same works for :error, :label and :wrapper.
Besides the html for any component can be changed. So, if you want to change
the label html you just need to give a hash to :label_html. To configure the
input html, supply :input_html instead and so on.
== Options
Some inputs, as datetime, time and select allow you to give extra options, like
prompt and/or include blank. Such options are given in plainly:
f.input :created_at, include_blank: true
== Collection
When playing with collections (:radio_buttons, :check_boxes and :select
inputs), you have three extra options:
collection: use to determine the collection to generate the radio or select
label_method: the method to apply on the array collection to get the label
value_method: the method to apply on the array collection to get the value
== Priority
Some inputs, as :time_zone and :country accepts a :priority option. If none is
given SimpleForm.time_zone_priority and SimpleForm.country_priority are used respectively. | [
"Basic",
"input",
"helper",
"combines",
"all",
"components",
"in",
"the",
"stack",
"to",
"generate",
"input",
"html",
"based",
"on",
"options",
"the",
"user",
"define",
"and",
"some",
"guesses",
"through",
"database",
"column",
"information",
".",
"By",
"defau... | 4dd9261ebb392e46a9beeefe8d83081e7c6e56b5 | https://github.com/plataformatec/simple_form/blob/4dd9261ebb392e46a9beeefe8d83081e7c6e56b5/lib/simple_form/form_builder.rb#L117-L124 | train | Returns the input object for the given attribute name. | [
30522,
13366,
7953,
1006,
17961,
1035,
2171,
1010,
7047,
1027,
1063,
1065,
1010,
1004,
3796,
1007,
7047,
1027,
1030,
12398,
2015,
1012,
2784,
1035,
4241,
2361,
1012,
2784,
1035,
13590,
1006,
7047,
1007,
2065,
1030,
12398,
2015,
7953,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_event_hub/lib/2017-04-01/generated/azure_mgmt_event_hub/consumer_groups.rb | Azure::EventHub::Mgmt::V2017_04_01.ConsumerGroups.list_by_event_hub_next | def list_by_event_hub_next(next_page_link, custom_headers:nil)
response = list_by_event_hub_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_event_hub_next(next_page_link, custom_headers:nil)
response = list_by_event_hub_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_event_hub_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_event_hub_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"re... | Gets all the consumer groups in a Namespace. An empty feed is returned if no
consumer group exists in the Namespace.
@param next_page_link [String] The NextLink from the previous successful call
to List operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ConsumerGroupListResult] operation results. | [
"Gets",
"all",
"the",
"consumer",
"groups",
"in",
"a",
"Namespace",
".",
"An",
"empty",
"feed",
"is",
"returned",
"if",
"no",
"consumer",
"group",
"exists",
"in",
"the",
"Namespace",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_event_hub/lib/2017-04-01/generated/azure_mgmt_event_hub/consumer_groups.rb#L500-L503 | train | Gets the list of all the available Azure Central Hubs. | [
30522,
13366,
2862,
1035,
2011,
1035,
2724,
1035,
9594,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
2724,
1035,
9594,
1035,
2279,
1035,
2004,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
phusion/passenger | src/ruby_supportlib/phusion_passenger/message_channel.rb | PhusionPassenger.MessageChannel.recv_io | def recv_io(klass = IO, negotiate = true)
write("pass IO") if negotiate
io = @io.recv_io(klass)
write("got IO") if negotiate
return io
end | ruby | def recv_io(klass = IO, negotiate = true)
write("pass IO") if negotiate
io = @io.recv_io(klass)
write("got IO") if negotiate
return io
end | [
"def",
"recv_io",
"(",
"klass",
"=",
"IO",
",",
"negotiate",
"=",
"true",
")",
"write",
"(",
"\"pass IO\"",
")",
"if",
"negotiate",
"io",
"=",
"@io",
".",
"recv_io",
"(",
"klass",
")",
"write",
"(",
"\"got IO\"",
")",
"if",
"negotiate",
"return",
"io",... | Receive an IO object (a file descriptor) from the channel. The other
side must have sent an IO object by calling send_io(). Note that
this only works on Unix sockets.
Might raise SystemCallError, IOError or SocketError when something
goes wrong. | [
"Receive",
"an",
"IO",
"object",
"(",
"a",
"file",
"descriptor",
")",
"from",
"the",
"channel",
".",
"The",
"other",
"side",
"must",
"have",
"sent",
"an",
"IO",
"object",
"by",
"calling",
"send_io",
"()",
".",
"Note",
"that",
"this",
"only",
"works",
"... | 970964b53e0ba86959acdf40f06c99b0c4a128ca | https://github.com/phusion/passenger/blob/970964b53e0ba86959acdf40f06c99b0c4a128ca/src/ruby_supportlib/phusion_passenger/message_channel.rb#L259-L264 | train | recv_io returns an IO object | [
30522,
13366,
28667,
2615,
1035,
22834,
1006,
1047,
27102,
1027,
22834,
1010,
13676,
1027,
2995,
1007,
4339,
1006,
1000,
3413,
22834,
1000,
1007,
2065,
13676,
22834,
1027,
1030,
22834,
1012,
28667,
2615,
1035,
22834,
1006,
1047,
27102,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | spaceship/lib/spaceship/tunes/tunes_client.rb | Spaceship.TunesClient.update_availability! | def update_availability!(app_id, availability)
r = request(:get, "ra/apps/#{app_id}/pricing/intervals")
data = parse_response(r, 'data')
data["countriesChanged"] = true
data["countries"] = availability.territories.map { |territory| { 'code' => territory.code } }
data["theWorld"] = availability.include_future_territories.nil? ? true : availability.include_future_territories
# InitializespreOrder (if needed)
data["preOrder"] ||= {}
# Sets app_available_date to nil if cleared_for_preorder if false
# This is need for apps that have never set either of these before
# API will error out if cleared_for_preorder is false and app_available_date has a date
cleared_for_preorder = availability.cleared_for_preorder
app_available_date = cleared_for_preorder ? availability.app_available_date : nil
data["b2bAppEnabled"] = availability.b2b_app_enabled
data["educationalDiscount"] = availability.educational_discount
data["preOrder"]["clearedForPreOrder"] = { "value" => cleared_for_preorder, "isEditable" => true, "isRequired" => true, "errorKeys" => nil }
data["preOrder"]["appAvailableDate"] = { "value" => app_available_date, "isEditable" => true, "isRequired" => true, "errorKeys" => nil }
data["b2bUsers"] = availability.b2b_app_enabled ? availability.b2b_users.map { |user| { "value" => { "add" => user.add, "delete" => user.delete, "dsUsername" => user.ds_username } } } : []
# send the changes back to Apple
r = request(:post) do |req|
req.url("ra/apps/#{app_id}/pricing/intervals")
req.body = data.to_json
req.headers['Content-Type'] = 'application/json'
end
handle_itc_response(r.body)
data = parse_response(r, 'data')
Spaceship::Tunes::Availability.factory(data)
end | ruby | def update_availability!(app_id, availability)
r = request(:get, "ra/apps/#{app_id}/pricing/intervals")
data = parse_response(r, 'data')
data["countriesChanged"] = true
data["countries"] = availability.territories.map { |territory| { 'code' => territory.code } }
data["theWorld"] = availability.include_future_territories.nil? ? true : availability.include_future_territories
# InitializespreOrder (if needed)
data["preOrder"] ||= {}
# Sets app_available_date to nil if cleared_for_preorder if false
# This is need for apps that have never set either of these before
# API will error out if cleared_for_preorder is false and app_available_date has a date
cleared_for_preorder = availability.cleared_for_preorder
app_available_date = cleared_for_preorder ? availability.app_available_date : nil
data["b2bAppEnabled"] = availability.b2b_app_enabled
data["educationalDiscount"] = availability.educational_discount
data["preOrder"]["clearedForPreOrder"] = { "value" => cleared_for_preorder, "isEditable" => true, "isRequired" => true, "errorKeys" => nil }
data["preOrder"]["appAvailableDate"] = { "value" => app_available_date, "isEditable" => true, "isRequired" => true, "errorKeys" => nil }
data["b2bUsers"] = availability.b2b_app_enabled ? availability.b2b_users.map { |user| { "value" => { "add" => user.add, "delete" => user.delete, "dsUsername" => user.ds_username } } } : []
# send the changes back to Apple
r = request(:post) do |req|
req.url("ra/apps/#{app_id}/pricing/intervals")
req.body = data.to_json
req.headers['Content-Type'] = 'application/json'
end
handle_itc_response(r.body)
data = parse_response(r, 'data')
Spaceship::Tunes::Availability.factory(data)
end | [
"def",
"update_availability!",
"(",
"app_id",
",",
"availability",
")",
"r",
"=",
"request",
"(",
":get",
",",
"\"ra/apps/#{app_id}/pricing/intervals\"",
")",
"data",
"=",
"parse_response",
"(",
"r",
",",
"'data'",
")",
"data",
"[",
"\"countriesChanged\"",
"]",
... | @!group Availability
Updates the availability
@note Although this information is publicly available, the current spaceship implementation requires you to have a logged in client to access it
@param app_id (String): The id of your app
@param availability (Availability): The availability update
@return [Spaceship::Tunes::Availability] the new Availability | [
"@!group",
"Availability"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/spaceship/lib/spaceship/tunes/tunes_client.rb#L700-L731 | train | Updates the availability of an app | [
30522,
13366,
10651,
1035,
11343,
999,
1006,
10439,
1035,
8909,
1010,
11343,
1007,
1054,
1027,
5227,
1006,
1024,
2131,
1010,
1000,
10958,
1013,
18726,
1013,
1001,
1063,
10439,
1035,
8909,
1065,
1013,
20874,
1013,
14025,
1000,
1007,
2951,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
piotrmurach/github | lib/github_api/client/activity/events.rb | Github.Client::Activity::Events.received | def received(*args)
arguments(args, required: [:user])
params = arguments.params
public_events = if params['public']
params.delete('public')
'/public'
end
response = get_request("/users/#{arguments.user}/received_events#{public_events}", params)
return response unless block_given?
response.each { |el| yield el }
end | ruby | def received(*args)
arguments(args, required: [:user])
params = arguments.params
public_events = if params['public']
params.delete('public')
'/public'
end
response = get_request("/users/#{arguments.user}/received_events#{public_events}", params)
return response unless block_given?
response.each { |el| yield el }
end | [
"def",
"received",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
"]",
")",
"params",
"=",
"arguments",
".",
"params",
"public_events",
"=",
"if",
"params",
"[",
"'public'",
"]",
"params",
".",
"delete",
"(",
"'pub... | List all events that a user has received
@see https://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received
These are events that you’ve received by watching repos
and following users. If you are authenticated as the given user,
you will see private events. Otherwise, you’ll only see public events.
@example
github = Github.new
github.activity.events.received 'user-name'
github.activity.events.received 'user-name' { |event| ... }
List all public events that a user has received
@see https://developer.github.com/v3/activity/events/#list-public-events-that-a-user-has-received
@example
github = Github.new
github.activity.events.received 'user-name', public: true
github.activity.events.received 'user-name', public: true { |event| ... }
@api public | [
"List",
"all",
"events",
"that",
"a",
"user",
"has",
"received"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/activity/events.rb#L150-L162 | train | Get received events | [
30522,
13366,
2363,
1006,
1008,
12098,
5620,
1007,
9918,
1006,
12098,
5620,
1010,
3223,
1024,
1031,
1024,
5310,
1033,
1007,
11498,
5244,
1027,
9918,
1012,
11498,
5244,
2270,
1035,
2824,
1027,
2065,
11498,
5244,
1031,
1005,
2270,
1005,
1033,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rollbar/rollbar-gem | lib/rollbar/notifier.rb | Rollbar.Notifier.log | def log(level, *args)
return 'disabled' unless enabled?
message, exception, extra, context = extract_arguments(args)
use_exception_level_filters = use_exception_level_filters?(extra)
return 'ignored' if ignored?(exception, use_exception_level_filters)
begin
status = call_before_process(:level => level,
:exception => exception,
:message => message,
:extra => extra)
return 'ignored' if status == 'ignored'
rescue Rollbar::Ignore
return 'ignored'
end
level = lookup_exception_level(level, exception,
use_exception_level_filters)
begin
report(level, message, exception, extra, context)
rescue StandardError, SystemStackError => e
report_internal_error(e)
'error'
end
end | ruby | def log(level, *args)
return 'disabled' unless enabled?
message, exception, extra, context = extract_arguments(args)
use_exception_level_filters = use_exception_level_filters?(extra)
return 'ignored' if ignored?(exception, use_exception_level_filters)
begin
status = call_before_process(:level => level,
:exception => exception,
:message => message,
:extra => extra)
return 'ignored' if status == 'ignored'
rescue Rollbar::Ignore
return 'ignored'
end
level = lookup_exception_level(level, exception,
use_exception_level_filters)
begin
report(level, message, exception, extra, context)
rescue StandardError, SystemStackError => e
report_internal_error(e)
'error'
end
end | [
"def",
"log",
"(",
"level",
",",
"*",
"args",
")",
"return",
"'disabled'",
"unless",
"enabled?",
"message",
",",
"exception",
",",
"extra",
",",
"context",
"=",
"extract_arguments",
"(",
"args",
")",
"use_exception_level_filters",
"=",
"use_exception_level_filters... | Sends a report to Rollbar.
Accepts any number of arguments. The last String argument will become
the message or description of the report. The last Exception argument
will become the associated exception for the report. The last hash
argument will be used as the extra data for the report.
If the extra hash contains a symbol key :custom_data_method_context
the value of the key will be used as the context for
configuration.custom_data_method and will be removed from the extra
hash.
@example
begin
foo = bar
rescue => e
Rollbar.log(e)
end
@example
Rollbar.log('This is a simple log message')
@example
Rollbar.log(e, 'This is a description of the exception') | [
"Sends",
"a",
"report",
"to",
"Rollbar",
"."
] | 83ef1acca2b0b1d1b74ff8ef29435ca82e8ca1d6 | https://github.com/rollbar/rollbar-gem/blob/83ef1acca2b0b1d1b74ff8ef29435ca82e8ca1d6/lib/rollbar/notifier.rb#L129-L157 | train | Log a message and exception | [
30522,
13366,
8833,
1006,
2504,
1010,
1008,
30524,
6453,
1035,
2504,
1035,
17736,
1029,
1006,
4469,
1007,
2709,
1005,
6439,
1005,
2065,
6439,
1029,
1006,
6453,
1010,
2224,
1035,
6453,
1035,
2504,
1035,
17736,
1007,
4088,
3570,
1027,
2655,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
castwide/solargraph | lib/solargraph/source.rb | Solargraph.Source.foldable_comment_block_ranges | def foldable_comment_block_ranges
return [] unless synchronized?
result = []
grouped = []
# @param cmnt [Parser::Source::Comment]
@comments.each do |cmnt|
if cmnt.document?
result.push Range.from_expr(cmnt.loc.expression)
elsif code.lines[cmnt.loc.expression.line].strip.start_with?('#')
if grouped.empty? || cmnt.loc.expression.line == grouped.last.loc.expression.line + 1
grouped.push cmnt
else
result.push Range.from_to(grouped.first.loc.expression.line, 0, grouped.last.loc.expression.line, 0) unless grouped.length < 3
grouped = [cmnt]
end
else
unless grouped.length < 3
result.push Range.from_to(grouped.first.loc.expression.line, 0, grouped.last.loc.expression.line, 0)
end
grouped.clear
end
end
result.push Range.from_to(grouped.first.loc.expression.line, 0, grouped.last.loc.expression.line, 0) unless grouped.length < 3
result
end | ruby | def foldable_comment_block_ranges
return [] unless synchronized?
result = []
grouped = []
# @param cmnt [Parser::Source::Comment]
@comments.each do |cmnt|
if cmnt.document?
result.push Range.from_expr(cmnt.loc.expression)
elsif code.lines[cmnt.loc.expression.line].strip.start_with?('#')
if grouped.empty? || cmnt.loc.expression.line == grouped.last.loc.expression.line + 1
grouped.push cmnt
else
result.push Range.from_to(grouped.first.loc.expression.line, 0, grouped.last.loc.expression.line, 0) unless grouped.length < 3
grouped = [cmnt]
end
else
unless grouped.length < 3
result.push Range.from_to(grouped.first.loc.expression.line, 0, grouped.last.loc.expression.line, 0)
end
grouped.clear
end
end
result.push Range.from_to(grouped.first.loc.expression.line, 0, grouped.last.loc.expression.line, 0) unless grouped.length < 3
result
end | [
"def",
"foldable_comment_block_ranges",
"return",
"[",
"]",
"unless",
"synchronized?",
"result",
"=",
"[",
"]",
"grouped",
"=",
"[",
"]",
"# @param cmnt [Parser::Source::Comment]",
"@comments",
".",
"each",
"do",
"|",
"cmnt",
"|",
"if",
"cmnt",
".",
"document?",
... | Get an array of foldable comment block ranges. Blocks are excluded if
they are less than 3 lines long.
@return [Array<Range>] | [
"Get",
"an",
"array",
"of",
"foldable",
"comment",
"block",
"ranges",
".",
"Blocks",
"are",
"excluded",
"if",
"they",
"are",
"less",
"than",
"3",
"lines",
"long",
"."
] | 47badb5d151aca775ccbe6c470236089eae7839d | https://github.com/castwide/solargraph/blob/47badb5d151aca775ccbe6c470236089eae7839d/lib/solargraph/source.rb#L370-L394 | train | Get the foldable comment block ranges | [
30522,
13366,
10671,
3085,
1035,
7615,
1035,
3796,
1035,
8483,
2709,
1031,
1033,
4983,
25549,
1029,
2765,
1027,
1031,
1033,
15131,
1027,
1031,
1033,
1001,
1030,
11498,
2213,
4642,
3372,
1031,
11968,
8043,
1024,
1024,
3120,
1024,
1024,
7615,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/dsc_compilation_job_operations.rb | Azure::Automation::Mgmt::V2015_10_31.DscCompilationJobOperations.create | def create(resource_group_name, automation_account_name, compilation_job_id, parameters, custom_headers:nil)
response = create_async(resource_group_name, automation_account_name, compilation_job_id, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create(resource_group_name, automation_account_name, compilation_job_id, parameters, custom_headers:nil)
response = create_async(resource_group_name, automation_account_name, compilation_job_id, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"compilation_job_id",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_async",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"compilat... | Creates the Dsc compilation job of the configuration.
@param resource_group_name [String] Name of an Azure Resource group.
@param automation_account_name [String] The name of the automation account.
@param compilation_job_id The the DSC configuration Id.
@param parameters [DscCompilationJobCreateParameters] The parameters supplied
to the create compilation job operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [DscCompilationJob] operation results. | [
"Creates",
"the",
"Dsc",
"compilation",
"job",
"of",
"the",
"configuration",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/dsc_compilation_job_operations.rb#L37-L40 | train | Creates a new Dsc compilation job. | [
30522,
13366,
3443,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
19309,
1035,
4070,
1035,
2171,
1010,
6268,
1035,
3105,
1035,
8909,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3443,
1035,
2004,
6038,
2278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
castwide/solargraph | lib/solargraph/api_map.rb | Solargraph.ApiMap.get_namespace_type | def get_namespace_type fqns
return nil if fqns.nil?
pin = store.get_path_pins(fqns).first
return nil if pin.nil?
pin.type
end | ruby | def get_namespace_type fqns
return nil if fqns.nil?
pin = store.get_path_pins(fqns).first
return nil if pin.nil?
pin.type
end | [
"def",
"get_namespace_type",
"fqns",
"return",
"nil",
"if",
"fqns",
".",
"nil?",
"pin",
"=",
"store",
".",
"get_path_pins",
"(",
"fqns",
")",
".",
"first",
"return",
"nil",
"if",
"pin",
".",
"nil?",
"pin",
".",
"type",
"end"
] | Get the namespace's type (Class or Module).
@param fqns [String] A fully qualified namespace
@return [Symbol] :class, :module, or nil | [
"Get",
"the",
"namespace",
"s",
"type",
"(",
"Class",
"or",
"Module",
")",
"."
] | 47badb5d151aca775ccbe6c470236089eae7839d | https://github.com/castwide/solargraph/blob/47badb5d151aca775ccbe6c470236089eae7839d/lib/solargraph/api_map.rb#L609-L614 | train | Get the type of the namespace | [
30522,
13366,
2131,
1035,
3415,
15327,
1035,
2828,
1042,
4160,
3619,
2709,
9152,
2140,
2065,
1042,
4160,
3619,
1012,
9152,
2140,
1029,
9231,
1027,
3573,
1012,
2131,
1035,
4130,
1035,
16300,
1006,
1042,
4160,
3619,
1007,
1012,
2034,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2017-10-01-preview/generated/azure_mgmt_sql/database_vulnerability_assessment_scans.rb | Azure::SQL::Mgmt::V2017_10_01_preview.DatabaseVulnerabilityAssessmentScans.export_with_http_info | def export_with_http_info(resource_group_name, server_name, database_name, scan_id, custom_headers:nil)
export_async(resource_group_name, server_name, database_name, scan_id, custom_headers:custom_headers).value!
end | ruby | def export_with_http_info(resource_group_name, server_name, database_name, scan_id, custom_headers:nil)
export_async(resource_group_name, server_name, database_name, scan_id, custom_headers:custom_headers).value!
end | [
"def",
"export_with_http_info",
"(",
"resource_group_name",
",",
"server_name",
",",
"database_name",
",",
"scan_id",
",",
"custom_headers",
":",
"nil",
")",
"export_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"database_name",
",",
"scan_id",
",",
"... | Convert an existing scan result to a human readable format. If already exists
nothing happens
@param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param server_name [String] The name of the server.
@param database_name [String] The name of the scanned database.
@param scan_id [String] The vulnerability assessment scan Id.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Convert",
"an",
"existing",
"scan",
"result",
"to",
"a",
"human",
"readable",
"format",
".",
"If",
"already",
"exists",
"nothing",
"happens"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2017-10-01-preview/generated/azure_mgmt_sql/database_vulnerability_assessment_scans.rb#L323-L325 | train | Export a database scan. | [
30522,
13366,
9167,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
7809,
1035,
2171,
1010,
13594,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
9167,
1035,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.get_services_event_list_with_http_info | def get_services_event_list_with_http_info(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
get_services_event_list_async(start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
end | ruby | def get_services_event_list_with_http_info(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
get_services_event_list_async(start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
end | [
"def",
"get_services_event_list_with_http_info",
"(",
"start_time_utc",
",",
"end_time_utc",
",",
"timeout",
":",
"60",
",",
"events_types_filter",
":",
"nil",
",",
"exclude_analysis_events",
":",
"nil",
",",
"skip_correlation_lookup",
":",
"nil",
",",
"custom_headers",... | Gets all Services-related events.
The response is list of ServiceEvent objects.
@param start_time_utc [String] The start time of a lookup query in ISO UTC
yyyy-MM-ddTHH:mm:ssZ.
@param end_time_utc [String] The end time of a lookup query in ISO UTC
yyyy-MM-ddTHH:mm:ssZ.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param events_types_filter [String] This is a comma separated string
specifying the types of FabricEvents that should only be included in the
response.
@param exclude_analysis_events [Boolean] This param disables the retrieval of
AnalysisEvents if true is passed.
@param skip_correlation_lookup [Boolean] This param disables the search of
CorrelatedEvents information if true is passed. otherwise the
CorrelationEvents get processed and HasCorrelatedEvents field in every
FabricEvent gets populated.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"all",
"Services",
"-",
"related",
"events",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L28404-L28406 | train | Gets the services event list. | [
30522,
13366,
2131,
1035,
2578,
1035,
2724,
1035,
2862,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2707,
1035,
2051,
1035,
11396,
1010,
2203,
1035,
2051,
1035,
11396,
1010,
2051,
5833,
1024,
3438,
1010,
2824,
1035,
4127,
1035,
11307,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hashicorp/vault-ruby | lib/vault/api/auth_token.rb | Vault.AuthToken.lookup_accessor | def lookup_accessor(accessor, options = {})
headers = extract_headers!(options)
json = client.post("/v1/auth/token/lookup-accessor", JSON.fast_generate(
accessor: accessor,
), headers)
return Secret.decode(json)
end | ruby | def lookup_accessor(accessor, options = {})
headers = extract_headers!(options)
json = client.post("/v1/auth/token/lookup-accessor", JSON.fast_generate(
accessor: accessor,
), headers)
return Secret.decode(json)
end | [
"def",
"lookup_accessor",
"(",
"accessor",
",",
"options",
"=",
"{",
"}",
")",
"headers",
"=",
"extract_headers!",
"(",
"options",
")",
"json",
"=",
"client",
".",
"post",
"(",
"\"/v1/auth/token/lookup-accessor\"",
",",
"JSON",
".",
"fast_generate",
"(",
"acce... | Lookup information about the given token accessor.
@example
Vault.auth_token.lookup_accessor("acbd-...") #=> #<Vault::Secret lease_id="">
@param [String] accessor
@param [Hash] options | [
"Lookup",
"information",
"about",
"the",
"given",
"token",
"accessor",
"."
] | 02f0532a802ba1a2a0d8703a4585dab76eb9d864 | https://github.com/hashicorp/vault-ruby/blob/02f0532a802ba1a2a0d8703a4585dab76eb9d864/lib/vault/api/auth_token.rb#L126-L132 | train | Lookup an accessor | [
30522,
13366,
2298,
6279,
1035,
3229,
2953,
1006,
3229,
2953,
1010,
7047,
1027,
1063,
1065,
1007,
20346,
2015,
1027,
14817,
1035,
20346,
2015,
999,
1006,
7047,
1007,
1046,
3385,
1027,
7396,
1012,
2695,
1006,
1000,
1013,
1058,
2487,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
deivid-rodriguez/byebug | lib/byebug/interface.rb | Byebug.Interface.split_commands | def split_commands(cmd_line)
return [""] if cmd_line.empty?
cmd_line.split(/;/).each_with_object([]) do |v, m|
if m.empty? || m.last[-1] != '\\'
m << v.strip
next
end
m.last[-1, 1] = ""
m.last << ";" << v
end
end | ruby | def split_commands(cmd_line)
return [""] if cmd_line.empty?
cmd_line.split(/;/).each_with_object([]) do |v, m|
if m.empty? || m.last[-1] != '\\'
m << v.strip
next
end
m.last[-1, 1] = ""
m.last << ";" << v
end
end | [
"def",
"split_commands",
"(",
"cmd_line",
")",
"return",
"[",
"\"\"",
"]",
"if",
"cmd_line",
".",
"empty?",
"cmd_line",
".",
"split",
"(",
"/",
"/",
")",
".",
"each_with_object",
"(",
"[",
"]",
")",
"do",
"|",
"v",
",",
"m",
"|",
"if",
"m",
".",
... | Splits a command line of the form "cmd1 ; cmd2 ; ... ; cmdN" into an
array of commands: [cmd1, cmd2, ..., cmdN] | [
"Splits",
"a",
"command",
"line",
"of",
"the",
"form",
"cmd1",
";",
"cmd2",
";",
"...",
";",
"cmdN",
"into",
"an",
"array",
"of",
"commands",
":",
"[",
"cmd1",
"cmd2",
"...",
"cmdN",
"]"
] | bf41a63858a648baa7fb621600d6451786d1572a | https://github.com/deivid-rodriguez/byebug/blob/bf41a63858a648baa7fb621600d6451786d1572a/lib/byebug/interface.rb#L128-L140 | train | Split the command line into a list of words | [
30522,
13366,
3975,
1035,
10954,
1006,
4642,
2094,
1035,
2240,
1007,
2709,
1031,
1000,
1000,
1033,
2065,
4642,
2094,
1035,
2240,
1012,
4064,
1029,
4642,
2094,
1035,
2240,
1012,
30524,
2079,
1064,
1058,
1010,
1049,
1064,
2065,
1049,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_machine_learning/lib/2017-01-01/generated/azure_mgmt_machine_learning/web_services.rb | Azure::MachineLearning::Mgmt::V2017_01_01.WebServices.create_regional_properties_async | def create_regional_properties_async(resource_group_name, web_service_name, region, custom_headers:nil)
# Send request
promise = begin_create_regional_properties_async(resource_group_name, web_service_name, region, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::MachineLearning::Mgmt::V2017_01_01::Models::AsyncOperationStatus.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | ruby | def create_regional_properties_async(resource_group_name, web_service_name, region, custom_headers:nil)
# Send request
promise = begin_create_regional_properties_async(resource_group_name, web_service_name, region, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::MachineLearning::Mgmt::V2017_01_01::Models::AsyncOperationStatus.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | [
"def",
"create_regional_properties_async",
"(",
"resource_group_name",
",",
"web_service_name",
",",
"region",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_create_regional_properties_async",
"(",
"resource_group_name",
",",
"web_service_nam... | @param resource_group_name [String] Name of the resource group in which the
web service is located.
@param web_service_name [String] The name of the web service.
@param region [String] The region for which encrypted credential parameters
are created.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"resource_group_name",
"[",
"String",
"]",
"Name",
"of",
"the",
"resource",
"group",
"in",
"which",
"the",
"web",
"service",
"is",
"located",
".",
"@param",
"web_service_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"web",
"service",
".",
... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_machine_learning/lib/2017-01-01/generated/azure_mgmt_machine_learning/web_services.rb#L315-L331 | train | Creates a regional properties for the specified web service. | [
30522,
13366,
3443,
1035,
3164,
1035,
5144,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4773,
1035,
2326,
1035,
2171,
1010,
2555,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_stream_analytics/lib/2016-03-01/generated/azure_mgmt_stream_analytics/outputs.rb | Azure::StreamAnalytics::Mgmt::V2016_03_01.Outputs.list_by_streaming_job | def list_by_streaming_job(resource_group_name, job_name, select:nil, custom_headers:nil)
first_page = list_by_streaming_job_as_lazy(resource_group_name, job_name, select:select, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_by_streaming_job(resource_group_name, job_name, select:nil, custom_headers:nil)
first_page = list_by_streaming_job_as_lazy(resource_group_name, job_name, select:select, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_by_streaming_job",
"(",
"resource_group_name",
",",
"job_name",
",",
"select",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_by_streaming_job_as_lazy",
"(",
"resource_group_name",
",",
"job_name",
",",
"select",
":",
"sele... | Lists all of the outputs under the specified streaming job.
@param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param job_name [String] The name of the streaming job.
@param select [String] The $select OData query parameter. This is a
comma-separated list of structural properties to include in the response, or
"*" to include all properties. By default, all properties are returned except
diagnostics. Currently only accepts '*' as a valid value.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<Output>] operation results. | [
"Lists",
"all",
"of",
"the",
"outputs",
"under",
"the",
"specified",
"streaming",
"job",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_stream_analytics/lib/2016-03-01/generated/azure_mgmt_stream_analytics/outputs.rb#L523-L526 | train | Gets all the image documents in a streaming job. | [
30522,
13366,
2862,
1035,
2011,
1035,
11058,
1035,
3105,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3105,
1035,
2171,
1010,
7276,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2862,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb | Azure::KeyVault::V2016_10_01.KeyVaultClient.get_secret_versions_with_http_info | def get_secret_versions_with_http_info(vault_base_url, secret_name, maxresults:nil, custom_headers:nil)
get_secret_versions_async(vault_base_url, secret_name, maxresults:maxresults, custom_headers:custom_headers).value!
end | ruby | def get_secret_versions_with_http_info(vault_base_url, secret_name, maxresults:nil, custom_headers:nil)
get_secret_versions_async(vault_base_url, secret_name, maxresults:maxresults, custom_headers:custom_headers).value!
end | [
"def",
"get_secret_versions_with_http_info",
"(",
"vault_base_url",
",",
"secret_name",
",",
"maxresults",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"get_secret_versions_async",
"(",
"vault_base_url",
",",
"secret_name",
",",
"maxresults",
":",
"maxresults",
... | List all versions of the specified secret.
The full secret identifier and attributes are provided in the response. No
values are returned for the secrets. This operations requires the
secrets/list permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param secret_name [String] The name of the secret.
@param maxresults [Integer] Maximum number of results to return in a page. If
not specified, the service will return up to 25 results.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"List",
"all",
"versions",
"of",
"the",
"specified",
"secret",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb#L3292-L3294 | train | Gets the versions of the specified secret. | [
30522,
13366,
2131,
1035,
3595,
1035,
4617,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
3595,
1035,
2171,
1010,
4098,
6072,
11314,
2015,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | supply/lib/supply/uploader.rb | Supply.Uploader.upload_obbs | def upload_obbs(apk_path, apk_version_code)
expansion_paths = find_obbs(apk_path)
['main', 'patch'].each do |type|
if expansion_paths[type]
upload_obb(expansion_paths[type], type, apk_version_code)
end
end
end | ruby | def upload_obbs(apk_path, apk_version_code)
expansion_paths = find_obbs(apk_path)
['main', 'patch'].each do |type|
if expansion_paths[type]
upload_obb(expansion_paths[type], type, apk_version_code)
end
end
end | [
"def",
"upload_obbs",
"(",
"apk_path",
",",
"apk_version_code",
")",
"expansion_paths",
"=",
"find_obbs",
"(",
"apk_path",
")",
"[",
"'main'",
",",
"'patch'",
"]",
".",
"each",
"do",
"|",
"type",
"|",
"if",
"expansion_paths",
"[",
"type",
"]",
"upload_obb",
... | searches for obbs in the directory where the apk is located and
upload at most one main and one patch file. Do nothing if it finds
more than one of either of them. | [
"searches",
"for",
"obbs",
"in",
"the",
"directory",
"where",
"the",
"apk",
"is",
"located",
"and",
"upload",
"at",
"most",
"one",
"main",
"and",
"one",
"patch",
"file",
".",
"Do",
"nothing",
"if",
"it",
"finds",
"more",
"than",
"one",
"of",
"either",
... | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/supply/lib/supply/uploader.rb#L294-L301 | train | Upload the obbs to the given apk_path | [
30522,
13366,
2039,
11066,
1035,
27885,
5910,
1006,
9706,
2243,
1035,
4130,
1010,
9706,
2243,
1035,
2544,
1035,
3642,
1007,
4935,
1035,
10425,
1027,
2424,
1035,
27885,
5910,
1006,
9706,
2243,
1035,
4130,
1007,
1031,
1005,
2364,
1005,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_container_instance/lib/2018-06-01/generated/azure_mgmt_container_instance/container_groups.rb | Azure::ContainerInstance::Mgmt::V2018_06_01.ContainerGroups.begin_restart | def begin_restart(resource_group_name, container_group_name, custom_headers:nil)
response = begin_restart_async(resource_group_name, container_group_name, custom_headers:custom_headers).value!
nil
end | ruby | def begin_restart(resource_group_name, container_group_name, custom_headers:nil)
response = begin_restart_async(resource_group_name, container_group_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_restart",
"(",
"resource_group_name",
",",
"container_group_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_restart_async",
"(",
"resource_group_name",
",",
"container_group_name",
",",
"custom_headers",
":custom_headers",
")",
".",
... | Restarts all containers in a container group.
Restarts all containers in a contaienr group in place. If container image has
updates, new image will be downloaded.
@param resource_group_name [String] The name of the resource group.
@param container_group_name [String] The name of the container group.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Restarts",
"all",
"containers",
"in",
"a",
"container",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_instance/lib/2018-06-01/generated/azure_mgmt_container_instance/container_groups.rb#L865-L868 | train | Restarts the specified container group. | [
30522,
13366,
4088,
1035,
23818,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
11661,
1035,
2177,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
23818,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cloudfoundry/bosh | src/bosh-director/lib/bosh/director/agent_client.rb | Bosh::Director.AgentClient.format_exception | def format_exception(exception)
return exception.to_s unless exception.is_a?(Hash)
msg = exception['message'].to_s
if exception['backtrace']
msg += "\n"
msg += Array(exception['backtrace']).join("\n")
end
if exception['blobstore_id']
blob = download_and_delete_blob(exception['blobstore_id'])
msg += "\n"
msg += blob.to_s
end
msg
end | ruby | def format_exception(exception)
return exception.to_s unless exception.is_a?(Hash)
msg = exception['message'].to_s
if exception['backtrace']
msg += "\n"
msg += Array(exception['backtrace']).join("\n")
end
if exception['blobstore_id']
blob = download_and_delete_blob(exception['blobstore_id'])
msg += "\n"
msg += blob.to_s
end
msg
end | [
"def",
"format_exception",
"(",
"exception",
")",
"return",
"exception",
".",
"to_s",
"unless",
"exception",
".",
"is_a?",
"(",
"Hash",
")",
"msg",
"=",
"exception",
"[",
"'message'",
"]",
".",
"to_s",
"if",
"exception",
"[",
"'backtrace'",
"]",
"msg",
"+=... | Returns formatted exception information
@param [Hash|#to_s] exception Serialized exception
@return [String] | [
"Returns",
"formatted",
"exception",
"information"
] | 2eaa7100879ddd20cd909cd698514746195e28b7 | https://github.com/cloudfoundry/bosh/blob/2eaa7100879ddd20cd909cd698514746195e28b7/src/bosh-director/lib/bosh/director/agent_client.rb#L287-L304 | train | Format an exception | [
30522,
13366,
4289,
1035,
6453,
1006,
6453,
1007,
2709,
6453,
1012,
2000,
1035,
1055,
4983,
6453,
1012,
2003,
1035,
1037,
1029,
1006,
23325,
1007,
5796,
2290,
1027,
6453,
1031,
1005,
4471,
1005,
1033,
1012,
2000,
1035,
1055,
2065,
6453,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-rds/lib/aws-sdk-rds/db_security_group.rb | Aws::RDS.DBSecurityGroup.revoke_ingress | def revoke_ingress(options = {})
options = options.merge(db_security_group_name: @name)
resp = @client.revoke_db_security_group_ingress(options)
DBSecurityGroup.new(
name: resp.data.db_security_group.db_security_group_name,
data: resp.data.db_security_group,
client: @client
)
end | ruby | def revoke_ingress(options = {})
options = options.merge(db_security_group_name: @name)
resp = @client.revoke_db_security_group_ingress(options)
DBSecurityGroup.new(
name: resp.data.db_security_group.db_security_group_name,
data: resp.data.db_security_group,
client: @client
)
end | [
"def",
"revoke_ingress",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"db_security_group_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"revoke_db_security_group_ingress",
"(",
"options",
")",
"DBSecurityGroup",
".",
... | @example Request syntax with placeholder values
dbsecuritygroup = db_security_group.revoke_ingress({
cidrip: "String",
ec2_security_group_name: "String",
ec2_security_group_id: "String",
ec2_security_group_owner_id: "String",
})
@param [Hash] options ({})
@option options [String] :cidrip
The IP range to revoke access from. Must be a valid CIDR range. If
`CIDRIP` is specified, `EC2SecurityGroupName`, `EC2SecurityGroupId`
and `EC2SecurityGroupOwnerId` can't be provided.
@option options [String] :ec2_security_group_name
The name of the EC2 security group to revoke access from. For VPC DB
security groups, `EC2SecurityGroupId` must be provided. Otherwise,
EC2SecurityGroupOwnerId and either `EC2SecurityGroupName` or
`EC2SecurityGroupId` must be provided.
@option options [String] :ec2_security_group_id
The id of the EC2 security group to revoke access from. For VPC DB
security groups, `EC2SecurityGroupId` must be provided. Otherwise,
EC2SecurityGroupOwnerId and either `EC2SecurityGroupName` or
`EC2SecurityGroupId` must be provided.
@option options [String] :ec2_security_group_owner_id
The AWS Account Number of the owner of the EC2 security group
specified in the `EC2SecurityGroupName` parameter. The AWS Access Key
ID is not an acceptable value. For VPC DB security groups,
`EC2SecurityGroupId` must be provided. Otherwise,
EC2SecurityGroupOwnerId and either `EC2SecurityGroupName` or
`EC2SecurityGroupId` must be provided.
@return [DBSecurityGroup] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-rds/lib/aws-sdk-rds/db_security_group.rb#L314-L322 | train | Revoke an ingress for this security group | [
30522,
13366,
7065,
11045,
1035,
13749,
8303,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
16962,
1035,
3036,
1035,
2177,
1035,
2171,
1024,
1030,
2171,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
7065,
11045,
1035... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/versions.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Versions.update | def update(app_id, version_id, version_update_object, custom_headers:nil)
response = update_async(app_id, version_id, version_update_object, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def update(app_id, version_id, version_update_object, custom_headers:nil)
response = update_async(app_id, version_id, version_update_object, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"update",
"(",
"app_id",
",",
"version_id",
",",
"version_update_object",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"update_async",
"(",
"app_id",
",",
"version_id",
",",
"version_update_object",
",",
"custom_headers",
":custom_headers",
")",
... | Updates the name or description of the application version.
@param app_id The application ID.
@param version_id [String] The version ID.
@param version_update_object [TaskUpdateObject] A model containing Name and
Description of the application.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OperationStatus] operation results. | [
"Updates",
"the",
"name",
"or",
"description",
"of",
"the",
"application",
"version",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/versions.rb#L358-L361 | train | Updates the specified version of the application. | [
30522,
13366,
10651,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
2544,
1035,
10651,
1035,
4874,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
10651,
1035,
2004,
6038,
2278,
1006,
10439,
1035,
8909,
1010,
2544... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getsentry/raven-ruby | lib/raven/integrations/sidekiq.rb | Raven.SidekiqErrorHandler.filter_context | def filter_context(context)
case context
when Array
context.map { |arg| filter_context(arg) }
when Hash
Hash[context.map { |key, value| filter_context_hash(key, value) }]
else
format_globalid(context)
end
end | ruby | def filter_context(context)
case context
when Array
context.map { |arg| filter_context(arg) }
when Hash
Hash[context.map { |key, value| filter_context_hash(key, value) }]
else
format_globalid(context)
end
end | [
"def",
"filter_context",
"(",
"context",
")",
"case",
"context",
"when",
"Array",
"context",
".",
"map",
"{",
"|",
"arg",
"|",
"filter_context",
"(",
"arg",
")",
"}",
"when",
"Hash",
"Hash",
"[",
"context",
".",
"map",
"{",
"|",
"key",
",",
"value",
... | Once an ActiveJob is queued, ActiveRecord references get serialized into
some internal reserved keys, such as _aj_globalid.
The problem is, if this job in turn gets queued back into ActiveJob with
these magic reserved keys, ActiveJob will throw up and error. We want to
capture these and mutate the keys so we can sanely report it. | [
"Once",
"an",
"ActiveJob",
"is",
"queued",
"ActiveRecord",
"references",
"get",
"serialized",
"into",
"some",
"internal",
"reserved",
"keys",
"such",
"as",
"_aj_globalid",
"."
] | 729c22f9284939695f14822683bff1a0b72502bd | https://github.com/getsentry/raven-ruby/blob/729c22f9284939695f14822683bff1a0b72502bd/lib/raven/integrations/sidekiq.rb#L39-L48 | train | Returns the unique context for the given context. | [
30522,
13366,
11307,
1035,
6123,
1006,
6123,
1007,
2553,
6123,
2043,
9140,
6123,
1012,
4949,
1063,
1064,
12098,
2290,
1064,
11307,
1035,
6123,
1006,
12098,
2290,
1007,
1065,
2043,
23325,
23325,
1031,
6123,
1012,
4949,
1063,
1064,
3145,
1010... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_service_bus/lib/2017-04-01/generated/azure_mgmt_service_bus/disaster_recovery_configs.rb | Azure::ServiceBus::Mgmt::V2017_04_01.DisasterRecoveryConfigs.check_name_availability_method_with_http_info | def check_name_availability_method_with_http_info(resource_group_name, namespace_name, parameters, custom_headers:nil)
check_name_availability_method_async(resource_group_name, namespace_name, parameters, custom_headers:custom_headers).value!
end | ruby | def check_name_availability_method_with_http_info(resource_group_name, namespace_name, parameters, custom_headers:nil)
check_name_availability_method_async(resource_group_name, namespace_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"check_name_availability_method_with_http_info",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"check_name_availability_method_async",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"parameters",
... | Check the give namespace name availability.
@param resource_group_name [String] Name of the Resource group within the
Azure subscription.
@param namespace_name [String] The namespace name
@param parameters [CheckNameAvailability] Parameters to check availability of
the given namespace name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Check",
"the",
"give",
"namespace",
"name",
"availability",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_service_bus/lib/2017-04-01/generated/azure_mgmt_service_bus/disaster_recovery_configs.rb#L55-L57 | train | Check name availability of the specified namespace. | [
30522,
13366,
4638,
1035,
2171,
1035,
11343,
1035,
4118,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3415,
15327,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4638,
1035,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
troessner/reek | lib/reek/context_builder.rb | Reek.ContextBuilder.process_casgn | def process_casgn(exp, parent)
if exp.defines_module?
process_module(exp, parent)
else
process(exp)
end
end | ruby | def process_casgn(exp, parent)
if exp.defines_module?
process_module(exp, parent)
else
process(exp)
end
end | [
"def",
"process_casgn",
"(",
"exp",
",",
"parent",
")",
"if",
"exp",
".",
"defines_module?",
"process_module",
"(",
"exp",
",",
"parent",
")",
"else",
"process",
"(",
"exp",
")",
"end",
"end"
] | Handles `casgn` ("class assign") nodes.
An input example that would trigger this method would be:
Foo = Class.new Bar | [
"Handles",
"casgn",
"(",
"class",
"assign",
")",
"nodes",
"."
] | 8c6b5c0c6228a6981ab48543457889f9ea984054 | https://github.com/troessner/reek/blob/8c6b5c0c6228a6981ab48543457889f9ea984054/lib/reek/context_builder.rb#L107-L113 | train | Process the CASGN | [
30522,
13366,
2832,
1035,
25222,
16206,
1006,
4654,
2361,
1010,
6687,
1007,
2065,
4654,
2361,
1012,
11859,
1035,
11336,
1029,
2832,
1035,
11336,
1006,
4654,
2361,
1010,
6687,
1007,
2842,
2832,
1006,
4654,
2361,
1007,
2203,
2203,
102,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/environments.rb | Azure::Labservices::Mgmt::V2018_10_15.Environments.begin_stop | def begin_stop(resource_group_name, lab_account_name, lab_name, environment_setting_name, environment_name, custom_headers:nil)
response = begin_stop_async(resource_group_name, lab_account_name, lab_name, environment_setting_name, environment_name, custom_headers:custom_headers).value!
nil
end | ruby | def begin_stop(resource_group_name, lab_account_name, lab_name, environment_setting_name, environment_name, custom_headers:nil)
response = begin_stop_async(resource_group_name, lab_account_name, lab_name, environment_setting_name, environment_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_stop",
"(",
"resource_group_name",
",",
"lab_account_name",
",",
"lab_name",
",",
"environment_setting_name",
",",
"environment_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_stop_async",
"(",
"resource_group_name",
",",
"lab_accoun... | Stops an environment by stopping all resources inside the environment This
operation can take a while to complete
@param resource_group_name [String] The name of the resource group.
@param lab_account_name [String] The name of the lab Account.
@param lab_name [String] The name of the lab.
@param environment_setting_name [String] The name of the environment Setting.
@param environment_name [String] The name of the environment.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Stops",
"an",
"environment",
"by",
"stopping",
"all",
"resources",
"inside",
"the",
"environment",
"This",
"operation",
"can",
"take",
"a",
"while",
"to",
"complete"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/environments.rb#L1083-L1086 | train | Stops the environment. | [
30522,
13366,
4088,
1035,
2644,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
6845,
1035,
4070,
1035,
2171,
1010,
6845,
1035,
2171,
1010,
4044,
1035,
4292,
1035,
2171,
1010,
4044,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
floere/phony | lib/phony/country_codes.rb | Phony.CountryCodes.plausible? | def plausible? number, hints = {}
normalized = clean number
# False if it fails the basic check.
#
return false unless (4..16) === normalized.size
country, cc, rest = partial_split normalized
# Country code plausible?
#
cc_needed = hints[:cc]
return false if cc_needed && !(cc_needed === cc)
# Country specific tests.
#
country.plausible? rest, hints
rescue StandardError
return false
end | ruby | def plausible? number, hints = {}
normalized = clean number
# False if it fails the basic check.
#
return false unless (4..16) === normalized.size
country, cc, rest = partial_split normalized
# Country code plausible?
#
cc_needed = hints[:cc]
return false if cc_needed && !(cc_needed === cc)
# Country specific tests.
#
country.plausible? rest, hints
rescue StandardError
return false
end | [
"def",
"plausible?",
"number",
",",
"hints",
"=",
"{",
"}",
"normalized",
"=",
"clean",
"number",
"# False if it fails the basic check.",
"#",
"return",
"false",
"unless",
"(",
"4",
"..",
"16",
")",
"===",
"normalized",
".",
"size",
"country",
",",
"cc",
","... | Is this number plausible? | [
"Is",
"this",
"number",
"plausible?"
] | 9ca50743499cf478a25fdb927bcdacd29d2c90c7 | https://github.com/floere/phony/blob/9ca50743499cf478a25fdb927bcdacd29d2c90c7/lib/phony/country_codes.rb#L95-L114 | train | Returns true if the number is plausible. | [
30522,
13366,
24286,
1029,
2193,
1010,
20385,
1027,
1063,
1065,
3671,
3550,
1027,
4550,
2193,
1001,
6270,
2065,
2009,
11896,
1996,
3937,
4638,
1012,
1001,
2709,
6270,
4983,
1006,
1018,
1012,
1012,
2385,
1007,
1027,
1027,
1027,
3671,
3550,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
piotrmurach/github | lib/github_api/client/users.rb | Github.Client::Users.get | def get(*args)
params = arguments(args).params
if user_name = params.delete('user')
get_request("/users/#{user_name}", params)
else
get_request("/user", params)
end
end | ruby | def get(*args)
params = arguments(args).params
if user_name = params.delete('user')
get_request("/users/#{user_name}", params)
else
get_request("/user", params)
end
end | [
"def",
"get",
"(",
"*",
"args",
")",
"params",
"=",
"arguments",
"(",
"args",
")",
".",
"params",
"if",
"user_name",
"=",
"params",
".",
"delete",
"(",
"'user'",
")",
"get_request",
"(",
"\"/users/#{user_name}\"",
",",
"params",
")",
"else",
"get_request",... | Get a single unauthenticated user
@example
github = Github.new
github.users.get user: 'user-name'
Get the authenticated user
@example
github = Github.new oauth_token: '...'
github.users.get
@api public | [
"Get",
"a",
"single",
"unauthenticated",
"user"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/users.rb#L68-L76 | train | Get a user s information | [
30522,
13366,
2131,
1006,
1008,
12098,
5620,
1007,
11498,
5244,
1027,
9918,
1006,
12098,
5620,
1007,
1012,
11498,
5244,
2065,
5310,
1035,
2171,
1027,
11498,
5244,
1012,
3972,
12870,
1006,
1005,
5310,
1005,
1007,
2131,
1035,
5227,
1006,
1000... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
thoughtbot/clearance | lib/clearance/authorization.rb | Clearance.Authorization.deny_access | def deny_access(flash_message = nil)
respond_to do |format|
format.any(:js, :json, :xml) { head :unauthorized }
format.any { redirect_request(flash_message) }
end
end | ruby | def deny_access(flash_message = nil)
respond_to do |format|
format.any(:js, :json, :xml) { head :unauthorized }
format.any { redirect_request(flash_message) }
end
end | [
"def",
"deny_access",
"(",
"flash_message",
"=",
"nil",
")",
"respond_to",
"do",
"|",
"format",
"|",
"format",
".",
"any",
"(",
":js",
",",
":json",
",",
":xml",
")",
"{",
"head",
":unauthorized",
"}",
"format",
".",
"any",
"{",
"redirect_request",
"(",
... | Responds to unauthorized requests in a manner fitting the request format.
`js`, `json`, and `xml` requests will receive a 401 with no body. All
other formats will be redirected appropriately and can optionally have the
flash message set.
When redirecting, the originally requested url will be stored in the
session (`session[:return_to]`), allowing it to be used as a redirect url
once the user has successfully signed in.
If there is a signed in user, the request will be redirected according to
the value returned from {#url_after_denied_access_when_signed_in}.
If there is no signed in user, the request will be redirected according to
the value returned from {#url_after_denied_access_when_signed_out}.
For the exact redirect behavior, see {#redirect_request}.
@param [String] flash_message | [
"Responds",
"to",
"unauthorized",
"requests",
"in",
"a",
"manner",
"fitting",
"the",
"request",
"format",
".",
"js",
"json",
"and",
"xml",
"requests",
"will",
"receive",
"a",
"401",
"with",
"no",
"body",
".",
"All",
"other",
"formats",
"will",
"be",
"redir... | 1623cdeb648f33a55f0eb7be17e8f19a4291e1f2 | https://github.com/thoughtbot/clearance/blob/1623cdeb648f33a55f0eb7be17e8f19a4291e1f2/lib/clearance/authorization.rb#L43-L48 | train | Deny access to the current page | [
30522,
13366,
9772,
1035,
3229,
1006,
5956,
1035,
4471,
1027,
9152,
2140,
1007,
6869,
1035,
2000,
2079,
1064,
4289,
1064,
4289,
1012,
2151,
1006,
1024,
1046,
2015,
1010,
1024,
1046,
3385,
1010,
1024,
20950,
1007,
1063,
2132,
1024,
24641,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.get_cluster_health | def get_cluster_health(nodes_health_state_filter:0, applications_health_state_filter:0, events_health_state_filter:0, exclude_health_statistics:false, include_system_application_health_statistics:false, timeout:60, custom_headers:nil)
response = get_cluster_health_async(nodes_health_state_filter:nodes_health_state_filter, applications_health_state_filter:applications_health_state_filter, events_health_state_filter:events_health_state_filter, exclude_health_statistics:exclude_health_statistics, include_system_application_health_statistics:include_system_application_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_cluster_health(nodes_health_state_filter:0, applications_health_state_filter:0, events_health_state_filter:0, exclude_health_statistics:false, include_system_application_health_statistics:false, timeout:60, custom_headers:nil)
response = get_cluster_health_async(nodes_health_state_filter:nodes_health_state_filter, applications_health_state_filter:applications_health_state_filter, events_health_state_filter:events_health_state_filter, exclude_health_statistics:exclude_health_statistics, include_system_application_health_statistics:include_system_application_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_cluster_health",
"(",
"nodes_health_state_filter",
":",
"0",
",",
"applications_health_state_filter",
":",
"0",
",",
"events_health_state_filter",
":",
"0",
",",
"exclude_health_statistics",
":",
"false",
",",
"include_system_application_health_statistics",
":",
... | Gets the health of a Service Fabric cluster.
Gets the health of a Service Fabric cluster.
Use EventsHealthStateFilter to filter the collection of health events
reported on the cluster based on the health state.
Similarly, use NodesHealthStateFilter and ApplicationsHealthStateFilter to
filter the collection of nodes and applications returned based on their
aggregated health state.
@param nodes_health_state_filter [Integer] Allows filtering of the node
health state objects returned in the result of cluster health query
based on their health state. The possible values for this parameter include
integer value of one of the
following health states. Only nodes that match the filter are returned. All
nodes are used to evaluate the aggregated health state.
If not specified, all entries are returned.
The state values are flag based enumeration, so the value could be a
combination of these values obtained using bitwise 'OR' operator.
For example, if the provided value is 6 then health state of nodes with
HealthState value of OK (2) and Warning (4) are returned.
- Default - Default value. Matches any HealthState. The value is zero.
- None - Filter that doesn't match any HealthState value. Used in order to
return no results on a given collection of states. The value is 1.
- Ok - Filter that matches input with HealthState value Ok. The value is 2.
- Warning - Filter that matches input with HealthState value Warning. The
value is 4.
- Error - Filter that matches input with HealthState value Error. The value
is 8.
- All - Filter that matches input with any HealthState value. The value is
65535.
@param applications_health_state_filter [Integer] Allows filtering of the
application health state objects returned in the result of cluster health
query based on their health state.
The possible values for this parameter include integer value obtained from
members or bitwise operations
on members of HealthStateFilter enumeration. Only applications that match the
filter are returned.
All applications are used to evaluate the aggregated health state. If not
specified, all entries are returned.
The state values are flag based enumeration, so the value could be a
combination of these values obtained using bitwise 'OR' operator.
For example, if the provided value is 6 then health state of applications
with HealthState value of OK (2) and Warning (4) are returned.
- Default - Default value. Matches any HealthState. The value is zero.
- None - Filter that doesn't match any HealthState value. Used in order to
return no results on a given collection of states. The value is 1.
- Ok - Filter that matches input with HealthState value Ok. The value is 2.
- Warning - Filter that matches input with HealthState value Warning. The
value is 4.
- Error - Filter that matches input with HealthState value Error. The value
is 8.
- All - Filter that matches input with any HealthState value. The value is
65535.
@param events_health_state_filter [Integer] Allows filtering the collection
of HealthEvent objects returned based on health state.
The possible values for this parameter include integer value of one of the
following health states.
Only events that match the filter are returned. All events are used to
evaluate the aggregated health state.
If not specified, all entries are returned. The state values are flag based
enumeration, so the value could be a combination of these value obtained
using bitwise 'OR' operator. For example, If the provided value is 6 then all
of the events with HealthState value of OK (2) and Warning (4) are returned.
- Default - Default value. Matches any HealthState. The value is zero.
- None - Filter that doesn't match any HealthState value. Used in order to
return no results on a given collection of states. The value is 1.
- Ok - Filter that matches input with HealthState value Ok. The value is 2.
- Warning - Filter that matches input with HealthState value Warning. The
value is 4.
- Error - Filter that matches input with HealthState value Error. The value
is 8.
- All - Filter that matches input with any HealthState value. The value is
65535.
@param exclude_health_statistics [Boolean] Indicates whether the health
statistics should be returned as part of the query result. False by default.
The statistics show the number of children entities in health state Ok,
Warning, and Error.
@param include_system_application_health_statistics [Boolean] Indicates
whether the health statistics should include the fabric:/System application
health statistics. False by default.
If IncludeSystemApplicationHealthStatistics is set to true, the health
statistics include the entities that belong to the fabric:/System
application.
Otherwise, the query result includes health statistics only for user
applications.
The health statistics must be included in the query result for this parameter
to be applied.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ClusterHealth] operation results. | [
"Gets",
"the",
"health",
"of",
"a",
"Service",
"Fabric",
"cluster",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L347-L350 | train | Gets cluster health of the specified App Service Environment. | [
30522,
13366,
2131,
1035,
9324,
1035,
2740,
1006,
14164,
1035,
2740,
1035,
2110,
1035,
11307,
1024,
1014,
1010,
5097,
1035,
2740,
1035,
2110,
1035,
11307,
1024,
1014,
1010,
2824,
1035,
2740,
1035,
2110,
1035,
11307,
1024,
1014,
1010,
23329,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/models/shift_sort.rb | SquareConnect.ShiftSort.field= | def field=(field)
validator = EnumAttributeValidator.new('String', ["START_AT", "END_AT", "CREATED_AT", "UPDATED_AT"])
unless validator.valid?(field)
fail ArgumentError, "invalid value for 'field', must be one of #{validator.allowable_values}."
end
@field = field
end | ruby | def field=(field)
validator = EnumAttributeValidator.new('String', ["START_AT", "END_AT", "CREATED_AT", "UPDATED_AT"])
unless validator.valid?(field)
fail ArgumentError, "invalid value for 'field', must be one of #{validator.allowable_values}."
end
@field = field
end | [
"def",
"field",
"=",
"(",
"field",
")",
"validator",
"=",
"EnumAttributeValidator",
".",
"new",
"(",
"'String'",
",",
"[",
"\"START_AT\"",
",",
"\"END_AT\"",
",",
"\"CREATED_AT\"",
",",
"\"UPDATED_AT\"",
"]",
")",
"unless",
"validator",
".",
"valid?",
"(",
"... | Custom attribute writer method checking allowed values (enum).
@param [Object] field Object to be assigned | [
"Custom",
"attribute",
"writer",
"method",
"checking",
"allowed",
"values",
"(",
"enum",
")",
"."
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/models/shift_sort.rb#L96-L102 | train | Set the field of the record. | [
30522,
13366,
2492,
1027,
1006,
2492,
1007,
9398,
8844,
1027,
4372,
12248,
4779,
3089,
8569,
2618,
10175,
8524,
4263,
1012,
2047,
1006,
1005,
5164,
1005,
1010,
1031,
1000,
2707,
1035,
2012,
1000,
1010,
1000,
2203,
1035,
2012,
1000,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
magnusvk/counter_culture | lib/counter_culture/counter.rb | CounterCulture.Counter.foreign_key_value | def foreign_key_value(obj, relation, was = false)
relation = relation.is_a?(Enumerable) ? relation.dup : [relation]
first_relation = relation.first
if was
first = relation.shift
foreign_key_value = attribute_was(obj, relation_foreign_key(first))
klass = relation_klass(first, source: obj, was: was)
if foreign_key_value
value = klass.where(
"#{klass.table_name}.#{relation_primary_key(first, source: obj, was: was)} = ?",
foreign_key_value).first
end
else
value = obj
end
while !value.nil? && relation.size > 0
value = value.send(relation.shift)
end
return value.try(relation_primary_key(first_relation, source: obj, was: was).try(:to_sym))
end | ruby | def foreign_key_value(obj, relation, was = false)
relation = relation.is_a?(Enumerable) ? relation.dup : [relation]
first_relation = relation.first
if was
first = relation.shift
foreign_key_value = attribute_was(obj, relation_foreign_key(first))
klass = relation_klass(first, source: obj, was: was)
if foreign_key_value
value = klass.where(
"#{klass.table_name}.#{relation_primary_key(first, source: obj, was: was)} = ?",
foreign_key_value).first
end
else
value = obj
end
while !value.nil? && relation.size > 0
value = value.send(relation.shift)
end
return value.try(relation_primary_key(first_relation, source: obj, was: was).try(:to_sym))
end | [
"def",
"foreign_key_value",
"(",
"obj",
",",
"relation",
",",
"was",
"=",
"false",
")",
"relation",
"=",
"relation",
".",
"is_a?",
"(",
"Enumerable",
")",
"?",
"relation",
".",
"dup",
":",
"[",
"relation",
"]",
"first_relation",
"=",
"relation",
".",
"fi... | gets the value of the foreign key on the given relation
relation: a symbol or array of symbols; specifies the relation
that has the counter cache column
was: whether to get the current or past value from ActiveRecord;
pass true to get the past value, false or nothing to get the
current value | [
"gets",
"the",
"value",
"of",
"the",
"foreign",
"key",
"on",
"the",
"given",
"relation"
] | 6b5bd4d6e1ee4f10f262ace7cfed5776af9520ba | https://github.com/magnusvk/counter_culture/blob/6b5bd4d6e1ee4f10f262ace7cfed5776af9520ba/lib/counter_culture/counter.rb#L133-L152 | train | Returns the value of the foreign key of the given object. | [
30522,
13366,
3097,
1035,
3145,
1035,
3643,
1006,
27885,
3501,
1010,
7189,
1010,
2001,
1027,
6270,
1007,
7189,
1027,
7189,
1012,
2003,
1035,
1037,
1029,
1006,
4372,
17897,
16670,
1007,
1029,
7189,
1012,
4241,
2361,
1024,
1031,
7189,
1033,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activesupport/lib/active_support/dependencies.rb | ActiveSupport.Dependencies.to_constant_name | def to_constant_name(desc) #:nodoc:
case desc
when String then desc.sub(/^::/, "")
when Symbol then desc.to_s
when Module
desc.name ||
raise(ArgumentError, "Anonymous modules have no name to be referenced by")
else raise TypeError, "Not a valid constant descriptor: #{desc.inspect}"
end
end | ruby | def to_constant_name(desc) #:nodoc:
case desc
when String then desc.sub(/^::/, "")
when Symbol then desc.to_s
when Module
desc.name ||
raise(ArgumentError, "Anonymous modules have no name to be referenced by")
else raise TypeError, "Not a valid constant descriptor: #{desc.inspect}"
end
end | [
"def",
"to_constant_name",
"(",
"desc",
")",
"#:nodoc:",
"case",
"desc",
"when",
"String",
"then",
"desc",
".",
"sub",
"(",
"/",
"/",
",",
"\"\"",
")",
"when",
"Symbol",
"then",
"desc",
".",
"to_s",
"when",
"Module",
"desc",
".",
"name",
"||",
"raise",... | Convert the provided const desc to a qualified constant name (as a string).
A module, class, symbol, or string may be provided. | [
"Convert",
"the",
"provided",
"const",
"desc",
"to",
"a",
"qualified",
"constant",
"name",
"(",
"as",
"a",
"string",
")",
".",
"A",
"module",
"class",
"symbol",
"or",
"string",
"may",
"be",
"provided",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/dependencies.rb#L693-L702 | train | Returns the constant name for the given descriptor. | [
30522,
13366,
2000,
1035,
5377,
1035,
2171,
1006,
4078,
2278,
1007,
1001,
1024,
7293,
10085,
1024,
2553,
4078,
2278,
2043,
5164,
2059,
4078,
2278,
1012,
4942,
1006,
1013,
1034,
1024,
1024,
1013,
1010,
1000,
1000,
1007,
2043,
6454,
2059,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
lostisland/faraday | lib/faraday/options.rb | Faraday.Options.fetch | def fetch(key, *args)
unless symbolized_key_set.include?(key.to_sym)
key_setter = "#{key}="
if !args.empty?
send(key_setter, args.first)
elsif block_given?
send(key_setter, Proc.new.call(key))
else
raise self.class.fetch_error_class, "key not found: #{key.inspect}"
end
end
send(key)
end | ruby | def fetch(key, *args)
unless symbolized_key_set.include?(key.to_sym)
key_setter = "#{key}="
if !args.empty?
send(key_setter, args.first)
elsif block_given?
send(key_setter, Proc.new.call(key))
else
raise self.class.fetch_error_class, "key not found: #{key.inspect}"
end
end
send(key)
end | [
"def",
"fetch",
"(",
"key",
",",
"*",
"args",
")",
"unless",
"symbolized_key_set",
".",
"include?",
"(",
"key",
".",
"to_sym",
")",
"key_setter",
"=",
"\"#{key}=\"",
"if",
"!",
"args",
".",
"empty?",
"send",
"(",
"key_setter",
",",
"args",
".",
"first",
... | Public | [
"Public"
] | 3abe9d1eea4bdf61cdf7b76ff9f1ae7e09482e70 | https://github.com/lostisland/faraday/blob/3abe9d1eea4bdf61cdf7b76ff9f1ae7e09482e70/lib/faraday/options.rb#L76-L88 | train | Fetch the value of the key | [
30522,
13366,
18584,
1006,
3145,
1010,
1008,
12098,
5620,
1007,
4983,
6454,
3550,
1035,
3145,
1035,
2275,
1012,
2421,
1029,
1006,
3145,
1012,
2000,
1035,
25353,
2213,
1007,
3145,
1035,
2275,
3334,
1027,
1000,
1001,
1063,
3145,
1065,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_storagesync/lib/2018-07-01/generated/azure_mgmt_storagesync/cloud_endpoints.rb | Azure::StorageSync::Mgmt::V2018_07_01.CloudEndpoints.begin_post_backup | def begin_post_backup(resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers:nil)
response = begin_post_backup_async(resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_post_backup(resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers:nil)
response = begin_post_backup_async(resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_post_backup",
"(",
"resource_group_name",
",",
"storage_sync_service_name",
",",
"sync_group_name",
",",
"cloud_endpoint_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_post_backup_async",
"(",
"resource_group_name",
... | Post Backup a given CloudEndpoint.
@param resource_group_name [String] The name of the resource group. The name
is case insensitive.
@param storage_sync_service_name [String] Name of Storage Sync Service
resource.
@param sync_group_name [String] Name of Sync Group resource.
@param cloud_endpoint_name [String] Name of Cloud Endpoint object.
@param parameters [BackupRequest] Body of Backup request.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [PostBackupResponse] operation results. | [
"Post",
"Backup",
"a",
"given",
"CloudEndpoint",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_storagesync/lib/2018-07-01/generated/azure_mgmt_storagesync/cloud_endpoints.rb#L989-L992 | train | Creates a new backup of the specified cloud endpoint. | [
30522,
13366,
4088,
1035,
2695,
1035,
10200,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
5527,
1035,
26351,
1035,
2326,
1035,
2171,
1010,
26351,
1035,
2177,
1035,
2171,
1010,
6112,
1035,
2203,
8400,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/application_gateways.rb | Azure::Network::Mgmt::V2019_02_01.ApplicationGateways.begin_delete | def begin_delete(resource_group_name, application_gateway_name, custom_headers:nil)
response = begin_delete_async(resource_group_name, application_gateway_name, custom_headers:custom_headers).value!
nil
end | ruby | def begin_delete(resource_group_name, application_gateway_name, custom_headers:nil)
response = begin_delete_async(resource_group_name, application_gateway_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_delete",
"(",
"resource_group_name",
",",
"application_gateway_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_delete_async",
"(",
"resource_group_name",
",",
"application_gateway_name",
",",
"custom_headers",
":custom_headers",
")",
"... | Deletes the specified application gateway.
@param resource_group_name [String] The name of the resource group.
@param application_gateway_name [String] The name of the application gateway.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Deletes",
"the",
"specified",
"application",
"gateway",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/application_gateways.rb#L1238-L1241 | train | Deletes the specified application gateway. | [
30522,
13366,
4088,
1035,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4646,
1035,
11909,
30524,
1035,
3972,
12870,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4646,
1035,
11909,
1035,
2171,
1010,
7661,
1035,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
decidim/decidim | decidim-core/lib/decidim/form_builder.rb | Decidim.FormBuilder.areas_select | def areas_select(name, collection, options = {})
selectables = if collection.first.is_a?(Decidim::Area)
assemblies = collection
.map { |a| [a.name[I18n.locale.to_s], a.id] }
.sort_by { |arr| arr[0] }
@template.options_for_select(
assemblies,
selected: options[:selected]
)
else
@template.option_groups_from_collection_for_select(
collection,
:areas,
:translated_name,
:id,
:translated_name,
selected: options[:selected]
)
end
select(name, selectables, options)
end | ruby | def areas_select(name, collection, options = {})
selectables = if collection.first.is_a?(Decidim::Area)
assemblies = collection
.map { |a| [a.name[I18n.locale.to_s], a.id] }
.sort_by { |arr| arr[0] }
@template.options_for_select(
assemblies,
selected: options[:selected]
)
else
@template.option_groups_from_collection_for_select(
collection,
:areas,
:translated_name,
:id,
:translated_name,
selected: options[:selected]
)
end
select(name, selectables, options)
end | [
"def",
"areas_select",
"(",
"name",
",",
"collection",
",",
"options",
"=",
"{",
"}",
")",
"selectables",
"=",
"if",
"collection",
".",
"first",
".",
"is_a?",
"(",
"Decidim",
"::",
"Area",
")",
"assemblies",
"=",
"collection",
".",
"map",
"{",
"|",
"a"... | Public: Generates a select field for areas.
name - The name of the field (usually area_id)
collection - A collection of areas or area_types.
If it's areas, we sort the selectable options alphabetically.
Returns a String. | [
"Public",
":",
"Generates",
"a",
"select",
"field",
"for",
"areas",
"."
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/lib/decidim/form_builder.rb#L212-L234 | train | Select a collection of areas | [
30522,
13366,
2752,
1035,
7276,
1006,
2171,
1010,
3074,
1010,
7047,
1027,
1063,
1065,
1007,
7276,
3085,
2015,
1027,
2065,
3074,
1012,
2034,
1012,
2003,
1035,
1037,
1029,
1006,
11703,
28173,
2213,
1024,
1024,
2181,
1007,
17720,
1027,
3074,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/spring | lib/spring/json.rb | Spring.OkJson.decode | def decode(s)
ts = lex(s)
v, ts = textparse(ts)
if ts.length > 0
raise Error, 'trailing garbage'
end
v
end | ruby | def decode(s)
ts = lex(s)
v, ts = textparse(ts)
if ts.length > 0
raise Error, 'trailing garbage'
end
v
end | [
"def",
"decode",
"(",
"s",
")",
"ts",
"=",
"lex",
"(",
"s",
")",
"v",
",",
"ts",
"=",
"textparse",
"(",
"ts",
")",
"if",
"ts",
".",
"length",
">",
"0",
"raise",
"Error",
",",
"'trailing garbage'",
"end",
"v",
"end"
] | Decodes a json document in string s and
returns the corresponding ruby value.
String s must be valid UTF-8. If you have
a string in some other encoding, convert
it first.
String values in the resulting structure
will be UTF-8. | [
"Decodes",
"a",
"json",
"document",
"in",
"string",
"s",
"and",
"returns",
"the",
"corresponding",
"ruby",
"value",
".",
"String",
"s",
"must",
"be",
"valid",
"UTF",
"-",
"8",
".",
"If",
"you",
"have",
"a",
"string",
"in",
"some",
"other",
"encoding",
... | e7a36afa436fcc59b6945f68dbc08f1076e65585 | https://github.com/rails/spring/blob/e7a36afa436fcc59b6945f68dbc08f1076e65585/lib/spring/json.rb#L68-L75 | train | Decode a string into a sequence of words. | [
30522,
13366,
21933,
3207,
1006,
1055,
1007,
24529,
1027,
17244,
1006,
1055,
1007,
1058,
1010,
24529,
1027,
3793,
19362,
3366,
1006,
24529,
1007,
2065,
24529,
1012,
3091,
1028,
1014,
5333,
7561,
1010,
1005,
12542,
13044,
1005,
2203,
1058,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.update_backup_policy | def update_backup_policy(backup_policy_description, backup_policy_name, timeout:60, custom_headers:nil)
response = update_backup_policy_async(backup_policy_description, backup_policy_name, timeout:timeout, custom_headers:custom_headers).value!
nil
end | ruby | def update_backup_policy(backup_policy_description, backup_policy_name, timeout:60, custom_headers:nil)
response = update_backup_policy_async(backup_policy_description, backup_policy_name, timeout:timeout, custom_headers:custom_headers).value!
nil
end | [
"def",
"update_backup_policy",
"(",
"backup_policy_description",
",",
"backup_policy_name",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"update_backup_policy_async",
"(",
"backup_policy_description",
",",
"backup_policy_name",
",",
... | Updates the backup policy.
Updates the backup policy identified by {backupPolicyName}
@param backup_policy_description [BackupPolicyDescription] Describes the
backup policy.
@param backup_policy_name [String] The name of the backup policy.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Updates",
"the",
"backup",
"policy",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L22839-L22842 | train | Updates the backup policy. | [
30522,
13366,
10651,
1035,
10200,
1035,
3343,
1006,
10200,
1035,
3343,
1035,
6412,
1010,
10200,
1035,
3343,
1035,
2171,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
10651,
1035,
10200,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.