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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
appium/ruby_lib | lib/appium_lib/ios/common/helper.rb | Appium.Ios.ele_index | def ele_index(class_name, index)
raise 'Index must be >= 1' unless index == 'last()' || (index.is_a?(Integer) && index >= 1)
elements = tags(class_name)
if index == 'last()'
result = elements.last
else
# elements array is 0 indexed
index -= 1
result = elements[index]
end
raise _no_such_element if result.nil?
result
end | ruby | def ele_index(class_name, index)
raise 'Index must be >= 1' unless index == 'last()' || (index.is_a?(Integer) && index >= 1)
elements = tags(class_name)
if index == 'last()'
result = elements.last
else
# elements array is 0 indexed
index -= 1
result = elements[index]
end
raise _no_such_element if result.nil?
result
end | [
"def",
"ele_index",
"(",
"class_name",
",",
"index",
")",
"raise",
"'Index must be >= 1'",
"unless",
"index",
"==",
"'last()'",
"||",
"(",
"index",
".",
"is_a?",
"(",
"Integer",
")",
"&&",
"index",
">=",
"1",
")",
"elements",
"=",
"tags",
"(",
"class_name"... | Get the element of type class_name at matching index.
@param class_name [String] the class name to find
@param index [Integer] the index
@return [Element] | [
"Get",
"the",
"element",
"of",
"type",
"class_name",
"at",
"matching",
"index",
"."
] | 1f5898400dd1928bfe42ddd5f842d1f8738f2f76 | https://github.com/appium/ruby_lib/blob/1f5898400dd1928bfe42ddd5f842d1f8738f2f76/lib/appium_lib/ios/common/helper.rb#L108-L124 | train | Returns the element with the specified class_name at the given index. | [
30522,
13366,
3449,
2063,
1035,
5950,
1006,
2465,
1035,
2171,
1010,
5950,
1007,
5333,
1005,
5950,
2442,
2022,
1028,
1027,
1015,
1005,
4983,
5950,
1027,
1027,
1005,
2197,
1006,
1007,
1005,
1064,
1064,
1006,
5950,
1012,
2003,
1035,
1037,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_policy_insights/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_states.rb | Azure::PolicyInsights::Mgmt::V2018_04_04.PolicyStates.list_query_results_for_policy_definition | def list_query_results_for_policy_definition(policy_states_resource, subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
response = list_query_results_for_policy_definition_async(policy_states_resource, subscription_id, policy_definition_name, query_options:query_options, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_query_results_for_policy_definition(policy_states_resource, subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
response = list_query_results_for_policy_definition_async(policy_states_resource, subscription_id, policy_definition_name, query_options:query_options, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_query_results_for_policy_definition",
"(",
"policy_states_resource",
",",
"subscription_id",
",",
"policy_definition_name",
",",
"query_options",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_query_results_for_policy_definition_async",
... | Queries policy states for the subscription level policy definition.
@param policy_states_resource [PolicyStatesResource] The virtual resource
under PolicyStates resource type. In a given time range, 'latest' represents
the latest policy state(s), whereas 'default' represents all policy state(s).
Possible values include: 'default', 'latest'
@param subscription_id [String] Microsoft Azure subscription ID.
@param policy_definition_name [String] Policy definition name.
@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 [PolicyStatesQueryResults] operation results. | [
"Queries",
"policy",
"states",
"for",
"the",
"subscription",
"level",
"policy",
"definition",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_policy_insights/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_states.rb#L1251-L1254 | train | Gets the policy states for the subscription. | [
30522,
13366,
2862,
1035,
23032,
1035,
3463,
1035,
2005,
1035,
3343,
1035,
6210,
1006,
3343,
1035,
2163,
1035,
7692,
1010,
15002,
1035,
8909,
1010,
3343,
1035,
6210,
1035,
2171,
1010,
23032,
1035,
7047,
1024,
9152,
2140,
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_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machines.rb | Azure::Compute::Mgmt::V2016_04_30_preview.VirtualMachines.start | def start(resource_group_name, vm_name, custom_headers:nil)
response = start_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def start(resource_group_name, vm_name, custom_headers:nil)
response = start_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"start",
"(",
"resource_group_name",
",",
"vm_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"start_async",
"(",
"resource_group_name",
",",
"vm_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
... | The operation to start a virtual machine.
@param resource_group_name [String] The name of the resource group.
@param vm_name [String] The name of the virtual machine.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OperationStatusResponse] operation results. | [
"The",
"operation",
"to",
"start",
"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#L905-L908 | train | Starts a virtual machine in a resource group. | [
30522,
13366,
2707,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2707,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
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... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_customvisiontraining/lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb | Azure::CognitiveServices::Customvisiontraining::V3_0.CustomvisiontrainingClient.get_tagged_images_with_http_info | def get_tagged_images_with_http_info(project_id, iteration_id:nil, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil)
get_tagged_images_async(project_id, iteration_id:iteration_id, tag_ids:tag_ids, order_by:order_by, take:take, skip:skip, custom_headers:custom_headers).value!
end | ruby | def get_tagged_images_with_http_info(project_id, iteration_id:nil, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil)
get_tagged_images_async(project_id, iteration_id:iteration_id, tag_ids:tag_ids, order_by:order_by, take:take, skip:skip, custom_headers:custom_headers).value!
end | [
"def",
"get_tagged_images_with_http_info",
"(",
"project_id",
",",
"iteration_id",
":",
"nil",
",",
"tag_ids",
":",
"nil",
",",
"order_by",
":",
"nil",
",",
"take",
":",
"50",
",",
"skip",
":",
"0",
",",
"custom_headers",
":",
"nil",
")",
"get_tagged_images_... | Get tagged images for a given project iteration.
This API supports batching and range selection. By default it will only
return first 50 images matching images.
Use the {take} and {skip} parameters to control how many images to return in
a given batch.
The filtering is on an and/or relationship. For example, if the provided tag
ids are for the "Dog" and
"Cat" tags, then only images tagged with Dog and/or Cat will be returned
@param project_id The project id.
@param iteration_id The iteration id. Defaults to workspace.
@param tag_ids A list of tags ids to filter the images. Defaults to all
tagged images when null. Limited to 20.
@param order_by [Enum] The ordering. Defaults to newest. Possible values
include: 'Newest', 'Oldest'
@param take [Integer] Maximum number of images to return. Defaults to 50,
limited to 256.
@param skip [Integer] Number of images to skip before beginning the image
batch. Defaults to 0.
@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",
"tagged",
"images",
"for",
"a",
"given",
"project",
"iteration",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_customvisiontraining/lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb#L987-L989 | train | Gets the list of images tagged in a project. | [
30522,
13366,
2131,
1035,
26610,
1035,
4871,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2622,
1035,
8909,
1010,
27758,
1035,
8909,
1024,
9152,
2140,
1010,
6415,
1035,
8909,
2015,
1024,
9152,
2140,
1010,
2344,
1035,
2011,
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... |
twitter/secure_headers | lib/secure_headers/headers/content_security_policy.rb | SecureHeaders.ContentSecurityPolicy.build_value | def build_value
directives.map do |directive_name|
case DIRECTIVE_VALUE_TYPES[directive_name]
when :source_list, :require_sri_for_list # require_sri is a simple set of strings that don't need to deal with symbol casing
build_source_list_directive(directive_name)
when :boolean
symbol_to_hyphen_case(directive_name) if @config.directive_value(directive_name)
when :sandbox_list
build_sandbox_list_directive(directive_name)
when :media_type_list
build_media_type_list_directive(directive_name)
end
end.compact.join("; ")
end | ruby | def build_value
directives.map do |directive_name|
case DIRECTIVE_VALUE_TYPES[directive_name]
when :source_list, :require_sri_for_list # require_sri is a simple set of strings that don't need to deal with symbol casing
build_source_list_directive(directive_name)
when :boolean
symbol_to_hyphen_case(directive_name) if @config.directive_value(directive_name)
when :sandbox_list
build_sandbox_list_directive(directive_name)
when :media_type_list
build_media_type_list_directive(directive_name)
end
end.compact.join("; ")
end | [
"def",
"build_value",
"directives",
".",
"map",
"do",
"|",
"directive_name",
"|",
"case",
"DIRECTIVE_VALUE_TYPES",
"[",
"directive_name",
"]",
"when",
":source_list",
",",
":require_sri_for_list",
"# require_sri is a simple set of strings that don't need to deal with symbol casin... | Private: converts the config object into a string representing a policy.
Places default-src at the first directive and report-uri as the last. All
others are presented in alphabetical order.
Returns a content security policy header value. | [
"Private",
":",
"converts",
"the",
"config",
"object",
"into",
"a",
"string",
"representing",
"a",
"policy",
".",
"Places",
"default",
"-",
"src",
"at",
"the",
"first",
"directive",
"and",
"report",
"-",
"uri",
"as",
"the",
"last",
".",
"All",
"others",
... | 543e6712aadae08f1653ed973e6b6204f7eac26a | https://github.com/twitter/secure_headers/blob/543e6712aadae08f1653ed973e6b6204f7eac26a/lib/secure_headers/headers/content_security_policy.rb#L51-L64 | train | Build the value of the directive | [
30522,
13366,
3857,
1035,
3643,
16449,
2015,
1012,
4949,
2079,
1064,
16449,
1035,
2171,
1064,
2553,
16449,
1035,
3643,
1035,
4127,
1031,
16449,
1035,
2171,
1033,
2043,
1024,
3120,
1035,
2862,
1010,
1024,
5478,
1035,
5185,
1035,
2005,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-s3/lib/aws-sdk-s3/bucket_tagging.rb | Aws::S3.BucketTagging.delete | def delete(options = {})
options = options.merge(bucket: @bucket_name)
resp = @client.delete_bucket_tagging(options)
resp.data
end | ruby | def delete(options = {})
options = options.merge(bucket: @bucket_name)
resp = @client.delete_bucket_tagging(options)
resp.data
end | [
"def",
"delete",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"bucket",
":",
"@bucket_name",
")",
"resp",
"=",
"@client",
".",
"delete_bucket_tagging",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @!group Actions
@example Request syntax with placeholder values
bucket_tagging.delete()
@param [Hash] options ({})
@return [EmptyStructure] | [
"@!group",
"Actions",
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-s3/lib/aws-sdk-s3/bucket_tagging.rb#L176-L180 | train | Delete the tagging from the bucket | [
30522,
13366,
3972,
12870,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
13610,
1024,
1030,
13610,
1035,
2171,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
3972,
12870,
1035,
13610,
1035,
6415,
4726,
1006,
7047,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
sinatra/sinatra | lib/sinatra/base.rb | Sinatra.Request.accept | def accept
@env['sinatra.accept'] ||= begin
if @env.include? 'HTTP_ACCEPT' and @env['HTTP_ACCEPT'].to_s != ''
@env['HTTP_ACCEPT'].to_s.scan(HEADER_VALUE_WITH_PARAMS).
map! { |e| AcceptEntry.new(e) }.sort
else
[AcceptEntry.new('*/*')]
end
end
end | ruby | def accept
@env['sinatra.accept'] ||= begin
if @env.include? 'HTTP_ACCEPT' and @env['HTTP_ACCEPT'].to_s != ''
@env['HTTP_ACCEPT'].to_s.scan(HEADER_VALUE_WITH_PARAMS).
map! { |e| AcceptEntry.new(e) }.sort
else
[AcceptEntry.new('*/*')]
end
end
end | [
"def",
"accept",
"@env",
"[",
"'sinatra.accept'",
"]",
"||=",
"begin",
"if",
"@env",
".",
"include?",
"'HTTP_ACCEPT'",
"and",
"@env",
"[",
"'HTTP_ACCEPT'",
"]",
".",
"to_s",
"!=",
"''",
"@env",
"[",
"'HTTP_ACCEPT'",
"]",
".",
"to_s",
".",
"scan",
"(",
"H... | Returns an array of acceptable media types for the response | [
"Returns",
"an",
"array",
"of",
"acceptable",
"media",
"types",
"for",
"the",
"response"
] | 1aa64f9858edc3f93cc8d46e26f724c1ae103b1c | https://github.com/sinatra/sinatra/blob/1aa64f9858edc3f93cc8d46e26f724c1ae103b1c/lib/sinatra/base.rb#L30-L39 | train | Returns the HTTP_ACCEPT header. | [
30522,
13366,
5138,
1030,
4372,
2615,
1031,
1005,
19643,
1012,
5138,
1005,
1033,
1064,
1064,
1027,
4088,
2065,
1030,
4372,
2615,
1012,
2421,
1029,
1005,
8299,
1035,
5138,
1005,
1998,
1030,
4372,
2615,
1031,
1005,
8299,
1035,
5138,
1005,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/partners.rb | Azure::Logic::Mgmt::V2016_06_01.Partners.get_with_http_info | def get_with_http_info(resource_group_name, integration_account_name, partner_name, custom_headers:nil)
get_async(resource_group_name, integration_account_name, partner_name, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, integration_account_name, partner_name, custom_headers:nil)
get_async(resource_group_name, integration_account_name, partner_name, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"integration_account_name",
",",
"partner_name",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"integration_account_name",
",",
"partner_name",
",",
"custom_headers",
":c... | Gets an integration account partner.
@param resource_group_name [String] The resource group name.
@param integration_account_name [String] The integration account name.
@param partner_name [String] The integration account partner 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. | [
"Gets",
"an",
"integration",
"account",
"partner",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/partners.rb#L152-L154 | train | Gets the integration account partner s segmentation. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8346,
1035,
4070,
1035,
2171,
1010,
4256,
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... |
david942j/one_gadget | lib/one_gadget/cli.rb | OneGadget.CLI.handle_near | def handle_near(libc_file, gadgets, near)
return error('Libc file must be given when using --near option') unless libc_file
functions = if File.file?(near) && OneGadget::Helper.valid_elf_file?(near)
OneGadget::Helper.got_functions(near)
else
near.split(',').map(&:strip)
end
function_offsets = OneGadget::Helper.function_offsets(libc_file, functions)
return error('No functions for processing') if function_offsets.empty?
function_offsets.each do |function, offset|
colored_offset = OneGadget::Helper.colored_hex(offset)
OneGadget::Logger.warn("Gadgets near #{OneGadget::Helper.colorize(function)}(#{colored_offset}):")
display_gadgets(gadgets.sort_by { |gadget| (gadget.offset - offset).abs }, @options[:raw])
show("\n")
end
true
end | ruby | def handle_near(libc_file, gadgets, near)
return error('Libc file must be given when using --near option') unless libc_file
functions = if File.file?(near) && OneGadget::Helper.valid_elf_file?(near)
OneGadget::Helper.got_functions(near)
else
near.split(',').map(&:strip)
end
function_offsets = OneGadget::Helper.function_offsets(libc_file, functions)
return error('No functions for processing') if function_offsets.empty?
function_offsets.each do |function, offset|
colored_offset = OneGadget::Helper.colored_hex(offset)
OneGadget::Logger.warn("Gadgets near #{OneGadget::Helper.colorize(function)}(#{colored_offset}):")
display_gadgets(gadgets.sort_by { |gadget| (gadget.offset - offset).abs }, @options[:raw])
show("\n")
end
true
end | [
"def",
"handle_near",
"(",
"libc_file",
",",
"gadgets",
",",
"near",
")",
"return",
"error",
"(",
"'Libc file must be given when using --near option'",
")",
"unless",
"libc_file",
"functions",
"=",
"if",
"File",
".",
"file?",
"(",
"near",
")",
"&&",
"OneGadget",
... | Implements the --near feature.
@param [String] libc_file
@param [Array<OneGadget::Gadget::Gadget>] gadgets
@param [String] near
This can be name of functions or an ELF file.
- Use one comma without spaces to specify a list of functions: +printf,scanf,free+.
- Path to an ELF file and take its GOT functions to process: +/bin/ls+ | [
"Implements",
"the",
"--",
"near",
"feature",
"."
] | ff6ef04541e83441bfe3c2664a6febd1640f4263 | https://github.com/david942j/one_gadget/blob/ff6ef04541e83441bfe3c2664a6febd1640f4263/lib/one_gadget/cli.rb#L200-L218 | train | Handles the near option. | [
30522,
13366,
5047,
1035,
2379,
1006,
5622,
9818,
1035,
5371,
1010,
11721,
28682,
1010,
2379,
1007,
2709,
7561,
1006,
1005,
5622,
9818,
5371,
2442,
2022,
2445,
2043,
2478,
1011,
1011,
2379,
5724,
1005,
1007,
4983,
5622,
9818,
1035,
5371,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.start_chaos_with_http_info | def start_chaos_with_http_info(chaos_parameters, timeout:60, custom_headers:nil)
start_chaos_async(chaos_parameters, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def start_chaos_with_http_info(chaos_parameters, timeout:60, custom_headers:nil)
start_chaos_async(chaos_parameters, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"start_chaos_with_http_info",
"(",
"chaos_parameters",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"start_chaos_async",
"(",
"chaos_parameters",
",",
"timeout",
":",
"timeout",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!... | Starts Chaos in the cluster.
If Chaos is not already running in the cluster, it starts Chaos with the
passed in Chaos parameters.
If Chaos is already running when this call is made, the call fails with the
error code FABRIC_E_CHAOS_ALREADY_RUNNING.
Please refer to the article [Induce controlled Chaos in Service Fabric
clusters](https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-controlled-chaos)
for more details.
@param chaos_parameters [ChaosParameters] Describes all the parameters to
configure a Chaos run.
@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 [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Starts",
"Chaos",
"in",
"the",
"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#L18561-L18563 | train | Starts a Chaos based on the specified parameters. | [
30522,
13366,
2707,
1035,
8488,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
8488,
1035,
11709,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2707,
1035,
8488,
1035,
2004,
6038,
2278,
1006,
8488,
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/jobs.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.Jobs.list_by_manager_next | def list_by_manager_next(next_page_link, custom_headers:nil)
response = list_by_manager_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_manager_next(next_page_link, custom_headers:nil)
response = list_by_manager_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_manager_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_manager_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"respon... | Gets all the jobs for the specified manager. With optional OData query
parameters, a filtered set of jobs is returned.
@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 [JobList] operation results. | [
"Gets",
"all",
"the",
"jobs",
"for",
"the",
"specified",
"manager",
".",
"With",
"optional",
"OData",
"query",
"parameters",
"a",
"filtered",
"set",
"of",
"jobs",
"is",
"returned",
"."
] | 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/jobs.rb#L567-L570 | train | Gets the list of all the available advisor terms. | [
30522,
13366,
2862,
1035,
2011,
1035,
3208,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
3208,
1035,
2279,
1035,
2004,
6038,
2278,
1006,
2279,
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... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb | Azure::CognitiveServices::ComputerVision::V2_0.ComputerVisionClient.analyze_image_in_stream | def analyze_image_in_stream(image, visual_features:nil, details:nil, language:nil, custom_headers:nil)
response = analyze_image_in_stream_async(image, visual_features:visual_features, details:details, language:language, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def analyze_image_in_stream(image, visual_features:nil, details:nil, language:nil, custom_headers:nil)
response = analyze_image_in_stream_async(image, visual_features:visual_features, details:details, language:language, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"analyze_image_in_stream",
"(",
"image",
",",
"visual_features",
":",
"nil",
",",
"details",
":",
"nil",
",",
"language",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"analyze_image_in_stream_async",
"(",
"image",
",",
"visual_feat... | This operation extracts a rich set of visual features based on the image
content.
Two input methods are supported -- (1) Uploading an image or (2) specifying
an image URL. Within your request, there is an optional parameter to allow
you to choose which features to return. By default, image categories are
returned in the response.
A successful response will be returned in JSON. If the request failed, the
response will contain an error code and a message to help understand what
went wrong.
@param image An image stream.
@param visual_features [Array<VisualFeatureTypes>] A string indicating what
visual feature types to return. Multiple values should be comma-separated.
Valid visual feature types include: Categories - categorizes image content
according to a taxonomy defined in documentation. Tags - tags the image with
a detailed list of words related to the image content. Description -
describes the image content with a complete English sentence. Faces - detects
if faces are present. If present, generate coordinates, gender and age.
ImageType - detects if image is clipart or a line drawing. Color - determines
the accent color, dominant color, and whether an image is black&white. Adult
- detects if the image is pornographic in nature (depicts nudity or a sex
act). Sexually suggestive content is also detected. Objects - detects
various objects within an image, including the approximate location. The
Objects argument is only available in English. Brands - detects various
brands within an image, including the approximate location. The Brands
argument is only available in English.
@param details [Array<Details>] A string indicating which domain-specific
details to return. Multiple values should be comma-separated. Valid visual
feature types include: Celebrities - identifies celebrities if detected in
the image, Landmarks - identifies notable landmarks in the image.
@param language [Enum] The desired language for output generation. If this
parameter is not specified, the default value is "en".Supported
languages:en - English, Default. es - Spanish, ja - Japanese, pt -
Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es',
'ja', 'pt', 'zh'
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ImageAnalysis] operation results. | [
"This",
"operation",
"extracts",
"a",
"rich",
"set",
"of",
"visual",
"features",
"based",
"on",
"the",
"image",
"content",
".",
"Two",
"input",
"methods",
"are",
"supported",
"--",
"(",
"1",
")",
"Uploading",
"an",
"image",
"or",
"(",
"2",
")",
"specifyi... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb#L1821-L1824 | train | Analyze an image in an image stream. | [
30522,
13366,
17908,
1035,
3746,
1035,
1999,
1035,
5460,
1006,
3746,
1010,
5107,
1035,
2838,
1024,
9152,
2140,
1010,
4751,
1024,
9152,
2140,
1010,
2653,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
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 | data/azure_service_fabric/lib/6.4.0.36/generated/azure_service_fabric/mesh_secret_value.rb | Azure::ServiceFabric::V6_4_0_36.MeshSecretValue.show | def show(secret_resource_name, secret_value_resource_name, custom_headers:nil)
response = show_async(secret_resource_name, secret_value_resource_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def show(secret_resource_name, secret_value_resource_name, custom_headers:nil)
response = show_async(secret_resource_name, secret_value_resource_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"show",
"(",
"secret_resource_name",
",",
"secret_value_resource_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"show_async",
"(",
"secret_resource_name",
",",
"secret_value_resource_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"val... | Lists the specified value of the secret resource.
Lists the decrypted value of the specified named value of the secret
resource. This is a privileged operation.
@param secret_resource_name [String] The name of the secret resource.
@param secret_value_resource_name [String] The name of the secret resource
value which is typically the version identifier for the value.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [SecretValue] operation results. | [
"Lists",
"the",
"specified",
"value",
"of",
"the",
"secret",
"resource",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.4.0.36/generated/azure_service_fabric/mesh_secret_value.rb#L466-L469 | train | Gets the information about the specified secret resource. | [
30522,
13366,
2265,
1006,
3595,
1035,
7692,
1035,
2171,
1010,
3595,
1035,
3643,
1035,
7692,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2265,
1035,
2004,
6038,
2278,
1006,
3595,
1035,
7692,
1035,
2171,
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... |
kmuto/review | lib/epubmaker/producer.rb | EPUBMaker.Producer.titlepage | def titlepage(wobj)
s = @epub.titlepage
if !s.nil? && !wobj.nil?
wobj.puts s
end
end | ruby | def titlepage(wobj)
s = @epub.titlepage
if !s.nil? && !wobj.nil?
wobj.puts s
end
end | [
"def",
"titlepage",
"(",
"wobj",
")",
"s",
"=",
"@epub",
".",
"titlepage",
"if",
"!",
"s",
".",
"nil?",
"&&",
"!",
"wobj",
".",
"nil?",
"wobj",
".",
"puts",
"s",
"end",
"end"
] | Write title file (copying) to IO object +wobj+. | [
"Write",
"title",
"file",
"(",
"copying",
")",
"to",
"IO",
"object",
"+",
"wobj",
"+",
"."
] | 77d1273e671663f05db2992281fd891b776badf0 | https://github.com/kmuto/review/blob/77d1273e671663f05db2992281fd891b776badf0/lib/epubmaker/producer.rb#L142-L147 | train | Returns the titlepage of the page | [
30522,
13366,
2516,
13704,
1006,
24185,
2497,
3501,
1007,
1055,
1027,
1030,
4958,
12083,
1012,
2516,
13704,
2065,
999,
1055,
1012,
9152,
2140,
1029,
1004,
1004,
999,
24185,
2497,
3501,
1012,
9152,
2140,
1029,
24185,
2497,
3501,
1012,
8509,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
mhenrixon/sidekiq-unique-jobs | lib/sidekiq_unique_jobs/unlockable.rb | SidekiqUniqueJobs.Unlockable.delete | def delete(item)
SidekiqUniqueJobs::UniqueArgs.digest(item)
SidekiqUniqueJobs::Locksmith.new(item).delete!
end | ruby | def delete(item)
SidekiqUniqueJobs::UniqueArgs.digest(item)
SidekiqUniqueJobs::Locksmith.new(item).delete!
end | [
"def",
"delete",
"(",
"item",
")",
"SidekiqUniqueJobs",
"::",
"UniqueArgs",
".",
"digest",
"(",
"item",
")",
"SidekiqUniqueJobs",
"::",
"Locksmith",
".",
"new",
"(",
"item",
")",
".",
"delete!",
"end"
] | Deletes a lock regardless of if it was locked or not.
This is good for situations when a job is locked by another item
@param [Hash] item a Sidekiq job hash | [
"Deletes",
"a",
"lock",
"regardless",
"of",
"if",
"it",
"was",
"locked",
"or",
"not",
"."
] | 2944b97c720528f53962ccfd17d43ac939a77f46 | https://github.com/mhenrixon/sidekiq-unique-jobs/blob/2944b97c720528f53962ccfd17d43ac939a77f46/lib/sidekiq_unique_jobs/unlockable.rb#L22-L25 | train | Delete the item from the database | [
30522,
13366,
3972,
12870,
1006,
8875,
1007,
2217,
3211,
28940,
3490,
4226,
5558,
5910,
1024,
1024,
4310,
2906,
5620,
1012,
17886,
1006,
8875,
1007,
2217,
3211,
28940,
3490,
4226,
5558,
5910,
1024,
1024,
11223,
19864,
1012,
2047,
1006,
8875... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/2018-06-01-preview/generated/azure_mgmt_sql/database_tables.rb | Azure::SQL::Mgmt::V2018_06_01_preview.DatabaseTables.list_by_schema_next | def list_by_schema_next(next_page_link, custom_headers:nil)
response = list_by_schema_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_schema_next(next_page_link, custom_headers:nil)
response = list_by_schema_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_schema_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_schema_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"response... | List database tables
@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 [DatabaseTableListResult] operation results. | [
"List",
"database",
"tables"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2018-06-01-preview/generated/azure_mgmt_sql/database_tables.rb#L259-L262 | train | Gets the list of all the managed database schema versions. | [
30522,
13366,
2862,
1035,
2011,
1035,
8040,
28433,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
8040,
28433,
1035,
2279,
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... |
jhund/filterrific | lib/filterrific/param_set.rb | Filterrific.ParamSet.to_hash | def to_hash
{}.tap { |h|
model_class.filterrific_available_filters.each do |filter_name|
param_value = self.send(filter_name)
case
when param_value.blank?
# do nothing
when param_value.is_a?(Proc)
# evaluate Proc so it can be serialized
h[filter_name] = param_value.call
when param_value.is_a?(OpenStruct)
# convert OpenStruct to hash
h[filter_name] = param_value.marshal_dump
else
h[filter_name] = param_value
end
end
}
end | ruby | def to_hash
{}.tap { |h|
model_class.filterrific_available_filters.each do |filter_name|
param_value = self.send(filter_name)
case
when param_value.blank?
# do nothing
when param_value.is_a?(Proc)
# evaluate Proc so it can be serialized
h[filter_name] = param_value.call
when param_value.is_a?(OpenStruct)
# convert OpenStruct to hash
h[filter_name] = param_value.marshal_dump
else
h[filter_name] = param_value
end
end
}
end | [
"def",
"to_hash",
"{",
"}",
".",
"tap",
"{",
"|",
"h",
"|",
"model_class",
".",
"filterrific_available_filters",
".",
"each",
"do",
"|",
"filter_name",
"|",
"param_value",
"=",
"self",
".",
"send",
"(",
"filter_name",
")",
"case",
"when",
"param_value",
".... | Returns Filterrific::ParamSet as hash (used for URL params and serialization)
@return [Hash] with stringified keys | [
"Returns",
"Filterrific",
"::",
"ParamSet",
"as",
"hash",
"(",
"used",
"for",
"URL",
"params",
"and",
"serialization",
")"
] | 811edc57d3e2a3e538c1f0e9554e0909be052881 | https://github.com/jhund/filterrific/blob/811edc57d3e2a3e538c1f0e9554e0909be052881/lib/filterrific/param_set.rb#L60-L78 | train | Convert the object to a hash of the object s attributes. | [
30522,
13366,
2000,
1035,
23325,
1063,
1065,
30524,
2553,
2043,
11498,
2213,
1035,
3643,
1012,
8744,
1029,
1001,
2079,
2498,
2043,
11498,
2213,
1035,
3643,
1012,
2003,
1035,
1037,
1029,
1006,
4013,
2278,
1007,
1001,
16157,
4013,
2278,
2061,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
github/linguist | samples/Ruby/sinatra.rb | Sinatra.Helpers.etag | def etag(value, options = {})
# Before touching this code, please double check RFC 2616 14.24 and 14.26.
options = {:kind => options} unless Hash === options
kind = options[:kind] || :strong
new_resource = options.fetch(:new_resource) { request.post? }
unless [:strong, :weak].include?(kind)
raise ArgumentError, ":strong or :weak expected"
end
value = '"%s"' % value
value = 'W/' + value if kind == :weak
response['ETag'] = value
if success? or status == 304
if etag_matches? env['HTTP_IF_NONE_MATCH'], new_resource
halt(request.safe? ? 304 : 412)
end
if env['HTTP_IF_MATCH']
halt 412 unless etag_matches? env['HTTP_IF_MATCH'], new_resource
end
end
end | ruby | def etag(value, options = {})
# Before touching this code, please double check RFC 2616 14.24 and 14.26.
options = {:kind => options} unless Hash === options
kind = options[:kind] || :strong
new_resource = options.fetch(:new_resource) { request.post? }
unless [:strong, :weak].include?(kind)
raise ArgumentError, ":strong or :weak expected"
end
value = '"%s"' % value
value = 'W/' + value if kind == :weak
response['ETag'] = value
if success? or status == 304
if etag_matches? env['HTTP_IF_NONE_MATCH'], new_resource
halt(request.safe? ? 304 : 412)
end
if env['HTTP_IF_MATCH']
halt 412 unless etag_matches? env['HTTP_IF_MATCH'], new_resource
end
end
end | [
"def",
"etag",
"(",
"value",
",",
"options",
"=",
"{",
"}",
")",
"# Before touching this code, please double check RFC 2616 14.24 and 14.26.",
"options",
"=",
"{",
":kind",
"=>",
"options",
"}",
"unless",
"Hash",
"===",
"options",
"kind",
"=",
"options",
"[",
":ki... | Set the response entity tag (HTTP 'ETag' header) and halt if conditional
GET matches. The +value+ argument is an identifier that uniquely
identifies the current version of the resource. The +kind+ argument
indicates whether the etag should be used as a :strong (default) or :weak
cache validator.
When the current request includes an 'If-None-Match' header with a
matching etag, execution is immediately halted. If the request method is
GET or HEAD, a '304 Not Modified' response is sent. | [
"Set",
"the",
"response",
"entity",
"tag",
"(",
"HTTP",
"ETag",
"header",
")",
"and",
"halt",
"if",
"conditional",
"GET",
"matches",
".",
"The",
"+",
"value",
"+",
"argument",
"is",
"an",
"identifier",
"that",
"uniquely",
"identifies",
"the",
"current",
"v... | 9116c90fcbb82ac03b4b33c58cfbde1fcf745e99 | https://github.com/github/linguist/blob/9116c90fcbb82ac03b4b33c58cfbde1fcf745e99/samples/Ruby/sinatra.rb#L440-L463 | train | Returns the ETag of the response. | [
30522,
13366,
27859,
2290,
1006,
3643,
1010,
7047,
1027,
1063,
1065,
1007,
1001,
2077,
7244,
2023,
3642,
1010,
3531,
3313,
4638,
14645,
24441,
2575,
2403,
1012,
2484,
1998,
2403,
1012,
2656,
1012,
7047,
1027,
1063,
1024,
2785,
30524,
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... |
cheezy/page-object | lib/page-object/accessors.rb | PageObject.Accessors.page_section | def page_section(name, section_class, identifier)
define_method(name) do
platform.page_for(identifier, section_class)
end
end | ruby | def page_section(name, section_class, identifier)
define_method(name) do
platform.page_for(identifier, section_class)
end
end | [
"def",
"page_section",
"(",
"name",
",",
"section_class",
",",
"identifier",
")",
"define_method",
"(",
"name",
")",
"do",
"platform",
".",
"page_for",
"(",
"identifier",
",",
"section_class",
")",
"end",
"end"
] | adds a method to return a page object rooted at an element
@example
page_section(:navigation_bar, NavigationBar, :id => 'nav-bar')
# will generate 'navigation_bar'
@param [Symbol] the name used for the generated methods
@param [Class] the class to instantiate for the element
@param [Hash] identifier how we find an element. | [
"adds",
"a",
"method",
"to",
"return",
"a",
"page",
"object",
"rooted",
"at",
"an",
"element"
] | 850d775bf63768fbb1551a34480195785fe8e193 | https://github.com/cheezy/page-object/blob/850d775bf63768fbb1551a34480195785fe8e193/lib/page-object/accessors.rb#L1057-L1061 | train | Define a method to return a page section | [
30522,
13366,
3931,
1035,
2930,
1006,
2171,
1010,
2930,
1035,
2465,
1010,
8909,
4765,
18095,
1007,
9375,
1035,
4118,
1006,
2171,
1007,
2079,
4132,
1012,
3931,
1035,
2005,
1006,
8909,
4765,
18095,
1010,
2930,
1035,
2465,
1007,
2203,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/public_ipprefixes.rb | Azure::Network::Mgmt::V2018_07_01.PublicIPPrefixes.begin_update_tags_with_http_info | def begin_update_tags_with_http_info(resource_group_name, public_ip_prefix_name, parameters, custom_headers:nil)
begin_update_tags_async(resource_group_name, public_ip_prefix_name, parameters, custom_headers:custom_headers).value!
end | ruby | def begin_update_tags_with_http_info(resource_group_name, public_ip_prefix_name, parameters, custom_headers:nil)
begin_update_tags_async(resource_group_name, public_ip_prefix_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_update_tags_with_http_info",
"(",
"resource_group_name",
",",
"public_ip_prefix_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_update_tags_async",
"(",
"resource_group_name",
",",
"public_ip_prefix_name",
",",
"parameters",
",",
"cust... | Updates public IP prefix tags.
@param resource_group_name [String] The name of the resource group.
@param public_ip_prefix_name [String] The name of the public IP prefix.
@param parameters [TagsObject] Parameters supplied to update public IP prefix
tags.
@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",
"public",
"IP",
"prefix",
"tags",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/public_ipprefixes.rb#L647-L649 | train | Updates the tags on an existing public IP prefix. | [
30522,
13366,
4088,
1035,
10651,
1035,
22073,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2270,
1035,
12997,
1035,
17576,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
408... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/2017-03-30/generated/azure_mgmt_network/network_interfaces.rb | Azure::Network::Mgmt::V2017_03_30.NetworkInterfaces.list_virtual_machine_scale_set_ip_configurations_with_http_info | def list_virtual_machine_scale_set_ip_configurations_with_http_info(resource_group_name, virtual_machine_scale_set_name, virtualmachine_index, network_interface_name, expand:nil, custom_headers:nil)
list_virtual_machine_scale_set_ip_configurations_async(resource_group_name, virtual_machine_scale_set_name, virtualmachine_index, network_interface_name, expand:expand, custom_headers:custom_headers).value!
end | ruby | def list_virtual_machine_scale_set_ip_configurations_with_http_info(resource_group_name, virtual_machine_scale_set_name, virtualmachine_index, network_interface_name, expand:nil, custom_headers:nil)
list_virtual_machine_scale_set_ip_configurations_async(resource_group_name, virtual_machine_scale_set_name, virtualmachine_index, network_interface_name, expand:expand, custom_headers:custom_headers).value!
end | [
"def",
"list_virtual_machine_scale_set_ip_configurations_with_http_info",
"(",
"resource_group_name",
",",
"virtual_machine_scale_set_name",
",",
"virtualmachine_index",
",",
"network_interface_name",
",",
"expand",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"list_virt... | Get the specified network interface ip configuration in a virtual machine
scale set.
@param resource_group_name [String] The name of the resource group.
@param virtual_machine_scale_set_name [String] The name of the virtual
machine scale set.
@param virtualmachine_index [String] The virtual machine index.
@param network_interface_name [String] The name of the network interface.
@param expand [String] Expands referenced resources.
@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",
"the",
"specified",
"network",
"interface",
"ip",
"configuration",
"in",
"a",
"virtual",
"machine",
"scale",
"set",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2017-03-30/generated/azure_mgmt_network/network_interfaces.rb#L365-L367 | train | Gets the specified network interface ip configurations. | [
30522,
13366,
2862,
1035,
7484,
1035,
3698,
1035,
4094,
1035,
2275,
1035,
12997,
1035,
22354,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7484,
1035,
3698,
1035,
4094,
1035,
2275,
1035,
2171,
1010,
7484,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/2017-03-30/generated/azure_mgmt_network/public_ipaddresses.rb | Azure::Network::Mgmt::V2017_03_30.PublicIPAddresses.get_virtual_machine_scale_set_public_ipaddress | def get_virtual_machine_scale_set_public_ipaddress(resource_group_name, virtual_machine_scale_set_name, virtualmachine_index, network_interface_name, ip_configuration_name, public_ip_address_name, expand:nil, custom_headers:nil)
response = get_virtual_machine_scale_set_public_ipaddress_async(resource_group_name, virtual_machine_scale_set_name, virtualmachine_index, network_interface_name, ip_configuration_name, public_ip_address_name, expand:expand, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_virtual_machine_scale_set_public_ipaddress(resource_group_name, virtual_machine_scale_set_name, virtualmachine_index, network_interface_name, ip_configuration_name, public_ip_address_name, expand:nil, custom_headers:nil)
response = get_virtual_machine_scale_set_public_ipaddress_async(resource_group_name, virtual_machine_scale_set_name, virtualmachine_index, network_interface_name, ip_configuration_name, public_ip_address_name, expand:expand, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_virtual_machine_scale_set_public_ipaddress",
"(",
"resource_group_name",
",",
"virtual_machine_scale_set_name",
",",
"virtualmachine_index",
",",
"network_interface_name",
",",
"ip_configuration_name",
",",
"public_ip_address_name",
",",
"expand",
":",
"nil",
",",
"... | Get the specified public IP address in a virtual machine scale set.
@param resource_group_name [String] The name of the resource group.
@param virtual_machine_scale_set_name [String] The name of the virtual
machine scale set.
@param virtualmachine_index [String] The virtual machine index.
@param network_interface_name [String] The name of the network interface.
@param ip_configuration_name [String] The name of the IP configuration.
@param public_ip_address_name [String] The name of the public IP Address.
@param expand [String] Expands referenced resources.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [PublicIPAddress] operation results. | [
"Get",
"the",
"specified",
"public",
"IP",
"address",
"in",
"a",
"virtual",
"machine",
"scale",
"set",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2017-03-30/generated/azure_mgmt_network/public_ipaddresses.rb#L251-L254 | train | Gets the specified virtual machine s public IP address. | [
30522,
13366,
2131,
1035,
7484,
1035,
3698,
1035,
4094,
1035,
2275,
1035,
2270,
1035,
25249,
16200,
4757,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7484,
1035,
3698,
1035,
4094,
1035,
2275,
1035,
2171,
1010,
7484,
22911,
14014,
1035,
5950,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.update_instances | def update_instances(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers:nil)
response = update_instances_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def update_instances(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers:nil)
response = update_instances_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"update_instances",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"vm_instance_ids",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"update_instances_async",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"vm_instance_ids",
",",
... | Upgrades one or more virtual machines to the latest SKU set in the VM scale
set model.
@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 [VirtualMachineScaleSetVMInstanceRequiredIDs] 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 [OperationStatusResponse] operation results. | [
"Upgrades",
"one",
"or",
"more",
"virtual",
"machines",
"to",
"the",
"latest",
"SKU",
"set",
"in",
"the",
"VM",
"scale",
"set",
"model",
"."
] | 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#L817-L820 | train | Updates a set of virtual machines in a VM scale set. | [
30522,
13366,
10651,
1035,
12107,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
4094,
1035,
2275,
1035,
2171,
1010,
1058,
2213,
1035,
6013,
1035,
8909,
2015,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
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... |
rails/rails | railties/lib/rails/engine.rb | Rails.Engine.app | def app
@app || @app_build_lock.synchronize {
@app ||= begin
stack = default_middleware_stack
config.middleware = build_middleware.merge_into(stack)
config.middleware.build(endpoint)
end
}
end | ruby | def app
@app || @app_build_lock.synchronize {
@app ||= begin
stack = default_middleware_stack
config.middleware = build_middleware.merge_into(stack)
config.middleware.build(endpoint)
end
}
end | [
"def",
"app",
"@app",
"||",
"@app_build_lock",
".",
"synchronize",
"{",
"@app",
"||=",
"begin",
"stack",
"=",
"default_middleware_stack",
"config",
".",
"middleware",
"=",
"build_middleware",
".",
"merge_into",
"(",
"stack",
")",
"config",
".",
"middleware",
"."... | Returns the underlying Rack application for this engine. | [
"Returns",
"the",
"underlying",
"Rack",
"application",
"for",
"this",
"engine",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/railties/lib/rails/engine.rb#L507-L515 | train | Returns the app object for this route | [
30522,
13366,
10439,
1030,
10439,
1064,
1064,
1030,
10439,
1035,
3857,
1035,
5843,
1012,
26351,
8093,
10698,
4371,
1063,
1030,
10439,
1064,
1064,
1027,
4088,
9991,
1027,
12398,
1035,
2690,
8059,
1035,
9991,
9530,
8873,
2290,
1012,
2690,
805... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-ec2/lib/aws-sdk-ec2/resource.rb | Aws::EC2.Resource.network_interfaces | def network_interfaces(options = {})
batches = Enumerator.new do |y|
resp = @client.describe_network_interfaces(options)
resp.each_page do |page|
batch = []
page.data.network_interfaces.each do |n|
batch << NetworkInterface.new(
id: n.network_interface_id,
data: n,
client: @client
)
end
y.yield(batch)
end
end
NetworkInterface::Collection.new(batches)
end | ruby | def network_interfaces(options = {})
batches = Enumerator.new do |y|
resp = @client.describe_network_interfaces(options)
resp.each_page do |page|
batch = []
page.data.network_interfaces.each do |n|
batch << NetworkInterface.new(
id: n.network_interface_id,
data: n,
client: @client
)
end
y.yield(batch)
end
end
NetworkInterface::Collection.new(batches)
end | [
"def",
"network_interfaces",
"(",
"options",
"=",
"{",
"}",
")",
"batches",
"=",
"Enumerator",
".",
"new",
"do",
"|",
"y",
"|",
"resp",
"=",
"@client",
".",
"describe_network_interfaces",
"(",
"options",
")",
"resp",
".",
"each_page",
"do",
"|",
"page",
... | @example Request syntax with placeholder values
network_interfaces = ec2.network_interfaces({
filters: [
{
name: "String",
values: ["String"],
},
],
dry_run: false,
network_interface_ids: ["String"],
})
@param [Hash] options ({})
@option options [Array<Types::Filter>] :filters
One or more filters.
* `addresses.private-ip-address` - The private IPv4 addresses
associated with the network interface.
* `addresses.primary` - Whether the private IPv4 address is the
primary IP address associated with the network interface.
* `addresses.association.public-ip` - The association ID returned when
the network interface was associated with the Elastic IP address
(IPv4).
* `addresses.association.owner-id` - The owner ID of the addresses
associated with the network interface.
* `association.association-id` - The association ID returned when the
network interface was associated with an IPv4 address.
* `association.allocation-id` - The allocation ID returned when you
allocated the Elastic IP address (IPv4) for your network interface.
* `association.ip-owner-id` - The owner of the Elastic IP address
(IPv4) associated with the network interface.
* `association.public-ip` - The address of the Elastic IP address
(IPv4) bound to the network interface.
* `association.public-dns-name` - The public DNS name for the network
interface (IPv4).
* `attachment.attachment-id` - The ID of the interface attachment.
* `attachment.attach.time` - The time that the network interface was
attached to an instance.
* `attachment.delete-on-termination` - Indicates whether the
attachment is deleted when an instance is terminated.
* `attachment.device-index` - The device index to which the network
interface is attached.
* `attachment.instance-id` - The ID of the instance to which the
network interface is attached.
* `attachment.instance-owner-id` - The owner ID of the instance to
which the network interface is attached.
* `attachment.nat-gateway-id` - The ID of the NAT gateway to which the
network interface is attached.
* `attachment.status` - The status of the attachment (`attaching` \|
`attached` \| `detaching` \| `detached`).
* `availability-zone` - The Availability Zone of the network
interface.
* `description` - The description of the network interface.
* `group-id` - The ID of a security group associated with the network
interface.
* `group-name` - The name of a security group associated with the
network interface.
* `ipv6-addresses.ipv6-address` - An IPv6 address associated with the
network interface.
* `mac-address` - The MAC address of the network interface.
* `network-interface-id` - The ID of the network interface.
* `owner-id` - The AWS account ID of the network interface owner.
* `private-ip-address` - The private IPv4 address or addresses of the
network interface.
* `private-dns-name` - The private DNS name of the network interface
(IPv4).
* `requester-id` - The ID of the entity that launched the instance on
your behalf (for example, AWS Management Console, Auto Scaling, and
so on).
* `requester-managed` - Indicates whether the network interface is
being managed by an AWS service (for example, AWS Management
Console, Auto Scaling, and so on).
* `source-dest-check` - Indicates whether the network interface
performs source/destination checking. A value of `true` means
checking is enabled, and `false` means checking is disabled. The
value must be `false` for the network interface to perform network
address translation (NAT) in your VPC.
* `status` - The status of the network interface. If the network
interface is not attached to an instance, the status is `available`;
if a network interface is attached to an instance the status is
`in-use`.
* `subnet-id` - The ID of the subnet for the network interface.
* `tag`\:<key> - The key/value combination of a tag assigned to
the resource. Use the tag key in the filter name and the tag value
as the filter value. For example, to find all resources that have a
tag with the key `Owner` and the value `TeamA`, specify `tag:Owner`
for the filter name and `TeamA` for the filter value.
* `tag-key` - The key of a tag assigned to the resource. Use this
filter to find all resources assigned a tag with a specific key,
regardless of the tag value.
* `vpc-id` - The ID of the VPC for the network interface.
@option options [Boolean] :dry_run
Checks whether you have the required permissions for the action,
without actually making the request, and provides an error response.
If you have the required permissions, the error response is
`DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
@option options [Array<String>] :network_interface_ids
One or more network interface IDs.
Default: Describes all your network interfaces.
@return [NetworkInterface::Collection] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb#L2180-L2196 | train | Returns an array of NetworkInterface objects | [
30522,
13366,
2897,
1035,
19706,
1006,
7047,
1027,
1063,
1065,
1007,
14108,
2229,
1027,
4372,
17897,
16259,
1012,
2047,
2079,
1064,
1061,
1064,
24501,
2361,
1027,
1030,
7396,
1012,
6235,
1035,
2897,
1035,
19706,
1006,
7047,
1007,
24501,
236... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/2016-03-01/generated/azure_mgmt_monitor/log_profiles.rb | Azure::Monitor::Mgmt::V2016_03_01.LogProfiles.update | def update(log_profile_name, log_profiles_resource, custom_headers:nil)
response = update_async(log_profile_name, log_profiles_resource, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def update(log_profile_name, log_profiles_resource, custom_headers:nil)
response = update_async(log_profile_name, log_profiles_resource, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"update",
"(",
"log_profile_name",
",",
"log_profiles_resource",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"update_async",
"(",
"log_profile_name",
",",
"log_profiles_resource",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"respo... | Updates an existing LogProfilesResource. To update other fields use the
CreateOrUpdate method.
@param log_profile_name [String] The name of the log profile.
@param log_profiles_resource [LogProfileResourcePatch] Parameters supplied to
the operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [LogProfileResource] operation results. | [
"Updates",
"an",
"existing",
"LogProfilesResource",
".",
"To",
"update",
"other",
"fields",
"use",
"the",
"CreateOrUpdate",
"method",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_monitor/lib/2016-03-01/generated/azure_mgmt_monitor/log_profiles.rb#L300-L303 | train | Updates the log profile. | [
30522,
13366,
10651,
1006,
8833,
1035,
6337,
1035,
2171,
1010,
8833,
1035,
17879,
1035,
7692,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
10651,
1035,
2004,
6038,
2278,
1006,
8833,
1035,
6337,
1035,
2171,
1010,
8833,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Dynamoid/dynamoid | lib/dynamoid/adapter.rb | Dynamoid.Adapter.scan | def scan(table, query = {}, opts = {})
benchmark('Scan', table, query) { adapter.scan(table, query, opts) }
end | ruby | def scan(table, query = {}, opts = {})
benchmark('Scan', table, query) { adapter.scan(table, query, opts) }
end | [
"def",
"scan",
"(",
"table",
",",
"query",
"=",
"{",
"}",
",",
"opts",
"=",
"{",
"}",
")",
"benchmark",
"(",
"'Scan'",
",",
"table",
",",
"query",
")",
"{",
"adapter",
".",
"scan",
"(",
"table",
",",
"query",
",",
"opts",
")",
"}",
"end"
] | Scans a table. Generally quite slow; try to avoid using scan if at all possible.
@param [String] table the name of the table to write the object to
@param [Hash] scan_hash a hash of attributes: matching records will be returned by the scan
@since 0.2.0 | [
"Scans",
"a",
"table",
".",
"Generally",
"quite",
"slow",
";",
"try",
"to",
"avoid",
"using",
"scan",
"if",
"at",
"all",
"possible",
"."
] | 9e3d006b039e45877b003564ded65509b10b6354 | https://github.com/Dynamoid/dynamoid/blob/9e3d006b039e45877b003564ded65509b10b6354/lib/dynamoid/adapter.rb#L120-L122 | train | Scan the table | [
30522,
13366,
13594,
1006,
2795,
1010,
23032,
1027,
1063,
1065,
1010,
23569,
30524,
13594,
1005,
1010,
2795,
1010,
23032,
1007,
1063,
15581,
2121,
1012,
13594,
1006,
2795,
1010,
23032,
1010,
23569,
2015,
1007,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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... |
meew0/discordrb | lib/discordrb/voice/network.rb | Discordrb::Voice.VoiceUDP.connect | def connect(endpoint, port, ssrc)
@endpoint = endpoint
@endpoint = @endpoint[6..-1] if @endpoint.start_with? 'wss://'
@endpoint = @endpoint.gsub(':80', '') # The endpoint may contain a port, we don't want that
@endpoint = Resolv.getaddress @endpoint
@port = port
@ssrc = ssrc
end | ruby | def connect(endpoint, port, ssrc)
@endpoint = endpoint
@endpoint = @endpoint[6..-1] if @endpoint.start_with? 'wss://'
@endpoint = @endpoint.gsub(':80', '') # The endpoint may contain a port, we don't want that
@endpoint = Resolv.getaddress @endpoint
@port = port
@ssrc = ssrc
end | [
"def",
"connect",
"(",
"endpoint",
",",
"port",
",",
"ssrc",
")",
"@endpoint",
"=",
"endpoint",
"@endpoint",
"=",
"@endpoint",
"[",
"6",
"..",
"-",
"1",
"]",
"if",
"@endpoint",
".",
"start_with?",
"'wss://'",
"@endpoint",
"=",
"@endpoint",
".",
"gsub",
"... | Creates a new UDP connection. Only creates a socket as the discovery reply may come before the data is
initialized.
Initializes the UDP socket with data obtained from opcode 2.
@param endpoint [String] The voice endpoint to connect to.
@param port [Integer] The port to connect to.
@param ssrc [Integer] The Super Secret Relay Code (SSRC). Discord uses this to identify different voice users
on the same endpoint. | [
"Creates",
"a",
"new",
"UDP",
"connection",
".",
"Only",
"creates",
"a",
"socket",
"as",
"the",
"discovery",
"reply",
"may",
"come",
"before",
"the",
"data",
"is",
"initialized",
".",
"Initializes",
"the",
"UDP",
"socket",
"with",
"data",
"obtained",
"from",... | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/voice/network.rb#L50-L58 | train | Connect to the server | [
30522,
13366,
7532,
1006,
2203,
8400,
1010,
3417,
1010,
20896,
2278,
1007,
1030,
2203,
8400,
1027,
2203,
8400,
30524,
28177,
12083,
1006,
1005,
1024,
3770,
1005,
1010,
1005,
1005,
1007,
1001,
1996,
2203,
8400,
2089,
5383,
1037,
3417,
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... |
appsignal/rdkafka-ruby | lib/rdkafka/config.rb | Rdkafka.Config.native_config | def native_config(opaque=nil)
Rdkafka::Bindings.rd_kafka_conf_new.tap do |config|
# Create config
@config_hash.merge(REQUIRED_CONFIG).each do |key, value|
error_buffer = FFI::MemoryPointer.from_string(" " * 256)
result = Rdkafka::Bindings.rd_kafka_conf_set(
config,
key.to_s,
value.to_s,
error_buffer,
256
)
unless result == :config_ok
raise ConfigError.new(error_buffer.read_string)
end
end
# Set opaque pointer that's used as a proxy for callbacks
if opaque
pointer = ::FFI::Pointer.new(:pointer, opaque.object_id)
Rdkafka::Bindings.rd_kafka_conf_set_opaque(config, pointer)
# Store opaque with the pointer as key. We use this approach instead
# of trying to convert the pointer to a Ruby object because there is
# no risk of a segfault this way.
Rdkafka::Config.opaques[pointer.to_i] = opaque
end
# Set log callback
Rdkafka::Bindings.rd_kafka_conf_set_log_cb(config, Rdkafka::Bindings::LogCallback)
# Set stats callback
Rdkafka::Bindings.rd_kafka_conf_set_stats_cb(config, Rdkafka::Bindings::StatsCallback)
end
end | ruby | def native_config(opaque=nil)
Rdkafka::Bindings.rd_kafka_conf_new.tap do |config|
# Create config
@config_hash.merge(REQUIRED_CONFIG).each do |key, value|
error_buffer = FFI::MemoryPointer.from_string(" " * 256)
result = Rdkafka::Bindings.rd_kafka_conf_set(
config,
key.to_s,
value.to_s,
error_buffer,
256
)
unless result == :config_ok
raise ConfigError.new(error_buffer.read_string)
end
end
# Set opaque pointer that's used as a proxy for callbacks
if opaque
pointer = ::FFI::Pointer.new(:pointer, opaque.object_id)
Rdkafka::Bindings.rd_kafka_conf_set_opaque(config, pointer)
# Store opaque with the pointer as key. We use this approach instead
# of trying to convert the pointer to a Ruby object because there is
# no risk of a segfault this way.
Rdkafka::Config.opaques[pointer.to_i] = opaque
end
# Set log callback
Rdkafka::Bindings.rd_kafka_conf_set_log_cb(config, Rdkafka::Bindings::LogCallback)
# Set stats callback
Rdkafka::Bindings.rd_kafka_conf_set_stats_cb(config, Rdkafka::Bindings::StatsCallback)
end
end | [
"def",
"native_config",
"(",
"opaque",
"=",
"nil",
")",
"Rdkafka",
"::",
"Bindings",
".",
"rd_kafka_conf_new",
".",
"tap",
"do",
"|",
"config",
"|",
"# Create config",
"@config_hash",
".",
"merge",
"(",
"REQUIRED_CONFIG",
")",
".",
"each",
"do",
"|",
"key",
... | This method is only intented to be used to create a client,
using it in another way will leak memory. | [
"This",
"method",
"is",
"only",
"intented",
"to",
"be",
"used",
"to",
"create",
"a",
"client",
"using",
"it",
"in",
"another",
"way",
"will",
"leak",
"memory",
"."
] | 87b3e0ddae5ea576847cb67228fcea06ec2a24d6 | https://github.com/appsignal/rdkafka-ruby/blob/87b3e0ddae5ea576847cb67228fcea06ec2a24d6/lib/rdkafka/config.rb#L160-L194 | train | Create a new Rdkafka configuration object | [
30522,
13366,
3128,
1035,
9530,
8873,
2290,
1006,
28670,
1027,
9152,
2140,
1007,
16428,
2912,
24316,
2050,
1024,
1024,
8031,
2015,
1012,
16428,
1035,
10556,
24316,
2050,
1035,
9530,
2546,
1035,
2047,
1012,
11112,
2079,
1064,
9530,
8873,
229... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | deliver/lib/deliver/upload_metadata.rb | Deliver.UploadMetadata.normalize_language_keys | def normalize_language_keys(options)
(LOCALISED_VERSION_VALUES + LOCALISED_APP_VALUES).each do |key|
current = options[key]
next unless current && current.kind_of?(Hash)
current.keys.each do |language|
current[language.to_s] = current.delete(language)
end
end
options
end | ruby | def normalize_language_keys(options)
(LOCALISED_VERSION_VALUES + LOCALISED_APP_VALUES).each do |key|
current = options[key]
next unless current && current.kind_of?(Hash)
current.keys.each do |language|
current[language.to_s] = current.delete(language)
end
end
options
end | [
"def",
"normalize_language_keys",
"(",
"options",
")",
"(",
"LOCALISED_VERSION_VALUES",
"+",
"LOCALISED_APP_VALUES",
")",
".",
"each",
"do",
"|",
"key",
"|",
"current",
"=",
"options",
"[",
"key",
"]",
"next",
"unless",
"current",
"&&",
"current",
".",
"kind_o... | Normalizes languages keys from symbols to strings | [
"Normalizes",
"languages",
"keys",
"from",
"symbols",
"to",
"strings"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/deliver/lib/deliver/upload_metadata.rb#L336-L347 | train | Normalize language keys | [
30522,
13366,
3671,
4697,
1035,
2653,
1035,
6309,
1006,
7047,
1007,
1006,
2334,
5084,
1035,
2544,
1035,
5300,
1009,
2334,
5084,
1035,
10439,
1035,
5300,
1007,
1012,
2169,
2079,
1064,
3145,
1064,
2783,
1027,
7047,
1031,
3145,
1033,
2279,
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_authorization/lib/2018-09-01-preview/generated/azure_mgmt_authorization/role_assignments.rb | Azure::Authorization::Mgmt::V2018_09_01_preview.RoleAssignments.delete | def delete(scope, role_assignment_name, custom_headers:nil)
response = delete_async(scope, role_assignment_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def delete(scope, role_assignment_name, custom_headers:nil)
response = delete_async(scope, role_assignment_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"delete",
"(",
"scope",
",",
"role_assignment_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_async",
"(",
"scope",
",",
"role_assignment_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
... | Deletes a role assignment.
@param scope [String] The scope of the role assignment to delete.
@param role_assignment_name [String] The name of the role assignment to
delete.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [RoleAssignment] operation results. | [
"Deletes",
"a",
"role",
"assignment",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_authorization/lib/2018-09-01-preview/generated/azure_mgmt_authorization/role_assignments.rb#L261-L264 | train | Deletes a role assignment. | [
30522,
13366,
3972,
12870,
1006,
9531,
1010,
2535,
1035,
8775,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
1035,
2004,
6038,
2278,
1006,
9531,
1010,
2535,
1035,
8775,
1035,
2171,
1010,
7661,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
dry-rb/dry-initializer | lib/dry/initializer/config.rb | Dry::Initializer.Config.public_attributes | def public_attributes(instance)
definitions.values.each_with_object({}) do |item, obj|
key = item.target
next unless instance.respond_to? key
val = instance.send(key)
obj[key] = val unless null == val
end
end | ruby | def public_attributes(instance)
definitions.values.each_with_object({}) do |item, obj|
key = item.target
next unless instance.respond_to? key
val = instance.send(key)
obj[key] = val unless null == val
end
end | [
"def",
"public_attributes",
"(",
"instance",
")",
"definitions",
".",
"values",
".",
"each_with_object",
"(",
"{",
"}",
")",
"do",
"|",
"item",
",",
"obj",
"|",
"key",
"=",
"item",
".",
"target",
"next",
"unless",
"instance",
".",
"respond_to?",
"key",
"... | The hash of public attributes for an instance of the [#extended_class]
@param [Dry::Initializer::Instance] instance
@return [Hash<Symbol, Object>] | [
"The",
"hash",
"of",
"public",
"attributes",
"for",
"an",
"instance",
"of",
"the",
"[",
"#extended_class",
"]"
] | 422d331468602ff0d3543fbb336b784343e5cc31 | https://github.com/dry-rb/dry-initializer/blob/422d331468602ff0d3543fbb336b784343e5cc31/lib/dry/initializer/config.rb#L77-L84 | train | Returns the public attributes of the given instance. | [
30522,
13366,
2270,
1035,
12332,
1006,
6013,
1007,
15182,
1012,
5300,
1012,
2169,
1035,
2007,
1035,
4874,
1006,
1063,
1065,
1007,
2079,
1064,
8875,
1010,
27885,
3501,
1064,
3145,
1027,
8875,
1012,
4539,
2279,
4983,
6013,
1012,
6869,
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_web/lib/2015-08-01/generated/azure_mgmt_web/app_service_certificate_orders.rb | Azure::Web::Mgmt::V2015_08_01.AppServiceCertificateOrders.delete_certificate_with_http_info | def delete_certificate_with_http_info(resource_group_name, certificate_order_name, name, custom_headers:nil)
delete_certificate_async(resource_group_name, certificate_order_name, name, custom_headers:custom_headers).value!
end | ruby | def delete_certificate_with_http_info(resource_group_name, certificate_order_name, name, custom_headers:nil)
delete_certificate_async(resource_group_name, certificate_order_name, name, custom_headers:custom_headers).value!
end | [
"def",
"delete_certificate_with_http_info",
"(",
"resource_group_name",
",",
"certificate_order_name",
",",
"name",
",",
"custom_headers",
":",
"nil",
")",
"delete_certificate_async",
"(",
"resource_group_name",
",",
"certificate_order_name",
",",
"name",
",",
"custom_heade... | Delete the certificate associated with a certificate order.
Delete 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 [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Delete",
"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#L981-L983 | train | Deletes the specified certificate order. | [
30522,
13366,
3972,
12870,
1035,
8196,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8196,
1035,
2344,
1035,
2171,
1010,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3972,
12870,
1035,
8196,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/2018-11-27-preview/generated/azure_mgmt_monitor/vminsights.rb | Azure::Monitor::Mgmt::V2018_11_27_preview.VMInsights.get_onboarding_status | def get_onboarding_status(resource_uri, custom_headers:nil)
response = get_onboarding_status_async(resource_uri, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_onboarding_status(resource_uri, custom_headers:nil)
response = get_onboarding_status_async(resource_uri, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_onboarding_status",
"(",
"resource_uri",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_onboarding_status_async",
"(",
"resource_uri",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"response... | Retrieves the VM Insights onboarding status for the specified resource or
resource scope.
@param resource_uri [String] The fully qualified Azure Resource manager
identifier of the resource, or scope, whose status to retrieve.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [VMInsightsOnboardingStatus] operation results. | [
"Retrieves",
"the",
"VM",
"Insights",
"onboarding",
"status",
"for",
"the",
"specified",
"resource",
"or",
"resource",
"scope",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_monitor/lib/2018-11-27-preview/generated/azure_mgmt_monitor/vminsights.rb#L35-L38 | train | Gets the onboarding status of the resource. | [
30522,
13366,
2131,
1035,
27120,
2075,
1035,
3570,
1006,
7692,
1035,
24471,
2072,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
27120,
2075,
1035,
3570,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
24471,
2072,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.begin_power_off | def begin_power_off(resource_group_name, vm_name, custom_headers:nil)
response = begin_power_off_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_power_off(resource_group_name, vm_name, custom_headers:nil)
response = begin_power_off_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_power_off",
"(",
"resource_group_name",
",",
"vm_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_power_off_async",
"(",
"resource_group_name",
",",
"vm_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response"... | The operation to power off (stop) a virtual machine. The virtual machine can
be restarted with the same provisioned resources. You are still charged for
this virtual machine.
@param resource_group_name [String] The name of the resource group.
@param vm_name [String] The name of the virtual machine.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OperationStatusResponse] operation results. | [
"The",
"operation",
"to",
"power",
"off",
"(",
"stop",
")",
"a",
"virtual",
"machine",
".",
"The",
"virtual",
"machine",
"can",
"be",
"restarted",
"with",
"the",
"same",
"provisioned",
"resources",
".",
"You",
"are",
"still",
"charged",
"for",
"this",
"vir... | 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#L1498-L1501 | train | Power off the virtual machine. | [
30522,
13366,
4088,
1035,
2373,
1035,
2125,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
2373,
1035,
2125,
1035,
2004,
6038,
2278,
1006,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
shugo/textbringer | lib/textbringer/buffer.rb | Textbringer.Buffer.save_excursion | def save_excursion
old_point = new_mark
old_mark = @mark&.dup
old_column = @goal_column
begin
yield
ensure
point_to_mark(old_point)
old_point.delete
if old_mark
@mark.location = old_mark.location
old_mark.delete
end
@goal_column = old_column
end
end | ruby | def save_excursion
old_point = new_mark
old_mark = @mark&.dup
old_column = @goal_column
begin
yield
ensure
point_to_mark(old_point)
old_point.delete
if old_mark
@mark.location = old_mark.location
old_mark.delete
end
@goal_column = old_column
end
end | [
"def",
"save_excursion",
"old_point",
"=",
"new_mark",
"old_mark",
"=",
"@mark",
"&.",
"dup",
"old_column",
"=",
"@goal_column",
"begin",
"yield",
"ensure",
"point_to_mark",
"(",
"old_point",
")",
"old_point",
".",
"delete",
"if",
"old_mark",
"@mark",
".",
"loca... | Don't save Buffer.current. | [
"Don",
"t",
"save",
"Buffer",
".",
"current",
"."
] | dcea7a098b5e04335e73faee5616bd1678add7ec | https://github.com/shugo/textbringer/blob/dcea7a098b5e04335e73faee5616bd1678add7ec/lib/textbringer/buffer.rb#L813-L828 | train | Save the new point and mark to the new mark and mark as an exception. | [
30522,
13366,
3828,
1035,
26144,
2214,
1035,
2391,
1027,
2047,
1035,
2928,
2214,
1035,
2928,
1027,
1030,
2928,
1004,
1012,
4241,
2361,
2214,
1035,
5930,
1027,
1030,
3125,
1035,
5930,
4088,
10750,
5676,
2391,
1035,
2000,
1035,
2928,
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_datalake_analytics/lib/2015-10-01-preview/generated/azure_mgmt_datalake_analytics/account.rb | Azure::DataLakeAnalytics::Mgmt::V2015_10_01_preview.Account.list_storage_accounts_as_lazy | def list_storage_accounts_as_lazy(resource_group_name, account_name, filter:nil, top:nil, skip:nil, expand:nil, select:nil, orderby:nil, count:nil, search:nil, format:nil, custom_headers:nil)
response = list_storage_accounts_async(resource_group_name, account_name, filter:filter, top:top, skip:skip, expand:expand, select:select, orderby:orderby, count:count, search:search, format:format, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_storage_accounts_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_storage_accounts_as_lazy(resource_group_name, account_name, filter:nil, top:nil, skip:nil, expand:nil, select:nil, orderby:nil, count:nil, search:nil, format:nil, custom_headers:nil)
response = list_storage_accounts_async(resource_group_name, account_name, filter:filter, top:top, skip:skip, expand:expand, select:select, orderby:orderby, count:count, search:search, format:format, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_storage_accounts_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_storage_accounts_as_lazy",
"(",
"resource_group_name",
",",
"account_name",
",",
"filter",
":",
"nil",
",",
"top",
":",
"nil",
",",
"skip",
":",
"nil",
",",
"expand",
":",
"nil",
",",
"select",
":",
"nil",
",",
"orderby",
":",
"nil",
",",
"c... | Gets the first page of Azure Storage accounts, if any, linked to the
specified Data Lake Analytics account. The response includes a link to the
next page, if any.
@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 for
which to list Azure Storage accounts.
@param filter [String] The 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 expand [String] OData expansion. Expand related resources in line with
the retrieved resources, e.g. Categories/$expand=Products would expand
Product data in line with each Category entry. 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 search [String] A free form search. A free-text search expression to
match for whether a particular entry should be included in the feed, e.g.
Categories?$search=blue OR green. Optional.
@param format [String] The desired return format. Return the response in
particular formatxii without access to request headers for standard
content-type negotiation (e.g Orders?$format=json). Optional.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [DataLakeAnalyticsAccountListStorageAccountsResult] which provide
lazy access to pages of the response. | [
"Gets",
"the",
"first",
"page",
"of",
"Azure",
"Storage",
"accounts",
"if",
"any",
"linked",
"to",
"the",
"specified",
"Data",
"Lake",
"Analytics",
"account",
".",
"The",
"response",
"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/2015-10-01-preview/generated/azure_mgmt_datalake_analytics/account.rb#L2994-L3003 | train | Gets a list of all the Azure Storage accounts in a resource group. | [
30522,
13366,
2862,
1035,
5527,
1035,
6115,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
11307,
1024,
9152,
2140,
1010,
2327,
1024,
9152,
2140,
1010,
13558,
1024,
9152,
2140,
1010,
7818,
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... |
jekyll/jekyll | lib/jekyll/filters.rb | Jekyll.Filters.compare_property_vs_target | def compare_property_vs_target(property, target)
case target
when NilClass
return true if property.nil?
when Liquid::Expression::MethodLiteral # `empty` or `blank`
return true if Array(property).join == target.to_s
else
Array(property).each do |prop|
return true if prop.to_s == target.to_s
end
end
false
end | ruby | def compare_property_vs_target(property, target)
case target
when NilClass
return true if property.nil?
when Liquid::Expression::MethodLiteral # `empty` or `blank`
return true if Array(property).join == target.to_s
else
Array(property).each do |prop|
return true if prop.to_s == target.to_s
end
end
false
end | [
"def",
"compare_property_vs_target",
"(",
"property",
",",
"target",
")",
"case",
"target",
"when",
"NilClass",
"return",
"true",
"if",
"property",
".",
"nil?",
"when",
"Liquid",
"::",
"Expression",
"::",
"MethodLiteral",
"# `empty` or `blank`",
"return",
"true",
... | `where` filter helper | [
"where",
"filter",
"helper"
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/filters.rb#L329-L342 | train | Compare the property and target | [
30522,
13366,
12826,
1035,
3200,
1035,
5443,
1035,
4539,
1006,
3200,
1010,
4539,
1007,
2553,
4539,
2043,
9152,
15472,
27102,
2709,
2995,
2065,
3200,
1012,
9152,
2140,
1029,
2043,
6381,
1024,
1024,
3670,
1024,
1024,
4118,
22779,
7941,
1001,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/app/services/decidim/traceability.rb | Decidim.Traceability.perform_action! | def perform_action!(action, resource, author, extra_log_info = {})
PaperTrail.request(whodunnit: gid(author)) do
Decidim::ApplicationRecord.transaction do
result = block_given? ? yield : nil
loggable_resource = resource.is_a?(Class) ? result : resource
log(action, author, loggable_resource, extra_log_info)
return result
end
end
end | ruby | def perform_action!(action, resource, author, extra_log_info = {})
PaperTrail.request(whodunnit: gid(author)) do
Decidim::ApplicationRecord.transaction do
result = block_given? ? yield : nil
loggable_resource = resource.is_a?(Class) ? result : resource
log(action, author, loggable_resource, extra_log_info)
return result
end
end
end | [
"def",
"perform_action!",
"(",
"action",
",",
"resource",
",",
"author",
",",
"extra_log_info",
"=",
"{",
"}",
")",
"PaperTrail",
".",
"request",
"(",
"whodunnit",
":",
"gid",
"(",
"author",
")",
")",
"do",
"Decidim",
"::",
"ApplicationRecord",
".",
"trans... | Performs the given block and sets the author of the action.
It also logs the action with the given `action` parameter.
The action and the logging are run inside a transaction.
action - a String or Symbol representing the action performed
resource - An ActiveRecord instance that implements `Decidim::Traceable`
author - An object that implements `to_gid` or a String
extra_log_info - a Hash with extra info that will be saved to the log
Returns whatever the given block returns. | [
"Performs",
"the",
"given",
"block",
"and",
"sets",
"the",
"author",
"of",
"the",
"action",
".",
"It",
"also",
"logs",
"the",
"action",
"with",
"the",
"given",
"action",
"parameter",
".",
"The",
"action",
"and",
"the",
"logging",
"are",
"run",
"inside",
... | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/app/services/decidim/traceability.rb#L61-L70 | train | Perform an action on the given resource. | [
30522,
13366,
4685,
1035,
2895,
999,
1006,
2895,
1010,
7692,
1010,
3166,
1010,
4469,
1035,
8833,
1035,
18558,
1027,
1063,
1065,
1007,
3259,
6494,
4014,
1012,
5227,
1006,
2040,
27584,
3490,
2102,
1024,
21025,
2094,
1006,
3166,
1007,
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... |
thoughtbot/factory_bot | lib/factory_bot/definition_proxy.rb | FactoryBot.DefinitionProxy.association | def association(name, *options)
if block_given?
raise AssociationDefinitionError.new(
"Unexpected block passed to '#{name}' association "\
"in '#{@definition.name}' factory",
)
else
declaration = Declaration::Association.new(name, *options)
@definition.declare_attribute(declaration)
end
end | ruby | def association(name, *options)
if block_given?
raise AssociationDefinitionError.new(
"Unexpected block passed to '#{name}' association "\
"in '#{@definition.name}' factory",
)
else
declaration = Declaration::Association.new(name, *options)
@definition.declare_attribute(declaration)
end
end | [
"def",
"association",
"(",
"name",
",",
"*",
"options",
")",
"if",
"block_given?",
"raise",
"AssociationDefinitionError",
".",
"new",
"(",
"\"Unexpected block passed to '#{name}' association \"",
"\"in '#{@definition.name}' factory\"",
",",
")",
"else",
"declaration",
"=",
... | Adds an attribute that builds an association. The associated instance will
be built using the same build strategy as the parent instance.
Example:
factory :user do
name 'Joey'
end
factory :post do
association :author, factory: :user
end
Arguments:
* name: +Symbol+
The name of this attribute.
* options: +Hash+
Options:
* factory: +Symbol+ or +String+
The name of the factory to use when building the associated instance.
If no name is given, the name of the attribute is assumed to be the
name of the factory. For example, a "user" association will by
default use the "user" factory. | [
"Adds",
"an",
"attribute",
"that",
"builds",
"an",
"association",
".",
"The",
"associated",
"instance",
"will",
"be",
"built",
"using",
"the",
"same",
"build",
"strategy",
"as",
"the",
"parent",
"instance",
"."
] | 99ac02400fd56bd1872fc3ed84f81ea5e8f27737 | https://github.com/thoughtbot/factory_bot/blob/99ac02400fd56bd1872fc3ed84f81ea5e8f27737/lib/factory_bot/definition_proxy.rb#L151-L161 | train | Creates an association definition | [
30522,
13366,
2523,
1006,
2171,
1010,
1008,
7047,
1007,
2065,
3796,
1035,
2445,
1029,
5333,
2523,
3207,
16294,
22753,
2121,
29165,
1012,
2047,
1006,
1000,
9223,
3796,
2979,
2000,
1005,
1001,
1063,
2171,
1065,
1005,
2523,
1000,
1032,
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... |
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.details | def details(query, accept_language:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, country_code:nil, id:nil, modules:nil, market:nil, resolution:nil, safe_search:nil, set_lang:nil, text_decorations:nil, text_format:nil, custom_headers:nil)
response = details_async(query, accept_language:accept_language, user_agent:user_agent, client_id:client_id, client_ip:client_ip, location:location, country_code:country_code, id:id, modules:modules, market:market, 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 details(query, accept_language:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, country_code:nil, id:nil, modules:nil, market:nil, resolution:nil, safe_search:nil, set_lang:nil, text_decorations:nil, text_format:nil, custom_headers:nil)
response = details_async(query, accept_language:accept_language, user_agent:user_agent, client_id:client_id, client_ip:client_ip, location:location, country_code:country_code, id:id, modules:modules, market:market, 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",
"details",
"(",
"query",
",",
"accept_language",
":",
"nil",
",",
"user_agent",
":",
"nil",
",",
"client_id",
":",
"nil",
",",
"client_ip",
":",
"nil",
",",
"location",
":",
"nil",
",",
"country_code",
":",
"nil",
",",
"id",
":",
"nil",
",",
"... | The Video Detail Search API lets you search on Bing and get back insights
about a video, such as related videos. This section provides technical
details about the query parameters and headers that you use to request
insights of 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 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 identify the video to get insights of.
@param modules [Array<VideoInsightModule>] A comma-delimited list of insights
to request. The following are the possible case-insensitive values. All:
Return all available insights. RelatedVideos: Return a list of videos that
are similar to the video specified by the id query parameter. VideoResult:
Return the video that you're requesting insights of (this is the video that
you set the id query parameter to in your insights request). If you specify
an insight and there is no data for it, the response object does not include
the related field. For example, if you specify RelatedVideos and none exist,
the response does not include the relatedVideos field. Although the user's
query term is not required, you should always include it because it helps to
improve relevance and the results.
@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 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 [VideoDetails] operation results. | [
"The",
"Video",
"Detail",
"Search",
"API",
"lets",
"you",
"search",
"on",
"Bing",
"and",
"get",
"back",
"insights",
"about",
"a",
"video",
"such",
"as",
"related",
"videos",
".",
"This",
"section",
"provides",
"technical",
"details",
"about",
"the",
"query",... | 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#L1079-L1082 | train | Returns the list of the available terms of the specified query. | [
30522,
13366,
4751,
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... |
mojombo/chronic | lib/chronic/handlers.rb | Chronic.Handlers.handle_sd_sm_sy | def handle_sd_sm_sy(tokens, options)
new_tokens = [tokens[1], tokens[0], tokens[2]]
time_tokens = tokens.last(tokens.size - 3)
handle_sm_sd_sy(new_tokens + time_tokens, options)
end | ruby | def handle_sd_sm_sy(tokens, options)
new_tokens = [tokens[1], tokens[0], tokens[2]]
time_tokens = tokens.last(tokens.size - 3)
handle_sm_sd_sy(new_tokens + time_tokens, options)
end | [
"def",
"handle_sd_sm_sy",
"(",
"tokens",
",",
"options",
")",
"new_tokens",
"=",
"[",
"tokens",
"[",
"1",
"]",
",",
"tokens",
"[",
"0",
"]",
",",
"tokens",
"[",
"2",
"]",
"]",
"time_tokens",
"=",
"tokens",
".",
"last",
"(",
"tokens",
".",
"size",
"... | Handle scalar-day/scalar-month/scalar-year (endian little) | [
"Handle",
"scalar",
"-",
"day",
"/",
"scalar",
"-",
"month",
"/",
"scalar",
"-",
"year",
"(",
"endian",
"little",
")"
] | 2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c | https://github.com/mojombo/chronic/blob/2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c/lib/chronic/handlers.rb#L231-L235 | train | Handle the S - S - Sy tokens | [
30522,
13366,
5047,
1035,
17371,
1035,
15488,
1035,
25353,
1006,
19204,
2015,
1010,
7047,
1007,
2047,
1035,
19204,
2015,
1027,
1031,
19204,
2015,
1031,
1015,
1033,
1010,
19204,
2015,
1031,
1014,
1033,
1010,
19204,
2015,
1031,
1016,
1033,
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... |
gocardless/hutch | lib/hutch/broker.rb | Hutch.Broker.queue | def queue(name, arguments = {})
with_bunny_precondition_handler('queue') do
namespace = @config[:namespace].to_s.downcase.gsub(/[^-_:\.\w]/, "")
name = name.prepend(namespace + ":") if namespace.present?
channel.queue(name, durable: true, arguments: arguments)
end
end | ruby | def queue(name, arguments = {})
with_bunny_precondition_handler('queue') do
namespace = @config[:namespace].to_s.downcase.gsub(/[^-_:\.\w]/, "")
name = name.prepend(namespace + ":") if namespace.present?
channel.queue(name, durable: true, arguments: arguments)
end
end | [
"def",
"queue",
"(",
"name",
",",
"arguments",
"=",
"{",
"}",
")",
"with_bunny_precondition_handler",
"(",
"'queue'",
")",
"do",
"namespace",
"=",
"@config",
"[",
":namespace",
"]",
".",
"to_s",
".",
"downcase",
".",
"gsub",
"(",
"/",
"\\.",
"\\w",
"/",
... | Create / get a durable queue and apply namespace if it exists. | [
"Create",
"/",
"get",
"a",
"durable",
"queue",
"and",
"apply",
"namespace",
"if",
"it",
"exists",
"."
] | 9314b3b8c84abeb78170730757f3eb8ccc4f54c5 | https://github.com/gocardless/hutch/blob/9314b3b8c84abeb78170730757f3eb8ccc4f54c5/lib/hutch/broker.rb#L173-L179 | train | Queue a message to the server | [
30522,
13366,
24240,
1006,
2171,
1010,
9918,
1027,
1063,
1065,
1007,
2007,
1035,
16291,
1035,
3653,
8663,
20562,
1035,
28213,
1006,
1005,
24240,
1005,
1007,
2079,
3415,
15327,
1027,
1030,
30524,
1007,
2171,
1027,
2171,
1012,
17463,
10497,
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... |
watir/watir | lib/watir/js_execution.rb | Watir.JSExecution.fire_event | def fire_event(event_name)
event_name = event_name.to_s.sub(/^on/, '').downcase
element_call { execute_js :fireEvent, @element, event_name }
end | ruby | def fire_event(event_name)
event_name = event_name.to_s.sub(/^on/, '').downcase
element_call { execute_js :fireEvent, @element, event_name }
end | [
"def",
"fire_event",
"(",
"event_name",
")",
"event_name",
"=",
"event_name",
".",
"to_s",
".",
"sub",
"(",
"/",
"/",
",",
"''",
")",
".",
"downcase",
"element_call",
"{",
"execute_js",
":fireEvent",
",",
"@element",
",",
"event_name",
"}",
"end"
] | Simulates JavaScript events on element.
Note that you may omit "on" from event name.
@example
browser.button(name: "new_user_button").fire_event :click
browser.button(name: "new_user_button").fire_event "mousemove"
browser.button(name: "new_user_button").fire_event "onmouseover"
@param [String, Symbol] event_name | [
"Simulates",
"JavaScript",
"events",
"on",
"element",
".",
"Note",
"that",
"you",
"may",
"omit",
"on",
"from",
"event",
"name",
"."
] | 2d8db09811c6221ae401b85b2f61f5fa66e463a3 | https://github.com/watir/watir/blob/2d8db09811c6221ae401b85b2f61f5fa66e463a3/lib/watir/js_execution.rb#L22-L26 | train | Fire an event on the element. | [
30522,
13366,
2543,
1035,
2724,
1006,
30524,
2655,
1063,
15389,
1035,
1046,
2015,
1024,
2543,
18697,
3372,
1010,
1030,
5783,
1010,
2724,
1035,
2171,
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,
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... |
elastic/apm-agent-ruby | lib/elastic_apm/stacktrace_builder.rb | ElasticAPM.StacktraceBuilder.build_frame | def build_frame(cache, keys)
line, type = keys
abs_path, lineno, function, _module_name = parse_line(line)
frame = Stacktrace::Frame.new
frame.abs_path = abs_path
frame.filename = strip_load_path(abs_path)
frame.function = function
frame.lineno = lineno.to_i
frame.library_frame = library_frame?(config, abs_path)
line_count =
context_lines_for(config, type, library_frame: frame.library_frame)
frame.build_context line_count
cache[[line, type]] = frame
end | ruby | def build_frame(cache, keys)
line, type = keys
abs_path, lineno, function, _module_name = parse_line(line)
frame = Stacktrace::Frame.new
frame.abs_path = abs_path
frame.filename = strip_load_path(abs_path)
frame.function = function
frame.lineno = lineno.to_i
frame.library_frame = library_frame?(config, abs_path)
line_count =
context_lines_for(config, type, library_frame: frame.library_frame)
frame.build_context line_count
cache[[line, type]] = frame
end | [
"def",
"build_frame",
"(",
"cache",
",",
"keys",
")",
"line",
",",
"type",
"=",
"keys",
"abs_path",
",",
"lineno",
",",
"function",
",",
"_module_name",
"=",
"parse_line",
"(",
"line",
")",
"frame",
"=",
"Stacktrace",
"::",
"Frame",
".",
"new",
"frame",
... | rubocop:disable Metrics/AbcSize, Metrics/MethodLength | [
"rubocop",
":",
"disable",
"Metrics",
"/",
"AbcSize",
"Metrics",
"/",
"MethodLength"
] | 82190d1a9ba22af3b2c2c6fe6d23cc471f2e7ff6 | https://github.com/elastic/apm-agent-ruby/blob/82190d1a9ba22af3b2c2c6fe6d23cc471f2e7ff6/lib/elastic_apm/stacktrace_builder.rb#L33-L49 | train | Build a frame from the given keys | [
30522,
13366,
3857,
1035,
4853,
1006,
17053,
1010,
6309,
1007,
2240,
1010,
2828,
1027,
6309,
14689,
1035,
4130,
1010,
17517,
2080,
1010,
3853,
1010,
1035,
11336,
1035,
30524,
4853,
1012,
5371,
18442,
1027,
6167,
1035,
7170,
1035,
4130,
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/sprockets | lib/sprockets/loader.rb | Sprockets.Loader.asset_from_cache | def asset_from_cache(key)
asset = cache.get(key, true)
if asset
asset[:uri] = expand_from_root(asset[:uri])
asset[:load_path] = expand_from_root(asset[:load_path])
asset[:filename] = expand_from_root(asset[:filename])
asset[:metadata][:included].map! { |uri| expand_from_root(uri) } if asset[:metadata][:included]
asset[:metadata][:links].map! { |uri| expand_from_root(uri) } if asset[:metadata][:links]
asset[:metadata][:stubbed].map! { |uri| expand_from_root(uri) } if asset[:metadata][:stubbed]
asset[:metadata][:required].map! { |uri| expand_from_root(uri) } if asset[:metadata][:required]
asset[:metadata][:to_load].map! { |uri| expand_from_root(uri) } if asset[:metadata][:to_load]
asset[:metadata][:to_link].map! { |uri| expand_from_root(uri) } if asset[:metadata][:to_link]
asset[:metadata][:dependencies].map! { |uri| uri.start_with?("file-digest://") ? expand_from_root(uri) : uri } if asset[:metadata][:dependencies]
asset[:metadata].each_key do |k|
next unless k =~ /_dependencies\z/
asset[:metadata][k].map! { |uri| expand_from_root(uri) }
end
end
asset
end | ruby | def asset_from_cache(key)
asset = cache.get(key, true)
if asset
asset[:uri] = expand_from_root(asset[:uri])
asset[:load_path] = expand_from_root(asset[:load_path])
asset[:filename] = expand_from_root(asset[:filename])
asset[:metadata][:included].map! { |uri| expand_from_root(uri) } if asset[:metadata][:included]
asset[:metadata][:links].map! { |uri| expand_from_root(uri) } if asset[:metadata][:links]
asset[:metadata][:stubbed].map! { |uri| expand_from_root(uri) } if asset[:metadata][:stubbed]
asset[:metadata][:required].map! { |uri| expand_from_root(uri) } if asset[:metadata][:required]
asset[:metadata][:to_load].map! { |uri| expand_from_root(uri) } if asset[:metadata][:to_load]
asset[:metadata][:to_link].map! { |uri| expand_from_root(uri) } if asset[:metadata][:to_link]
asset[:metadata][:dependencies].map! { |uri| uri.start_with?("file-digest://") ? expand_from_root(uri) : uri } if asset[:metadata][:dependencies]
asset[:metadata].each_key do |k|
next unless k =~ /_dependencies\z/
asset[:metadata][k].map! { |uri| expand_from_root(uri) }
end
end
asset
end | [
"def",
"asset_from_cache",
"(",
"key",
")",
"asset",
"=",
"cache",
".",
"get",
"(",
"key",
",",
"true",
")",
"if",
"asset",
"asset",
"[",
":uri",
"]",
"=",
"expand_from_root",
"(",
"asset",
"[",
":uri",
"]",
")",
"asset",
"[",
":load_path",
"]",
"=",... | Internal: Load asset hash from cache
key - A String containing lookup information for an asset
This method converts all "compressed" paths to absolute paths.
Returns a hash of values representing an asset | [
"Internal",
":",
"Load",
"asset",
"hash",
"from",
"cache"
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/loader.rb#L74-L94 | train | Get the asset from the cache | [
30522,
13366,
11412,
1035,
2013,
1035,
17053,
1006,
3145,
1007,
11412,
1027,
17053,
1012,
2131,
1006,
3145,
1010,
2995,
1007,
2065,
11412,
11412,
1031,
1024,
24471,
2072,
1033,
1027,
7818,
1035,
2013,
1035,
7117,
1006,
11412,
1031,
1024,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.delete_unlabelled_utterance | def delete_unlabelled_utterance(app_id, version_id, utterance, custom_headers:nil)
response = delete_unlabelled_utterance_async(app_id, version_id, utterance, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def delete_unlabelled_utterance(app_id, version_id, utterance, custom_headers:nil)
response = delete_unlabelled_utterance_async(app_id, version_id, utterance, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"delete_unlabelled_utterance",
"(",
"app_id",
",",
"version_id",
",",
"utterance",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_unlabelled_utterance_async",
"(",
"app_id",
",",
"version_id",
",",
"utterance",
",",
"custom_headers",
":custom_... | Deleted an unlabelled utterance in a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param utterance [String] The utterance text to delete.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OperationStatus] operation results. | [
"Deleted",
"an",
"unlabelled",
"utterance",
"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/versions.rb#L756-L759 | train | Deletes an unlabelled utterance. | [
30522,
13366,
3972,
12870,
1035,
4895,
20470,
21148,
1035,
14395,
6651,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
14395,
6651,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
1035,
4895,
20470,
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... |
piotrmurach/github | lib/github_api/client/git_data/tags.rb | Github.Client::GitData::Tags.create | def create(*args)
arguments(args, required: [:user, :repo]) do
permit VALID_TAG_PARAM_NAMES
assert_values VALID_TAG_PARAM_VALUES
end
post_request("/repos/#{arguments.user}/#{arguments.repo}/git/tags", arguments.params)
end | ruby | def create(*args)
arguments(args, required: [:user, :repo]) do
permit VALID_TAG_PARAM_NAMES
assert_values VALID_TAG_PARAM_VALUES
end
post_request("/repos/#{arguments.user}/#{arguments.repo}/git/tags", arguments.params)
end | [
"def",
"create",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
"]",
")",
"do",
"permit",
"VALID_TAG_PARAM_NAMES",
"assert_values",
"VALID_TAG_PARAM_VALUES",
"end",
"post_request",
"(",
"\"/repos/#{arguments.user... | Create a tag object
Note that creating a tag object does not create the reference that
makes a tag in Git. If you want to create an annotated tag in Git,
you have to do this call to create the tag object, and then create
the refs/tags/[tag] reference. If you want to create a lightweight
tag, you simply have to create the reference -
this call would be unnecessary.
@param [Hash] params
@input params [String] :tag
The tag
@input params [String] :message
The tag message
@input params [String] :object
The SHA of the git object this is tagging
@input params [String] :type
The type of the object we're tagging.
Normally this is a commit but it can also be a tree or a blob
@input params [Hash] :tagger
A hash with information about the individual creating the tag.
The tagger hash contains the following keys:
@input tagger [String] :name
The name of the author of the tag
@input tagger [String] :email
The email of the author of the tag
@input tagger [String] :date
When this object was tagged. This is a timestamp in ISO 8601
format: YYYY-MM-DDTHH:MM:SSZ.
@xample
github = Github.new
github.git_data.tags.create 'user-name', 'repo-name',
tag: "v0.0.1",
message: "initial version\n",
type: "commit",
object: "c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c",
tagger: {
name: "Scott Chacon",
email: "schacon@gmail.com",
date: "2011-06-17T14:53:3"
}
@api public | [
"Create",
"a",
"tag",
"object"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/git_data/tags.rb#L86-L93 | train | Create a tag | [
30522,
13366,
3443,
1006,
1008,
12098,
5620,
1007,
9918,
1006,
12098,
5620,
1010,
3223,
1024,
1031,
1024,
5310,
1010,
1024,
16360,
2080,
1033,
1007,
2079,
9146,
9398,
1035,
6415,
1035,
11498,
2213,
1035,
3415,
20865,
1035,
5300,
9398,
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... |
meew0/discordrb | lib/discordrb/events/message.rb | Discordrb::Events.MessageEvent.send_file | def send_file(file, caption: nil, filename: nil, spoiler: nil)
@message.channel.send_file(file, caption: caption, filename: filename, spoiler: spoiler)
end | ruby | def send_file(file, caption: nil, filename: nil, spoiler: nil)
@message.channel.send_file(file, caption: caption, filename: filename, spoiler: spoiler)
end | [
"def",
"send_file",
"(",
"file",
",",
"caption",
":",
"nil",
",",
"filename",
":",
"nil",
",",
"spoiler",
":",
"nil",
")",
"@message",
".",
"channel",
".",
"send_file",
"(",
"file",
",",
"caption",
":",
"caption",
",",
"filename",
":",
"filename",
",",... | Sends file with a caption to the channel this message was sent in, right now.
It is usually preferable to use {#<<} and {#attach_file} instead
because it avoids rate limiting problems
@param file [File] The file to send to the channel
@param caption [String] The caption attached to the file
@param filename [String] Overrides the filename of the uploaded file
@param spoiler [true, false] Whether or not this file should appear as a spoiler.
@return [Discordrb::Message] the message that was sent
@example Send a file from disk
event.send_file(File.open('rubytaco.png', 'r')) | [
"Sends",
"file",
"with",
"a",
"caption",
"to",
"the",
"channel",
"this",
"message",
"was",
"sent",
"in",
"right",
"now",
".",
"It",
"is",
"usually",
"preferable",
"to",
"use",
"{",
"#<<",
"}",
"and",
"{",
"#attach_file",
"}",
"instead",
"because",
"it",
... | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/events/message.rb#L133-L135 | train | Send a file to the channel | [
30522,
13366,
4604,
1035,
5371,
1006,
5371,
1010,
14408,
3258,
1024,
9152,
2140,
1010,
5371,
18442,
1024,
9152,
2140,
1010,
27594,
2121,
1024,
9152,
2140,
1007,
1030,
4471,
1012,
3149,
1012,
4604,
1035,
5371,
1006,
5371,
1010,
14408,
3258,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/2017-03-30/generated/azure_mgmt_network/network_interfaces.rb | Azure::Network::Mgmt::V2017_03_30.NetworkInterfaces.list_virtual_machine_scale_set_ip_configurations | def list_virtual_machine_scale_set_ip_configurations(resource_group_name, virtual_machine_scale_set_name, virtualmachine_index, network_interface_name, expand:nil, custom_headers:nil)
first_page = list_virtual_machine_scale_set_ip_configurations_as_lazy(resource_group_name, virtual_machine_scale_set_name, virtualmachine_index, network_interface_name, expand:expand, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_virtual_machine_scale_set_ip_configurations(resource_group_name, virtual_machine_scale_set_name, virtualmachine_index, network_interface_name, expand:nil, custom_headers:nil)
first_page = list_virtual_machine_scale_set_ip_configurations_as_lazy(resource_group_name, virtual_machine_scale_set_name, virtualmachine_index, network_interface_name, expand:expand, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_virtual_machine_scale_set_ip_configurations",
"(",
"resource_group_name",
",",
"virtual_machine_scale_set_name",
",",
"virtualmachine_index",
",",
"network_interface_name",
",",
"expand",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"l... | Get the specified network interface ip configuration in a virtual machine
scale set.
@param resource_group_name [String] The name of the resource group.
@param virtual_machine_scale_set_name [String] The name of the virtual
machine scale set.
@param virtualmachine_index [String] The virtual machine index.
@param network_interface_name [String] The name of the network interface.
@param expand [String] Expands referenced resources.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<NetworkInterfaceIPConfiguration>] operation results. | [
"Get",
"the",
"specified",
"network",
"interface",
"ip",
"configuration",
"in",
"a",
"virtual",
"machine",
"scale",
"set",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2017-03-30/generated/azure_mgmt_network/network_interfaces.rb#L345-L348 | train | Gets all the virtual machine IP configurations for a network interface. | [
30522,
13366,
2862,
1035,
7484,
1035,
3698,
1035,
4094,
1035,
2275,
1035,
12997,
1035,
22354,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7484,
1035,
3698,
1035,
4094,
1035,
2275,
1035,
2171,
1010,
7484,
22911,
14014,
1035,
5950,
1010,
2897,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
TrestleAdmin/trestle | app/helpers/trestle/timestamp_helper.rb | Trestle.TimestampHelper.timestamp | def timestamp(time, options={})
return unless time
classes = ["timestamp", options[:class]].compact
precision = options.fetch(:precision) { Trestle.config.timestamp_precision }
date_format = options.fetch(:date_format) { :trestle_date }
time_format = options.fetch(:time_format) { precision == :seconds ? :trestle_time_with_seconds : :trestle_time }
time_tag(time, class: classes) do
safe_join([
l(time, format: date_format, default: proc { |date| "#{date.day.ordinalize} %b %Y" }),
content_tag(:small, l(time, format: time_format, default: "%l:%M:%S %p"))
], "\n")
end
end | ruby | def timestamp(time, options={})
return unless time
classes = ["timestamp", options[:class]].compact
precision = options.fetch(:precision) { Trestle.config.timestamp_precision }
date_format = options.fetch(:date_format) { :trestle_date }
time_format = options.fetch(:time_format) { precision == :seconds ? :trestle_time_with_seconds : :trestle_time }
time_tag(time, class: classes) do
safe_join([
l(time, format: date_format, default: proc { |date| "#{date.day.ordinalize} %b %Y" }),
content_tag(:small, l(time, format: time_format, default: "%l:%M:%S %p"))
], "\n")
end
end | [
"def",
"timestamp",
"(",
"time",
",",
"options",
"=",
"{",
"}",
")",
"return",
"unless",
"time",
"classes",
"=",
"[",
"\"timestamp\"",
",",
"options",
"[",
":class",
"]",
"]",
".",
"compact",
"precision",
"=",
"options",
".",
"fetch",
"(",
":precision",
... | Renders a Time object as a formatted timestamp (using a <time> tag)
time - The Time object to format.
options - Hash of options (default: {}):
:class - Additional HTML classes to add to the <time> tag.
:precision - Time precision, either :minutes or :seconds (default: :minutes).
:date_format - I18n date format to use for the date (default: :trestle_date).
:time_format - I18n time format to use for the time (default: :trestle_time).
Examples
<%= timestamp(article.created_at) %>
<%= timestamp(Time.current, class: "timestamp-inline", precision: :seconds) %>
Returns the HTML representation of the given Time. | [
"Renders",
"a",
"Time",
"object",
"as",
"a",
"formatted",
"timestamp",
"(",
"using",
"a",
"<time",
">",
"tag",
")"
] | fd5b8aeb5077e13d539cb5ddd99db1dd279f19ca | https://github.com/TrestleAdmin/trestle/blob/fd5b8aeb5077e13d539cb5ddd99db1dd279f19ca/app/helpers/trestle/timestamp_helper.rb#L19-L33 | train | Returns the time tag for the given time | [
30522,
13366,
2335,
15464,
2361,
1006,
2051,
1010,
7047,
1027,
1063,
1065,
1007,
2709,
4983,
2051,
4280,
1027,
1031,
1000,
2335,
15464,
2361,
1000,
1010,
7047,
1031,
1024,
2465,
1033,
1033,
1012,
9233,
11718,
1027,
7047,
1012,
18584,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb | Aws::EC2.Resource.create_security_group | def create_security_group(options = {})
resp = @client.create_security_group(options)
SecurityGroup.new(
id: resp.data.group_id,
client: @client
)
end | ruby | def create_security_group(options = {})
resp = @client.create_security_group(options)
SecurityGroup.new(
id: resp.data.group_id,
client: @client
)
end | [
"def",
"create_security_group",
"(",
"options",
"=",
"{",
"}",
")",
"resp",
"=",
"@client",
".",
"create_security_group",
"(",
"options",
")",
"SecurityGroup",
".",
"new",
"(",
"id",
":",
"resp",
".",
"data",
".",
"group_id",
",",
"client",
":",
"@client",... | @example Request syntax with placeholder values
securitygroup = ec2.create_security_group({
description: "String", # required
group_name: "String", # required
vpc_id: "String",
dry_run: false,
})
@param [Hash] options ({})
@option options [required, String] :description
A description for the security group. This is informational only.
Constraints: Up to 255 characters in length
Constraints for EC2-Classic: ASCII characters
Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and
.\_-:/()#,@\[\]+=&;\\\{\\}!$*
@option options [required, String] :group_name
The name of the security group.
Constraints: Up to 255 characters in length. Cannot start with `sg-`.
Constraints for EC2-Classic: ASCII characters
Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and
.\_-:/()#,@\[\]+=&;\\\{\\}!$*
@option options [String] :vpc_id
\[EC2-VPC\] The ID of the VPC. Required for EC2-VPC.
@option options [Boolean] :dry_run
Checks whether you have the required permissions for the action,
without actually making the request, and provides an error response.
If you have the required permissions, the error response is
`DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
@return [SecurityGroup] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb#L715-L721 | train | Creates a new security group | [
30522,
13366,
3443,
1035,
3036,
1035,
2177,
1006,
7047,
1027,
1063,
1065,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
3443,
1035,
3036,
1035,
2177,
1006,
7047,
1007,
3036,
17058,
1012,
2047,
1006,
8909,
1024,
24501,
2361,
1012,
2951,
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... |
rmosolgo/graphql-ruby | lib/graphql/analysis/analyze_query.rb | GraphQL.Analysis.analyze_query | def analyze_query(query, analyzers, multiplex_states: [])
query.trace("analyze_query", { query: query }) do
analyzers_to_run = analyzers.select do |analyzer|
if analyzer.respond_to?(:analyze?)
analyzer.analyze?(query)
else
true
end
end
reducer_states = analyzers_to_run.map { |r| ReducerState.new(r, query) } + multiplex_states
irep = query.internal_representation
irep.operation_definitions.each do |name, op_node|
reduce_node(op_node, reducer_states)
end
reducer_states.map(&:finalize_reducer)
end
end | ruby | def analyze_query(query, analyzers, multiplex_states: [])
query.trace("analyze_query", { query: query }) do
analyzers_to_run = analyzers.select do |analyzer|
if analyzer.respond_to?(:analyze?)
analyzer.analyze?(query)
else
true
end
end
reducer_states = analyzers_to_run.map { |r| ReducerState.new(r, query) } + multiplex_states
irep = query.internal_representation
irep.operation_definitions.each do |name, op_node|
reduce_node(op_node, reducer_states)
end
reducer_states.map(&:finalize_reducer)
end
end | [
"def",
"analyze_query",
"(",
"query",
",",
"analyzers",
",",
"multiplex_states",
":",
"[",
"]",
")",
"query",
".",
"trace",
"(",
"\"analyze_query\"",
",",
"{",
"query",
":",
"query",
"}",
")",
"do",
"analyzers_to_run",
"=",
"analyzers",
".",
"select",
"do"... | Visit `query`'s internal representation, calling `analyzers` along the way.
- First, query analyzers are filtered down by calling `.analyze?(query)`, if they respond to that method
- Then, query analyzers are initialized by calling `.initial_value(query)`, if they respond to that method.
- Then, they receive `.call(memo, visit_type, irep_node)`, where visit type is `:enter` or `:leave`.
- Last, they receive `.final_value(memo)`, if they respond to that method.
It returns an array of final `memo` values in the order that `analyzers` were passed in.
@param query [GraphQL::Query]
@param analyzers [Array<#call>] Objects that respond to `#call(memo, visit_type, irep_node)`
@return [Array<Any>] Results from those analyzers | [
"Visit",
"query",
"s",
"internal",
"representation",
"calling",
"analyzers",
"along",
"the",
"way",
"."
] | d5be13a816f220b9efbabeaa69a3e56fedf311f5 | https://github.com/rmosolgo/graphql-ruby/blob/d5be13a816f220b9efbabeaa69a3e56fedf311f5/lib/graphql/analysis/analyze_query.rb#L40-L60 | train | Analyzes the query | [
30522,
13366,
17908,
1035,
23032,
1006,
23032,
1010,
17908,
2869,
1010,
3674,
2595,
1035,
2163,
1024,
1031,
1033,
1007,
23032,
1012,
7637,
1006,
1000,
17908,
1035,
23032,
1000,
1010,
1063,
23032,
1024,
23032,
1065,
1007,
2079,
17908,
2869,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-07-01/generated/azure_mgmt_network/connection_monitors.rb | Azure::Network::Mgmt::V2018_07_01.ConnectionMonitors.query_async | def query_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
# Send request
promise = begin_query_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Network::Mgmt::V2018_07_01::Models::ConnectionMonitorQueryResult.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 query_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
# Send request
promise = begin_query_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Network::Mgmt::V2018_07_01::Models::ConnectionMonitorQueryResult.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",
"query_async",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"connection_monitor_name",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_query_async",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"con... | @param resource_group_name [String] The name of the resource group containing
Network Watcher.
@param network_watcher_name [String] The name of the Network Watcher
resource.
@param connection_monitor_name [String] The name given to the connection
monitor.
@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",
"]",
"The",
"name",
"of",
"the",
"resource",
"group",
"containing",
"Network",
"Watcher",
".",
"@param",
"network_watcher_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"Network",
"Watcher",
"resource",
"."... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/connection_monitors.rb#L342-L358 | train | Gets the list of connection monitor events. | [
30522,
13366,
23032,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2897,
1035,
3422,
2121,
1035,
2171,
1010,
4434,
1035,
8080,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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_cdn/lib/2015-06-01/generated/azure_mgmt_cdn/custom_domains.rb | Azure::CDN::Mgmt::V2015_06_01.CustomDomains.list_by_endpoint | def list_by_endpoint(endpoint_name, profile_name, resource_group_name, custom_headers:nil)
response = list_by_endpoint_async(endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_endpoint(endpoint_name, profile_name, resource_group_name, custom_headers:nil)
response = list_by_endpoint_async(endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_endpoint",
"(",
"endpoint_name",
",",
"profile_name",
",",
"resource_group_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_endpoint_async",
"(",
"endpoint_name",
",",
"profile_name",
",",
"resource_group_name",
",",
"custom_heade... | Lists the existing CDN custom domains within an endpoint.
@param endpoint_name [String] Name of the endpoint within the CDN profile.
@param profile_name [String] Name of the CDN profile within the resource
group.
@param resource_group_name [String] Name of the resource group within the
Azure subscription.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [CustomDomainListResult] operation results. | [
"Lists",
"the",
"existing",
"CDN",
"custom",
"domains",
"within",
"an",
"endpoint",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_cdn/lib/2015-06-01/generated/azure_mgmt_cdn/custom_domains.rb#L40-L43 | train | Gets the list of all the available network endpoints. | [
30522,
13366,
2862,
1035,
2011,
1035,
2203,
8400,
1006,
2203,
8400,
1035,
2171,
1010,
6337,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
2203,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/2015-05-01-preview/generated/azure_mgmt_sql/database_recommended_actions.rb | Azure::SQL::Mgmt::V2015_05_01_preview.DatabaseRecommendedActions.get | def get(resource_group_name, server_name, database_name, advisor_name, recommended_action_name, custom_headers:nil)
response = get_async(resource_group_name, server_name, database_name, advisor_name, recommended_action_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get(resource_group_name, server_name, database_name, advisor_name, recommended_action_name, custom_headers:nil)
response = get_async(resource_group_name, server_name, database_name, advisor_name, recommended_action_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get",
"(",
"resource_group_name",
",",
"server_name",
",",
"database_name",
",",
"advisor_name",
",",
"recommended_action_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"datab... | Gets a database recommended action.
@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 database.
@param advisor_name [String] The name of the Database Advisor.
@param recommended_action_name [String] The name of Database Recommended
Action.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [RecommendedAction] operation results. | [
"Gets",
"a",
"database",
"recommended",
"action",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2015-05-01-preview/generated/azure_mgmt_sql/database_recommended_actions.rb#L165-L168 | train | Gets the specified database advisor and recommended action. | [
30522,
13366,
2131,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
7809,
1035,
2171,
1010,
8619,
1035,
2171,
1010,
6749,
1035,
2895,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
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... |
samvera/hyrax | app/controllers/hyrax/file_sets_controller.rb | Hyrax.FileSetsController.update | def update
if attempt_update
after_update_response
else
after_update_failure_response
end
rescue RSolr::Error::Http => error
flash[:error] = error.message
logger.error "FileSetsController::update rescued #{error.class}\n\t#{error.message}\n #{error.backtrace.join("\n")}\n\n"
render action: 'edit'
end | ruby | def update
if attempt_update
after_update_response
else
after_update_failure_response
end
rescue RSolr::Error::Http => error
flash[:error] = error.message
logger.error "FileSetsController::update rescued #{error.class}\n\t#{error.message}\n #{error.backtrace.join("\n")}\n\n"
render action: 'edit'
end | [
"def",
"update",
"if",
"attempt_update",
"after_update_response",
"else",
"after_update_failure_response",
"end",
"rescue",
"RSolr",
"::",
"Error",
"::",
"Http",
"=>",
"error",
"flash",
"[",
":error",
"]",
"=",
"error",
".",
"message",
"logger",
".",
"error",
"\... | PATCH /concern/file_sets/:id | [
"PATCH",
"/",
"concern",
"/",
"file_sets",
"/",
":",
"id"
] | e2b4f56e829a53b1f11296324736e9d5b8c9ee5f | https://github.com/samvera/hyrax/blob/e2b4f56e829a53b1f11296324736e9d5b8c9ee5f/app/controllers/hyrax/file_sets_controller.rb#L55-L65 | train | Update the file sets | [
30522,
13366,
10651,
2065,
3535,
1035,
10651,
2044,
1035,
10651,
1035,
3433,
2842,
2044,
1035,
10651,
1035,
4945,
1035,
3433,
2203,
5343,
12667,
4747,
2099,
1024,
1024,
7561,
1024,
1024,
8299,
1027,
1028,
7561,
5956,
1031,
1024,
7561,
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... |
samvera/hyrax | spec/support/selectors.rb | Selectors.Dashboard.select_user | def select_user(user, role = 'Depositor')
first('a.select2-choice').click
find('.select2-input').set(user.user_key)
sleep 1
first('div.select2-result-label').click
within('div.add-users') do
select(role)
find('input.edit-collection-add-sharing-button').click
end
end | ruby | def select_user(user, role = 'Depositor')
first('a.select2-choice').click
find('.select2-input').set(user.user_key)
sleep 1
first('div.select2-result-label').click
within('div.add-users') do
select(role)
find('input.edit-collection-add-sharing-button').click
end
end | [
"def",
"select_user",
"(",
"user",
",",
"role",
"=",
"'Depositor'",
")",
"first",
"(",
"'a.select2-choice'",
")",
".",
"click",
"find",
"(",
"'.select2-input'",
")",
".",
"set",
"(",
"user",
".",
"user_key",
")",
"sleep",
"1",
"first",
"(",
"'div.select2-r... | For use with javascript user selector that allows for searching for an existing user
and granting them permission to an object.
@param [User] user to select
@param [String] role granting the user permission (e.g. 'Manager' | 'Depositor' | 'Viewer') | [
"For",
"use",
"with",
"javascript",
"user",
"selector",
"that",
"allows",
"for",
"searching",
"for",
"an",
"existing",
"user",
"and",
"granting",
"them",
"permission",
"to",
"an",
"object",
"."
] | e2b4f56e829a53b1f11296324736e9d5b8c9ee5f | https://github.com/samvera/hyrax/blob/e2b4f56e829a53b1f11296324736e9d5b8c9ee5f/spec/support/selectors.rb#L13-L22 | train | Select a user | [
30522,
13366,
7276,
1035,
5310,
1006,
5310,
1010,
2535,
1027,
1005,
12816,
2953,
1005,
1007,
2034,
1006,
1005,
1037,
1012,
7276,
2475,
1011,
3601,
1005,
1007,
1012,
11562,
2424,
1006,
1005,
1012,
7276,
2475,
1011,
7953,
1005,
1007,
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 | 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_partition_health | def get_partition_health(partition_id, events_health_state_filter:0, replicas_health_state_filter:0, exclude_health_statistics:false, timeout:60, custom_headers:nil)
response = get_partition_health_async(partition_id, events_health_state_filter:events_health_state_filter, replicas_health_state_filter:replicas_health_state_filter, exclude_health_statistics:exclude_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_partition_health(partition_id, events_health_state_filter:0, replicas_health_state_filter:0, exclude_health_statistics:false, timeout:60, custom_headers:nil)
response = get_partition_health_async(partition_id, events_health_state_filter:events_health_state_filter, replicas_health_state_filter:replicas_health_state_filter, exclude_health_statistics:exclude_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_partition_health",
"(",
"partition_id",
",",
"events_health_state_filter",
":",
"0",
",",
"replicas_health_state_filter",
":",
"0",
",",
"exclude_health_statistics",
":",
"false",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"respon... | Gets the health of the specified Service Fabric partition.
Gets the health information of the specified partition.
Use EventsHealthStateFilter to filter the collection of health events
reported on the service based on the health state.
Use ReplicasHealthStateFilter to filter the collection of ReplicaHealthState
objects on the partition.
If you specify a partition that does not exist in the health store, this
request returns an error.
@param partition_id The identity of the partition.
@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 replicas_health_state_filter [Integer] Allows filtering the collection
of ReplicaHealthState objects on the partition. The value can be obtained
from members or bitwise operations on members of HealthStateFilter. Only
replicas that match the filter will be returned. All replicas will be used to
evaluate the aggregated health state. If not specified, all entries will be
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) will be returned. The possible values for this
parameter include integer value of one of the following health states.
- 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 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 [PartitionHealth] operation results. | [
"Gets",
"the",
"health",
"of",
"the",
"specified",
"Service",
"Fabric",
"partition",
"."
] | 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#L12253-L12256 | train | Gets the health of the specified partition. | [
30522,
13366,
2131,
1035,
13571,
1035,
2740,
1006,
13571,
1035,
8909,
1010,
2824,
1035,
2740,
1035,
2110,
1035,
11307,
1024,
1014,
1010,
15059,
2015,
1035,
2740,
1035,
2110,
1035,
11307,
1024,
1014,
1010,
23329,
1035,
2740,
1035,
6747,
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_consumption/lib/2018-06-30/generated/azure_mgmt_consumption/usage_details.rb | Azure::Consumption::Mgmt::V2018_06_30.UsageDetails.list_by_billing_period_next | def list_by_billing_period_next(next_page_link, custom_headers:nil)
response = list_by_billing_period_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_billing_period_next(next_page_link, custom_headers:nil)
response = list_by_billing_period_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_billing_period_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_billing_period_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unle... | Lists the usage details for a scope by billing period. Usage details are
available via this API only for May 1, 2014 or later.
@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 [UsageDetailsListResult] operation results. | [
"Lists",
"the",
"usage",
"details",
"for",
"a",
"scope",
"by",
"billing",
"period",
".",
"Usage",
"details",
"are",
"available",
"via",
"this",
"API",
"only",
"for",
"May",
"1",
"2014",
"or",
"later",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_consumption/lib/2018-06-30/generated/azure_mgmt_consumption/usage_details.rb#L1328-L1331 | train | Gets the list of a specific language. | [
30522,
13366,
2862,
1035,
2011,
1035,
25640,
1035,
2558,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
25640,
1035,
2558,
1035,
2279,
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 | management/azure_mgmt_machine_learning_services/lib/2018-03-01-preview/generated/azure_mgmt_machine_learning_services/machine_learning_compute.rb | Azure::MachineLearningServices::Mgmt::V2018_03_01_preview.MachineLearningCompute.create_or_update_async | def create_or_update_async(resource_group_name, workspace_name, compute_name, parameters, custom_headers:nil)
# Send request
promise = begin_create_or_update_async(resource_group_name, workspace_name, compute_name, parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::MachineLearningServices::Mgmt::V2018_03_01_preview::Models::ComputeResource.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_or_update_async(resource_group_name, workspace_name, compute_name, parameters, custom_headers:nil)
# Send request
promise = begin_create_or_update_async(resource_group_name, workspace_name, compute_name, parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::MachineLearningServices::Mgmt::V2018_03_01_preview::Models::ComputeResource.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_or_update_async",
"(",
"resource_group_name",
",",
"workspace_name",
",",
"compute_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"workspac... | @param resource_group_name [String] Name of the resource group in which
workspace is located.
@param workspace_name [String] Name of Azure Machine Learning workspace.
@param compute_name [String] Name of the Azure Machine Learning compute.
@param parameters [ComputeResource] Payload with Machine Learning compute
definition.
@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",
"workspace",
"is",
"located",
".",
"@param",
"workspace_name",
"[",
"String",
"]",
"Name",
"of",
"Azure",
"Machine",
"Learning",
"workspace",
".",
"@p... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_machine_learning_services/lib/2018-03-01-preview/generated/azure_mgmt_machine_learning_services/machine_learning_compute.rb#L259-L275 | train | Creates or updates a compute. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2573,
15327,
1035,
2171,
1010,
24134,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
github/linguist | samples/Ruby/sinatra.rb | Sinatra.Helpers.stream | def stream(keep_open = false)
scheduler = env['async.callback'] ? EventMachine : Stream
current = @params.dup
body Stream.new(scheduler, keep_open) { |out| with_params(current) { yield(out) } }
end | ruby | def stream(keep_open = false)
scheduler = env['async.callback'] ? EventMachine : Stream
current = @params.dup
body Stream.new(scheduler, keep_open) { |out| with_params(current) { yield(out) } }
end | [
"def",
"stream",
"(",
"keep_open",
"=",
"false",
")",
"scheduler",
"=",
"env",
"[",
"'async.callback'",
"]",
"?",
"EventMachine",
":",
"Stream",
"current",
"=",
"@params",
".",
"dup",
"body",
"Stream",
".",
"new",
"(",
"scheduler",
",",
"keep_open",
")",
... | Allows to start sending data to the client even though later parts of
the response body have not yet been generated.
The close parameter specifies whether Stream#close should be called
after the block has been executed. This is only relevant for evented
servers like Thin or Rainbows. | [
"Allows",
"to",
"start",
"sending",
"data",
"to",
"the",
"client",
"even",
"though",
"later",
"parts",
"of",
"the",
"response",
"body",
"have",
"not",
"yet",
"been",
"generated",
"."
] | 9116c90fcbb82ac03b4b33c58cfbde1fcf745e99 | https://github.com/github/linguist/blob/9116c90fcbb82ac03b4b33c58cfbde1fcf745e99/samples/Ruby/sinatra.rb#L343-L347 | train | Creates a new Stream with the current params | [
30522,
13366,
5460,
1006,
2562,
1035,
2330,
1027,
6270,
1007,
6134,
2099,
1027,
4372,
2615,
1031,
1005,
2004,
6038,
2278,
1012,
2655,
5963,
1005,
1033,
1029,
2724,
22911,
14014,
1024,
5460,
2783,
1027,
1030,
11498,
5244,
1012,
4241,
2361,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/site.rb | Jekyll.Site.in_source_dir | def in_source_dir(*paths)
paths.reduce(source) do |base, path|
Jekyll.sanitized_path(base, path)
end
end | ruby | def in_source_dir(*paths)
paths.reduce(source) do |base, path|
Jekyll.sanitized_path(base, path)
end
end | [
"def",
"in_source_dir",
"(",
"*",
"paths",
")",
"paths",
".",
"reduce",
"(",
"source",
")",
"do",
"|",
"base",
",",
"path",
"|",
"Jekyll",
".",
"sanitized_path",
"(",
"base",
",",
"path",
")",
"end",
"end"
] | Public: Prefix a given path with the source directory.
paths - (optional) path elements to a file or directory within the
source directory
Returns a path which is prefixed with the source directory. | [
"Public",
":",
"Prefix",
"a",
"given",
"path",
"with",
"the",
"source",
"directory",
"."
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/site.rb#L378-L382 | train | Returns the absolute path to the source directory. | [
30522,
13366,
1999,
1035,
3120,
1035,
16101,
1006,
1008,
10425,
1007,
10425,
1012,
5547,
1006,
3120,
1007,
2079,
1064,
2918,
1010,
4130,
1064,
15333,
4801,
3363,
1012,
2624,
25090,
5422,
1035,
4130,
1006,
2918,
1010,
4130,
1007,
2203,
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... |
rails/rails | activestorage/lib/active_storage/service/azure_storage_service.rb | ActiveStorage.Service::AzureStorageService.stream | def stream(key)
blob = blob_for(key)
chunk_size = 5.megabytes
offset = 0
raise ActiveStorage::FileNotFoundError unless blob.present?
while offset < blob.properties[:content_length]
_, chunk = blobs.get_blob(container, key, start_range: offset, end_range: offset + chunk_size - 1)
yield chunk.force_encoding(Encoding::BINARY)
offset += chunk_size
end
end | ruby | def stream(key)
blob = blob_for(key)
chunk_size = 5.megabytes
offset = 0
raise ActiveStorage::FileNotFoundError unless blob.present?
while offset < blob.properties[:content_length]
_, chunk = blobs.get_blob(container, key, start_range: offset, end_range: offset + chunk_size - 1)
yield chunk.force_encoding(Encoding::BINARY)
offset += chunk_size
end
end | [
"def",
"stream",
"(",
"key",
")",
"blob",
"=",
"blob_for",
"(",
"key",
")",
"chunk_size",
"=",
"5",
".",
"megabytes",
"offset",
"=",
"0",
"raise",
"ActiveStorage",
"::",
"FileNotFoundError",
"unless",
"blob",
".",
"present?",
"while",
"offset",
"<",
"blob"... | Reads the object for the given key in chunks, yielding each to the block. | [
"Reads",
"the",
"object",
"for",
"the",
"given",
"key",
"in",
"chunks",
"yielding",
"each",
"to",
"the",
"block",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activestorage/lib/active_storage/service/azure_storage_service.rb#L137-L150 | train | Get a stream of bytes from the blob. | [
30522,
13366,
5460,
1006,
3145,
1007,
1038,
4135,
2497,
1027,
1038,
4135,
2497,
1035,
2005,
1006,
3145,
1007,
20000,
1035,
2946,
1027,
1019,
1012,
13164,
3762,
4570,
16396,
1027,
1014,
5333,
3161,
23809,
4270,
1024,
1024,
5371,
17048,
14876... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-04-01/generated/azure_mgmt_network/express_route_cross_connections.rb | Azure::Network::Mgmt::V2018_04_01.ExpressRouteCrossConnections.begin_update_tags_with_http_info | def begin_update_tags_with_http_info(resource_group_name, cross_connection_name, cross_connection_parameters, custom_headers:nil)
begin_update_tags_async(resource_group_name, cross_connection_name, cross_connection_parameters, custom_headers:custom_headers).value!
end | ruby | def begin_update_tags_with_http_info(resource_group_name, cross_connection_name, cross_connection_parameters, custom_headers:nil)
begin_update_tags_async(resource_group_name, cross_connection_name, cross_connection_parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_update_tags_with_http_info",
"(",
"resource_group_name",
",",
"cross_connection_name",
",",
"cross_connection_parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_update_tags_async",
"(",
"resource_group_name",
",",
"cross_connection_name",
",",
"cross_conn... | Updates an express route cross connection tags.
@param resource_group_name [String] The name of the resource group.
@param cross_connection_name [String] The name of the cross connection.
@param cross_connection_parameters [TagsObject] Parameters supplied to update
express route cross connection tags.
@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",
"an",
"express",
"route",
"cross",
"connection",
"tags",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-04-01/generated/azure_mgmt_network/express_route_cross_connections.rb#L674-L676 | train | Updates the specified cross connection tags. | [
30522,
13366,
4088,
1035,
10651,
1035,
22073,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2892,
1035,
4434,
1035,
2171,
1010,
2892,
1035,
4434,
1035,
11709,
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... |
forward3d/rbhive | lib/rbhive/t_c_l_i_connection.rb | RBHive.TCLIConnection.async_fetch | def async_fetch(handles, max_rows = 100)
# Can't get data from an unfinished query
unless async_is_complete?(handles)
raise "Can't perform fetch on a query in state: #{async_state(handles)}"
end
# Fetch and
fetch_rows(prepare_operation_handle(handles), :first, max_rows)
end | ruby | def async_fetch(handles, max_rows = 100)
# Can't get data from an unfinished query
unless async_is_complete?(handles)
raise "Can't perform fetch on a query in state: #{async_state(handles)}"
end
# Fetch and
fetch_rows(prepare_operation_handle(handles), :first, max_rows)
end | [
"def",
"async_fetch",
"(",
"handles",
",",
"max_rows",
"=",
"100",
")",
"# Can't get data from an unfinished query",
"unless",
"async_is_complete?",
"(",
"handles",
")",
"raise",
"\"Can't perform fetch on a query in state: #{async_state(handles)}\"",
"end",
"# Fetch and",
"fetc... | Async fetch results from an async execute | [
"Async",
"fetch",
"results",
"from",
"an",
"async",
"execute"
] | a630b57332f2face03501da3ecad2905c78056fa | https://github.com/forward3d/rbhive/blob/a630b57332f2face03501da3ecad2905c78056fa/lib/rbhive/t_c_l_i_connection.rb#L267-L275 | train | Fetch the data from the given operation handles asynchronously | [
30522,
13366,
2004,
6038,
2278,
1035,
18584,
1006,
16024,
1010,
4098,
1035,
10281,
1027,
2531,
1007,
1001,
2064,
1005,
1056,
2131,
2951,
2013,
2019,
14342,
23032,
4983,
2004,
6038,
2278,
1035,
2003,
1035,
3143,
1029,
1006,
16024,
1007,
5333... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.create_regex_entity_model | def create_regex_entity_model(app_id, version_id, regex_entity_extractor_create_obj, custom_headers:nil)
response = create_regex_entity_model_async(app_id, version_id, regex_entity_extractor_create_obj, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_regex_entity_model(app_id, version_id, regex_entity_extractor_create_obj, custom_headers:nil)
response = create_regex_entity_model_async(app_id, version_id, regex_entity_extractor_create_obj, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_regex_entity_model",
"(",
"app_id",
",",
"version_id",
",",
"regex_entity_extractor_create_obj",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_regex_entity_model_async",
"(",
"app_id",
",",
"version_id",
",",
"regex_entity_extractor_create_... | Adds a regular expression entity model to a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param regex_entity_extractor_create_obj [RegexModelCreateObject] A model
object containing the name and regex pattern for the new regular expression
entity extractor.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Uuid] operation results. | [
"Adds",
"a",
"regular",
"expression",
"entity",
"model",
"to",
"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#L5773-L5776 | train | Creates a regex entity model for a version of the application. | [
30522,
13366,
3443,
1035,
19723,
10288,
1035,
9178,
1035,
2944,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
19723,
10288,
1035,
9178,
1035,
14817,
2953,
1035,
3443,
1035,
27885,
3501,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
mongodb/mongo-ruby-driver | profile/benchmarking/helper.rb | Mongo.Benchmarking.load_file | def load_file(file_name)
File.open(file_name, "r") do |f|
f.each_line.collect do |line|
parse_json(line)
end
end
end | ruby | def load_file(file_name)
File.open(file_name, "r") do |f|
f.each_line.collect do |line|
parse_json(line)
end
end
end | [
"def",
"load_file",
"(",
"file_name",
")",
"File",
".",
"open",
"(",
"file_name",
",",
"\"r\"",
")",
"do",
"|",
"f",
"|",
"f",
".",
"each_line",
".",
"collect",
"do",
"|",
"line",
"|",
"parse_json",
"(",
"line",
")",
"end",
"end",
"end"
] | Load a json file and represent each document as a Hash.
@example Load a file.
Benchmarking.load_file(file_name)
@param [ String ] The file name.
@return [ Array ] A list of extended-json documents.
@since 2.2.3 | [
"Load",
"a",
"json",
"file",
"and",
"represent",
"each",
"document",
"as",
"a",
"Hash",
"."
] | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/profile/benchmarking/helper.rb#L18-L24 | train | Load a file into the object | [
30522,
13366,
7170,
1035,
5371,
1006,
5371,
1035,
2171,
1007,
5371,
1012,
2330,
1006,
5371,
1035,
2171,
1010,
1000,
1054,
1000,
1007,
2079,
1064,
1042,
1064,
1042,
1012,
2169,
1035,
2240,
1012,
8145,
2079,
1064,
2240,
1064,
11968,
3366,
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... |
square/connect-ruby-sdk | lib/square_connect/models/break_type.rb | SquareConnect.BreakType.location_id= | def location_id=(location_id)
if location_id.nil?
fail ArgumentError, "location_id cannot be nil"
end
if location_id.to_s.length < 1
fail ArgumentError, "invalid value for 'location_id', the character length must be great than or equal to 1."
end
@location_id = location_id
end | ruby | def location_id=(location_id)
if location_id.nil?
fail ArgumentError, "location_id cannot be nil"
end
if location_id.to_s.length < 1
fail ArgumentError, "invalid value for 'location_id', the character length must be great than or equal to 1."
end
@location_id = location_id
end | [
"def",
"location_id",
"=",
"(",
"location_id",
")",
"if",
"location_id",
".",
"nil?",
"fail",
"ArgumentError",
",",
"\"location_id cannot be nil\"",
"end",
"if",
"location_id",
".",
"to_s",
".",
"length",
"<",
"1",
"fail",
"ArgumentError",
",",
"\"invalid value fo... | Custom attribute writer method with validation
@param [Object] location_id Value to be assigned | [
"Custom",
"attribute",
"writer",
"method",
"with",
"validation"
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/models/break_type.rb#L176-L186 | train | Sets the location_id of the object. | [
30522,
13366,
3295,
1035,
8909,
1027,
1006,
3295,
1035,
8909,
1007,
2065,
3295,
1035,
8909,
1012,
9152,
2140,
1029,
8246,
6685,
2121,
29165,
1010,
1000,
3295,
1035,
8909,
3685,
2022,
9152,
2140,
1000,
2203,
2065,
3295,
1035,
8909,
1012,
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... |
jhund/filterrific | lib/filterrific/action_controller_extension.rb | Filterrific.ActionControllerExtension.compute_filterrific_params | def compute_filterrific_params(model_class, filterrific_params, opts, persistence_id)
opts = { "sanitize_params" => true }.merge(opts.stringify_keys)
r = (
filterrific_params.presence || # start with passed in params
(persistence_id && session[persistence_id].presence) || # then try session persisted params if persistence_id is present
opts['default_filter_params'] || # then use passed in opts
model_class.filterrific_default_filter_params # finally use model_class defaults
).stringify_keys
r.slice!(*opts['available_filters'].map(&:to_s)) if opts['available_filters']
# Sanitize params to prevent reflected XSS attack
if opts["sanitize_params"]
r.each { |k,v| r[k] = sanitize_filterrific_param(r[k]) }
end
r
end | ruby | def compute_filterrific_params(model_class, filterrific_params, opts, persistence_id)
opts = { "sanitize_params" => true }.merge(opts.stringify_keys)
r = (
filterrific_params.presence || # start with passed in params
(persistence_id && session[persistence_id].presence) || # then try session persisted params if persistence_id is present
opts['default_filter_params'] || # then use passed in opts
model_class.filterrific_default_filter_params # finally use model_class defaults
).stringify_keys
r.slice!(*opts['available_filters'].map(&:to_s)) if opts['available_filters']
# Sanitize params to prevent reflected XSS attack
if opts["sanitize_params"]
r.each { |k,v| r[k] = sanitize_filterrific_param(r[k]) }
end
r
end | [
"def",
"compute_filterrific_params",
"(",
"model_class",
",",
"filterrific_params",
",",
"opts",
",",
"persistence_id",
")",
"opts",
"=",
"{",
"\"sanitize_params\"",
"=>",
"true",
"}",
".",
"merge",
"(",
"opts",
".",
"stringify_keys",
")",
"r",
"=",
"(",
"filt... | Computes filterrific params using a number of strategies. Limits params
to 'available_filters' if given via opts.
@param model_class [ActiveRecord::Base]
@param filterrific_params [ActionController::Params, Hash]
@param opts [Hash]
@option opts [Boolean, optional] "sanitize_params"
if true, sanitizes all filterrific params to prevent reflected (or stored) XSS attacks.
Defaults to true.
@param persistence_id [String, nil] | [
"Computes",
"filterrific",
"params",
"using",
"a",
"number",
"of",
"strategies",
".",
"Limits",
"params",
"to",
"available_filters",
"if",
"given",
"via",
"opts",
"."
] | 811edc57d3e2a3e538c1f0e9554e0909be052881 | https://github.com/jhund/filterrific/blob/811edc57d3e2a3e538c1f0e9554e0909be052881/lib/filterrific/action_controller_extension.rb#L70-L84 | train | Compute the filter params for a model class | [
30522,
13366,
24134,
1035,
11307,
3089,
8873,
2278,
30524,
11498,
5244,
1000,
1027,
1028,
2995,
1065,
1012,
13590,
1006,
23569,
2015,
1012,
5164,
8757,
1035,
6309,
1007,
1054,
1027,
1006,
11307,
3089,
8873,
2278,
1035,
11498,
5244,
1012,
37... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/request_handler.rb | PhusionPassenger.RequestHandler.cleanup | def cleanup
if @main_loop_thread
@main_loop_thread_lock.synchronize do
@graceful_termination_pipe[1].close rescue nil
end
@main_loop_thread.join
end
@server_sockets.each_value do |info|
socket = info[:socket]
type = get_socket_address_type(info[:address])
begin
socket.close if !socket.closed?
rescue Exception => e
# Ignore "stream closed" error, which occurs in some unit tests.
# We catch Exception here instead of IOError because of a Ruby 1.8.7 bug.
if e.to_s !~ /stream closed/ && e.message.to_s !~ /stream closed/
raise e
end
end
if type == :unix
filename = info[:address].sub(/^unix:/, '')
File.unlink(filename) rescue nil
end
end
@owner_pipe.close rescue nil
end | ruby | def cleanup
if @main_loop_thread
@main_loop_thread_lock.synchronize do
@graceful_termination_pipe[1].close rescue nil
end
@main_loop_thread.join
end
@server_sockets.each_value do |info|
socket = info[:socket]
type = get_socket_address_type(info[:address])
begin
socket.close if !socket.closed?
rescue Exception => e
# Ignore "stream closed" error, which occurs in some unit tests.
# We catch Exception here instead of IOError because of a Ruby 1.8.7 bug.
if e.to_s !~ /stream closed/ && e.message.to_s !~ /stream closed/
raise e
end
end
if type == :unix
filename = info[:address].sub(/^unix:/, '')
File.unlink(filename) rescue nil
end
end
@owner_pipe.close rescue nil
end | [
"def",
"cleanup",
"if",
"@main_loop_thread",
"@main_loop_thread_lock",
".",
"synchronize",
"do",
"@graceful_termination_pipe",
"[",
"1",
"]",
".",
"close",
"rescue",
"nil",
"end",
"@main_loop_thread",
".",
"join",
"end",
"@server_sockets",
".",
"each_value",
"do",
"... | Create a new RequestHandler with the given owner pipe.
+owner_pipe+ must be the readable part of a pipe IO object.
Additionally, the following options may be given:
- connect_password
Clean up temporary stuff created by the request handler.
If the main loop was started by #main_loop, then this method may only
be called after the main loop has exited.
If the main loop was started by #start_main_loop_thread, then this method
may be called at any time, and it will stop the main loop thread. | [
"Create",
"a",
"new",
"RequestHandler",
"with",
"the",
"given",
"owner",
"pipe",
".",
"+",
"owner_pipe",
"+",
"must",
"be",
"the",
"readable",
"part",
"of",
"a",
"pipe",
"IO",
"object",
"."
] | 970964b53e0ba86959acdf40f06c99b0c4a128ca | https://github.com/phusion/passenger/blob/970964b53e0ba86959acdf40f06c99b0c4a128ca/src/ruby_supportlib/phusion_passenger/request_handler.rb#L140-L166 | train | Cleanup the connection to the server. | [
30522,
13366,
27686,
2065,
1030,
2364,
1035,
7077,
1035,
11689,
1030,
2364,
1035,
7077,
1035,
11689,
1035,
5843,
1012,
26351,
8093,
10698,
4371,
2079,
1030,
19415,
1035,
18287,
1035,
8667,
1031,
1015,
1033,
1012,
2485,
5343,
9152,
2140,
220... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
jhund/filterrific | lib/filterrific/param_set.rb | Filterrific.ParamSet.condition_filterrific_params | def condition_filterrific_params(fp)
fp.each do |key, val|
case
when val.is_a?(Proc)
# evaluate Procs
fp[key] = val.call
when val.is_a?(Array)
# type cast integers in the array
fp[key] = fp[key].map { |e| e =~ integer_detector_regex ? e.to_i : e }
when val.is_a?(Hash)
# type cast Hash to OpenStruct so that nested params render correctly
# in the form
fp[key] = OpenStruct.new(fp[key])
when val =~ integer_detector_regex
# type cast integer
fp[key] = fp[key].to_i
end
end
fp
end | ruby | def condition_filterrific_params(fp)
fp.each do |key, val|
case
when val.is_a?(Proc)
# evaluate Procs
fp[key] = val.call
when val.is_a?(Array)
# type cast integers in the array
fp[key] = fp[key].map { |e| e =~ integer_detector_regex ? e.to_i : e }
when val.is_a?(Hash)
# type cast Hash to OpenStruct so that nested params render correctly
# in the form
fp[key] = OpenStruct.new(fp[key])
when val =~ integer_detector_regex
# type cast integer
fp[key] = fp[key].to_i
end
end
fp
end | [
"def",
"condition_filterrific_params",
"(",
"fp",
")",
"fp",
".",
"each",
"do",
"|",
"key",
",",
"val",
"|",
"case",
"when",
"val",
".",
"is_a?",
"(",
"Proc",
")",
"# evaluate Procs",
"fp",
"[",
"key",
"]",
"=",
"val",
".",
"call",
"when",
"val",
"."... | Conditions params: Evaluates Procs and type casts integer values.
@param fp [Hash] the filterrific params hash
@return[Hash] the conditioned params hash | [
"Conditions",
"params",
":",
"Evaluates",
"Procs",
"and",
"type",
"casts",
"integer",
"values",
"."
] | 811edc57d3e2a3e538c1f0e9554e0909be052881 | https://github.com/jhund/filterrific/blob/811edc57d3e2a3e538c1f0e9554e0909be052881/lib/filterrific/param_set.rb#L91-L110 | train | This method is used to evaluate the params in the filter | [
30522,
13366,
4650,
1035,
11307,
3089,
8873,
2278,
1035,
11498,
5244,
1006,
1042,
2361,
1007,
1042,
2361,
1012,
2169,
2079,
1064,
3145,
1010,
11748,
1064,
2553,
2043,
11748,
1012,
2003,
1035,
1037,
1029,
1006,
4013,
2278,
1007,
1001,
16157,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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_logic/lib/2016-06-01/generated/azure_mgmt_logic/workflows.rb | Azure::Logic::Mgmt::V2016_06_01.Workflows.move_with_http_info | def move_with_http_info(resource_group_name, workflow_name, move, custom_headers:nil)
move_async(resource_group_name, workflow_name, move, custom_headers:custom_headers).value!
end | ruby | def move_with_http_info(resource_group_name, workflow_name, move, custom_headers:nil)
move_async(resource_group_name, workflow_name, move, custom_headers:custom_headers).value!
end | [
"def",
"move_with_http_info",
"(",
"resource_group_name",
",",
"workflow_name",
",",
"move",
",",
"custom_headers",
":",
"nil",
")",
"move_async",
"(",
"resource_group_name",
",",
"workflow_name",
",",
"move",
",",
"custom_headers",
":custom_headers",
")",
".",
"val... | Moves an existing workflow.
@param resource_group_name [String] The resource group name.
@param workflow_name [String] The workflow name.
@param move [Workflow] The workflow to move.
@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. | [
"Moves",
"an",
"existing",
"workflow",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/workflows.rb#L1075-L1077 | train | Moves a workflow to an existing container. | [
30522,
13366,
2693,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2147,
12314,
1035,
2171,
1010,
2693,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2693,
1035,
2004,
6038,
2278,
1006,
7692,
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... |
puppetlabs/puppet | lib/puppet/functions.rb | Puppet::Functions.DispatcherBuilder.return_type | def return_type(type)
unless type.is_a?(String) || type.is_a?(Puppet::Pops::Types::PAnyType)
raise ArgumentError, _("Argument to 'return_type' must be a String reference to a Puppet Data Type. Got %{type_class}") % { type_class: type.class }
end
@return_type = type
end | ruby | def return_type(type)
unless type.is_a?(String) || type.is_a?(Puppet::Pops::Types::PAnyType)
raise ArgumentError, _("Argument to 'return_type' must be a String reference to a Puppet Data Type. Got %{type_class}") % { type_class: type.class }
end
@return_type = type
end | [
"def",
"return_type",
"(",
"type",
")",
"unless",
"type",
".",
"is_a?",
"(",
"String",
")",
"||",
"type",
".",
"is_a?",
"(",
"Puppet",
"::",
"Pops",
"::",
"Types",
"::",
"PAnyType",
")",
"raise",
"ArgumentError",
",",
"_",
"(",
"\"Argument to 'return_type'... | Defines the return type. Defaults to 'Any'
@param [String] type a reference to a Puppet Data Type
@api public | [
"Defines",
"the",
"return",
"type",
".",
"Defaults",
"to",
"Any",
"@param",
"[",
"String",
"]",
"type",
"a",
"reference",
"to",
"a",
"Puppet",
"Data",
"Type"
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/functions.rb#L520-L525 | train | Sets the return type for this object. | [
30522,
13366,
2709,
1035,
2828,
1006,
2828,
1007,
4983,
2828,
1012,
2003,
1035,
1037,
1029,
1006,
5164,
1007,
1064,
1064,
2828,
1012,
2003,
30524,
1024,
1024,
6090,
22123,
18863,
1007,
5333,
6685,
2121,
29165,
1010,
1035,
1006,
1000,
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... |
mongodb/mongo-ruby-driver | lib/mongo/dbref.rb | Mongo.DBRef.as_json | def as_json(*args)
document = { COLLECTION => collection, ID => id }
document.merge!(DATABASE => database) if database
document
end | ruby | def as_json(*args)
document = { COLLECTION => collection, ID => id }
document.merge!(DATABASE => database) if database
document
end | [
"def",
"as_json",
"(",
"*",
"args",
")",
"document",
"=",
"{",
"COLLECTION",
"=>",
"collection",
",",
"ID",
"=>",
"id",
"}",
"document",
".",
"merge!",
"(",
"DATABASE",
"=>",
"database",
")",
"if",
"database",
"document",
"end"
] | Get the DBRef as a JSON document
@example Get the DBRef as a JSON hash.
dbref.as_json
@return [ Hash ] The max key as a JSON hash.
@since 2.1.0 | [
"Get",
"the",
"DBRef",
"as",
"a",
"JSON",
"document"
] | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/dbref.rb#L55-L59 | train | Returns the document as JSON | [
30522,
13366,
2004,
1035,
1046,
3385,
1006,
1008,
12098,
5620,
1007,
6254,
1027,
1063,
3074,
1027,
1028,
3074,
1010,
8909,
1027,
1028,
8909,
1065,
6254,
1012,
13590,
999,
1006,
7809,
1027,
1028,
7809,
1007,
2065,
7809,
6254,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_node_health | def get_node_health(node_name, events_health_state_filter:0, timeout:60, custom_headers:nil)
response = get_node_health_async(node_name, events_health_state_filter:events_health_state_filter, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_node_health(node_name, events_health_state_filter:0, timeout:60, custom_headers:nil)
response = get_node_health_async(node_name, events_health_state_filter:events_health_state_filter, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_node_health",
"(",
"node_name",
",",
"events_health_state_filter",
":",
"0",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_node_health_async",
"(",
"node_name",
",",
"events_health_state_filter",
":events_health_s... | Gets the health of a Service Fabric node.
Gets the health of a Service Fabric node. Use EventsHealthStateFilter to
filter the collection of health events reported on the node based on the
health state. If the node that you specify by name does not exist in the
health store, this returns an error.
@param node_name [String] The name of the node.
@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 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 [NodeHealth] operation results. | [
"Gets",
"the",
"health",
"of",
"a",
"Service",
"Fabric",
"node",
"."
] | 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#L3498-L3501 | train | Gets the node health of a Service Fabric node. | [
30522,
13366,
2131,
1035,
13045,
1035,
2740,
1006,
13045,
1035,
2171,
1010,
2824,
1035,
2740,
1035,
2110,
1035,
11307,
1024,
1014,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
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... |
zendesk/ruby-kafka | lib/kafka/consumer.rb | Kafka.Consumer.resume | def resume(topic, partition)
pause_for(topic, partition).resume!
# During re-balancing we might have lost the paused partition. Check if partition is still in group before seek.
seek_to_next(topic, partition) if @group.assigned_to?(topic, partition)
end | ruby | def resume(topic, partition)
pause_for(topic, partition).resume!
# During re-balancing we might have lost the paused partition. Check if partition is still in group before seek.
seek_to_next(topic, partition) if @group.assigned_to?(topic, partition)
end | [
"def",
"resume",
"(",
"topic",
",",
"partition",
")",
"pause_for",
"(",
"topic",
",",
"partition",
")",
".",
"resume!",
"# During re-balancing we might have lost the paused partition. Check if partition is still in group before seek.",
"seek_to_next",
"(",
"topic",
",",
"part... | Resume processing of a topic partition.
@see #pause
@param topic [String]
@param partition [Integer]
@return [nil] | [
"Resume",
"processing",
"of",
"a",
"topic",
"partition",
"."
] | 2a73471b6a607a52dc85c79301ba522acb4566b5 | https://github.com/zendesk/ruby-kafka/blob/2a73471b6a607a52dc85c79301ba522acb4566b5/lib/kafka/consumer.rb#L159-L164 | train | Resume a partition | [
30522,
13366,
13746,
1006,
8476,
1010,
13571,
1007,
8724,
1035,
2005,
1006,
8476,
1010,
13571,
1007,
1012,
13746,
999,
1001,
2076,
2128,
1011,
20120,
2057,
2453,
2031,
2439,
1996,
5864,
13571,
1012,
4638,
2065,
13571,
2003,
2145,
1999,
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... |
square/connect-ruby-sdk | lib/square_connect/models/catalog_tax.rb | SquareConnect.CatalogTax.calculation_phase= | def calculation_phase=(calculation_phase)
validator = EnumAttributeValidator.new('String', ["TAX_SUBTOTAL_PHASE", "TAX_TOTAL_PHASE"])
unless validator.valid?(calculation_phase)
fail ArgumentError, "invalid value for 'calculation_phase', must be one of #{validator.allowable_values}."
end
@calculation_phase = calculation_phase
end | ruby | def calculation_phase=(calculation_phase)
validator = EnumAttributeValidator.new('String', ["TAX_SUBTOTAL_PHASE", "TAX_TOTAL_PHASE"])
unless validator.valid?(calculation_phase)
fail ArgumentError, "invalid value for 'calculation_phase', must be one of #{validator.allowable_values}."
end
@calculation_phase = calculation_phase
end | [
"def",
"calculation_phase",
"=",
"(",
"calculation_phase",
")",
"validator",
"=",
"EnumAttributeValidator",
".",
"new",
"(",
"'String'",
",",
"[",
"\"TAX_SUBTOTAL_PHASE\"",
",",
"\"TAX_TOTAL_PHASE\"",
"]",
")",
"unless",
"validator",
".",
"valid?",
"(",
"calculation... | Custom attribute writer method checking allowed values (enum).
@param [Object] calculation_phase 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/catalog_tax.rb#L132-L138 | train | Sets the calculation phase of the current page. | [
30522,
13366,
17208,
1035,
4403,
1027,
1006,
17208,
1035,
4403,
1007,
9398,
8844,
1027,
4372,
12248,
4779,
3089,
8569,
2618,
10175,
8524,
4263,
1012,
2047,
1006,
30524,
4171,
1035,
2561,
1035,
4403,
1000,
1033,
1007,
4983,
9398,
8844,
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_cdn/lib/2016-10-02/generated/azure_mgmt_cdn/profiles.rb | Azure::CDN::Mgmt::V2016_10_02.Profiles.delete | def delete(resource_group_name, profile_name, custom_headers:nil)
response = delete_async(resource_group_name, profile_name, custom_headers:custom_headers).value!
nil
end | ruby | def delete(resource_group_name, profile_name, custom_headers:nil)
response = delete_async(resource_group_name, profile_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"delete",
"(",
"resource_group_name",
",",
"profile_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_async",
"(",
"resource_group_name",
",",
"profile_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"nil",
"end"
] | Deletes an existing CDN profile with the specified parameters. Deleting a
profile will result in the deletion of all of the sub-resources including
endpoints, origins and custom domains.
@param resource_group_name [String] Name of the Resource group within the
Azure subscription.
@param profile_name [String] Name of the CDN profile which is unique within
the resource group.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Deletes",
"an",
"existing",
"CDN",
"profile",
"with",
"the",
"specified",
"parameters",
".",
"Deleting",
"a",
"profile",
"will",
"result",
"in",
"the",
"deletion",
"of",
"all",
"of",
"the",
"sub",
"-",
"resources",
"including",
"endpoints",
"origins",
"and",
... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_cdn/lib/2016-10-02/generated/azure_mgmt_cdn/profiles.rb#L420-L423 | train | Deletes the specified elastic network profile. | [
30522,
13366,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
6337,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
6337,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
randym/axlsx | lib/axlsx/package.rb | Axlsx.Package.serialize | def serialize(output, confirm_valid=false)
return false unless !confirm_valid || self.validate.empty?
Relationship.clear_cached_instances
Zip::OutputStream.open(output) do |zip|
write_parts(zip)
end
true
end | ruby | def serialize(output, confirm_valid=false)
return false unless !confirm_valid || self.validate.empty?
Relationship.clear_cached_instances
Zip::OutputStream.open(output) do |zip|
write_parts(zip)
end
true
end | [
"def",
"serialize",
"(",
"output",
",",
"confirm_valid",
"=",
"false",
")",
"return",
"false",
"unless",
"!",
"confirm_valid",
"||",
"self",
".",
"validate",
".",
"empty?",
"Relationship",
".",
"clear_cached_instances",
"Zip",
"::",
"OutputStream",
".",
"open",
... | Serialize your workbook to disk as an xlsx document.
@param [String] output The name of the file you want to serialize your package to
@param [Boolean] confirm_valid Validate the package prior to serialization.
@return [Boolean] False if confirm_valid and validation errors exist. True if the package was serialized
@note A tremendous amount of effort has gone into ensuring that you cannot create invalid xlsx documents.
confirm_valid should be used in the rare case that you cannot open the serialized file.
@see Package#validate
@example
# This is how easy it is to create a valid xlsx file. Of course you might want to add a sheet or two, and maybe some data, styles and charts.
# Take a look at the README for an example of how to do it!
#serialize to a file
p = Axlsx::Package.new
# ......add cool stuff to your workbook......
p.serialize("example.xlsx")
# Serialize to a stream
s = p.to_stream()
File.open('example_streamed.xlsx', 'w') { |f| f.write(s.read) } | [
"Serialize",
"your",
"workbook",
"to",
"disk",
"as",
"an",
"xlsx",
"document",
"."
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/package.rb#L101-L108 | train | Serialize the object to a zip file | [
30522,
13366,
7642,
4697,
1006,
6434,
1010,
12210,
1035,
9398,
1027,
6270,
1007,
2709,
6270,
4983,
999,
12210,
1035,
9398,
1064,
1064,
2969,
1012,
9398,
3686,
1012,
4064,
1029,
3276,
1012,
3154,
1035,
17053,
2094,
1035,
12107,
14101,
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... |
heroku/legacy-cli | lib/heroku/command/plugins.rb | Heroku::Command.Plugins.index | def index
validate_arguments!
plugins = ::Heroku::Plugin.list
if plugins.length > 0
styled_header("Installed Plugins")
styled_array(plugins)
end
::Heroku::JSPlugin.list
end | ruby | def index
validate_arguments!
plugins = ::Heroku::Plugin.list
if plugins.length > 0
styled_header("Installed Plugins")
styled_array(plugins)
end
::Heroku::JSPlugin.list
end | [
"def",
"index",
"validate_arguments!",
"plugins",
"=",
"::",
"Heroku",
"::",
"Plugin",
".",
"list",
"if",
"plugins",
".",
"length",
">",
"0",
"styled_header",
"(",
"\"Installed Plugins\"",
")",
"styled_array",
"(",
"plugins",
")",
"end",
"::",
"Heroku",
"::",
... | plugins
list installed plugins
Example:
$ heroku plugins
=== Installed Plugins
heroku-production-check@0.2.0 | [
"plugins"
] | 6f18521a258394bfb79e6b36f7160ad8559a8e16 | https://github.com/heroku/legacy-cli/blob/6f18521a258394bfb79e6b36f7160ad8559a8e16/lib/heroku/command/plugins.rb#L20-L30 | train | Returns the number of available plugins. | [
30522,
13366,
5950,
9398,
3686,
1035,
9918,
999,
13354,
7076,
1027,
1024,
1024,
5394,
5283,
1024,
1024,
13354,
2378,
1012,
2862,
2065,
13354,
7076,
1012,
3091,
1028,
1014,
13650,
1035,
20346,
1006,
1000,
5361,
13354,
7076,
1000,
1007,
13650... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/static_file.rb | Jekyll.StaticFile.destination | def destination(dest)
dest = @site.in_dest_dir(dest)
@site.in_dest_dir(dest, Jekyll::URL.unescape_path(url))
end | ruby | def destination(dest)
dest = @site.in_dest_dir(dest)
@site.in_dest_dir(dest, Jekyll::URL.unescape_path(url))
end | [
"def",
"destination",
"(",
"dest",
")",
"dest",
"=",
"@site",
".",
"in_dest_dir",
"(",
"dest",
")",
"@site",
".",
"in_dest_dir",
"(",
"dest",
",",
"Jekyll",
"::",
"URL",
".",
"unescape_path",
"(",
"url",
")",
")",
"end"
] | Obtain destination path.
dest - The String path to the destination dir.
Returns destination file path. | [
"Obtain",
"destination",
"path",
"."
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/static_file.rb#L56-L59 | train | Returns the destination directory for this site. | [
30522,
13366,
7688,
1006,
4078,
2102,
1007,
4078,
2102,
1027,
1030,
2609,
1012,
1999,
1035,
4078,
2102,
1035,
16101,
1006,
4078,
2102,
1007,
1030,
2609,
1012,
1999,
1035,
4078,
2102,
1035,
16101,
1006,
4078,
2102,
1010,
15333,
4801,
3363,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-07-01/generated/azure_mgmt_network/express_route_cross_connection_peerings.rb | Azure::Network::Mgmt::V2018_07_01.ExpressRouteCrossConnectionPeerings.begin_delete | def begin_delete(resource_group_name, cross_connection_name, peering_name, custom_headers:nil)
response = begin_delete_async(resource_group_name, cross_connection_name, peering_name, custom_headers:custom_headers).value!
nil
end | ruby | def begin_delete(resource_group_name, cross_connection_name, peering_name, custom_headers:nil)
response = begin_delete_async(resource_group_name, cross_connection_name, peering_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_delete",
"(",
"resource_group_name",
",",
"cross_connection_name",
",",
"peering_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_delete_async",
"(",
"resource_group_name",
",",
"cross_connection_name",
",",
"peering_name",
",",
"cust... | Deletes the specified peering from the ExpressRouteCrossConnection.
@param resource_group_name [String] The name of the resource group.
@param cross_connection_name [String] The name of the
ExpressRouteCrossConnection.
@param peering_name [String] The name of the peering.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Deletes",
"the",
"specified",
"peering",
"from",
"the",
"ExpressRouteCrossConnection",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/express_route_cross_connection_peerings.rb#L323-L326 | train | Deletes a peering from the specified ExpressRouteCrossConnection. | [
30522,
13366,
4088,
1035,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2892,
1035,
4434,
1035,
2171,
1010,
16740,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
3972,
12870,
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 | 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_database | def list_by_database(location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
first_page = list_by_database_as_lazy(location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database:only_latest_per_database, database_state:database_state, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_by_database(location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
first_page = list_by_database_as_lazy(location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database:only_latest_per_database, database_state:database_state, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_by_database",
"(",
"location_name",
",",
"long_term_retention_server_name",
",",
"long_term_retention_database_name",
",",
"only_latest_per_database",
":",
"nil",
",",
"database_state",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
... | Lists all long term retention backups for a database.
@param location_name [String] The location of the database
@param long_term_retention_server_name [String] The name of the server
@param long_term_retention_database_name [String] The name of the database
@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 [Array<LongTermRetentionBackup>] operation results. | [
"Lists",
"all",
"long",
"term",
"retention",
"backups",
"for",
"a",
"database",
"."
] | 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#L185-L188 | train | Gets all the long term retention policies for a database. | [
30522,
13366,
2862,
1035,
2011,
1035,
7809,
1006,
3295,
1035,
2171,
1010,
2146,
1035,
2744,
1035,
20125,
1035,
8241,
1035,
2171,
1010,
2146,
1035,
2744,
1035,
20125,
1035,
7809,
1035,
2171,
1010,
2069,
1035,
6745,
1035,
2566,
1035,
7809,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/instance.rb | Raven.Instance.annotate_exception | def annotate_exception(exc, options = {})
notes = (exc.instance_variable_defined?(:@__raven_context) && exc.instance_variable_get(:@__raven_context)) || {}
Raven::Utils::DeepMergeHash.deep_merge!(notes, options)
exc.instance_variable_set(:@__raven_context, notes)
exc
end | ruby | def annotate_exception(exc, options = {})
notes = (exc.instance_variable_defined?(:@__raven_context) && exc.instance_variable_get(:@__raven_context)) || {}
Raven::Utils::DeepMergeHash.deep_merge!(notes, options)
exc.instance_variable_set(:@__raven_context, notes)
exc
end | [
"def",
"annotate_exception",
"(",
"exc",
",",
"options",
"=",
"{",
"}",
")",
"notes",
"=",
"(",
"exc",
".",
"instance_variable_defined?",
"(",
":@__raven_context",
")",
"&&",
"exc",
".",
"instance_variable_get",
"(",
":@__raven_context",
")",
")",
"||",
"{",
... | Provides extra context to the exception prior to it being handled by
Raven. An exception can have multiple annotations, which are merged
together.
The options (annotation) is treated the same as the ``options``
parameter to ``capture_exception`` or ``Event.from_exception``, and
can contain the same ``:user``, ``:tags``, etc. options as these
methods.
These will be merged with the ``options`` parameter to
``Event.from_exception`` at the top of execution.
@example
begin
raise "Hello"
rescue => exc
Raven.annotate_exception(exc, :user => { 'id' => 1,
'email' => 'foo@example.com' })
end | [
"Provides",
"extra",
"context",
"to",
"the",
"exception",
"prior",
"to",
"it",
"being",
"handled",
"by",
"Raven",
".",
"An",
"exception",
"can",
"have",
"multiple",
"annotations",
"which",
"are",
"merged",
"together",
"."
] | 729c22f9284939695f14822683bff1a0b72502bd | https://github.com/getsentry/raven-ruby/blob/729c22f9284939695f14822683bff1a0b72502bd/lib/raven/instance.rb#L159-L164 | train | annotate an exception with the given options | [
30522,
13366,
5754,
17287,
2618,
1035,
6453,
1006,
4654,
2278,
1010,
7047,
1027,
1063,
1065,
1007,
3964,
1027,
1006,
4654,
2278,
1012,
6013,
1035,
8023,
1035,
4225,
1029,
1006,
1024,
1030,
1035,
1035,
10000,
1035,
6123,
1007,
1004,
1004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Shopify/liquid | lib/liquid/standardfilters.rb | Liquid.StandardFilters.truncate | def truncate(input, length = 50, truncate_string = "...".freeze)
return if input.nil?
input_str = input.to_s
length = Utils.to_integer(length)
truncate_string_str = truncate_string.to_s
l = length - truncate_string_str.length
l = 0 if l < 0
input_str.length > length ? input_str[0...l] + truncate_string_str : input_str
end | ruby | def truncate(input, length = 50, truncate_string = "...".freeze)
return if input.nil?
input_str = input.to_s
length = Utils.to_integer(length)
truncate_string_str = truncate_string.to_s
l = length - truncate_string_str.length
l = 0 if l < 0
input_str.length > length ? input_str[0...l] + truncate_string_str : input_str
end | [
"def",
"truncate",
"(",
"input",
",",
"length",
"=",
"50",
",",
"truncate_string",
"=",
"\"...\"",
".",
"freeze",
")",
"return",
"if",
"input",
".",
"nil?",
"input_str",
"=",
"input",
".",
"to_s",
"length",
"=",
"Utils",
".",
"to_integer",
"(",
"length",... | Truncate a string down to x characters | [
"Truncate",
"a",
"string",
"down",
"to",
"x",
"characters"
] | b3b63a683f6daaea7e70f1602ee829abdf970ef3 | https://github.com/Shopify/liquid/blob/b3b63a683f6daaea7e70f1602ee829abdf970ef3/lib/liquid/standardfilters.rb#L75-L83 | train | Truncate the string to a specified length. | [
30522,
13366,
19817,
4609,
16280,
1006,
7953,
1010,
3091,
1027,
2753,
1010,
19817,
4609,
16280,
1035,
5164,
1027,
1000,
1012,
1012,
1012,
1000,
1012,
13184,
1007,
2709,
2065,
7953,
1012,
9152,
2140,
1029,
7953,
1035,
2358,
2099,
1027,
7953,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.get_security_settings_with_http_info | def get_security_settings_with_http_info(device_name, resource_group_name, manager_name, custom_headers:nil)
get_security_settings_async(device_name, resource_group_name, manager_name, custom_headers:custom_headers).value!
end | ruby | def get_security_settings_with_http_info(device_name, resource_group_name, manager_name, custom_headers:nil)
get_security_settings_async(device_name, resource_group_name, manager_name, custom_headers:custom_headers).value!
end | [
"def",
"get_security_settings_with_http_info",
"(",
"device_name",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"get_security_settings_async",
"(",
"device_name",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_heade... | Returns the Security properties of the specified device name.
@param device_name [String] The device name
@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. | [
"Returns",
"the",
"Security",
"properties",
"of",
"the",
"specified",
"device",
"name",
"."
] | 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#L339-L341 | train | Gets security settings for the specified device. | [
30522,
13366,
2131,
1035,
3036,
1035,
10906,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
5080,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
3036,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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_customer_insights/lib/2017-01-01/generated/azure_mgmt_customer_insights/interactions.rb | Azure::CustomerInsights::Mgmt::V2017_01_01.Interactions.suggest_relationship_links | def suggest_relationship_links(resource_group_name, hub_name, interaction_name, custom_headers:nil)
response = suggest_relationship_links_async(resource_group_name, hub_name, interaction_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def suggest_relationship_links(resource_group_name, hub_name, interaction_name, custom_headers:nil)
response = suggest_relationship_links_async(resource_group_name, hub_name, interaction_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"suggest_relationship_links",
"(",
"resource_group_name",
",",
"hub_name",
",",
"interaction_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"suggest_relationship_links_async",
"(",
"resource_group_name",
",",
"hub_name",
",",
"interaction_name",
",... | Suggests relationships to create relationship links.
@param resource_group_name [String] The name of the resource group.
@param hub_name [String] The name of the hub.
@param interaction_name [String] The name of the interaction.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [SuggestRelationshipLinksResponse] operation results. | [
"Suggests",
"relationships",
"to",
"create",
"relationship",
"links",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_customer_insights/lib/2017-01-01/generated/azure_mgmt_customer_insights/interactions.rb#L286-L289 | train | Suggest relationship links for a hub. | [
30522,
13366,
6592,
1035,
3276,
1035,
6971,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
9594,
1035,
2171,
1010,
8290,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
6592,
1035,
3276,
1035,
6971,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/ddos_custom_policies.rb | Azure::Network::Mgmt::V2019_02_01.DdosCustomPolicies.begin_create_or_update_with_http_info | def begin_create_or_update_with_http_info(resource_group_name, ddos_custom_policy_name, parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, ddos_custom_policy_name, parameters, custom_headers:custom_headers).value!
end | ruby | def begin_create_or_update_with_http_info(resource_group_name, ddos_custom_policy_name, parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, ddos_custom_policy_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_create_or_update_with_http_info",
"(",
"resource_group_name",
",",
"ddos_custom_policy_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"ddos_custom_policy_name",
",",
"parameters",
... | Creates or updates a DDoS custom policy.
@param resource_group_name [String] The name of the resource group.
@param ddos_custom_policy_name [String] The name of the DDoS custom policy.
@param parameters [DdosCustomPolicy] Parameters supplied to the create or
update 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. | [
"Creates",
"or",
"updates",
"a",
"DDoS",
"custom",
"policy",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/ddos_custom_policies.rb#L356-L358 | train | Creates or updates a DDoS custom policy. | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
20315,
2891,
1035,
7661,
1035,
3343,
1035,
2171,
1010,
11709,
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... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.get_composite_entity | def get_composite_entity(app_id, version_id, c_entity_id, custom_headers:nil)
response = get_composite_entity_async(app_id, version_id, c_entity_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_composite_entity(app_id, version_id, c_entity_id, custom_headers:nil)
response = get_composite_entity_async(app_id, version_id, c_entity_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_composite_entity",
"(",
"app_id",
",",
"version_id",
",",
"c_entity_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_composite_entity_async",
"(",
"app_id",
",",
"version_id",
",",
"c_entity_id",
",",
"custom_headers",
":custom_headers",
... | Gets information about a composite entity in a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param c_entity_id The composite entity extractor ID.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [CompositeEntityExtractor] operation results. | [
"Gets",
"information",
"about",
"a",
"composite",
"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#L2733-L2736 | train | Gets the composite entity. | [
30522,
13366,
2131,
1035,
12490,
1035,
9178,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
1039,
1035,
9178,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
12490,
1035,
9178,
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... |
strongself/Generamba | lib/generamba/template/installer/template_installer_factory.rb | Generamba.TemplateInstallerFactory.installer_for_type | def installer_for_type(type)
case type
when TemplateDeclarationType::LOCAL_TEMPLATE
return Generamba::LocalInstaller.new
when TemplateDeclarationType::REMOTE_TEMPLATE
return Generamba::RemoteInstaller.new
when TemplateDeclarationType::CATALOG_TEMPLATE
return Generamba::CatalogInstaller.new
else
return nil
end
end | ruby | def installer_for_type(type)
case type
when TemplateDeclarationType::LOCAL_TEMPLATE
return Generamba::LocalInstaller.new
when TemplateDeclarationType::REMOTE_TEMPLATE
return Generamba::RemoteInstaller.new
when TemplateDeclarationType::CATALOG_TEMPLATE
return Generamba::CatalogInstaller.new
else
return nil
end
end | [
"def",
"installer_for_type",
"(",
"type",
")",
"case",
"type",
"when",
"TemplateDeclarationType",
"::",
"LOCAL_TEMPLATE",
"return",
"Generamba",
"::",
"LocalInstaller",
".",
"new",
"when",
"TemplateDeclarationType",
"::",
"REMOTE_TEMPLATE",
"return",
"Generamba",
"::",
... | Provides the appropriate strategy for a given template type | [
"Provides",
"the",
"appropriate",
"strategy",
"for",
"a",
"given",
"template",
"type"
] | 9ef343805f3a66f58bc36e120e822d5436a4da97 | https://github.com/strongself/Generamba/blob/9ef343805f3a66f58bc36e120e822d5436a4da97/lib/generamba/template/installer/template_installer_factory.rb#L9-L20 | train | Returns a new instance of the installer for the given type | [
30522,
13366,
16500,
2121,
1035,
2005,
1035,
2828,
1006,
2828,
1007,
2553,
2828,
2043,
23561,
3207,
20464,
25879,
3258,
13874,
1024,
1024,
2334,
1035,
23561,
2709,
11416,
11201,
1024,
1024,
2334,
7076,
9080,
3917,
1012,
2047,
2043,
23561,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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_registry/lib/2018-02-01-preview/generated/azure_mgmt_container_registry/builds.rb | Azure::ContainerRegistry::Mgmt::V2018_02_01_preview.Builds.get_log_link_with_http_info | def get_log_link_with_http_info(resource_group_name, registry_name, build_id, custom_headers:nil)
get_log_link_async(resource_group_name, registry_name, build_id, custom_headers:custom_headers).value!
end | ruby | def get_log_link_with_http_info(resource_group_name, registry_name, build_id, custom_headers:nil)
get_log_link_async(resource_group_name, registry_name, build_id, custom_headers:custom_headers).value!
end | [
"def",
"get_log_link_with_http_info",
"(",
"resource_group_name",
",",
"registry_name",
",",
"build_id",
",",
"custom_headers",
":",
"nil",
")",
"get_log_link_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"build_id",
",",
"custom_headers",
":custom_header... | Gets a link to download the build logs.
@param resource_group_name [String] The name of the resource group to which
the container registry belongs.
@param registry_name [String] The name of the container registry.
@param build_id [String] The build 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. | [
"Gets",
"a",
"link",
"to",
"download",
"the",
"build",
"logs",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_registry/lib/2018-02-01-preview/generated/azure_mgmt_container_registry/builds.rb#L318-L320 | train | Gets the log link to the specified build. | [
30522,
13366,
2131,
1035,
8833,
1035,
4957,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
3857,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
8833,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
commander-rb/commander | lib/commander/command.rb | Commander.Command.parse_options_and_call_procs | def parse_options_and_call_procs(*args)
return args if args.empty?
# empty proxy_options before populating via OptionParser
# prevents duplication of options if the command is run twice
proxy_options.clear
@options.each_with_object(OptionParser.new) do |option, opts|
opts.on(*option[:args], &option[:proc])
opts
end.parse! args
end | ruby | def parse_options_and_call_procs(*args)
return args if args.empty?
# empty proxy_options before populating via OptionParser
# prevents duplication of options if the command is run twice
proxy_options.clear
@options.each_with_object(OptionParser.new) do |option, opts|
opts.on(*option[:args], &option[:proc])
opts
end.parse! args
end | [
"def",
"parse_options_and_call_procs",
"(",
"*",
"args",
")",
"return",
"args",
"if",
"args",
".",
"empty?",
"# empty proxy_options before populating via OptionParser",
"# prevents duplication of options if the command is run twice",
"proxy_options",
".",
"clear",
"@options",
"."... | :stopdoc:
Parses options and calls associated procs,
returning the arguments remaining. | [
":",
"stopdoc",
":"
] | 332047c14948225462fe60042eed23adfb996d68 | https://github.com/commander-rb/commander/blob/332047c14948225462fe60042eed23adfb996d68/lib/commander/command.rb#L162-L171 | train | Parse the options and call the proc | [
30522,
13366,
11968,
3366,
1035,
7047,
1035,
1998,
1035,
2655,
1035,
4013,
6169,
1006,
1008,
12098,
5620,
1007,
2709,
12098,
5620,
2065,
12098,
5620,
1012,
4064,
1029,
1001,
4064,
24540,
1035,
7047,
2077,
3769,
10924,
3081,
5724,
19362,
804... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
hanami/hanami | lib/hanami/common_logger.rb | Hanami.CommonLogger.log | def log(env, status, header, began_at)
now = Time.now
length = extract_content_length(header)
msg = Hash[
http: env[HTTP_VERSION],
verb: env[REQUEST_METHOD],
status: status.to_s[0..3],
ip: env[HTTP_X_FORWARDED_FOR] || env[REMOTE_ADDR],
path: env[SCRIPT_NAME] + env[PATH_INFO].to_s,
length: length,
params: extract_params(env),
elapsed: now - began_at
]
logger = @logger || env[RACK_ERRORS]
# Standard library logger doesn't support write but it supports << which actually
# calls to write on the log device without formatting
if logger.respond_to?(:write)
logger.write(msg)
else
logger.info(msg)
end
end | ruby | def log(env, status, header, began_at)
now = Time.now
length = extract_content_length(header)
msg = Hash[
http: env[HTTP_VERSION],
verb: env[REQUEST_METHOD],
status: status.to_s[0..3],
ip: env[HTTP_X_FORWARDED_FOR] || env[REMOTE_ADDR],
path: env[SCRIPT_NAME] + env[PATH_INFO].to_s,
length: length,
params: extract_params(env),
elapsed: now - began_at
]
logger = @logger || env[RACK_ERRORS]
# Standard library logger doesn't support write but it supports << which actually
# calls to write on the log device without formatting
if logger.respond_to?(:write)
logger.write(msg)
else
logger.info(msg)
end
end | [
"def",
"log",
"(",
"env",
",",
"status",
",",
"header",
",",
"began_at",
")",
"now",
"=",
"Time",
".",
"now",
"length",
"=",
"extract_content_length",
"(",
"header",
")",
"msg",
"=",
"Hash",
"[",
"http",
":",
"env",
"[",
"HTTP_VERSION",
"]",
",",
"ve... | @since 1.0.0
@api private
rubocop:disable Metrics/AbcSize
rubocop:disable Metrics/MethodLength | [
"@since",
"1",
".",
"0",
".",
"0",
"@api",
"private"
] | 8c6e5147e92ef869b25379448572da3698eacfdc | https://github.com/hanami/hanami/blob/8c6e5147e92ef869b25379448572da3698eacfdc/lib/hanami/common_logger.rb#L57-L80 | train | Log the request | [
30522,
13366,
8833,
1006,
4372,
2615,
1010,
3570,
1010,
20346,
1010,
2211,
1035,
2012,
1007,
2085,
1027,
2051,
1012,
2085,
3091,
1027,
14817,
1035,
4180,
1035,
3091,
1006,
20346,
1007,
5796,
2290,
1027,
23325,
1031,
8299,
1024,
4372,
2615,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.break_pairing | def break_pairing(resource_group_name, namespace_name, alias_parameter, custom_headers:nil)
response = break_pairing_async(resource_group_name, namespace_name, alias_parameter, custom_headers:custom_headers).value!
nil
end | ruby | def break_pairing(resource_group_name, namespace_name, alias_parameter, custom_headers:nil)
response = break_pairing_async(resource_group_name, namespace_name, alias_parameter, custom_headers:custom_headers).value!
nil
end | [
"def",
"break_pairing",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"alias_parameter",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"break_pairing_async",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"alias_parameter",
",",
"custom_hea... | This operation disables the Disaster Recovery and stops replicating changes
from primary to secondary namespaces
@param resource_group_name [String] Name of the Resource group within the
Azure subscription.
@param namespace_name [String] The namespace name
@param alias_parameter [String] The Disaster Recovery configuration name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"This",
"operation",
"disables",
"the",
"Disaster",
"Recovery",
"and",
"stops",
"replicating",
"changes",
"from",
"primary",
"to",
"secondary",
"namespaces"
] | 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#L569-L572 | train | Break a namespace in a given resource group. | [
30522,
13366,
3338,
1035,
22778,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3415,
15327,
1035,
2171,
1010,
14593,
1035,
16381,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3338,
1035,
22778,
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... |
puppetlabs/puppet | lib/puppet/pops/loaders.rb | Puppet::Pops.Loaders.instantiate_definition | def instantiate_definition(definition, loader)
case definition
when Model::PlanDefinition
instantiate_PlanDefinition(definition, loader)
when Model::FunctionDefinition
instantiate_FunctionDefinition(definition, loader)
when Model::TypeAlias
instantiate_TypeAlias(definition, loader)
when Model::TypeMapping
instantiate_TypeMapping(definition, loader)
else
raise Puppet::ParseError, "Internal Error: Unknown type of definition - got '#{definition.class}'"
end
end | ruby | def instantiate_definition(definition, loader)
case definition
when Model::PlanDefinition
instantiate_PlanDefinition(definition, loader)
when Model::FunctionDefinition
instantiate_FunctionDefinition(definition, loader)
when Model::TypeAlias
instantiate_TypeAlias(definition, loader)
when Model::TypeMapping
instantiate_TypeMapping(definition, loader)
else
raise Puppet::ParseError, "Internal Error: Unknown type of definition - got '#{definition.class}'"
end
end | [
"def",
"instantiate_definition",
"(",
"definition",
",",
"loader",
")",
"case",
"definition",
"when",
"Model",
"::",
"PlanDefinition",
"instantiate_PlanDefinition",
"(",
"definition",
",",
"loader",
")",
"when",
"Model",
"::",
"FunctionDefinition",
"instantiate_Function... | Add given 4.x definition to the given loader. | [
"Add",
"given",
"4",
".",
"x",
"definition",
"to",
"the",
"given",
"loader",
"."
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/pops/loaders.rb#L311-L324 | train | Instantiate a definition using the given loader | [
30522,
13366,
7107,
13143,
1035,
6210,
1006,
6210,
1010,
7170,
2121,
1007,
2553,
6210,
2043,
2944,
1024,
1024,
2933,
3207,
16294,
22753,
7107,
13143,
1035,
2933,
3207,
16294,
22753,
1006,
6210,
1010,
7170,
2121,
1007,
2043,
2944,
1024,
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... |
fastlane/fastlane | fastlane_core/lib/fastlane_core/project.rb | FastlaneCore.Project.configurations | def configurations
@configurations ||= if workspace?
workspace
.file_references
.map(&:path)
.reject { |p| p.include?("Pods/Pods.xcodeproj") }
.map do |p|
# To maintain backwards compatibility, we
# silently ignore non-existent projects from
# workspaces.
begin
Xcodeproj::Project.open(p).build_configurations
rescue
[]
end
end
.flatten
.compact
.map(&:name)
else
project.build_configurations.map(&:name)
end
end | ruby | def configurations
@configurations ||= if workspace?
workspace
.file_references
.map(&:path)
.reject { |p| p.include?("Pods/Pods.xcodeproj") }
.map do |p|
# To maintain backwards compatibility, we
# silently ignore non-existent projects from
# workspaces.
begin
Xcodeproj::Project.open(p).build_configurations
rescue
[]
end
end
.flatten
.compact
.map(&:name)
else
project.build_configurations.map(&:name)
end
end | [
"def",
"configurations",
"@configurations",
"||=",
"if",
"workspace?",
"workspace",
".",
"file_references",
".",
"map",
"(",
":path",
")",
".",
"reject",
"{",
"|",
"p",
"|",
"p",
".",
"include?",
"(",
"\"Pods/Pods.xcodeproj\"",
")",
"}",
".",
"map",
"do",
... | Get all available configurations in an array | [
"Get",
"all",
"available",
"configurations",
"in",
"an",
"array"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/fastlane_core/lib/fastlane_core/project.rb#L177-L199 | train | Returns the list of build configurations for this project. | [
30522,
13366,
22354,
1030,
22354,
1064,
1064,
1027,
2065,
2573,
15327,
1029,
2573,
15327,
1012,
5371,
1035,
7604,
1012,
4949,
1006,
1004,
1024,
4130,
1007,
1012,
15454,
1063,
1064,
1052,
1064,
1052,
1012,
2421,
1029,
1006,
1000,
26723,
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... |
3scale/3scale_toolbox | lib/3scale_toolbox/configuration.rb | ThreeScaleToolbox.Configuration.read | def read
@store.transaction(true) do
@store.roots.each_with_object({}) do |key, obj|
obj[key] = @store[key]
end
end
end | ruby | def read
@store.transaction(true) do
@store.roots.each_with_object({}) do |key, obj|
obj[key] = @store[key]
end
end
end | [
"def",
"read",
"@store",
".",
"transaction",
"(",
"true",
")",
"do",
"@store",
".",
"roots",
".",
"each_with_object",
"(",
"{",
"}",
")",
"do",
"|",
"key",
",",
"obj",
"|",
"obj",
"[",
"key",
"]",
"=",
"@store",
"[",
"key",
"]",
"end",
"end",
"en... | returns copy of data stored | [
"returns",
"copy",
"of",
"data",
"stored"
] | aeb19add0ae2348788b0b21f641bf88bf7003ea3 | https://github.com/3scale/3scale_toolbox/blob/aeb19add0ae2348788b0b21f641bf88bf7003ea3/lib/3scale_toolbox/configuration.rb#L27-L33 | train | Read the root node from the store | [
30522,
13366,
3191,
1030,
3573,
1012,
12598,
1006,
2995,
1007,
2079,
1030,
3573,
1012,
6147,
1012,
2169,
1035,
2007,
1035,
4874,
1006,
1063,
1065,
1007,
2079,
1064,
3145,
1010,
27885,
3501,
1064,
27885,
3501,
1031,
3145,
1033,
1027,
1030,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/overcommit | lib/overcommit/hook_context/base.rb | Overcommit::HookContext.Base.filter_directories | def filter_directories(modified_files)
modified_files.reject do |file|
File.directory?(file) && !Overcommit::Utils::FileUtils.symlink?(file)
end
end | ruby | def filter_directories(modified_files)
modified_files.reject do |file|
File.directory?(file) && !Overcommit::Utils::FileUtils.symlink?(file)
end
end | [
"def",
"filter_directories",
"(",
"modified_files",
")",
"modified_files",
".",
"reject",
"do",
"|",
"file",
"|",
"File",
".",
"directory?",
"(",
"file",
")",
"&&",
"!",
"Overcommit",
"::",
"Utils",
"::",
"FileUtils",
".",
"symlink?",
"(",
"file",
")",
"en... | Filter out directories. This could happen when changing a symlink to a
directory as part of an amendment, since the symlink will still appear as
a file, but the actual working tree will have a directory. | [
"Filter",
"out",
"directories",
".",
"This",
"could",
"happen",
"when",
"changing",
"a",
"symlink",
"to",
"a",
"directory",
"as",
"part",
"of",
"an",
"amendment",
"since",
"the",
"symlink",
"will",
"still",
"appear",
"as",
"a",
"file",
"but",
"the",
"actua... | 35d60adb41da942178b789560968e3ad030b0ac7 | https://github.com/sds/overcommit/blob/35d60adb41da942178b789560968e3ad030b0ac7/lib/overcommit/hook_context/base.rb#L133-L137 | train | Filter out directories that are not directories | [
30522,
13366,
11307,
1035,
2472,
3111,
1006,
6310,
1035,
6764,
1007,
6310,
1035,
6764,
1012,
15454,
2079,
1064,
5371,
1064,
5371,
1012,
14176,
1029,
1006,
5371,
1007,
1004,
1004,
999,
2058,
9006,
22930,
1024,
1024,
21183,
12146,
1024,
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... |
stripe/stripe-ruby | lib/stripe/stripe_object.rb | Stripe.StripeObject.update_attributes | def update_attributes(values, opts = {}, dirty: true)
values.each do |k, v|
add_accessors([k], values) unless metaclass.method_defined?(k.to_sym)
@values[k] = Util.convert_to_stripe_object(v, opts)
dirty_value!(@values[k]) if dirty
@unsaved_values.add(k)
end
end | ruby | def update_attributes(values, opts = {}, dirty: true)
values.each do |k, v|
add_accessors([k], values) unless metaclass.method_defined?(k.to_sym)
@values[k] = Util.convert_to_stripe_object(v, opts)
dirty_value!(@values[k]) if dirty
@unsaved_values.add(k)
end
end | [
"def",
"update_attributes",
"(",
"values",
",",
"opts",
"=",
"{",
"}",
",",
"dirty",
":",
"true",
")",
"values",
".",
"each",
"do",
"|",
"k",
",",
"v",
"|",
"add_accessors",
"(",
"[",
"k",
"]",
",",
"values",
")",
"unless",
"metaclass",
".",
"metho... | Mass assigns attributes on the model.
This is a version of +update_attributes+ that takes some extra options
for internal use.
==== Attributes
* +values+ - Hash of values to use to update the current attributes of
the object.
* +opts+ - Options for +StripeObject+ like an API key that will be reused
on subsequent API calls.
==== Options
* +:dirty+ - Whether values should be initiated as "dirty" (unsaved) and
which applies only to new StripeObjects being initiated under this
StripeObject. Defaults to true. | [
"Mass",
"assigns",
"attributes",
"on",
"the",
"model",
"."
] | 322a8c60be8a9b9ac8aad8857864680a32176935 | https://github.com/stripe/stripe-ruby/blob/322a8c60be8a9b9ac8aad8857864680a32176935/lib/stripe/stripe_object.rb#L156-L163 | train | Update the attributes of the object | [
30522,
13366,
10651,
1035,
12332,
1006,
5300,
1010,
23569,
2015,
1027,
1063,
1065,
1010,
6530,
1024,
2995,
1007,
5300,
1012,
2169,
2079,
1064,
1047,
1010,
1058,
1064,
5587,
1035,
3229,
5668,
1006,
1031,
1047,
1033,
1010,
5300,
1007,
4983,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.