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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aws/aws-sdk-ruby | gems/aws-sdk-iam/lib/aws-sdk-iam/resource.rb | Aws::IAM.Resource.policies | def policies(options = {})
batches = Enumerator.new do |y|
resp = @client.list_policies(options)
resp.each_page do |page|
batch = []
page.data.policies.each do |p|
batch << Policy.new(
arn: p.arn,
data: p,
client: @client
)
end
y.yield(batch)
end
end
Policy::Collection.new(batches)
end | ruby | def policies(options = {})
batches = Enumerator.new do |y|
resp = @client.list_policies(options)
resp.each_page do |page|
batch = []
page.data.policies.each do |p|
batch << Policy.new(
arn: p.arn,
data: p,
client: @client
)
end
y.yield(batch)
end
end
Policy::Collection.new(batches)
end | [
"def",
"policies",
"(",
"options",
"=",
"{",
"}",
")",
"batches",
"=",
"Enumerator",
".",
"new",
"do",
"|",
"y",
"|",
"resp",
"=",
"@client",
".",
"list_policies",
"(",
"options",
")",
"resp",
".",
"each_page",
"do",
"|",
"page",
"|",
"batch",
"=",
... | @example Request syntax with placeholder values
policies = iam.policies({
scope: "All", # accepts All, AWS, Local
only_attached: false,
path_prefix: "policyPathType",
policy_usage_filter: "PermissionsPolicy", # accepts PermissionsPolicy, PermissionsBoundary
})
@param [Hash] options ({})
@option options [String] :scope
The scope to use for filtering the results.
To list only AWS managed policies, set `Scope` to `AWS`. To list only
the customer managed policies in your AWS account, set `Scope` to
`Local`.
This parameter is optional. If it is not included, or if it is set to
`All`, all policies are returned.
@option options [Boolean] :only_attached
A flag to filter the results to only the attached policies.
When `OnlyAttached` is `true`, the returned list contains only the
policies that are attached to an IAM user, group, or role. When
`OnlyAttached` is `false`, or when the parameter is not included, all
policies are returned.
@option options [String] :path_prefix
The path prefix for filtering the results. This parameter is optional.
If it is not included, it defaults to a slash (/), listing all
policies. This parameter allows (through its [regex pattern][1]) a
string of characters consisting of either a forward slash (/) by
itself or a string that must begin and end with forward slashes. In
addition, it can contain any ASCII character from the ! (\\u0021)
through the DEL character (\\u007F), including most punctuation
characters, digits, and upper and lowercased letters.
[1]: http://wikipedia.org/wiki/regex
@option options [String] :policy_usage_filter
The policy usage method to use for filtering the results.
To list only permissions policies,
set `PolicyUsageFilter` to `PermissionsPolicy`. To list only the
policies used to set permissions boundaries, set the value
to `PermissionsBoundary`.
This parameter is optional. If it is not included, all policies are
returned.
@return [Policy::Collection] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-iam/lib/aws-sdk-iam/resource.rb#L940-L956 | train | List all policies | [
30522,
13366,
6043,
1006,
7047,
1027,
1063,
1065,
1007,
14108,
2229,
1027,
4372,
17897,
16259,
1012,
2047,
2079,
1064,
1061,
1064,
24501,
2361,
1027,
1030,
7396,
1012,
2862,
1035,
6043,
1006,
7047,
1007,
24501,
2361,
1012,
2169,
1035,
3931,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/git_repo.rb | Overcommit.GitRepo.list_files | def list_files(paths = [], options = {})
ref = options[:ref] || 'HEAD'
path_list = paths.empty? ? '' : "\"#{paths.join('" "')}\""
`git ls-tree --name-only #{ref} #{path_list}`.
split(/\n/).
map { |relative_file| File.expand_path(relative_file) }.
reject { |file| File.directory?(file) } # Exclude submodule directories
end | ruby | def list_files(paths = [], options = {})
ref = options[:ref] || 'HEAD'
path_list = paths.empty? ? '' : "\"#{paths.join('" "')}\""
`git ls-tree --name-only #{ref} #{path_list}`.
split(/\n/).
map { |relative_file| File.expand_path(relative_file) }.
reject { |file| File.directory?(file) } # Exclude submodule directories
end | [
"def",
"list_files",
"(",
"paths",
"=",
"[",
"]",
",",
"options",
"=",
"{",
"}",
")",
"ref",
"=",
"options",
"[",
":ref",
"]",
"||",
"'HEAD'",
"path_list",
"=",
"paths",
".",
"empty?",
"?",
"''",
":",
"\"\\\"#{paths.join('\" \"')}\\\"\"",
"`",
"#{",
"r... | Returns the names of files in the given paths that are tracked by git.
@param paths [Array<String>] list of paths to check
@option options [String] ref ('HEAD') Git ref to check
@return [Array<String>] list of absolute file paths | [
"Returns",
"the",
"names",
"of",
"files",
"in",
"the",
"given",
"paths",
"that",
"are",
"tracked",
"by",
"git",
"."
] | 35d60adb41da942178b789560968e3ad030b0ac7 | https://github.com/sds/overcommit/blob/35d60adb41da942178b789560968e3ad030b0ac7/lib/overcommit/git_repo.rb#L109-L116 | train | List all files in a given list of directories | [
30522,
13366,
2862,
1035,
6764,
1006,
10425,
1027,
1031,
1033,
1010,
7047,
1027,
1063,
1065,
1007,
25416,
1027,
7047,
1031,
1024,
25416,
1033,
1064,
1064,
1005,
2132,
1005,
4130,
1035,
2862,
1027,
10425,
1012,
4064,
1029,
1029,
1005,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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_iteration | def get_iteration(project_id, iteration_id, custom_headers:nil)
response = get_iteration_async(project_id, iteration_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_iteration(project_id, iteration_id, custom_headers:nil)
response = get_iteration_async(project_id, iteration_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_iteration",
"(",
"project_id",
",",
"iteration_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_iteration_async",
"(",
"project_id",
",",
"iteration_id",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"... | Get a specific iteration.
@param project_id The id of the project the iteration belongs to.
@param iteration_id The id of the iteration to get.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Iteration] operation results. | [
"Get",
"a",
"specific",
"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#L3519-L3522 | train | Gets the current iteration s segmentation. | [
30522,
13366,
2131,
1035,
27758,
1006,
2622,
1035,
8909,
1010,
27758,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
27758,
1035,
2004,
6038,
2278,
1006,
2622,
1035,
8909,
1010,
27758,
1035,
8909,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/property.rb | Azure::ApiManagement::Mgmt::V2018_01_01.Property.get_with_http_info | def get_with_http_info(resource_group_name, service_name, prop_id, custom_headers:nil)
get_async(resource_group_name, service_name, prop_id, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, service_name, prop_id, custom_headers:nil)
get_async(resource_group_name, service_name, prop_id, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"service_name",
",",
"prop_id",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"service_name",
",",
"prop_id",
",",
"custom_headers",
":custom_headers",
")",
".",
"v... | Gets the details of the property specified by its identifier.
@param resource_group_name [String] The name of the resource group.
@param service_name [String] The name of the API Management service.
@param prop_id [String] Identifier of the property.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"details",
"of",
"the",
"property",
"specified",
"by",
"its",
"identifier",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/property.rb#L268-L270 | train | Gets the specified property. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
17678,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
2004,
6038,
2278,
1006,
7692,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/environments.rb | Puppet::Environments.Static.get_conf | def get_conf(name)
env = get(name)
if env
Puppet::Settings::EnvironmentConf.static_for(env, Puppet[:environment_timeout], Puppet[:static_catalogs], Puppet[:rich_data])
else
nil
end
end | ruby | def get_conf(name)
env = get(name)
if env
Puppet::Settings::EnvironmentConf.static_for(env, Puppet[:environment_timeout], Puppet[:static_catalogs], Puppet[:rich_data])
else
nil
end
end | [
"def",
"get_conf",
"(",
"name",
")",
"env",
"=",
"get",
"(",
"name",
")",
"if",
"env",
"Puppet",
"::",
"Settings",
"::",
"EnvironmentConf",
".",
"static_for",
"(",
"env",
",",
"Puppet",
"[",
":environment_timeout",
"]",
",",
"Puppet",
"[",
":static_catalog... | Returns a basic environment configuration object tied to the environment's
implementation values. Will not interpolate.
@!macro loader_get_conf | [
"Returns",
"a",
"basic",
"environment",
"configuration",
"object",
"tied",
"to",
"the",
"environment",
"s",
"implementation",
"values",
".",
"Will",
"not",
"interpolate",
"."
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/environments.rb#L115-L122 | train | Get the configuration for a specific environment | [
30522,
13366,
2131,
1035,
9530,
2546,
1006,
2171,
1007,
4372,
2615,
1027,
2131,
1006,
2171,
1007,
2065,
4372,
2615,
13997,
1024,
1024,
10906,
1024,
1024,
4044,
8663,
2546,
1012,
10763,
1035,
2005,
1006,
4372,
2615,
1010,
13997,
1031,
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_dns/lib/2017-09-01/generated/azure_mgmt_dns/record_sets.rb | Azure::Dns::Mgmt::V2017_09_01.RecordSets.update_with_http_info | def update_with_http_info(resource_group_name, zone_name, relative_record_set_name, record_type, parameters, if_match:nil, custom_headers:nil)
update_async(resource_group_name, zone_name, relative_record_set_name, record_type, parameters, if_match:if_match, custom_headers:custom_headers).value!
end | ruby | def update_with_http_info(resource_group_name, zone_name, relative_record_set_name, record_type, parameters, if_match:nil, custom_headers:nil)
update_async(resource_group_name, zone_name, relative_record_set_name, record_type, parameters, if_match:if_match, custom_headers:custom_headers).value!
end | [
"def",
"update_with_http_info",
"(",
"resource_group_name",
",",
"zone_name",
",",
"relative_record_set_name",
",",
"record_type",
",",
"parameters",
",",
"if_match",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"update_async",
"(",
"resource_group_name",
",",
... | Updates a record set within a DNS zone.
@param resource_group_name [String] The name of the resource group. The name
is case insensitive.
@param zone_name [String] The name of the DNS zone (without a terminating
dot).
@param relative_record_set_name [String] The name of the record set, relative
to the name of the zone.
@param record_type [RecordType] The type of DNS record in this record set.
Possible values include: 'A', 'AAAA', 'CAA', 'CNAME', 'MX', 'NS', 'PTR',
'SOA', 'SRV', 'TXT'
@param parameters [RecordSet] Parameters supplied to the Update operation.
@param if_match [String] The etag of the record set. Omit this value to
always overwrite the current record set. Specify the last-seen etag value to
prevent accidentally overwritting concurrent changes.
@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",
"a",
"record",
"set",
"within",
"a",
"DNS",
"zone",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_dns/lib/2017-09-01/generated/azure_mgmt_dns/record_sets.rb#L71-L73 | train | Updates a record set. | [
30522,
13366,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4224,
1035,
2171,
1010,
5816,
1035,
2501,
1035,
2275,
1035,
2171,
1010,
2501,
1035,
2828,
1010,
11709,
1010,
2065,
1035,
2674,
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... |
toptal/chewy | lib/chewy/query.rb | Chewy.Query.delete_all | def delete_all
if Runtime.version >= '2.0'
plugins = Chewy.client.nodes.info(plugins: true)['nodes'].values.map { |item| item['plugins'] }.flatten
raise PluginMissing, 'install delete-by-query plugin' unless plugins.find { |item| item['name'] == 'delete-by-query' }
end
request = chain { criteria.update_options simple: true }.send(:_request)
ActiveSupport::Notifications.instrument 'delete_query.chewy',
request: request, indexes: _indexes, types: _types,
index: _indexes.one? ? _indexes.first : _indexes,
type: _types.one? ? _types.first : _types do
if Runtime.version >= '2.0'
path = Elasticsearch::API::Utils.__pathify(
Elasticsearch::API::Utils.__listify(request[:index]),
Elasticsearch::API::Utils.__listify(request[:type]),
'/_query'
)
Chewy.client.perform_request(Elasticsearch::API::HTTP_DELETE, path, {}, request[:body]).body
else
Chewy.client.delete_by_query(request)
end
end
end | ruby | def delete_all
if Runtime.version >= '2.0'
plugins = Chewy.client.nodes.info(plugins: true)['nodes'].values.map { |item| item['plugins'] }.flatten
raise PluginMissing, 'install delete-by-query plugin' unless plugins.find { |item| item['name'] == 'delete-by-query' }
end
request = chain { criteria.update_options simple: true }.send(:_request)
ActiveSupport::Notifications.instrument 'delete_query.chewy',
request: request, indexes: _indexes, types: _types,
index: _indexes.one? ? _indexes.first : _indexes,
type: _types.one? ? _types.first : _types do
if Runtime.version >= '2.0'
path = Elasticsearch::API::Utils.__pathify(
Elasticsearch::API::Utils.__listify(request[:index]),
Elasticsearch::API::Utils.__listify(request[:type]),
'/_query'
)
Chewy.client.perform_request(Elasticsearch::API::HTTP_DELETE, path, {}, request[:body]).body
else
Chewy.client.delete_by_query(request)
end
end
end | [
"def",
"delete_all",
"if",
"Runtime",
".",
"version",
">=",
"'2.0'",
"plugins",
"=",
"Chewy",
".",
"client",
".",
"nodes",
".",
"info",
"(",
"plugins",
":",
"true",
")",
"[",
"'nodes'",
"]",
".",
"values",
".",
"map",
"{",
"|",
"item",
"|",
"item",
... | Deletes all documents matching a query.
@example
UsersIndex.delete_all
UsersIndex.filter{ age <= 42 }.delete_all
UsersIndex::User.delete_all
UsersIndex::User.filter{ age <= 42 }.delete_all | [
"Deletes",
"all",
"documents",
"matching",
"a",
"query",
"."
] | cb1bb3efb1bd8a31e7e31add6072189cb1f4f01b | https://github.com/toptal/chewy/blob/cb1bb3efb1bd8a31e7e31add6072189cb1f4f01b/lib/chewy/query.rb#L980-L1003 | train | Delete all the documents in the cluster | [
30522,
13366,
3972,
12870,
1035,
2035,
2065,
2448,
7292,
1012,
2544,
1028,
1027,
1005,
1016,
1012,
1014,
1005,
13354,
7076,
1027,
21271,
2100,
1012,
7396,
1012,
14164,
1012,
18558,
1006,
13354,
7076,
1024,
2995,
1007,
1031,
1005,
14164,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/diagnostic_logger.rb | Azure::ApiManagement::Mgmt::V2018_01_01.DiagnosticLogger.check_entity_exists_with_http_info | def check_entity_exists_with_http_info(resource_group_name, service_name, diagnostic_id, loggerid, custom_headers:nil)
check_entity_exists_async(resource_group_name, service_name, diagnostic_id, loggerid, custom_headers:custom_headers).value!
end | ruby | def check_entity_exists_with_http_info(resource_group_name, service_name, diagnostic_id, loggerid, custom_headers:nil)
check_entity_exists_async(resource_group_name, service_name, diagnostic_id, loggerid, custom_headers:custom_headers).value!
end | [
"def",
"check_entity_exists_with_http_info",
"(",
"resource_group_name",
",",
"service_name",
",",
"diagnostic_id",
",",
"loggerid",
",",
"custom_headers",
":",
"nil",
")",
"check_entity_exists_async",
"(",
"resource_group_name",
",",
"service_name",
",",
"diagnostic_id",
... | Checks that logger entity specified by identifier is associated with the
diagnostics entity.
@param resource_group_name [String] The name of the resource group.
@param service_name [String] The name of the API Management service.
@param diagnostic_id [String] Diagnostic identifier. Must be unique in the
current API Management service instance.
@param loggerid [String] Logger identifier. Must be unique in the API
Management service instance.
@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. | [
"Checks",
"that",
"logger",
"entity",
"specified",
"by",
"identifier",
"is",
"associated",
"with",
"the",
"diagnostics",
"entity",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/diagnostic_logger.rb#L190-L192 | train | Checks if the diagnostic entity with the given identifier already exists. | [
30522,
13366,
4638,
1035,
9178,
1035,
6526,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
16474,
1035,
8909,
1010,
8833,
4590,
3593,
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... |
roo-rb/roo | lib/roo/excelx.rb | Roo.Excelx.font | def font(row, col, sheet = nil)
key = normalize(row, col)
definition_index = safe_send(sheet_for(sheet).cells[key], :style)
styles.definitions[definition_index] if definition_index
end | ruby | def font(row, col, sheet = nil)
key = normalize(row, col)
definition_index = safe_send(sheet_for(sheet).cells[key], :style)
styles.definitions[definition_index] if definition_index
end | [
"def",
"font",
"(",
"row",
",",
"col",
",",
"sheet",
"=",
"nil",
")",
"key",
"=",
"normalize",
"(",
"row",
",",
"col",
")",
"definition_index",
"=",
"safe_send",
"(",
"sheet_for",
"(",
"sheet",
")",
".",
"cells",
"[",
"key",
"]",
",",
":style",
")"... | Given a cell, return the cell's style | [
"Given",
"a",
"cell",
"return",
"the",
"cell",
"s",
"style"
] | 4ec1104f0c3c2a29711c0c907371cd2be12bcc3c | https://github.com/roo-rb/roo/blob/4ec1104f0c3c2a29711c0c907371cd2be12bcc3c/lib/roo/excelx.rb#L183-L187 | train | Returns the font definition for a given cell | [
30522,
13366,
15489,
1006,
5216,
1010,
8902,
1010,
7123,
1027,
9152,
2140,
1007,
3145,
1027,
3671,
4697,
1006,
5216,
1010,
8902,
1007,
6210,
1035,
5950,
1027,
3647,
1035,
4604,
1006,
7123,
1035,
2005,
1006,
7123,
1007,
1012,
4442,
1031,
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_storage/lib/2018-07-01/generated/azure_mgmt_storage/blob_containers.rb | Azure::Storage::Mgmt::V2018_07_01.BlobContainers.get_immutability_policy_with_http_info | def get_immutability_policy_with_http_info(resource_group_name, account_name, container_name, if_match:nil, custom_headers:nil)
get_immutability_policy_async(resource_group_name, account_name, container_name, if_match:if_match, custom_headers:custom_headers).value!
end | ruby | def get_immutability_policy_with_http_info(resource_group_name, account_name, container_name, if_match:nil, custom_headers:nil)
get_immutability_policy_async(resource_group_name, account_name, container_name, if_match:if_match, custom_headers:custom_headers).value!
end | [
"def",
"get_immutability_policy_with_http_info",
"(",
"resource_group_name",
",",
"account_name",
",",
"container_name",
",",
"if_match",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"get_immutability_policy_async",
"(",
"resource_group_name",
",",
"account_name",
... | Gets the existing immutability policy along with the corresponding ETag in
response headers and body.
@param resource_group_name [String] The name of the resource group within the
user's subscription. The name is case insensitive.
@param account_name [String] The name of the storage account within the
specified resource group. Storage account names must be between 3 and 24
characters in length and use numbers and lower-case letters only.
@param container_name [String] The name of the blob container within the
specified storage account. Blob container names must be between 3 and 63
characters in length and use numbers, lower-case letters and dash (-) only.
Every dash (-) character must be immediately preceded and followed by a
letter or number.
@param if_match [String] The entity state (ETag) version of the immutability
policy to update. A value of "*" can be used to apply the operation only if
the immutability policy already exists. If omitted, this operation will
always be applied.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"existing",
"immutability",
"policy",
"along",
"with",
"the",
"corresponding",
"ETag",
"in",
"response",
"headers",
"and",
"body",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_storage/lib/2018-07-01/generated/azure_mgmt_storage/blob_containers.rb#L1170-L1172 | train | Gets the immutability policy for the specified container. | [
30522,
13366,
2131,
1035,
10047,
28120,
8010,
1035,
3343,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
11661,
1035,
2171,
1010,
2065,
1035,
2674,
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... |
zendesk/ruby-kafka | lib/kafka/client.rb | Kafka.Client.last_offsets_for | def last_offsets_for(*topics)
@cluster.add_target_topics(topics)
topics.map {|topic|
partition_ids = @cluster.partitions_for(topic).collect(&:partition_id)
partition_offsets = @cluster.resolve_offsets(topic, partition_ids, :latest)
[topic, partition_offsets.collect { |k, v| [k, v - 1] }.to_h]
}.to_h
end | ruby | def last_offsets_for(*topics)
@cluster.add_target_topics(topics)
topics.map {|topic|
partition_ids = @cluster.partitions_for(topic).collect(&:partition_id)
partition_offsets = @cluster.resolve_offsets(topic, partition_ids, :latest)
[topic, partition_offsets.collect { |k, v| [k, v - 1] }.to_h]
}.to_h
end | [
"def",
"last_offsets_for",
"(",
"*",
"topics",
")",
"@cluster",
".",
"add_target_topics",
"(",
"topics",
")",
"topics",
".",
"map",
"{",
"|",
"topic",
"|",
"partition_ids",
"=",
"@cluster",
".",
"partitions_for",
"(",
"topic",
")",
".",
"collect",
"(",
":p... | Retrieve the offset of the last message in each partition of the specified topics.
@param topics [Array<String>] topic names.
@return [Hash<String, Hash<Integer, Integer>>]
@example
last_offsets_for('topic-1', 'topic-2') # =>
# {
# 'topic-1' => { 0 => 100, 1 => 100 },
# 'topic-2' => { 0 => 100, 1 => 100 }
# } | [
"Retrieve",
"the",
"offset",
"of",
"the",
"last",
"message",
"in",
"each",
"partition",
"of",
"the",
"specified",
"topics",
"."
] | 2a73471b6a607a52dc85c79301ba522acb4566b5 | https://github.com/zendesk/ruby-kafka/blob/2a73471b6a607a52dc85c79301ba522acb4566b5/lib/kafka/client.rb#L688-L695 | train | Returns the last offsets for the given topics | [
30522,
13366,
2197,
1035,
16396,
2015,
1035,
2005,
1006,
1008,
7832,
1007,
1030,
9324,
1012,
5587,
1035,
4539,
1035,
7832,
1006,
7832,
1007,
7832,
1012,
4949,
1063,
1064,
8476,
1064,
13571,
1035,
8909,
2015,
1027,
1030,
9324,
1012,
13571,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/persistence.rb | Dynamoid.Persistence.save | def save(_options = {})
self.class.create_table
if new_record?
conditions = { unless_exists: [self.class.hash_key] }
conditions[:unless_exists] << range_key if range_key
run_callbacks(:create) { persist(conditions) }
else
persist
end
end | ruby | def save(_options = {})
self.class.create_table
if new_record?
conditions = { unless_exists: [self.class.hash_key] }
conditions[:unless_exists] << range_key if range_key
run_callbacks(:create) { persist(conditions) }
else
persist
end
end | [
"def",
"save",
"(",
"_options",
"=",
"{",
"}",
")",
"self",
".",
"class",
".",
"create_table",
"if",
"new_record?",
"conditions",
"=",
"{",
"unless_exists",
":",
"[",
"self",
".",
"class",
".",
"hash_key",
"]",
"}",
"conditions",
"[",
":unless_exists",
"... | Run the callbacks and then persist this object in the datastore.
@since 0.2.0 | [
"Run",
"the",
"callbacks",
"and",
"then",
"persist",
"this",
"object",
"in",
"the",
"datastore",
"."
] | 9e3d006b039e45877b003564ded65509b10b6354 | https://github.com/Dynamoid/dynamoid/blob/9e3d006b039e45877b003564ded65509b10b6354/lib/dynamoid/persistence.rb#L140-L151 | train | Save the record to the database | [
30522,
13366,
3828,
1006,
1035,
7047,
1027,
1063,
1065,
1007,
2969,
1012,
2465,
1012,
3443,
1035,
2795,
2065,
2047,
1035,
2501,
1029,
3785,
1027,
1063,
4983,
1035,
6526,
1024,
1031,
2969,
1012,
2465,
1012,
23325,
1035,
3145,
1033,
1065,
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_sql/lib/2014-04-01/generated/azure_mgmt_sql/databases.rb | Azure::SQL::Mgmt::V2014_04_01.Databases.get_by_elastic_pool | def get_by_elastic_pool(resource_group_name, server_name, elastic_pool_name, database_name, custom_headers:nil)
response = get_by_elastic_pool_async(resource_group_name, server_name, elastic_pool_name, database_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_by_elastic_pool(resource_group_name, server_name, elastic_pool_name, database_name, custom_headers:nil)
response = get_by_elastic_pool_async(resource_group_name, server_name, elastic_pool_name, database_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_by_elastic_pool",
"(",
"resource_group_name",
",",
"server_name",
",",
"elastic_pool_name",
",",
"database_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_by_elastic_pool_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"elas... | Gets a database inside of an elastic pool.
@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 elastic_pool_name [String] The name of the elastic pool to be
retrieved.
@param database_name [String] The name of the database to be retrieved.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Database] operation results. | [
"Gets",
"a",
"database",
"inside",
"of",
"an",
"elastic",
"pool",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/databases.rb#L551-L554 | train | Gets the elastic pool information. | [
30522,
13366,
2131,
1035,
2011,
1035,
21274,
1035,
4770,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
21274,
1035,
4770,
1035,
2171,
1010,
7809,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.Base.process_route | def process_route(pattern, conditions, block = nil, values = [])
route = @request.path_info
route = '/' if route.empty? and not settings.empty_path_info?
route = route[0..-2] if !settings.strict_paths? && route != '/' && route.end_with?('/')
return unless params = pattern.params(route)
params.delete("ignore") # TODO: better params handling, maybe turn it into "smart" object or detect changes
force_encoding(params)
original, @params = @params, @params.merge(params) if params.any?
regexp_exists = pattern.is_a?(Mustermann::Regular) || (pattern.respond_to?(:patterns) && pattern.patterns.any? {|subpattern| subpattern.is_a?(Mustermann::Regular)} )
if regexp_exists
captures = pattern.match(route).captures.map { |c| URI_INSTANCE.unescape(c) if c }
values += captures
@params[:captures] = force_encoding(captures) unless captures.nil? || captures.empty?
else
values += params.values.flatten
end
catch(:pass) do
conditions.each { |c| throw :pass if c.bind(self).call == false }
block ? block[self, values] : yield(self, values)
end
rescue
@env['sinatra.error.params'] = @params
raise
ensure
@params = original if original
end | ruby | def process_route(pattern, conditions, block = nil, values = [])
route = @request.path_info
route = '/' if route.empty? and not settings.empty_path_info?
route = route[0..-2] if !settings.strict_paths? && route != '/' && route.end_with?('/')
return unless params = pattern.params(route)
params.delete("ignore") # TODO: better params handling, maybe turn it into "smart" object or detect changes
force_encoding(params)
original, @params = @params, @params.merge(params) if params.any?
regexp_exists = pattern.is_a?(Mustermann::Regular) || (pattern.respond_to?(:patterns) && pattern.patterns.any? {|subpattern| subpattern.is_a?(Mustermann::Regular)} )
if regexp_exists
captures = pattern.match(route).captures.map { |c| URI_INSTANCE.unescape(c) if c }
values += captures
@params[:captures] = force_encoding(captures) unless captures.nil? || captures.empty?
else
values += params.values.flatten
end
catch(:pass) do
conditions.each { |c| throw :pass if c.bind(self).call == false }
block ? block[self, values] : yield(self, values)
end
rescue
@env['sinatra.error.params'] = @params
raise
ensure
@params = original if original
end | [
"def",
"process_route",
"(",
"pattern",
",",
"conditions",
",",
"block",
"=",
"nil",
",",
"values",
"=",
"[",
"]",
")",
"route",
"=",
"@request",
".",
"path_info",
"route",
"=",
"'/'",
"if",
"route",
".",
"empty?",
"and",
"not",
"settings",
".",
"empty... | If the current request matches pattern and conditions, fill params
with keys and call the given block.
Revert params afterwards.
Returns pass block. | [
"If",
"the",
"current",
"request",
"matches",
"pattern",
"and",
"conditions",
"fill",
"params",
"with",
"keys",
"and",
"call",
"the",
"given",
"block",
".",
"Revert",
"params",
"afterwards",
"."
] | 1aa64f9858edc3f93cc8d46e26f724c1ae103b1c | https://github.com/sinatra/sinatra/blob/1aa64f9858edc3f93cc8d46e26f724c1ae103b1c/lib/sinatra/base.rb#L1019-L1047 | train | Process the route | [
30522,
13366,
2832,
1035,
2799,
1006,
5418,
1010,
3785,
1010,
3796,
1027,
9152,
2140,
1010,
5300,
1027,
1031,
1033,
1007,
2799,
1027,
1030,
5227,
1012,
4130,
1035,
18558,
2799,
1027,
1005,
1013,
1005,
2065,
2799,
1012,
4064,
1029,
1998,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.list_intents | def list_intents(app_id, version_id, skip:0, take:100, custom_headers:nil)
response = list_intents_async(app_id, version_id, skip:skip, take:take, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_intents(app_id, version_id, skip:0, take:100, custom_headers:nil)
response = list_intents_async(app_id, version_id, skip:skip, take:take, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_intents",
"(",
"app_id",
",",
"version_id",
",",
"skip",
":",
"0",
",",
"take",
":",
"100",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_intents_async",
"(",
"app_id",
",",
"version_id",
",",
"skip",
":",
"skip",
",",
"take... | Gets information about the intent models in a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param skip [Integer] The number of entries to skip. Default value is 0.
@param take [Integer] The number of entries to return. Maximum page size is
500. Default is 100.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array] operation results. | [
"Gets",
"information",
"about",
"the",
"intent",
"models",
"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#L149-L152 | train | Gets the list of intents for the application version. | [
30522,
13366,
2862,
1035,
7848,
2015,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
13558,
1024,
1014,
1010,
2202,
1024,
2531,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
7848,
2015,
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_scheduler/lib/2016-03-01/generated/azure_mgmt_scheduler/job_collections.rb | Azure::Scheduler::Mgmt::V2016_03_01.JobCollections.begin_delete | def begin_delete(resource_group_name, job_collection_name, custom_headers:nil)
response = begin_delete_async(resource_group_name, job_collection_name, custom_headers:custom_headers).value!
nil
end | ruby | def begin_delete(resource_group_name, job_collection_name, custom_headers:nil)
response = begin_delete_async(resource_group_name, job_collection_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_delete",
"(",
"resource_group_name",
",",
"job_collection_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_delete_async",
"(",
"resource_group_name",
",",
"job_collection_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"val... | Deletes a job collection.
@param resource_group_name [String] The resource group name.
@param job_collection_name [String] The job collection name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Deletes",
"a",
"job",
"collection",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_scheduler/lib/2016-03-01/generated/azure_mgmt_scheduler/job_collections.rb#L633-L636 | train | Deletes a job collection. | [
30522,
13366,
4088,
1035,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3105,
1035,
3074,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
3972,
12870,
1035,
2004,
6038,
2278,
1006,
7692,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
ruby2d/ruby2d | lib/ruby2d/window.rb | Ruby2D.Window.mouse_callback | def mouse_callback(type, button, direction, x, y, delta_x, delta_y)
# All mouse events
@events[:mouse].each do |id, e|
e.call(MouseEvent.new(type, button, direction, x, y, delta_x, delta_y))
end
case type
# When mouse button pressed
when :down
@events[:mouse_down].each do |id, e|
e.call(MouseEvent.new(type, button, nil, x, y, nil, nil))
end
# When mouse button released
when :up
@events[:mouse_up].each do |id, e|
e.call(MouseEvent.new(type, button, nil, x, y, nil, nil))
end
# When mouse motion / movement
when :scroll
@events[:mouse_scroll].each do |id, e|
e.call(MouseEvent.new(type, nil, direction, nil, nil, delta_x, delta_y))
end
# When mouse scrolling, wheel or trackpad
when :move
@events[:mouse_move].each do |id, e|
e.call(MouseEvent.new(type, nil, nil, x, y, delta_x, delta_y))
end
end
end | ruby | def mouse_callback(type, button, direction, x, y, delta_x, delta_y)
# All mouse events
@events[:mouse].each do |id, e|
e.call(MouseEvent.new(type, button, direction, x, y, delta_x, delta_y))
end
case type
# When mouse button pressed
when :down
@events[:mouse_down].each do |id, e|
e.call(MouseEvent.new(type, button, nil, x, y, nil, nil))
end
# When mouse button released
when :up
@events[:mouse_up].each do |id, e|
e.call(MouseEvent.new(type, button, nil, x, y, nil, nil))
end
# When mouse motion / movement
when :scroll
@events[:mouse_scroll].each do |id, e|
e.call(MouseEvent.new(type, nil, direction, nil, nil, delta_x, delta_y))
end
# When mouse scrolling, wheel or trackpad
when :move
@events[:mouse_move].each do |id, e|
e.call(MouseEvent.new(type, nil, nil, x, y, delta_x, delta_y))
end
end
end | [
"def",
"mouse_callback",
"(",
"type",
",",
"button",
",",
"direction",
",",
"x",
",",
"y",
",",
"delta_x",
",",
"delta_y",
")",
"# All mouse events",
"@events",
"[",
":mouse",
"]",
".",
"each",
"do",
"|",
"id",
",",
"e",
"|",
"e",
".",
"call",
"(",
... | Mouse callback method, called by the native and web extentions | [
"Mouse",
"callback",
"method",
"called",
"by",
"the",
"native",
"and",
"web",
"extentions"
] | 43ce9805a7ae8b82b7ab8c50bf6d4c845d395dc4 | https://github.com/ruby2d/ruby2d/blob/43ce9805a7ae8b82b7ab8c50bf6d4c845d395dc4/lib/ruby2d/window.rb#L303-L331 | train | Mouse callback | [
30522,
13366,
8000,
1035,
2655,
5963,
1006,
2828,
1010,
6462,
1010,
3257,
1010,
1060,
1010,
1061,
1010,
7160,
1035,
1060,
1010,
7160,
1035,
1061,
1007,
1001,
2035,
8000,
2824,
1030,
2824,
1031,
1024,
8000,
1033,
1012,
2169,
2079,
1064,
89... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/event_subscriptions.rb | Azure::EventGrid::Mgmt::V2018_01_01.EventSubscriptions.begin_delete | def begin_delete(scope, event_subscription_name, custom_headers:nil)
response = begin_delete_async(scope, event_subscription_name, custom_headers:custom_headers).value!
nil
end | ruby | def begin_delete(scope, event_subscription_name, custom_headers:nil)
response = begin_delete_async(scope, event_subscription_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_delete",
"(",
"scope",
",",
"event_subscription_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_delete_async",
"(",
"scope",
",",
"event_subscription_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"nil",
"en... | Delete an event subscription
Delete an existing event subscription
@param scope [String] The scope of the event subscription. The scope can be a
subscription, or a resource group, or a top level resource belonging to a
resource provider namespace, or an EventGrid topic. For example, use
'/subscriptions/{subscriptionId}/' for a subscription,
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
resource group, and
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
for a resource, and
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
for an EventGrid topic.
@param event_subscription_name [String] Name of the event subscription
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Delete",
"an",
"event",
"subscription"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/event_subscriptions.rb#L1572-L1575 | train | Deletes an existing event subscription. | [
30522,
13366,
4088,
1035,
3972,
12870,
1006,
9531,
1010,
2724,
1035,
15002,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
3972,
12870,
1035,
2004,
6038,
2278,
1006,
9531,
1010,
2724,
1035,
15002,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb | Azure::Web::Mgmt::V2018_02_01.AppServiceEnvironments.list_capacities_next | def list_capacities_next(next_page_link, custom_headers:nil)
response = list_capacities_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_capacities_next(next_page_link, custom_headers:nil)
response = list_capacities_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_capacities_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_capacities_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"respon... | Get the used, available, and total worker capacity an App Service
Environment.
Get the used, available, and total worker capacity an App Service
Environment.
@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 [StampCapacityCollection] operation results. | [
"Get",
"the",
"used",
"available",
"and",
"total",
"worker",
"capacity",
"an",
"App",
"Service",
"Environment",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb#L5184-L5187 | train | Gets the list of all the available capability terms. | [
30522,
13366,
2862,
1035,
21157,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
21157,
1035,
2279,
1035,
2004,
6038,
2278,
1006,
2279,
1035,
3931,
1035,
4957,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.container | def container(wobj)
s = @epub.container
if !s.nil? && !wobj.nil?
wobj.puts s
end
end | ruby | def container(wobj)
s = @epub.container
if !s.nil? && !wobj.nil?
wobj.puts s
end
end | [
"def",
"container",
"(",
"wobj",
")",
"s",
"=",
"@epub",
".",
"container",
"if",
"!",
"s",
".",
"nil?",
"&&",
"!",
"wobj",
".",
"nil?",
"wobj",
".",
"puts",
"s",
"end",
"end"
] | Write container file to IO object +wobj+. | [
"Write",
"container",
"file",
"to",
"IO",
"object",
"+",
"wobj",
"+",
"."
] | 77d1273e671663f05db2992281fd891b776badf0 | https://github.com/kmuto/review/blob/77d1273e671663f05db2992281fd891b776badf0/lib/epubmaker/producer.rb#L123-L128 | train | Returns the container of the current object. | [
30522,
13366,
11661,
1006,
24185,
2497,
3501,
1007,
1055,
1027,
1030,
4958,
12083,
1012,
11661,
2065,
999,
1055,
1012,
9152,
2140,
1029,
1004,
1004,
999,
24185,
2497,
3501,
1012,
9152,
2140,
1029,
24185,
2497,
3501,
1012,
8509,
1055,
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... |
soundcloud/lhm | lib/lhm/sql_helper.rb | Lhm.SqlHelper.supports_atomic_switch? | def supports_atomic_switch?
major, minor, tiny = version_string.split('.').map(&:to_i)
case major
when 4 then return false if minor and minor < 2
when 5
case minor
when 0 then return false if tiny and tiny < 52
when 1 then return false
when 4 then return false if tiny and tiny < 4
when 5 then return false if tiny and tiny < 3
end
when 6
case minor
when 0 then return false if tiny and tiny < 11
end
end
true
end | ruby | def supports_atomic_switch?
major, minor, tiny = version_string.split('.').map(&:to_i)
case major
when 4 then return false if minor and minor < 2
when 5
case minor
when 0 then return false if tiny and tiny < 52
when 1 then return false
when 4 then return false if tiny and tiny < 4
when 5 then return false if tiny and tiny < 3
end
when 6
case minor
when 0 then return false if tiny and tiny < 11
end
end
true
end | [
"def",
"supports_atomic_switch?",
"major",
",",
"minor",
",",
"tiny",
"=",
"version_string",
".",
"split",
"(",
"'.'",
")",
".",
"map",
"(",
":to_i",
")",
"case",
"major",
"when",
"4",
"then",
"return",
"false",
"if",
"minor",
"and",
"minor",
"<",
"2",
... | Older versions of MySQL contain an atomic rename bug affecting bin
log order. Affected versions extracted from bug report:
http://bugs.mysql.com/bug.php?id=39675
More Info: http://dev.mysql.com/doc/refman/5.5/en/metadata-locking.html | [
"Older",
"versions",
"of",
"MySQL",
"contain",
"an",
"atomic",
"rename",
"bug",
"affecting",
"bin",
"log",
"order",
".",
"Affected",
"versions",
"extracted",
"from",
"bug",
"report",
":"
] | 50907121eee514649fa944fb300d5d8a64fa873e | https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/lib/lhm/sql_helper.rb#L47-L65 | train | Returns true if the version string supports atomic switch. | [
30522,
13366,
6753,
1035,
9593,
1035,
6942,
1029,
2350,
1010,
3576,
1010,
4714,
1027,
2544,
1035,
5164,
1012,
3975,
1006,
1005,
1012,
1005,
1007,
1012,
4949,
1006,
1004,
1024,
2000,
1035,
1045,
1007,
2553,
2350,
2043,
1018,
2059,
2709,
62... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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_replica_health_with_http_info | def get_replica_health_with_http_info(partition_id, replica_id, events_health_state_filter:0, timeout:60, custom_headers:nil)
get_replica_health_async(partition_id, replica_id, events_health_state_filter:events_health_state_filter, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def get_replica_health_with_http_info(partition_id, replica_id, events_health_state_filter:0, timeout:60, custom_headers:nil)
get_replica_health_async(partition_id, replica_id, events_health_state_filter:events_health_state_filter, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"get_replica_health_with_http_info",
"(",
"partition_id",
",",
"replica_id",
",",
"events_health_state_filter",
":",
"0",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"get_replica_health_async",
"(",
"partition_id",
",",
"replica_id",
",",... | Gets the health of a Service Fabric stateful service replica or stateless
service instance.
Gets the health of a Service Fabric replica.
Use EventsHealthStateFilter to filter the collection of health events
reported on the replica based on the health state.
@param partition_id The identity of the partition.
@param replica_id [String] The identifier of the replica.
@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 [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"health",
"of",
"a",
"Service",
"Fabric",
"stateful",
"service",
"replica",
"or",
"stateless",
"service",
"instance",
"."
] | 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#L14757-L14759 | train | Gets the health of the replica. | [
30522,
13366,
2131,
1035,
15059,
1035,
2740,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
13571,
1035,
8909,
1010,
15059,
1035,
8909,
1010,
2824,
1035,
2740,
1035,
2110,
1035,
11307,
1024,
1014,
1010,
2051,
5833,
1024,
3438,
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... |
puppetlabs/puppet | lib/puppet/rest/route.rb | Puppet::Rest.Route.with_base_url | def with_base_url(dns_resolver)
if @server && @port
# First try connecting to the previously selected server and port.
begin
return yield(base_url)
rescue SystemCallError => e
if Puppet[:use_srv_records]
Puppet.debug "Connection to cached server and port #{@server}:#{@port} failed, reselecting."
else
raise Puppet::Error, _("Connection to cached server and port %{server}:%{port} failed: %{message}") %
{ server: @server, port: @port, message: e.message }
end
end
end
if Puppet[:use_srv_records]
dns_resolver.each_srv_record(Puppet[:srv_domain], @srv_service) do |srv_server, srv_port|
# Try each of the servers for this service in weighted order
# until a working one is found.
begin
@server = srv_server
@port = srv_port
return yield(base_url)
rescue SystemCallError
Puppet.debug "Connection to selected server and port #{@server}:#{@port} failed. Trying next cached SRV record."
@server = nil
@port = nil
end
end
end
# If not using SRV records, fall back to the defaults calculated above
@server = @default_server
@port = @default_port
Puppet.debug "No more servers in SRV record, falling back to #{@server}:#{@port}" if Puppet[:use_srv_records]
return yield(base_url)
end | ruby | def with_base_url(dns_resolver)
if @server && @port
# First try connecting to the previously selected server and port.
begin
return yield(base_url)
rescue SystemCallError => e
if Puppet[:use_srv_records]
Puppet.debug "Connection to cached server and port #{@server}:#{@port} failed, reselecting."
else
raise Puppet::Error, _("Connection to cached server and port %{server}:%{port} failed: %{message}") %
{ server: @server, port: @port, message: e.message }
end
end
end
if Puppet[:use_srv_records]
dns_resolver.each_srv_record(Puppet[:srv_domain], @srv_service) do |srv_server, srv_port|
# Try each of the servers for this service in weighted order
# until a working one is found.
begin
@server = srv_server
@port = srv_port
return yield(base_url)
rescue SystemCallError
Puppet.debug "Connection to selected server and port #{@server}:#{@port} failed. Trying next cached SRV record."
@server = nil
@port = nil
end
end
end
# If not using SRV records, fall back to the defaults calculated above
@server = @default_server
@port = @default_port
Puppet.debug "No more servers in SRV record, falling back to #{@server}:#{@port}" if Puppet[:use_srv_records]
return yield(base_url)
end | [
"def",
"with_base_url",
"(",
"dns_resolver",
")",
"if",
"@server",
"&&",
"@port",
"# First try connecting to the previously selected server and port.",
"begin",
"return",
"yield",
"(",
"base_url",
")",
"rescue",
"SystemCallError",
"=>",
"e",
"if",
"Puppet",
"[",
":use_s... | Create a Route containing information for querying the given API,
hosted at a server determined either by SRV service or by the
fallback server on the fallback port.
@param [String] api the path leading to the root of the API. Must
contain a trailing slash for proper endpoint path
construction
@param [Symbol] server_setting the setting to check for special
server configuration
@param [Symbol] port_setting the setting to check for speical
port configuration
@param [Symbol] srv_service the name of the service when using SRV
records
Select a server and port to create a base URL for the API specified by this
route. If the connection fails and SRV records are in use, the next suitable
server will be tried. If SRV records are not in use or no successful connection
could be made, fall back to the configured server and port for this API, taking
into account failover settings.
@parma [Puppet::Network::Resolver] dns_resolver the DNS resolver to use to check
SRV records
@yield [URI] supply a base URL to make a request with
@raise [Puppet::Error] if connection to selected server and port fails, and SRV
records are not in use | [
"Create",
"a",
"Route",
"containing",
"information",
"for",
"querying",
"the",
"given",
"API",
"hosted",
"at",
"a",
"server",
"determined",
"either",
"by",
"SRV",
"service",
"or",
"by",
"the",
"fallback",
"server",
"on",
"the",
"fallback",
"port",
"."
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/rest/route.rb#L37-L74 | train | Returns a new instance of the class with the base url set. | [
30522,
13366,
2007,
1035,
2918,
1035,
24471,
2140,
1006,
1040,
3619,
1035,
10663,
2099,
1007,
2065,
1030,
8241,
1004,
1004,
1030,
3417,
1001,
2034,
3046,
7176,
2000,
1996,
3130,
3479,
8241,
1998,
3417,
1012,
4088,
2709,
10750,
1006,
2918,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
apache/thrift | lib/rb/lib/thrift/protocol/json_protocol.rb | Thrift.JsonProtocol.write_json_base64 | def write_json_base64(str)
@context.write(trans)
trans.write(@@kJSONStringDelimiter)
trans.write(Base64.strict_encode64(str))
trans.write(@@kJSONStringDelimiter)
end | ruby | def write_json_base64(str)
@context.write(trans)
trans.write(@@kJSONStringDelimiter)
trans.write(Base64.strict_encode64(str))
trans.write(@@kJSONStringDelimiter)
end | [
"def",
"write_json_base64",
"(",
"str",
")",
"@context",
".",
"write",
"(",
"trans",
")",
"trans",
".",
"write",
"(",
"@@kJSONStringDelimiter",
")",
"trans",
".",
"write",
"(",
"Base64",
".",
"strict_encode64",
"(",
"str",
")",
")",
"trans",
".",
"write",
... | Write out the contents of the string as JSON string, base64-encoding
the string's contents, and escaping as appropriate | [
"Write",
"out",
"the",
"contents",
"of",
"the",
"string",
"as",
"JSON",
"string",
"base64",
"-",
"encoding",
"the",
"string",
"s",
"contents",
"and",
"escaping",
"as",
"appropriate"
] | 27d8387c49a49fcf193893f834e9766ae0b051c1 | https://github.com/apache/thrift/blob/27d8387c49a49fcf193893f834e9766ae0b051c1/lib/rb/lib/thrift/protocol/json_protocol.rb#L311-L316 | train | Write the string to the JSON object. | [
30522,
13366,
4339,
1035,
1046,
3385,
1035,
2918,
21084,
1006,
2358,
2099,
1007,
1030,
6123,
1012,
4339,
1006,
9099,
1007,
9099,
1012,
4339,
1006,
1030,
1030,
1047,
22578,
5644,
18886,
3070,
9247,
27605,
3334,
1007,
9099,
1012,
4339,
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... |
meew0/discordrb | lib/discordrb/bot.rb | Discordrb.Bot.update_guild_member | def update_guild_member(data)
server_id = data['guild_id'].to_i
server = self.server(server_id)
member = server.member(data['user']['id'].to_i)
member.update_roles(data['roles'])
member.update_nick(data['nick'])
end | ruby | def update_guild_member(data)
server_id = data['guild_id'].to_i
server = self.server(server_id)
member = server.member(data['user']['id'].to_i)
member.update_roles(data['roles'])
member.update_nick(data['nick'])
end | [
"def",
"update_guild_member",
"(",
"data",
")",
"server_id",
"=",
"data",
"[",
"'guild_id'",
"]",
".",
"to_i",
"server",
"=",
"self",
".",
"server",
"(",
"server_id",
")",
"member",
"=",
"server",
".",
"member",
"(",
"data",
"[",
"'user'",
"]",
"[",
"'... | Internal handler for GUILD_MEMBER_UPDATE | [
"Internal",
"handler",
"for",
"GUILD_MEMBER_UPDATE"
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/bot.rb#L873-L880 | train | Update guild member | [
30522,
13366,
10651,
1035,
9054,
1035,
2266,
1006,
2951,
1007,
8241,
1035,
8909,
1027,
2951,
1031,
1005,
9054,
1035,
8909,
1005,
1033,
1012,
2000,
1035,
1045,
8241,
1027,
2969,
1012,
8241,
1006,
8241,
1035,
8909,
1007,
2266,
1027,
8241,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb | Aws::EC2.Resource.create_vpc | def create_vpc(options = {})
resp = @client.create_vpc(options)
Vpc.new(
id: resp.data.vpc.vpc_id,
data: resp.data.vpc,
client: @client
)
end | ruby | def create_vpc(options = {})
resp = @client.create_vpc(options)
Vpc.new(
id: resp.data.vpc.vpc_id,
data: resp.data.vpc,
client: @client
)
end | [
"def",
"create_vpc",
"(",
"options",
"=",
"{",
"}",
")",
"resp",
"=",
"@client",
".",
"create_vpc",
"(",
"options",
")",
"Vpc",
".",
"new",
"(",
"id",
":",
"resp",
".",
"data",
".",
"vpc",
".",
"vpc_id",
",",
"data",
":",
"resp",
".",
"data",
"."... | @example Request syntax with placeholder values
vpc = ec2.create_vpc({
cidr_block: "String", # required
amazon_provided_ipv_6_cidr_block: false,
dry_run: false,
instance_tenancy: "default", # accepts default, dedicated, host
})
@param [Hash] options ({})
@option options [required, String] :cidr_block
The IPv4 network range for the VPC, in CIDR notation. For example,
`10.0.0.0/16`.
@option options [Boolean] :amazon_provided_ipv_6_cidr_block
Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length
for the VPC. You cannot specify the range of IP addresses, or the size
of the CIDR block.
@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 [String] :instance_tenancy
The tenancy options for instances launched into the VPC. For
`default`, instances are launched with shared tenancy by default. You
can launch instances with any tenancy into a shared tenancy VPC. For
`dedicated`, instances are launched as dedicated tenancy instances by
default. You can only launch instances with a tenancy of `dedicated`
or `host` into a dedicated tenancy VPC.
**Important:** The `host` value cannot be used with this parameter.
Use the `default` or `dedicated` values only.
Default: `default`
@return [Vpc] | [
"@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#L1004-L1011 | train | Creates a new vpc | [
30522,
13366,
3443,
1035,
21210,
2278,
1006,
7047,
1027,
1063,
1065,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
3443,
1035,
21210,
2278,
1006,
7047,
1007,
21210,
2278,
1012,
2047,
1006,
8909,
1024,
24501,
2361,
1012,
2951,
1012,
21210,
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... |
jekyll/jekyll | lib/jekyll/convertible.rb | Jekyll.Convertible.write | def write(dest)
path = destination(dest)
FileUtils.mkdir_p(File.dirname(path))
Jekyll.logger.debug "Writing:", path
File.write(path, output, :mode => "wb")
Jekyll::Hooks.trigger hook_owner, :post_write, self
end | ruby | def write(dest)
path = destination(dest)
FileUtils.mkdir_p(File.dirname(path))
Jekyll.logger.debug "Writing:", path
File.write(path, output, :mode => "wb")
Jekyll::Hooks.trigger hook_owner, :post_write, self
end | [
"def",
"write",
"(",
"dest",
")",
"path",
"=",
"destination",
"(",
"dest",
")",
"FileUtils",
".",
"mkdir_p",
"(",
"File",
".",
"dirname",
"(",
"path",
")",
")",
"Jekyll",
".",
"logger",
".",
"debug",
"\"Writing:\"",
",",
"path",
"File",
".",
"write",
... | Write the generated page file to the destination directory.
dest - The String path to the destination dir.
Returns nothing. | [
"Write",
"the",
"generated",
"page",
"file",
"to",
"the",
"destination",
"directory",
"."
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/convertible.rb#L222-L228 | train | Write the file to the destination | [
30522,
13366,
4339,
1006,
4078,
2102,
1007,
4130,
1027,
7688,
1006,
4078,
30524,
5371,
1012,
4339,
1006,
4130,
1010,
6434,
1010,
1024,
5549,
1027,
1028,
1000,
25610,
1000,
1007,
15333,
4801,
3363,
1024,
1024,
18008,
1012,
9495,
8103,
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... |
alexreisner/geocoder | lib/geocoder/lookups/ipapi_com.rb | Geocoder::Lookup.IpapiCom.base_query_url | def base_query_url(query)
domain = configuration.api_key ? "pro.ip-api.com" : "ip-api.com"
url = "#{protocol}://#{domain}/json/#{query.sanitized_text}"
url << "?" if not url_query_string(query).empty?
url
end | ruby | def base_query_url(query)
domain = configuration.api_key ? "pro.ip-api.com" : "ip-api.com"
url = "#{protocol}://#{domain}/json/#{query.sanitized_text}"
url << "?" if not url_query_string(query).empty?
url
end | [
"def",
"base_query_url",
"(",
"query",
")",
"domain",
"=",
"configuration",
".",
"api_key",
"?",
"\"pro.ip-api.com\"",
":",
"\"ip-api.com\"",
"url",
"=",
"\"#{protocol}://#{domain}/json/#{query.sanitized_text}\"",
"url",
"<<",
"\"?\"",
"if",
"not",
"url_query_string",
"... | ---------------------------------------------------------------- | [
"----------------------------------------------------------------"
] | e087dc2759264ee6f307b926bb2de4ec2406859e | https://github.com/alexreisner/geocoder/blob/e087dc2759264ee6f307b926bb2de4ec2406859e/lib/geocoder/lookups/ipapi_com.rb#L21-L26 | train | Returns the base url for a query | [
30522,
13366,
2918,
1035,
23032,
1035,
24471,
2140,
1006,
23032,
1007,
5884,
1027,
9563,
1012,
17928,
1035,
3145,
1029,
1000,
4013,
1012,
12997,
1011,
17928,
1012,
30524,
1013,
1046,
3385,
1013,
1001,
1063,
23032,
1012,
2624,
25090,
5422,
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_consumption/lib/2018-01-31/generated/azure_mgmt_consumption/reservations_summaries.rb | Azure::Consumption::Mgmt::V2018_01_31.ReservationsSummaries.list_by_reservation_order_as_lazy | def list_by_reservation_order_as_lazy(reservation_order_id, grain, filter:nil, custom_headers:nil)
response = list_by_reservation_order_async(reservation_order_id, grain, filter:filter, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_reservation_order_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_by_reservation_order_as_lazy(reservation_order_id, grain, filter:nil, custom_headers:nil)
response = list_by_reservation_order_async(reservation_order_id, grain, filter:filter, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_reservation_order_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_by_reservation_order_as_lazy",
"(",
"reservation_order_id",
",",
"grain",
",",
"filter",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_reservation_order_async",
"(",
"reservation_order_id",
",",
"grain",
",",
"filter",
":",... | Lists the reservations summaries for daily or monthly grain.
@param reservation_order_id [String] Order Id of the reservation
@param grain [Datagrain] Can be daily or monthly. Possible values include:
'DailyGrain', 'MonthlyGrain'
@param filter [String] Required only for daily grain. The
properties/UsageDate for start date and end date. The filter supports 'le'
and 'ge'
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ReservationSummariesListResult] which provide lazy access to pages
of the response. | [
"Lists",
"the",
"reservations",
"summaries",
"for",
"daily",
"or",
"monthly",
"grain",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_consumption/lib/2018-01-31/generated/azure_mgmt_consumption/reservations_summaries.rb#L426-L435 | train | Gets a list of all the image images in a reservation order. | [
30522,
13366,
2862,
1035,
2011,
1035,
11079,
1035,
2344,
1035,
2004,
1035,
13971,
1006,
11079,
1035,
2344,
1035,
8909,
1010,
8982,
1010,
11307,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
david942j/one_gadget | lib/one_gadget/helper.rb | OneGadget.Helper.valid_elf_file? | def valid_elf_file?(path)
# A light-weight way to check if is a valid ELF file
# Checks at least one phdr should present.
File.open(path) { |f| ELFTools::ELFFile.new(f).each_segments.first }
true
rescue ELFTools::ELFError
false
end | ruby | def valid_elf_file?(path)
# A light-weight way to check if is a valid ELF file
# Checks at least one phdr should present.
File.open(path) { |f| ELFTools::ELFFile.new(f).each_segments.first }
true
rescue ELFTools::ELFError
false
end | [
"def",
"valid_elf_file?",
"(",
"path",
")",
"# A light-weight way to check if is a valid ELF file",
"# Checks at least one phdr should present.",
"File",
".",
"open",
"(",
"path",
")",
"{",
"|",
"f",
"|",
"ELFTools",
"::",
"ELFFile",
".",
"new",
"(",
"f",
")",
".",
... | Checks if the file of given path is a valid ELF file.
@param [String] path Path to target file.
@return [Boolean] If the file is an ELF or not.
@example
Helper.valid_elf_file?('/etc/passwd')
#=> false
Helper.valid_elf_file?('/lib64/ld-linux-x86-64.so.2')
#=> true | [
"Checks",
"if",
"the",
"file",
"of",
"given",
"path",
"is",
"a",
"valid",
"ELF",
"file",
"."
] | ff6ef04541e83441bfe3c2664a6febd1640f4263 | https://github.com/david942j/one_gadget/blob/ff6ef04541e83441bfe3c2664a6febd1640f4263/lib/one_gadget/helper.rb#L60-L67 | train | Checks if the file is a valid ELF file | [
30522,
13366,
9398,
1035,
17163,
1035,
5371,
1029,
1006,
4130,
1007,
1001,
1037,
2422,
1011,
3635,
2126,
2000,
4638,
2065,
2003,
1037,
9398,
17163,
5371,
1001,
14148,
2012,
2560,
2028,
8065,
2099,
2323,
2556,
1012,
5371,
1012,
2330,
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... |
meew0/discordrb | lib/discordrb/data/channel.rb | Discordrb.Channel.make_invite | def make_invite(max_age = 0, max_uses = 0, temporary = false, unique = false, reason = nil)
response = API::Channel.create_invite(@bot.token, @id, max_age, max_uses, temporary, unique, reason)
Invite.new(JSON.parse(response), @bot)
end | ruby | def make_invite(max_age = 0, max_uses = 0, temporary = false, unique = false, reason = nil)
response = API::Channel.create_invite(@bot.token, @id, max_age, max_uses, temporary, unique, reason)
Invite.new(JSON.parse(response), @bot)
end | [
"def",
"make_invite",
"(",
"max_age",
"=",
"0",
",",
"max_uses",
"=",
"0",
",",
"temporary",
"=",
"false",
",",
"unique",
"=",
"false",
",",
"reason",
"=",
"nil",
")",
"response",
"=",
"API",
"::",
"Channel",
".",
"create_invite",
"(",
"@bot",
".",
"... | Creates a new invite to this channel.
@param max_age [Integer] How many seconds this invite should last.
@param max_uses [Integer] How many times this invite should be able to be used.
@param temporary [true, false] Whether membership should be temporary (kicked after going offline).
@param unique [true, false] If true, Discord will always send a unique invite instead of possibly re-using a similar one
@param reason [String] The reason the for the creation of this invite.
@return [Invite] the created invite. | [
"Creates",
"a",
"new",
"invite",
"to",
"this",
"channel",
"."
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/data/channel.rb#L633-L636 | train | Create an invite to this channel | [
30522,
13366,
2191,
1035,
13260,
1006,
4098,
1035,
2287,
1027,
1014,
1010,
4098,
1035,
3594,
1027,
1014,
1010,
5741,
1027,
6270,
1010,
4310,
1027,
6270,
1010,
3114,
1027,
9152,
2140,
1007,
3433,
1027,
17928,
1024,
1024,
3149,
1012,
3443,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/mongoid | lib/mongoid/threaded.rb | Mongoid.Threaded.set_current_scope | def set_current_scope(scope, klass)
if scope.nil?
if Thread.current[CURRENT_SCOPE_KEY]
Thread.current[CURRENT_SCOPE_KEY].delete(klass)
Thread.current[CURRENT_SCOPE_KEY] = nil if Thread.current[CURRENT_SCOPE_KEY].empty?
end
else
Thread.current[CURRENT_SCOPE_KEY] ||= {}
Thread.current[CURRENT_SCOPE_KEY][klass] = scope
end
end | ruby | def set_current_scope(scope, klass)
if scope.nil?
if Thread.current[CURRENT_SCOPE_KEY]
Thread.current[CURRENT_SCOPE_KEY].delete(klass)
Thread.current[CURRENT_SCOPE_KEY] = nil if Thread.current[CURRENT_SCOPE_KEY].empty?
end
else
Thread.current[CURRENT_SCOPE_KEY] ||= {}
Thread.current[CURRENT_SCOPE_KEY][klass] = scope
end
end | [
"def",
"set_current_scope",
"(",
"scope",
",",
"klass",
")",
"if",
"scope",
".",
"nil?",
"if",
"Thread",
".",
"current",
"[",
"CURRENT_SCOPE_KEY",
"]",
"Thread",
".",
"current",
"[",
"CURRENT_SCOPE_KEY",
"]",
".",
"delete",
"(",
"klass",
")",
"Thread",
"."... | Set the current Mongoid scope. Safe for multi-model scope chaining.
@example Set the scope.
Threaded.current_scope(scope, klass)
@param [ Criteria ] scope The current scope.
@param [ Class ] klass The current model class.
@return [ Criteria ] The scope.
@since 5.0.1 | [
"Set",
"the",
"current",
"Mongoid",
"scope",
".",
"Safe",
"for",
"multi",
"-",
"model",
"scope",
"chaining",
"."
] | 56976e32610f4c2450882b0bfe14da099f0703f4 | https://github.com/mongodb/mongoid/blob/56976e32610f4c2450882b0bfe14da099f0703f4/lib/mongoid/threaded.rb#L263-L273 | train | Sets the current scope for the current page. | [
30522,
13366,
2275,
1035,
2783,
1035,
9531,
1006,
9531,
1010,
1047,
27102,
1007,
2065,
9531,
1012,
9152,
2140,
1029,
2065,
11689,
1012,
2783,
1031,
2783,
1035,
9531,
1035,
3145,
1033,
11689,
1012,
2783,
1031,
2783,
1035,
9531,
1035,
3145,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.fail_over | def fail_over(resource_group_name, namespace_name, alias_parameter, custom_headers:nil)
response = fail_over_async(resource_group_name, namespace_name, alias_parameter, custom_headers:custom_headers).value!
nil
end | ruby | def fail_over(resource_group_name, namespace_name, alias_parameter, custom_headers:nil)
response = fail_over_async(resource_group_name, namespace_name, alias_parameter, custom_headers:custom_headers).value!
nil
end | [
"def",
"fail_over",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"alias_parameter",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"fail_over_async",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"alias_parameter",
",",
"custom_headers",
... | Invokes GEO DR failover and reconfigure the alias to point to the secondary
namespace
@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. | [
"Invokes",
"GEO",
"DR",
"failover",
"and",
"reconfigure",
"the",
"alias",
"to",
"point",
"to",
"the",
"secondary",
"namespace"
] | 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#L666-L669 | train | Fails over the namespace. | [
30522,
13366,
8246,
1035,
2058,
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,
8246,
1035,
2058,
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... |
huginn/huginn | app/controllers/concerns/sortable_table.rb | SortableTable.SortableTableHelper.sortable_column | def sortable_column(attribute, default_direction = nil, options = nil)
if options.nil? && (options = Hash.try_convert(default_direction))
default_direction = nil
end
default_direction ||= 'desc'
options ||= {}
name = options[:name] || attribute.humanize
selected = @table_sort_info[:attribute].to_s == attribute
if selected
direction = @table_sort_info[:direction]
new_direction = direction.to_s == 'desc' ? 'asc' : 'desc'
classes = "selected #{direction}"
else
classes = ''
new_direction = default_direction
end
link_to(name, url_for(sort: "#{attribute}.#{new_direction}"), class: classes)
end | ruby | def sortable_column(attribute, default_direction = nil, options = nil)
if options.nil? && (options = Hash.try_convert(default_direction))
default_direction = nil
end
default_direction ||= 'desc'
options ||= {}
name = options[:name] || attribute.humanize
selected = @table_sort_info[:attribute].to_s == attribute
if selected
direction = @table_sort_info[:direction]
new_direction = direction.to_s == 'desc' ? 'asc' : 'desc'
classes = "selected #{direction}"
else
classes = ''
new_direction = default_direction
end
link_to(name, url_for(sort: "#{attribute}.#{new_direction}"), class: classes)
end | [
"def",
"sortable_column",
"(",
"attribute",
",",
"default_direction",
"=",
"nil",
",",
"options",
"=",
"nil",
")",
"if",
"options",
".",
"nil?",
"&&",
"(",
"options",
"=",
"Hash",
".",
"try_convert",
"(",
"default_direction",
")",
")",
"default_direction",
"... | :call-seq:
sortable_column(attribute, default_direction = 'desc', name: attribute.humanize) | [
":",
"call",
"-",
"seq",
":",
"sortable_column",
"(",
"attribute",
"default_direction",
"=",
"desc",
"name",
":",
"attribute",
".",
"humanize",
")"
] | 01e18fef7b6bd827a5d48a89391e460b5fb1bee3 | https://github.com/huginn/huginn/blob/01e18fef7b6bd827a5d48a89391e460b5fb1bee3/app/controllers/concerns/sortable_table.rb#L42-L59 | train | Returns a sortable column link to the given attribute. | [
30522,
13366,
4066,
3085,
1035,
5930,
1006,
17961,
1010,
12398,
1035,
3257,
1027,
9152,
2140,
1010,
7047,
1027,
9152,
2140,
1007,
2065,
7047,
1012,
9152,
2140,
1029,
1004,
1004,
1006,
7047,
1027,
23325,
1012,
3046,
1035,
10463,
1006,
12398,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
interagent/committee | lib/committee/drivers/open_api_2.rb | Committee::Drivers.OpenAPI2.parse | def parse(data)
REQUIRED_FIELDS.each do |field|
if !data[field]
raise ArgumentError, "Committee: no #{field} section in spec data."
end
end
if data['swagger'] != '2.0'
raise ArgumentError, "Committee: driver requires OpenAPI 2.0."
end
schema = Schema.new
schema.driver = self
schema.base_path = data['basePath'] || ''
# Arbitrarily choose the first media type found in these arrays. This
# appraoch could probably stand to be improved, but at least users will
# for now have the option of turning media type validation off if they so
# choose.
schema.consumes = data['consumes'].first
schema.produces = data['produces'].first
schema.definitions, store = parse_definitions!(data)
schema.routes = parse_routes!(data, schema, store)
schema
end | ruby | def parse(data)
REQUIRED_FIELDS.each do |field|
if !data[field]
raise ArgumentError, "Committee: no #{field} section in spec data."
end
end
if data['swagger'] != '2.0'
raise ArgumentError, "Committee: driver requires OpenAPI 2.0."
end
schema = Schema.new
schema.driver = self
schema.base_path = data['basePath'] || ''
# Arbitrarily choose the first media type found in these arrays. This
# appraoch could probably stand to be improved, but at least users will
# for now have the option of turning media type validation off if they so
# choose.
schema.consumes = data['consumes'].first
schema.produces = data['produces'].first
schema.definitions, store = parse_definitions!(data)
schema.routes = parse_routes!(data, schema, store)
schema
end | [
"def",
"parse",
"(",
"data",
")",
"REQUIRED_FIELDS",
".",
"each",
"do",
"|",
"field",
"|",
"if",
"!",
"data",
"[",
"field",
"]",
"raise",
"ArgumentError",
",",
"\"Committee: no #{field} section in spec data.\"",
"end",
"end",
"if",
"data",
"[",
"'swagger'",
"]... | Parses an API schema and builds a set of route definitions for use with
Committee.
The expected input format is a data hash with keys as strings (as opposed
to symbols) like the kind produced by JSON.parse or YAML.load. | [
"Parses",
"an",
"API",
"schema",
"and",
"builds",
"a",
"set",
"of",
"route",
"definitions",
"for",
"use",
"with",
"Committee",
"."
] | 810fadcea1bc1c529627d47325c1008b5c33b0a4 | https://github.com/interagent/committee/blob/810fadcea1bc1c529627d47325c1008b5c33b0a4/lib/committee/drivers/open_api_2.rb#L41-L68 | train | Parse the spec data | [
30522,
13366,
11968,
3366,
1006,
2951,
1007,
3223,
1035,
4249,
1012,
2169,
2079,
1064,
2492,
1064,
2065,
999,
2951,
1031,
2492,
1033,
5333,
6685,
2121,
29165,
1010,
1000,
2837,
1024,
2053,
1001,
1063,
2492,
1065,
2930,
1999,
28699,
2951,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/diagnostics.rb | Azure::Web::Mgmt::V2018_02_01.Diagnostics.list_site_diagnostic_categories_slot_as_lazy | def list_site_diagnostic_categories_slot_as_lazy(resource_group_name, site_name, slot, custom_headers:nil)
response = list_site_diagnostic_categories_slot_async(resource_group_name, site_name, slot, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_site_diagnostic_categories_slot_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_site_diagnostic_categories_slot_as_lazy(resource_group_name, site_name, slot, custom_headers:nil)
response = list_site_diagnostic_categories_slot_async(resource_group_name, site_name, slot, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_site_diagnostic_categories_slot_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_site_diagnostic_categories_slot_as_lazy",
"(",
"resource_group_name",
",",
"site_name",
",",
"slot",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_site_diagnostic_categories_slot_async",
"(",
"resource_group_name",
",",
"site_name",
",",
"slot"... | Get Diagnostics Categories
Get Diagnostics Categories
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param site_name [String] Site Name
@param slot [String] Slot Name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [DiagnosticCategoryCollection] which provide lazy access to pages of
the response. | [
"Get",
"Diagnostics",
"Categories"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/diagnostics.rb#L3751-L3760 | train | Gets the diagnostic categories for a site. | [
30522,
13366,
2862,
1035,
2609,
1035,
16474,
1035,
7236,
1035,
10453,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2609,
1035,
2171,
1010,
10453,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.patch_closed_list | def patch_closed_list(app_id, version_id, cl_entity_id, closed_list_model_patch_object, custom_headers:nil)
response = patch_closed_list_async(app_id, version_id, cl_entity_id, closed_list_model_patch_object, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def patch_closed_list(app_id, version_id, cl_entity_id, closed_list_model_patch_object, custom_headers:nil)
response = patch_closed_list_async(app_id, version_id, cl_entity_id, closed_list_model_patch_object, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"patch_closed_list",
"(",
"app_id",
",",
"version_id",
",",
"cl_entity_id",
",",
"closed_list_model_patch_object",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"patch_closed_list_async",
"(",
"app_id",
",",
"version_id",
",",
"cl_entity_id",
",",
... | Adds a batch of sublists to an existing list entity in a version of the
application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param cl_entity_id The list entity model ID.
@param closed_list_model_patch_object [ClosedListModelPatchObject] A words
list batch.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OperationStatus] operation results. | [
"Adds",
"a",
"batch",
"of",
"sublists",
"to",
"an",
"existing",
"list",
"entity",
"in",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L3239-L3242 | train | Patch an existing closed list entity. | [
30522,
13366,
8983,
1035,
2701,
1035,
2862,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
18856,
1035,
9178,
1035,
8909,
1010,
2701,
1035,
2862,
1035,
2944,
1035,
8983,
1035,
4874,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
backup/backup | vagrant/spec/support/package.rb | BackupSpec.Package.files | def files
@files ||= begin
storage = model.storages.first
return [] unless storage # model didn't store anything
path = storage.send(:remote_path)
unless path == File.expand_path(path)
path.sub!(/(ssh|rsync)-daemon-module/, '')
path = File.expand_path(File.join('~/', path))
end
Dir[File.join(path, "#{ model.trigger }.tar*")].sort
end
end | ruby | def files
@files ||= begin
storage = model.storages.first
return [] unless storage # model didn't store anything
path = storage.send(:remote_path)
unless path == File.expand_path(path)
path.sub!(/(ssh|rsync)-daemon-module/, '')
path = File.expand_path(File.join('~/', path))
end
Dir[File.join(path, "#{ model.trigger }.tar*")].sort
end
end | [
"def",
"files",
"@files",
"||=",
"begin",
"storage",
"=",
"model",
".",
"storages",
".",
"first",
"return",
"[",
"]",
"unless",
"storage",
"# model didn't store anything",
"path",
"=",
"storage",
".",
"send",
"(",
":remote_path",
")",
"unless",
"path",
"==",
... | If a trigger is run multiple times within a test (like when testing cycling),
multiple packages will exist under different timestamp folders.
This allows us to find the package files for the specific model given.
For most tests the Local storage is used, which will have a remote_path
that's already expanded. Others like SCP, RSync (:ssh mode), etc... will
have a remote_path that's relative to the vagrant user's home.
The exception is the RSync daemon modes, where remote_path will begin
with daemon module names, which are mapped to the vagrant user's home. | [
"If",
"a",
"trigger",
"is",
"run",
"multiple",
"times",
"within",
"a",
"test",
"(",
"like",
"when",
"testing",
"cycling",
")",
"multiple",
"packages",
"will",
"exist",
"under",
"different",
"timestamp",
"folders",
".",
"This",
"allows",
"us",
"to",
"find",
... | 64370f925e859f858766b674717a3dbee0de7a26 | https://github.com/backup/backup/blob/64370f925e859f858766b674717a3dbee0de7a26/vagrant/spec/support/package.rb#L41-L53 | train | Returns an array of the files that are in the archive. | [
30522,
13366,
6764,
1030,
6764,
1064,
1064,
1027,
4088,
5527,
1027,
2944,
1012,
5527,
2015,
1012,
2034,
2709,
1031,
1033,
4983,
5527,
1001,
2944,
2134,
1005,
1056,
3573,
2505,
4130,
1027,
5527,
1012,
4604,
1006,
1024,
6556,
1035,
4130,
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... |
hashicorp/vagrant | lib/vagrant/environment.rb | Vagrant.Environment.default_provider | def default_provider(**opts)
opts[:exclude] = Set.new(opts[:exclude]) if opts[:exclude]
opts[:force_default] = true if !opts.key?(:force_default)
opts[:check_usable] = true if !opts.key?(:check_usable)
# Implement the algorithm from
# https://www.vagrantup.com/docs/providers/basic_usage.html#default-provider
# with additional steps 2.5 and 3.5 from
# https://bugzilla.redhat.com/show_bug.cgi?id=1444492
# to allow system-configured provider priorities.
#
# 1. The --provider flag on a vagrant up is chosen above all else, if it is
# present.
#
# (Step 1 is done by the caller; this method is only called if --provider
# wasn't given.)
#
# 2. If the VAGRANT_DEFAULT_PROVIDER environmental variable is set, it
# takes next priority and will be the provider chosen.
default = ENV["VAGRANT_DEFAULT_PROVIDER"].to_s
if default.empty?
default = nil
else
default = default.to_sym
@logger.debug("Default provider: `#{default}`")
end
# If we're forcing the default, just short-circuit and return
# that (the default behavior)
if default && opts[:force_default]
@logger.debug("Using forced default provider: `#{default}`")
return default
end
# Determine the config to use to look for provider definitions. By
# default it is the global but if we're targeting a specific machine,
# then look there.
root_config = vagrantfile.config
if opts[:machine]
machine_info = vagrantfile.machine_config(opts[:machine], nil, nil, nil)
root_config = machine_info[:config]
end
# Get the list of providers within our configuration, in order.
config = root_config.vm.__providers
# Get the list of usable providers with their internally-declared
# priorities.
usable = []
Vagrant.plugin("2").manager.providers.each do |key, data|
impl = data[0]
popts = data[1]
# Skip excluded providers
next if opts[:exclude] && opts[:exclude].include?(key)
# Skip providers that can't be defaulted, unless they're in our
# config, in which case someone made our decision for us.
if !config.include?(key)
next if popts.key?(:defaultable) && !popts[:defaultable]
end
# Skip providers that aren't usable.
next if opts[:check_usable] && !impl.usable?(false)
# Each provider sets its own priority, defaulting to 5 so we can trust
# it's always set.
usable << [popts[:priority], key]
end
@logger.debug("Initial usable provider list: #{usable}")
# Sort the usable providers by priority. Higher numbers are higher
# priority, otherwise alpha sort.
usable = usable.sort {|a, b| a[0] == b[0] ? a[1] <=> b[1] : b[0] <=> a[0]}
.map {|prio, key| key}
@logger.debug("Priority sorted usable provider list: #{usable}")
# If we're not forcing the default, but it's usable and hasn't been
# otherwise excluded, return it now.
if usable.include?(default)
@logger.debug("Using default provider `#{default}` as it was found in usable list.")
return default
end
# 2.5. Vagrant will go through all of the config.vm.provider calls in the
# Vagrantfile and try each in order. It will choose the first
# provider that is usable and listed in VAGRANT_PREFERRED_PROVIDERS.
preferred = ENV.fetch('VAGRANT_PREFERRED_PROVIDERS', '')
.split(',')
.map {|s| s.strip}
.select {|s| !s.empty?}
.map {|s| s.to_sym}
@logger.debug("Preferred provider list: #{preferred}")
config.each do |key|
if usable.include?(key) && preferred.include?(key)
@logger.debug("Using preferred provider `#{key}` detected in configuration and usable.")
return key
end
end
# 3. Vagrant will go through all of the config.vm.provider calls in the
# Vagrantfile and try each in order. It will choose the first provider
# that is usable. For example, if you configure Hyper-V, it will never
# be chosen on Mac this way. It must be both configured and usable.
config.each do |key|
if usable.include?(key)
@logger.debug("Using provider `#{key}` detected in configuration and usable.")
return key
end
end
# 3.5. Vagrant will go through VAGRANT_PREFERRED_PROVIDERS and find the
# first plugin that reports it is usable.
preferred.each do |key|
if usable.include?(key)
@logger.debug("Using preferred provider `#{key}` found in usable list.")
return key
end
end
# 4. Vagrant will go through all installed provider plugins (including the
# ones that come with Vagrant), and find the first plugin that reports
# it is usable. There is a priority system here: systems that are known
# better have a higher priority than systems that are worse. For
# example, if you have the VMware provider installed, it will always
# take priority over VirtualBox.
if !usable.empty?
@logger.debug("Using provider `#{usable[0]}` as it is the highest priority in the usable list.")
return usable[0]
end
# 5. If Vagrant still has not found any usable providers, it will error.
# No providers available is a critical error for Vagrant.
raise Errors::NoDefaultProvider
end | ruby | def default_provider(**opts)
opts[:exclude] = Set.new(opts[:exclude]) if opts[:exclude]
opts[:force_default] = true if !opts.key?(:force_default)
opts[:check_usable] = true if !opts.key?(:check_usable)
# Implement the algorithm from
# https://www.vagrantup.com/docs/providers/basic_usage.html#default-provider
# with additional steps 2.5 and 3.5 from
# https://bugzilla.redhat.com/show_bug.cgi?id=1444492
# to allow system-configured provider priorities.
#
# 1. The --provider flag on a vagrant up is chosen above all else, if it is
# present.
#
# (Step 1 is done by the caller; this method is only called if --provider
# wasn't given.)
#
# 2. If the VAGRANT_DEFAULT_PROVIDER environmental variable is set, it
# takes next priority and will be the provider chosen.
default = ENV["VAGRANT_DEFAULT_PROVIDER"].to_s
if default.empty?
default = nil
else
default = default.to_sym
@logger.debug("Default provider: `#{default}`")
end
# If we're forcing the default, just short-circuit and return
# that (the default behavior)
if default && opts[:force_default]
@logger.debug("Using forced default provider: `#{default}`")
return default
end
# Determine the config to use to look for provider definitions. By
# default it is the global but if we're targeting a specific machine,
# then look there.
root_config = vagrantfile.config
if opts[:machine]
machine_info = vagrantfile.machine_config(opts[:machine], nil, nil, nil)
root_config = machine_info[:config]
end
# Get the list of providers within our configuration, in order.
config = root_config.vm.__providers
# Get the list of usable providers with their internally-declared
# priorities.
usable = []
Vagrant.plugin("2").manager.providers.each do |key, data|
impl = data[0]
popts = data[1]
# Skip excluded providers
next if opts[:exclude] && opts[:exclude].include?(key)
# Skip providers that can't be defaulted, unless they're in our
# config, in which case someone made our decision for us.
if !config.include?(key)
next if popts.key?(:defaultable) && !popts[:defaultable]
end
# Skip providers that aren't usable.
next if opts[:check_usable] && !impl.usable?(false)
# Each provider sets its own priority, defaulting to 5 so we can trust
# it's always set.
usable << [popts[:priority], key]
end
@logger.debug("Initial usable provider list: #{usable}")
# Sort the usable providers by priority. Higher numbers are higher
# priority, otherwise alpha sort.
usable = usable.sort {|a, b| a[0] == b[0] ? a[1] <=> b[1] : b[0] <=> a[0]}
.map {|prio, key| key}
@logger.debug("Priority sorted usable provider list: #{usable}")
# If we're not forcing the default, but it's usable and hasn't been
# otherwise excluded, return it now.
if usable.include?(default)
@logger.debug("Using default provider `#{default}` as it was found in usable list.")
return default
end
# 2.5. Vagrant will go through all of the config.vm.provider calls in the
# Vagrantfile and try each in order. It will choose the first
# provider that is usable and listed in VAGRANT_PREFERRED_PROVIDERS.
preferred = ENV.fetch('VAGRANT_PREFERRED_PROVIDERS', '')
.split(',')
.map {|s| s.strip}
.select {|s| !s.empty?}
.map {|s| s.to_sym}
@logger.debug("Preferred provider list: #{preferred}")
config.each do |key|
if usable.include?(key) && preferred.include?(key)
@logger.debug("Using preferred provider `#{key}` detected in configuration and usable.")
return key
end
end
# 3. Vagrant will go through all of the config.vm.provider calls in the
# Vagrantfile and try each in order. It will choose the first provider
# that is usable. For example, if you configure Hyper-V, it will never
# be chosen on Mac this way. It must be both configured and usable.
config.each do |key|
if usable.include?(key)
@logger.debug("Using provider `#{key}` detected in configuration and usable.")
return key
end
end
# 3.5. Vagrant will go through VAGRANT_PREFERRED_PROVIDERS and find the
# first plugin that reports it is usable.
preferred.each do |key|
if usable.include?(key)
@logger.debug("Using preferred provider `#{key}` found in usable list.")
return key
end
end
# 4. Vagrant will go through all installed provider plugins (including the
# ones that come with Vagrant), and find the first plugin that reports
# it is usable. There is a priority system here: systems that are known
# better have a higher priority than systems that are worse. For
# example, if you have the VMware provider installed, it will always
# take priority over VirtualBox.
if !usable.empty?
@logger.debug("Using provider `#{usable[0]}` as it is the highest priority in the usable list.")
return usable[0]
end
# 5. If Vagrant still has not found any usable providers, it will error.
# No providers available is a critical error for Vagrant.
raise Errors::NoDefaultProvider
end | [
"def",
"default_provider",
"(",
"**",
"opts",
")",
"opts",
"[",
":exclude",
"]",
"=",
"Set",
".",
"new",
"(",
"opts",
"[",
":exclude",
"]",
")",
"if",
"opts",
"[",
":exclude",
"]",
"opts",
"[",
":force_default",
"]",
"=",
"true",
"if",
"!",
"opts",
... | This returns the provider name for the default provider for this
environment.
@return [Symbol] Name of the default provider. | [
"This",
"returns",
"the",
"provider",
"name",
"for",
"the",
"default",
"provider",
"for",
"this",
"environment",
"."
] | c22a145c59790c098f95d50141d9afb48e1ef55f | https://github.com/hashicorp/vagrant/blob/c22a145c59790c098f95d50141d9afb48e1ef55f/lib/vagrant/environment.rb#L299-L440 | train | Returns the default provider for the current environment. | [
30522,
13366,
12398,
1035,
10802,
1006,
1008,
1008,
23569,
2015,
1007,
23569,
2015,
1031,
1024,
23329,
1033,
1027,
2275,
1012,
2047,
1006,
23569,
2015,
1031,
1024,
23329,
1033,
1007,
2065,
23569,
2015,
1031,
1024,
23329,
1033,
23569,
2015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
decidim/decidim | decidim-initiatives/app/models/decidim/initiative.rb | Decidim.Initiative.has_authorship? | def has_authorship?(user)
return true if author.id == user.id
committee_members.approved.where(decidim_users_id: user.id).any?
end | ruby | def has_authorship?(user)
return true if author.id == user.id
committee_members.approved.where(decidim_users_id: user.id).any?
end | [
"def",
"has_authorship?",
"(",
"user",
")",
"return",
"true",
"if",
"author",
".",
"id",
"==",
"user",
".",
"id",
"committee_members",
".",
"approved",
".",
"where",
"(",
"decidim_users_id",
":",
"user",
".",
"id",
")",
".",
"any?",
"end"
] | PUBLIC
Checks if user is the author or is part of the promotal committee
of the initiative.
RETURNS boolean | [
"PUBLIC"
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-initiatives/app/models/decidim/initiative.rb#L291-L294 | train | Returns true if the user has an authorship | [
30522,
13366,
2038,
1035,
26324,
1029,
1006,
5310,
1007,
2709,
2995,
2065,
3166,
1012,
8909,
1027,
1027,
5310,
1012,
8909,
2837,
1035,
2372,
1012,
4844,
1012,
2073,
1006,
11703,
28173,
2213,
1035,
5198,
1035,
8909,
1024,
5310,
1012,
8909,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/workbook/worksheet/auto_filter/auto_filter.rb | Axlsx.AutoFilter.to_xml_string | def to_xml_string(str='')
return unless range
str << "<autoFilter ref='#{range}'>"
columns.each { |filter_column| filter_column.to_xml_string(str) }
str << "</autoFilter>"
end | ruby | def to_xml_string(str='')
return unless range
str << "<autoFilter ref='#{range}'>"
columns.each { |filter_column| filter_column.to_xml_string(str) }
str << "</autoFilter>"
end | [
"def",
"to_xml_string",
"(",
"str",
"=",
"''",
")",
"return",
"unless",
"range",
"str",
"<<",
"\"<autoFilter ref='#{range}'>\"",
"columns",
".",
"each",
"{",
"|",
"filter_column",
"|",
"filter_column",
".",
"to_xml_string",
"(",
"str",
")",
"}",
"str",
"<<",
... | serialize the object
@return [String] | [
"serialize",
"the",
"object"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb#L69-L74 | train | Convert the filter to XML string. | [
30522,
13366,
2000,
1035,
20950,
1035,
5164,
1006,
2358,
2099,
1027,
1005,
1005,
1007,
2709,
4983,
2846,
2358,
2099,
1026,
1026,
1000,
1026,
8285,
8873,
21928,
25416,
1027,
1005,
1001,
1063,
2846,
1065,
1005,
1028,
1000,
7753,
1012,
2169,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | activerecord/lib/active_record/connection_handling.rb | ActiveRecord.ConnectionHandling.connected_to | def connected_to(database: nil, role: nil, &blk)
if database && role
raise ArgumentError, "connected_to can only accept a `database` or a `role` argument, but not both arguments."
elsif database
if database.is_a?(Hash)
role, database = database.first
role = role.to_sym
end
config_hash = resolve_config_for_connection(database)
handler = lookup_connection_handler(role)
handler.establish_connection(config_hash)
with_handler(role, &blk)
elsif role
with_handler(role.to_sym, &blk)
else
raise ArgumentError, "must provide a `database` or a `role`."
end
end | ruby | def connected_to(database: nil, role: nil, &blk)
if database && role
raise ArgumentError, "connected_to can only accept a `database` or a `role` argument, but not both arguments."
elsif database
if database.is_a?(Hash)
role, database = database.first
role = role.to_sym
end
config_hash = resolve_config_for_connection(database)
handler = lookup_connection_handler(role)
handler.establish_connection(config_hash)
with_handler(role, &blk)
elsif role
with_handler(role.to_sym, &blk)
else
raise ArgumentError, "must provide a `database` or a `role`."
end
end | [
"def",
"connected_to",
"(",
"database",
":",
"nil",
",",
"role",
":",
"nil",
",",
"&",
"blk",
")",
"if",
"database",
"&&",
"role",
"raise",
"ArgumentError",
",",
"\"connected_to can only accept a `database` or a `role` argument, but not both arguments.\"",
"elsif",
"dat... | Connects to a database or role (ex writing, reading, or another
custom role) for the duration of the block.
If a role is passed, Active Record will look up the connection
based on the requested role:
ActiveRecord::Base.connected_to(role: :writing) do
Dog.create! # creates dog using dog writing connection
end
ActiveRecord::Base.connected_to(role: :reading) do
Dog.create! # throws exception because we're on a replica
end
ActiveRecord::Base.connected_to(role: :unknown_role) do
# raises exception due to non-existent role
end
For cases where you may want to connect to a database outside of the model,
you can use +connected_to+ with a +database+ argument. The +database+ argument
expects a symbol that corresponds to the database key in your config.
ActiveRecord::Base.connected_to(database: :animals_slow_replica) do
Dog.run_a_long_query # runs a long query while connected to the +animals_slow_replica+
end
This will connect to a new database for the queries inside the block. By
default the `:writing` role will be used since all connections must be assigned
a role. If you would like to use a different role you can pass a hash to database:
ActiveRecord::Base.connected_to(database: { readonly_slow: :animals_slow_replica }) do
# runs a long query while connected to the +animals_slow_replica+ using the readonly_slow role.
Dog.run_a_long_query
end
When using the database key a new connection will be established every time. | [
"Connects",
"to",
"a",
"database",
"or",
"role",
"(",
"ex",
"writing",
"reading",
"or",
"another",
"custom",
"role",
")",
"for",
"the",
"duration",
"of",
"the",
"block",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activerecord/lib/active_record/connection_handling.rb#L117-L137 | train | Connect to a database or role | [
30522,
13366,
4198,
1035,
2000,
1006,
7809,
1024,
9152,
2140,
1010,
2535,
1024,
9152,
2140,
1010,
1004,
1038,
13687,
1007,
2065,
7809,
1004,
1004,
2535,
5333,
6685,
2121,
29165,
1010,
1000,
4198,
1035,
2000,
2064,
2069,
5138,
1037,
1036,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/helper.rb | OneGadget.Helper.colorize | def colorize(str, sev: :normal_s)
return str unless color_enabled?
cc = COLOR_CODE
color = cc.key?(sev) ? cc[sev] : ''
"#{color}#{str.sub(cc[:esc_m], color)}#{cc[:esc_m]}"
end | ruby | def colorize(str, sev: :normal_s)
return str unless color_enabled?
cc = COLOR_CODE
color = cc.key?(sev) ? cc[sev] : ''
"#{color}#{str.sub(cc[:esc_m], color)}#{cc[:esc_m]}"
end | [
"def",
"colorize",
"(",
"str",
",",
"sev",
":",
":normal_s",
")",
"return",
"str",
"unless",
"color_enabled?",
"cc",
"=",
"COLOR_CODE",
"color",
"=",
"cc",
".",
"key?",
"(",
"sev",
")",
"?",
"cc",
"[",
"sev",
"]",
":",
"''",
"\"#{color}#{str.sub(cc[:esc_... | Wrap string with color codes for pretty inspect.
@param [String] str Contents to colorize.
@param [Symbol] sev Specify which kind of color to use, valid symbols are defined in {.COLOR_CODE}.
@return [String] String wrapped with color codes. | [
"Wrap",
"string",
"with",
"color",
"codes",
"for",
"pretty",
"inspect",
"."
] | ff6ef04541e83441bfe3c2664a6febd1640f4263 | https://github.com/david942j/one_gadget/blob/ff6ef04541e83441bfe3c2664a6febd1640f4263/lib/one_gadget/helper.rb#L122-L128 | train | colorize the string | [
30522,
13366,
3609,
4697,
1006,
2358,
2099,
1010,
7367,
2615,
1024,
1024,
3671,
1035,
1055,
1007,
2709,
2358,
2099,
4983,
3609,
1035,
9124,
1029,
10507,
1027,
3609,
1035,
3642,
3609,
1027,
10507,
1012,
3145,
1029,
1006,
7367,
2615,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/diagnostics.rb | Azure::Web::Mgmt::V2018_02_01.Diagnostics.get_hosting_environment_detector_response | def get_hosting_environment_detector_response(resource_group_name, name, detector_name, start_time:nil, end_time:nil, time_grain:nil, custom_headers:nil)
response = get_hosting_environment_detector_response_async(resource_group_name, name, detector_name, start_time:start_time, end_time:end_time, time_grain:time_grain, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_hosting_environment_detector_response(resource_group_name, name, detector_name, start_time:nil, end_time:nil, time_grain:nil, custom_headers:nil)
response = get_hosting_environment_detector_response_async(resource_group_name, name, detector_name, start_time:start_time, end_time:end_time, time_grain:time_grain, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_hosting_environment_detector_response",
"(",
"resource_group_name",
",",
"name",
",",
"detector_name",
",",
"start_time",
":",
"nil",
",",
"end_time",
":",
"nil",
",",
"time_grain",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
... | Get Hosting Environment Detector Response
Get Hosting Environment Detector Response
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param name [String] App Service Environment Name
@param detector_name [String] Detector Resource Name
@param start_time [DateTime] Start Time
@param end_time [DateTime] End Time
@param time_grain [String] Time Grain
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [DetectorResponse] operation results. | [
"Get",
"Hosting",
"Environment",
"Detector",
"Response"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/diagnostics.rb#L145-L148 | train | Gets the hosting environment detector response. | [
30522,
13366,
2131,
1035,
9936,
1035,
4044,
1035,
19034,
1035,
3433,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
19034,
1035,
2171,
1010,
2707,
1035,
2051,
1024,
9152,
2140,
1010,
2203,
1035,
2051,
1024,
9152,
2140,
1010,
2051,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.summarize_for_resource_group_with_http_info | def summarize_for_resource_group_with_http_info(subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
summarize_for_resource_group_async(subscription_id, resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
end | ruby | def summarize_for_resource_group_with_http_info(subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
summarize_for_resource_group_async(subscription_id, resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
end | [
"def",
"summarize_for_resource_group_with_http_info",
"(",
"subscription_id",
",",
"resource_group_name",
",",
"query_options",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"summarize_for_resource_group_async",
"(",
"subscription_id",
",",
"resource_group_name",
",",
... | Summarizes policy states for the resources under the resource group.
@param subscription_id [String] Microsoft Azure subscription ID.
@param resource_group_name [String] Resource group 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 [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Summarizes",
"policy",
"states",
"for",
"the",
"resources",
"under",
"the",
"resource",
"group",
"."
] | 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#L664-L666 | train | Gets the number of documents in a resource group. | [
30522,
13366,
7680,
7849,
4697,
1035,
2005,
1035,
7692,
1035,
2177,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
15002,
1035,
8909,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
23032,
1035,
7047,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_container_registry/lib/2017-06-01-preview/generated/azure_mgmt_container_registry/webhooks.rb | Azure::ContainerRegistry::Mgmt::V2017_06_01_preview.Webhooks.create_async | def create_async(resource_group_name, registry_name, webhook_name, webhook_create_parameters, custom_headers:nil)
# Send request
promise = begin_create_async(resource_group_name, registry_name, webhook_name, webhook_create_parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::ContainerRegistry::Mgmt::V2017_06_01_preview::Models::Webhook.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_async(resource_group_name, registry_name, webhook_name, webhook_create_parameters, custom_headers:nil)
# Send request
promise = begin_create_async(resource_group_name, registry_name, webhook_name, webhook_create_parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::ContainerRegistry::Mgmt::V2017_06_01_preview::Models::Webhook.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_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"webhook_name",
",",
"webhook_create_parameters",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_create_async",
"(",
"resource_group_name",
",",
"registry_name"... | @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 webhook_name [String] The name of the webhook.
@param webhook_create_parameters [WebhookCreateParameters] The parameters for
creating a webhook.
@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",
"to",
"which",
"the",
"container",
"registry",
"belongs",
".",
"@param",
"registry_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"container",
"regist... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_registry/lib/2017-06-01-preview/generated/azure_mgmt_container_registry/webhooks.rb#L161-L177 | train | Creates a webhook. | [
30522,
13366,
3443,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
4773,
6806,
6559,
1035,
2171,
1010,
4773,
6806,
6559,
1035,
3443,
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... |
puppetlabs/puppet | lib/puppet/type.rb | Puppet.Type.insync? | def insync?(is)
insync = true
if property = @parameters[:ensure]
unless is.include? property
#TRANSLATORS 'is' is a variable name and should not be translated
raise Puppet::DevError, _("The 'is' value is not in the 'is' array for '%{name}'") % { name: property.name }
end
ensureis = is[property]
if property.safe_insync?(ensureis) and property.should == :absent
return true
end
end
properties.each { |prop|
unless is.include? prop
#TRANSLATORS 'is' is a variable name and should not be translated
raise Puppet::DevError, _("The 'is' value is not in the 'is' array for '%{name}'") % { name: prop.name }
end
propis = is[prop]
unless prop.safe_insync?(propis)
prop.debug("Not in sync: #{propis.inspect} vs #{prop.should.inspect}")
insync = false
#else
# property.debug("In sync")
end
}
#self.debug("#{self} sync status is #{insync}")
insync
end | ruby | def insync?(is)
insync = true
if property = @parameters[:ensure]
unless is.include? property
#TRANSLATORS 'is' is a variable name and should not be translated
raise Puppet::DevError, _("The 'is' value is not in the 'is' array for '%{name}'") % { name: property.name }
end
ensureis = is[property]
if property.safe_insync?(ensureis) and property.should == :absent
return true
end
end
properties.each { |prop|
unless is.include? prop
#TRANSLATORS 'is' is a variable name and should not be translated
raise Puppet::DevError, _("The 'is' value is not in the 'is' array for '%{name}'") % { name: prop.name }
end
propis = is[prop]
unless prop.safe_insync?(propis)
prop.debug("Not in sync: #{propis.inspect} vs #{prop.should.inspect}")
insync = false
#else
# property.debug("In sync")
end
}
#self.debug("#{self} sync status is #{insync}")
insync
end | [
"def",
"insync?",
"(",
"is",
")",
"insync",
"=",
"true",
"if",
"property",
"=",
"@parameters",
"[",
":ensure",
"]",
"unless",
"is",
".",
"include?",
"property",
"#TRANSLATORS 'is' is a variable name and should not be translated",
"raise",
"Puppet",
"::",
"DevError",
... | Returns true if all contained objects are in sync.
@todo "contained in what?" in the given "in" parameter?
@todo deal with the comment _"FIXME I don't think this is used on the type instances any more,
it's really only used for testing"_
@return [Boolean] true if in sync, false otherwise. | [
"Returns",
"true",
"if",
"all",
"contained",
"objects",
"are",
"in",
"sync",
".",
"@todo",
"contained",
"in",
"what?",
"in",
"the",
"given",
"in",
"parameter?"
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/type.rb#L1023-L1054 | train | Returns true if the given object is in the sync state. | [
30522,
13366,
16021,
6038,
2278,
1029,
1006,
2003,
1007,
16021,
6038,
2278,
1027,
2995,
2065,
3200,
1027,
1030,
11709,
1031,
1024,
5676,
1033,
4983,
2003,
1012,
2421,
1029,
3200,
1001,
28396,
1005,
2003,
1005,
2003,
1037,
8023,
2171,
1998,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/presenters/hyrax/member_presenter_factory.rb | Hyrax.MemberPresenterFactory.file_set_ids | def file_set_ids
@file_set_ids ||= begin
ActiveFedora::SolrService.query("{!field f=has_model_ssim}FileSet",
rows: 10_000,
fl: ActiveFedora.id_field,
fq: "{!join from=ordered_targets_ssim to=id}id:\"#{id}/list_source\"")
.flat_map { |x| x.fetch(ActiveFedora.id_field, []) }
end
end | ruby | def file_set_ids
@file_set_ids ||= begin
ActiveFedora::SolrService.query("{!field f=has_model_ssim}FileSet",
rows: 10_000,
fl: ActiveFedora.id_field,
fq: "{!join from=ordered_targets_ssim to=id}id:\"#{id}/list_source\"")
.flat_map { |x| x.fetch(ActiveFedora.id_field, []) }
end
end | [
"def",
"file_set_ids",
"@file_set_ids",
"||=",
"begin",
"ActiveFedora",
"::",
"SolrService",
".",
"query",
"(",
"\"{!field f=has_model_ssim}FileSet\"",
",",
"rows",
":",
"10_000",
",",
"fl",
":",
"ActiveFedora",
".",
"id_field",
",",
"fq",
":",
"\"{!join from=ordere... | These are the file sets that belong to this work, but not necessarily
in order.
Arbitrarily maxed at 10 thousand; had to specify rows due to solr's default of 10 | [
"These",
"are",
"the",
"file",
"sets",
"that",
"belong",
"to",
"this",
"work",
"but",
"not",
"necessarily",
"in",
"order",
".",
"Arbitrarily",
"maxed",
"at",
"10",
"thousand",
";",
"had",
"to",
"specify",
"rows",
"due",
"to",
"solr",
"s",
"default",
"of"... | e2b4f56e829a53b1f11296324736e9d5b8c9ee5f | https://github.com/samvera/hyrax/blob/e2b4f56e829a53b1f11296324736e9d5b8c9ee5f/app/presenters/hyrax/member_presenter_factory.rb#L54-L62 | train | Returns the file set ids for this record | [
30522,
13366,
5371,
1035,
2275,
1035,
8909,
2015,
1030,
5371,
1035,
2275,
1035,
8909,
2015,
1064,
1064,
1027,
4088,
3161,
25031,
6525,
1024,
1024,
14017,
22573,
2099,
7903,
2063,
1012,
23032,
1006,
1000,
1063,
999,
2492,
1042,
1027,
2038,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.delete_composite_entity_child | def delete_composite_entity_child(app_id, version_id, c_entity_id, c_child_id, custom_headers:nil)
response = delete_composite_entity_child_async(app_id, version_id, c_entity_id, c_child_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def delete_composite_entity_child(app_id, version_id, c_entity_id, c_child_id, custom_headers:nil)
response = delete_composite_entity_child_async(app_id, version_id, c_entity_id, c_child_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"delete_composite_entity_child",
"(",
"app_id",
",",
"version_id",
",",
"c_entity_id",
",",
"c_child_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_composite_entity_child_async",
"(",
"app_id",
",",
"version_id",
",",
"c_entity_id",
",",
... | Deletes a composite entity extractor child from 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 c_child_id The hierarchical entity extractor child ID.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OperationStatus] operation results. | [
"Deletes",
"a",
"composite",
"entity",
"extractor",
"child",
"from",
"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#L5550-L5553 | train | Deletes a composite entity child. | [
30522,
13366,
3972,
12870,
1035,
12490,
1035,
9178,
1035,
2775,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
1039,
1035,
9178,
1035,
8909,
1010,
1039,
1035,
2775,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
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... |
palkan/logidze | lib/logidze/history.rb | Logidze.History.current_ts? | def current_ts?(time)
(current_version.time <= time) &&
(next_version.nil? || (next_version.time < time))
end | ruby | def current_ts?(time)
(current_version.time <= time) &&
(next_version.nil? || (next_version.time < time))
end | [
"def",
"current_ts?",
"(",
"time",
")",
"(",
"current_version",
".",
"time",
"<=",
"time",
")",
"&&",
"(",
"next_version",
".",
"nil?",
"||",
"(",
"next_version",
".",
"time",
"<",
"time",
")",
")",
"end"
] | Return true iff time corresponds to current version | [
"Return",
"true",
"iff",
"time",
"corresponds",
"to",
"current",
"version"
] | ffa0f793cb9c6fab96fa67a285341ca9aaa7ded8 | https://github.com/palkan/logidze/blob/ffa0f793cb9c6fab96fa67a285341ca9aaa7ded8/lib/logidze/history.rb#L98-L101 | train | Returns true if the current version is at the given time. | [
30522,
13366,
2783,
1035,
24529,
1029,
1006,
2051,
1007,
1006,
2783,
1035,
2544,
1012,
2051,
1026,
1027,
2051,
1007,
1004,
1004,
1006,
2279,
1035,
2544,
1012,
9152,
2140,
1029,
1064,
1064,
1006,
2279,
1035,
2544,
1012,
2051,
1026,
2051,
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... |
projectcypress/health-data-standards | lib/hqmf-parser/2.0/document_helpers/doc_population_helper.rb | HQMF2.DocumentPopulationHelper.extract_observations | def extract_observations
has_observation = false
# look for observation data in separate section but create a population for it if it exists
observation_section = @doc.xpath('/cda:QualityMeasureDocument/cda:component/cda:measureObservationSection',
HQMF2::Document::NAMESPACES)
unless observation_section.empty?
observation_section.xpath('cda:definition', HQMF2::Document::NAMESPACES).each do |criteria_def|
criteria_id = 'OBSERV'
criteria = PopulationCriteria.new(criteria_def, @document, @id_generator)
criteria.type = 'OBSERV'
# This section constructs a human readable id. The first IPP will be IPP, the second will be IPP_1, etc.
# This allows the populations to be more readable. The alternative would be to have the hqmf ids in the
# populations, which would work, but is difficult to read the populations.
if @ids_by_hqmf_id["#{criteria.hqmf_id}"]
criteria.create_human_readable_id(@ids_by_hqmf_id[criteria.hqmf_id])
else
criteria.create_human_readable_id(population_id_with_counter(criteria_id))
@ids_by_hqmf_id["#{criteria.hqmf_id}"] = criteria.id
end
@population_criteria << criteria
has_observation = true
end
end
has_observation
end | ruby | def extract_observations
has_observation = false
# look for observation data in separate section but create a population for it if it exists
observation_section = @doc.xpath('/cda:QualityMeasureDocument/cda:component/cda:measureObservationSection',
HQMF2::Document::NAMESPACES)
unless observation_section.empty?
observation_section.xpath('cda:definition', HQMF2::Document::NAMESPACES).each do |criteria_def|
criteria_id = 'OBSERV'
criteria = PopulationCriteria.new(criteria_def, @document, @id_generator)
criteria.type = 'OBSERV'
# This section constructs a human readable id. The first IPP will be IPP, the second will be IPP_1, etc.
# This allows the populations to be more readable. The alternative would be to have the hqmf ids in the
# populations, which would work, but is difficult to read the populations.
if @ids_by_hqmf_id["#{criteria.hqmf_id}"]
criteria.create_human_readable_id(@ids_by_hqmf_id[criteria.hqmf_id])
else
criteria.create_human_readable_id(population_id_with_counter(criteria_id))
@ids_by_hqmf_id["#{criteria.hqmf_id}"] = criteria.id
end
@population_criteria << criteria
has_observation = true
end
end
has_observation
end | [
"def",
"extract_observations",
"has_observation",
"=",
"false",
"# look for observation data in separate section but create a population for it if it exists",
"observation_section",
"=",
"@doc",
".",
"xpath",
"(",
"'/cda:QualityMeasureDocument/cda:component/cda:measureObservationSection'",
... | Extracts the measure observations, will return true if one exists | [
"Extracts",
"the",
"measure",
"observations",
"will",
"return",
"true",
"if",
"one",
"exists"
] | 252d4f0927c513eacde6b9ea41b76faa1423c34b | https://github.com/projectcypress/health-data-standards/blob/252d4f0927c513eacde6b9ea41b76faa1423c34b/lib/hqmf-parser/2.0/document_helpers/doc_population_helper.rb#L64-L89 | train | Extract the observations from the document | [
30522,
13366,
14817,
1035,
9420,
2038,
1035,
8089,
1027,
6270,
1001,
2298,
2005,
8089,
2951,
1999,
3584,
2930,
2021,
3443,
1037,
2313,
2005,
2009,
2065,
2009,
6526,
8089,
1035,
2930,
1027,
1030,
9986,
1012,
26726,
8988,
1006,
1005,
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... |
randym/axlsx | lib/axlsx/stylesheet/xf.rb | Axlsx.Xf.to_xml_string | def to_xml_string(str = '')
str << '<xf '
serialized_attributes str
str << '>'
alignment.to_xml_string(str) if self.alignment
protection.to_xml_string(str) if self.protection
str << '</xf>'
end | ruby | def to_xml_string(str = '')
str << '<xf '
serialized_attributes str
str << '>'
alignment.to_xml_string(str) if self.alignment
protection.to_xml_string(str) if self.protection
str << '</xf>'
end | [
"def",
"to_xml_string",
"(",
"str",
"=",
"''",
")",
"str",
"<<",
"'<xf '",
"serialized_attributes",
"str",
"str",
"<<",
"'>'",
"alignment",
".",
"to_xml_string",
"(",
"str",
")",
"if",
"self",
".",
"alignment",
"protection",
".",
"to_xml_string",
"(",
"str",... | Serializes the object
@param [String] str
@return [String] | [
"Serializes",
"the",
"object"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/stylesheet/xf.rb#L136-L143 | train | Returns the XML string for this object. | [
30522,
13366,
2000,
1035,
20950,
1035,
5164,
1006,
2358,
2099,
1027,
1005,
1005,
1007,
2358,
2099,
1026,
1026,
30524,
5164,
1006,
2358,
2099,
1007,
2065,
2969,
1012,
3860,
2358,
2099,
1026,
1026,
1005,
1026,
1013,
1060,
2546,
1028,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jekyll/jekyll | lib/jekyll/utils.rb | Jekyll.Utils.parse_date | def parse_date(input, msg = "Input could not be parsed.")
Time.parse(input).localtime
rescue ArgumentError
raise Errors::InvalidDateError, "Invalid date '#{input}': #{msg}"
end | ruby | def parse_date(input, msg = "Input could not be parsed.")
Time.parse(input).localtime
rescue ArgumentError
raise Errors::InvalidDateError, "Invalid date '#{input}': #{msg}"
end | [
"def",
"parse_date",
"(",
"input",
",",
"msg",
"=",
"\"Input could not be parsed.\"",
")",
"Time",
".",
"parse",
"(",
"input",
")",
".",
"localtime",
"rescue",
"ArgumentError",
"raise",
"Errors",
"::",
"InvalidDateError",
",",
"\"Invalid date '#{input}': #{msg}\"",
... | Parse a date/time and throw an error if invalid
input - the date/time to parse
msg - (optional) the error message to show the user
Returns the parsed date if successful, throws a FatalException
if not | [
"Parse",
"a",
"date",
"/",
"time",
"and",
"throw",
"an",
"error",
"if",
"invalid"
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/utils.rb#L127-L131 | train | Parse a date | [
30522,
13366,
11968,
3366,
1035,
3058,
1006,
7953,
1010,
5796,
2290,
1027,
1000,
7953,
2071,
2025,
2022,
11968,
6924,
1012,
1000,
1007,
2051,
1012,
11968,
3366,
1006,
7953,
1007,
1012,
2334,
7292,
5343,
6685,
2121,
29165,
5333,
10697,
1024,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb | Azure::Web::Mgmt::V2018_02_01.AppServiceEnvironments.get_worker_pool_with_http_info | def get_worker_pool_with_http_info(resource_group_name, name, worker_pool_name, custom_headers:nil)
get_worker_pool_async(resource_group_name, name, worker_pool_name, custom_headers:custom_headers).value!
end | ruby | def get_worker_pool_with_http_info(resource_group_name, name, worker_pool_name, custom_headers:nil)
get_worker_pool_async(resource_group_name, name, worker_pool_name, custom_headers:custom_headers).value!
end | [
"def",
"get_worker_pool_with_http_info",
"(",
"resource_group_name",
",",
"name",
",",
"worker_pool_name",
",",
"custom_headers",
":",
"nil",
")",
"get_worker_pool_async",
"(",
"resource_group_name",
",",
"name",
",",
"worker_pool_name",
",",
"custom_headers",
":custom_he... | Get properties of a worker pool.
Get properties of a worker pool.
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param name [String] Name of the App Service Environment.
@param worker_pool_name [String] Name of the worker pool.
@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",
"properties",
"of",
"a",
"worker",
"pool",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb#L3168-L3170 | train | Gets the specified worker pool. | [
30522,
13366,
2131,
1035,
7309,
1035,
4770,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
7309,
1035,
4770,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
7309,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/client.rb | Kafka.Client.async_producer | def async_producer(delivery_interval: 0, delivery_threshold: 0, max_queue_size: 1000, max_retries: -1, retry_backoff: 0, **options)
sync_producer = producer(**options)
AsyncProducer.new(
sync_producer: sync_producer,
delivery_interval: delivery_interval,
delivery_threshold: delivery_threshold,
max_queue_size: max_queue_size,
max_retries: max_retries,
retry_backoff: retry_backoff,
instrumenter: @instrumenter,
logger: @logger,
)
end | ruby | def async_producer(delivery_interval: 0, delivery_threshold: 0, max_queue_size: 1000, max_retries: -1, retry_backoff: 0, **options)
sync_producer = producer(**options)
AsyncProducer.new(
sync_producer: sync_producer,
delivery_interval: delivery_interval,
delivery_threshold: delivery_threshold,
max_queue_size: max_queue_size,
max_retries: max_retries,
retry_backoff: retry_backoff,
instrumenter: @instrumenter,
logger: @logger,
)
end | [
"def",
"async_producer",
"(",
"delivery_interval",
":",
"0",
",",
"delivery_threshold",
":",
"0",
",",
"max_queue_size",
":",
"1000",
",",
"max_retries",
":",
"-",
"1",
",",
"retry_backoff",
":",
"0",
",",
"**",
"options",
")",
"sync_producer",
"=",
"produce... | Creates a new AsyncProducer instance.
All parameters allowed by {#producer} can be passed. In addition to this,
a few extra parameters can be passed when creating an async producer.
@param max_queue_size [Integer] the maximum number of messages allowed in
the queue.
@param delivery_threshold [Integer] if greater than zero, the number of
buffered messages that will automatically trigger a delivery.
@param delivery_interval [Integer] if greater than zero, the number of
seconds between automatic message deliveries.
@see AsyncProducer
@return [AsyncProducer] | [
"Creates",
"a",
"new",
"AsyncProducer",
"instance",
"."
] | 2a73471b6a607a52dc85c79301ba522acb4566b5 | https://github.com/zendesk/ruby-kafka/blob/2a73471b6a607a52dc85c79301ba522acb4566b5/lib/kafka/client.rb#L303-L316 | train | Creates a new AsyncProducer instance. | [
30522,
13366,
2004,
6038,
2278,
1035,
3135,
1006,
6959,
1035,
13483,
1024,
1014,
1010,
6959,
1035,
11207,
1024,
1014,
1010,
4098,
1035,
24240,
1035,
2946,
1024,
6694,
1010,
4098,
1035,
2128,
21011,
1024,
1011,
1015,
1010,
2128,
11129,
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... |
fluent/fluentd | lib/fluent/plugin/in_monitor_agent.rb | Fluent::Plugin.MonitorAgentInput.plugin_info_by_id | def plugin_info_by_id(plugin_id, opts={})
found = all_plugins.find {|pe|
pe.respond_to?(:plugin_id) && pe.plugin_id.to_s == plugin_id
}
if found
get_monitor_info(found, opts)
else
nil
end
end | ruby | def plugin_info_by_id(plugin_id, opts={})
found = all_plugins.find {|pe|
pe.respond_to?(:plugin_id) && pe.plugin_id.to_s == plugin_id
}
if found
get_monitor_info(found, opts)
else
nil
end
end | [
"def",
"plugin_info_by_id",
"(",
"plugin_id",
",",
"opts",
"=",
"{",
"}",
")",
"found",
"=",
"all_plugins",
".",
"find",
"{",
"|",
"pe",
"|",
"pe",
".",
"respond_to?",
"(",
":plugin_id",
")",
"&&",
"pe",
".",
"plugin_id",
".",
"to_s",
"==",
"plugin_id"... | search a plugin by plugin_id | [
"search",
"a",
"plugin",
"by",
"plugin_id"
] | add2af9a5b7f74fc36957b8e6138b3c5a2871a92 | https://github.com/fluent/fluentd/blob/add2af9a5b7f74fc36957b8e6138b3c5a2871a92/lib/fluent/plugin/in_monitor_agent.rb#L329-L338 | train | Get the plugin info by plugin_id | [
30522,
13366,
13354,
2378,
1035,
18558,
1035,
2011,
1035,
8909,
1006,
13354,
2378,
1035,
8909,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2179,
1027,
2035,
1035,
13354,
7076,
1012,
2424,
1063,
1064,
21877,
1064,
21877,
1012,
6869,
1035,
200... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/connection.rb | SidekiqUniqueJobs.Connection.redis | def redis(redis_pool = nil)
if redis_pool
redis_pool.with { |conn| yield conn }
else
Sidekiq.redis { |conn| yield conn }
end
end | ruby | def redis(redis_pool = nil)
if redis_pool
redis_pool.with { |conn| yield conn }
else
Sidekiq.redis { |conn| yield conn }
end
end | [
"def",
"redis",
"(",
"redis_pool",
"=",
"nil",
")",
"if",
"redis_pool",
"redis_pool",
".",
"with",
"{",
"|",
"conn",
"|",
"yield",
"conn",
"}",
"else",
"Sidekiq",
".",
"redis",
"{",
"|",
"conn",
"|",
"yield",
"conn",
"}",
"end",
"end"
] | Creates a connection to redis
@return [Sidekiq::RedisConnection, ConnectionPool] a connection to redis | [
"Creates",
"a",
"connection",
"to",
"redis"
] | 2944b97c720528f53962ccfd17d43ac939a77f46 | https://github.com/mhenrixon/sidekiq-unique-jobs/blob/2944b97c720528f53962ccfd17d43ac939a77f46/lib/sidekiq_unique_jobs/connection.rb#L14-L20 | train | Returns a new Redis connection | [
30522,
13366,
2417,
2483,
1006,
2417,
2483,
1035,
4770,
1027,
9152,
2140,
1007,
2065,
2417,
2483,
1035,
4770,
2417,
2483,
1035,
4770,
1012,
2007,
1063,
1064,
9530,
2078,
1064,
10750,
9530,
2078,
1065,
2842,
2217,
3211,
4160,
1012,
2417,
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... |
rails/rails | actionmailer/lib/action_mailer/base.rb | ActionMailer.Base.set_content_type | def set_content_type(m, user_content_type, class_default) # :doc:
params = m.content_type_parameters || {}
case
when user_content_type.present?
user_content_type
when m.has_attachments?
if m.attachments.detect(&:inline?)
["multipart", "related", params]
else
["multipart", "mixed", params]
end
when m.multipart?
["multipart", "alternative", params]
else
m.content_type || class_default
end
end | ruby | def set_content_type(m, user_content_type, class_default) # :doc:
params = m.content_type_parameters || {}
case
when user_content_type.present?
user_content_type
when m.has_attachments?
if m.attachments.detect(&:inline?)
["multipart", "related", params]
else
["multipart", "mixed", params]
end
when m.multipart?
["multipart", "alternative", params]
else
m.content_type || class_default
end
end | [
"def",
"set_content_type",
"(",
"m",
",",
"user_content_type",
",",
"class_default",
")",
"# :doc:",
"params",
"=",
"m",
".",
"content_type_parameters",
"||",
"{",
"}",
"case",
"when",
"user_content_type",
".",
"present?",
"user_content_type",
"when",
"m",
".",
... | Used by #mail to set the content type of the message.
It will use the given +user_content_type+, or multipart if the mail
message has any attachments. If the attachments are inline, the content
type will be "multipart/related", otherwise "multipart/mixed".
If there is no content type passed in via headers, and there are no
attachments, or the message is multipart, then the default content type is
used. | [
"Used",
"by",
"#mail",
"to",
"set",
"the",
"content",
"type",
"of",
"the",
"message",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/actionmailer/lib/action_mailer/base.rb#L886-L902 | train | set the content type of a message | [
30522,
13366,
2275,
1035,
4180,
1035,
2828,
1006,
1049,
1010,
5310,
1035,
4180,
1035,
2828,
1010,
2465,
1035,
12398,
1007,
1001,
1024,
9986,
1024,
11498,
5244,
1027,
1049,
1012,
4180,
1035,
2828,
1035,
11709,
1064,
1064,
1063,
1065,
2553,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/licensed | lib/licensed/dependency_record.rb | Licensed.DependencyRecord.save | def save(filename)
data_to_save = @metadata.merge({
"licenses" => licenses,
"notices" => notices
})
FileUtils.mkdir_p(File.dirname(filename))
File.write(filename, data_to_save.to_yaml)
end | ruby | def save(filename)
data_to_save = @metadata.merge({
"licenses" => licenses,
"notices" => notices
})
FileUtils.mkdir_p(File.dirname(filename))
File.write(filename, data_to_save.to_yaml)
end | [
"def",
"save",
"(",
"filename",
")",
"data_to_save",
"=",
"@metadata",
".",
"merge",
"(",
"{",
"\"licenses\"",
"=>",
"licenses",
",",
"\"notices\"",
"=>",
"notices",
"}",
")",
"FileUtils",
".",
"mkdir_p",
"(",
"File",
".",
"dirname",
"(",
"filename",
")",
... | Construct a new record
licenses - a string, or array of strings, representing the content of each license
notices - a string, or array of strings, representing the content of each legal notice
metadata - a Hash of the metadata for the package
Save the metadata and text to a file
filename - The destination file to save record contents at | [
"Construct",
"a",
"new",
"record"
] | afba288df344e001d43e94ad9217635a011b79c2 | https://github.com/github/licensed/blob/afba288df344e001d43e94ad9217635a011b79c2/lib/licensed/dependency_record.rb#L47-L55 | train | Save the metadata to a file | [
30522,
13366,
3828,
1006,
5371,
18442,
1007,
2951,
1035,
2000,
1035,
3828,
1027,
1030,
27425,
1012,
13590,
1006,
1063,
1000,
15943,
1000,
1027,
1028,
15943,
1010,
1000,
14444,
1000,
1027,
1028,
14444,
1065,
1007,
5371,
21823,
4877,
1012,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
roo-rb/roo | lib/roo/open_office.rb | Roo.OpenOffice.perform_decryption | def perform_decryption(
encryption_data,
password,
content_entry,
roo_content_xml_path
)
# Extract various expected attributes from the manifest that
# describe the encryption
algorithm_node = encryption_data.xpath('manifest:algorithm').first
key_derivation_node =
encryption_data.xpath('manifest:key-derivation').first
start_key_generation_node =
encryption_data.xpath('manifest:start-key-generation').first
# If we have all the expected elements, then we can perform
# the decryption.
if !algorithm_node.nil? && !key_derivation_node.nil? &&
!start_key_generation_node.nil?
# The algorithm is a URI describing the algorithm used
algorithm = algorithm_node['manifest:algorithm-name']
# The initialization vector is base-64 encoded
iv = Base64.decode64(
algorithm_node['manifest:initialisation-vector']
)
key_derivation_name = key_derivation_node['manifest:key-derivation-name']
iteration_count = key_derivation_node['manifest:iteration-count'].to_i
salt = Base64.decode64(key_derivation_node['manifest:salt'])
# The key is hashed with an algorithm represented by this URI
key_generation_name =
start_key_generation_node[
'manifest:start-key-generation-name'
]
hashed_password = password
if key_generation_name == 'http://www.w3.org/2000/09/xmldsig#sha256'
hashed_password = Digest::SHA256.digest(password)
else
fail ArgumentError, "Unknown key generation algorithm #{key_generation_name}"
end
cipher = find_cipher(
algorithm,
key_derivation_name,
hashed_password,
salt,
iteration_count,
iv
)
begin
decrypted = decrypt(content_entry, cipher)
# Finally, inflate the decrypted stream and overwrite
# content.xml
IO.binwrite(
roo_content_xml_path,
Zlib::Inflate.new(-Zlib::MAX_WBITS).inflate(decrypted)
)
rescue StandardError => error
raise ArgumentError, "Invalid password or other data error: #{error}"
end
else
fail ArgumentError, 'manifest.xml missing encryption-data elements'
end
end | ruby | def perform_decryption(
encryption_data,
password,
content_entry,
roo_content_xml_path
)
# Extract various expected attributes from the manifest that
# describe the encryption
algorithm_node = encryption_data.xpath('manifest:algorithm').first
key_derivation_node =
encryption_data.xpath('manifest:key-derivation').first
start_key_generation_node =
encryption_data.xpath('manifest:start-key-generation').first
# If we have all the expected elements, then we can perform
# the decryption.
if !algorithm_node.nil? && !key_derivation_node.nil? &&
!start_key_generation_node.nil?
# The algorithm is a URI describing the algorithm used
algorithm = algorithm_node['manifest:algorithm-name']
# The initialization vector is base-64 encoded
iv = Base64.decode64(
algorithm_node['manifest:initialisation-vector']
)
key_derivation_name = key_derivation_node['manifest:key-derivation-name']
iteration_count = key_derivation_node['manifest:iteration-count'].to_i
salt = Base64.decode64(key_derivation_node['manifest:salt'])
# The key is hashed with an algorithm represented by this URI
key_generation_name =
start_key_generation_node[
'manifest:start-key-generation-name'
]
hashed_password = password
if key_generation_name == 'http://www.w3.org/2000/09/xmldsig#sha256'
hashed_password = Digest::SHA256.digest(password)
else
fail ArgumentError, "Unknown key generation algorithm #{key_generation_name}"
end
cipher = find_cipher(
algorithm,
key_derivation_name,
hashed_password,
salt,
iteration_count,
iv
)
begin
decrypted = decrypt(content_entry, cipher)
# Finally, inflate the decrypted stream and overwrite
# content.xml
IO.binwrite(
roo_content_xml_path,
Zlib::Inflate.new(-Zlib::MAX_WBITS).inflate(decrypted)
)
rescue StandardError => error
raise ArgumentError, "Invalid password or other data error: #{error}"
end
else
fail ArgumentError, 'manifest.xml missing encryption-data elements'
end
end | [
"def",
"perform_decryption",
"(",
"encryption_data",
",",
"password",
",",
"content_entry",
",",
"roo_content_xml_path",
")",
"# Extract various expected attributes from the manifest that",
"# describe the encryption",
"algorithm_node",
"=",
"encryption_data",
".",
"xpath",
"(",
... | Process the ODS encryption manifest and perform the decryption | [
"Process",
"the",
"ODS",
"encryption",
"manifest",
"and",
"perform",
"the",
"decryption"
] | 4ec1104f0c3c2a29711c0c907371cd2be12bcc3c | https://github.com/roo-rb/roo/blob/4ec1104f0c3c2a29711c0c907371cd2be12bcc3c/lib/roo/open_office.rb#L273-L344 | train | Perform the decryption of the content entry | [
30522,
13366,
4685,
1035,
11703,
2854,
16790,
1006,
21999,
1035,
2951,
1010,
20786,
1010,
4180,
1035,
4443,
1010,
20996,
2080,
1035,
4180,
1035,
20950,
1035,
4130,
1007,
1001,
14817,
2536,
3517,
12332,
2013,
1996,
19676,
2008,
1001,
6235,
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_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.delete_entity_with_http_info | def delete_entity_with_http_info(app_id, version_id, entity_id, custom_headers:nil)
delete_entity_async(app_id, version_id, entity_id, custom_headers:custom_headers).value!
end | ruby | def delete_entity_with_http_info(app_id, version_id, entity_id, custom_headers:nil)
delete_entity_async(app_id, version_id, entity_id, custom_headers:custom_headers).value!
end | [
"def",
"delete_entity_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"custom_headers",
":",
"nil",
")",
"delete_entity_async",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!"... | Deletes an entity from a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param entity_id The entity extractor 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. | [
"Deletes",
"an",
"entity",
"from",
"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#L2352-L2354 | train | Deletes the entity. | [
30522,
13366,
3972,
12870,
1035,
9178,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
9178,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3972,
12870,
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... |
kmuto/review | lib/epubmaker/producer.rb | EPUBMaker.Producer.merge_config | def merge_config(config)
@config.deep_merge!(config)
complement
unless @config['epubversion'].nil?
case @config['epubversion'].to_i
when 2
@epub = EPUBMaker::EPUBv2.new(self)
when 3
@epub = EPUBMaker::EPUBv3.new(self)
else
raise "Invalid EPUB version (#{@config['epubversion']}.)"
end
end
if config['language']
ReVIEW::I18n.locale = config['language']
end
support_legacy_maker
end | ruby | def merge_config(config)
@config.deep_merge!(config)
complement
unless @config['epubversion'].nil?
case @config['epubversion'].to_i
when 2
@epub = EPUBMaker::EPUBv2.new(self)
when 3
@epub = EPUBMaker::EPUBv3.new(self)
else
raise "Invalid EPUB version (#{@config['epubversion']}.)"
end
end
if config['language']
ReVIEW::I18n.locale = config['language']
end
support_legacy_maker
end | [
"def",
"merge_config",
"(",
"config",
")",
"@config",
".",
"deep_merge!",
"(",
"config",
")",
"complement",
"unless",
"@config",
"[",
"'epubversion'",
"]",
".",
"nil?",
"case",
"@config",
"[",
"'epubversion'",
"]",
".",
"to_i",
"when",
"2",
"@epub",
"=",
"... | Update parameters by merging from new parameter hash +config+. | [
"Update",
"parameters",
"by",
"merging",
"from",
"new",
"parameter",
"hash",
"+",
"config",
"+",
"."
] | 77d1273e671663f05db2992281fd891b776badf0 | https://github.com/kmuto/review/blob/77d1273e671663f05db2992281fd891b776badf0/lib/epubmaker/producer.rb#L77-L95 | train | Merge the config with the current one | [
30522,
13366,
13590,
1035,
9530,
8873,
2290,
1006,
9530,
8873,
2290,
1007,
1030,
9530,
8873,
2290,
1012,
2784,
1035,
13590,
999,
1006,
9530,
8873,
2290,
1007,
13711,
4983,
1030,
9530,
8873,
2290,
1031,
1005,
4958,
12083,
27774,
1005,
1033,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
boazsegev/combine_pdf | lib/combine_pdf/page_methods.rb | CombinePDF.Page_Methods.init_contents | def init_contents
self[:Contents] = self[:Contents][:referenced_object][:indirect_without_dictionary] if self[:Contents].is_a?(Hash) && self[:Contents][:referenced_object] && self[:Contents][:referenced_object].is_a?(Hash) && self[:Contents][:referenced_object][:indirect_without_dictionary]
self[:Contents] = [self[:Contents]] unless self[:Contents].is_a?(Array)
self[:Contents].delete(is_reference_only: true, referenced_object: { indirect_reference_id: 0, raw_stream_content: '' })
# un-nest any referenced arrays
self[:Contents].map! { |s| actual_value(s).is_a?(Array) ? actual_value(s) : s }
self[:Contents].flatten!
self[:Contents].compact!
# wrap content streams
insert_content 'q', 0
insert_content 'Q'
# Prep content
@contents = ''
insert_content @contents
@contents
end | ruby | def init_contents
self[:Contents] = self[:Contents][:referenced_object][:indirect_without_dictionary] if self[:Contents].is_a?(Hash) && self[:Contents][:referenced_object] && self[:Contents][:referenced_object].is_a?(Hash) && self[:Contents][:referenced_object][:indirect_without_dictionary]
self[:Contents] = [self[:Contents]] unless self[:Contents].is_a?(Array)
self[:Contents].delete(is_reference_only: true, referenced_object: { indirect_reference_id: 0, raw_stream_content: '' })
# un-nest any referenced arrays
self[:Contents].map! { |s| actual_value(s).is_a?(Array) ? actual_value(s) : s }
self[:Contents].flatten!
self[:Contents].compact!
# wrap content streams
insert_content 'q', 0
insert_content 'Q'
# Prep content
@contents = ''
insert_content @contents
@contents
end | [
"def",
"init_contents",
"self",
"[",
":Contents",
"]",
"=",
"self",
"[",
":Contents",
"]",
"[",
":referenced_object",
"]",
"[",
":indirect_without_dictionary",
"]",
"if",
"self",
"[",
":Contents",
"]",
".",
"is_a?",
"(",
"Hash",
")",
"&&",
"self",
"[",
":C... | initializes the content stream in case it was not initialized before | [
"initializes",
"the",
"content",
"stream",
"in",
"case",
"it",
"was",
"not",
"initialized",
"before"
] | 09054051019c069f551f3e60be789577c0f93900 | https://github.com/boazsegev/combine_pdf/blob/09054051019c069f551f3e60be789577c0f93900/lib/combine_pdf/page_methods.rb#L669-L685 | train | Initialize the contents array | [
30522,
13366,
1999,
4183,
1035,
8417,
2969,
1031,
1024,
8417,
1033,
1027,
2969,
1031,
1024,
8417,
1033,
1031,
1024,
14964,
1035,
4874,
1033,
1031,
1024,
14958,
1035,
2302,
1035,
9206,
1033,
2065,
2969,
1031,
1024,
8417,
1033,
1012,
2003,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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_operational_insights/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/linked_services.rb | Azure::OperationalInsights::Mgmt::V2015_11_01_preview.LinkedServices.list_by_workspace | def list_by_workspace(resource_group_name, workspace_name, custom_headers:nil)
response = list_by_workspace_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_workspace(resource_group_name, workspace_name, custom_headers:nil)
response = list_by_workspace_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_workspace",
"(",
"resource_group_name",
",",
"workspace_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_workspace_async",
"(",
"resource_group_name",
",",
"workspace_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"val... | Gets the linked services instances in a workspace.
@param resource_group_name [String] The name of the resource group to get.
The name is case insensitive.
@param workspace_name [String] Name of the Log Analytics Workspace that
contains the linked services.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [LinkedServiceListResult] operation results. | [
"Gets",
"the",
"linked",
"services",
"instances",
"in",
"a",
"workspace",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_operational_insights/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/linked_services.rb#L364-L367 | train | Gets the list of all the elastic network interfaces in a workspace. | [
30522,
13366,
2862,
1035,
2011,
1035,
2573,
15327,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2573,
15327,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
2573,
15327,
1035,
2004,
6038,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/services/hyrax/file_set_fixity_check_service.rb | Hyrax.FileSetFixityCheckService.needs_fixity_check? | def needs_fixity_check?(latest_fixity_check)
return true unless latest_fixity_check
unless latest_fixity_check.updated_at
logger.warn "***FIXITY*** problem with fixity check log! Latest Fixity check is not nil, but updated_at is not set #{latest_fixity_check}"
return true
end
days_since_last_fixity_check(latest_fixity_check) >= max_days_between_fixity_checks
end | ruby | def needs_fixity_check?(latest_fixity_check)
return true unless latest_fixity_check
unless latest_fixity_check.updated_at
logger.warn "***FIXITY*** problem with fixity check log! Latest Fixity check is not nil, but updated_at is not set #{latest_fixity_check}"
return true
end
days_since_last_fixity_check(latest_fixity_check) >= max_days_between_fixity_checks
end | [
"def",
"needs_fixity_check?",
"(",
"latest_fixity_check",
")",
"return",
"true",
"unless",
"latest_fixity_check",
"unless",
"latest_fixity_check",
".",
"updated_at",
"logger",
".",
"warn",
"\"***FIXITY*** problem with fixity check log! Latest Fixity check is not nil, but updated_at i... | Check if time since the last fixity check is greater than the maximum days allowed between fixity checks
@param [ChecksumAuditLog] latest_fixity_check the most recent fixity check | [
"Check",
"if",
"time",
"since",
"the",
"last",
"fixity",
"check",
"is",
"greater",
"than",
"the",
"maximum",
"days",
"allowed",
"between",
"fixity",
"checks"
] | e2b4f56e829a53b1f11296324736e9d5b8c9ee5f | https://github.com/samvera/hyrax/blob/e2b4f56e829a53b1f11296324736e9d5b8c9ee5f/app/services/hyrax/file_set_fixity_check_service.rb#L95-L102 | train | Returns true if the latest fixity check needs to be run | [
30522,
13366,
3791,
1035,
8081,
3012,
1035,
4638,
1029,
1006,
6745,
1035,
8081,
3012,
1035,
4638,
1007,
2709,
2995,
4983,
6745,
1035,
8081,
3012,
1035,
4638,
4983,
6745,
1035,
8081,
3012,
1035,
4638,
1012,
7172,
1035,
2012,
8833,
4590,
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... |
hashicorp/vault-ruby | lib/vault/client.rb | Vault.Client.list | def list(path, params = {}, headers = {})
params = params.merge(list: true)
request(:get, path, params, headers)
end | ruby | def list(path, params = {}, headers = {})
params = params.merge(list: true)
request(:get, path, params, headers)
end | [
"def",
"list",
"(",
"path",
",",
"params",
"=",
"{",
"}",
",",
"headers",
"=",
"{",
"}",
")",
"params",
"=",
"params",
".",
"merge",
"(",
"list",
":",
"true",
")",
"request",
"(",
":get",
",",
"path",
",",
"params",
",",
"headers",
")",
"end"
] | Perform a LIST request.
@see Client#request | [
"Perform",
"a",
"LIST",
"request",
"."
] | 02f0532a802ba1a2a0d8703a4585dab76eb9d864 | https://github.com/hashicorp/vault-ruby/blob/02f0532a802ba1a2a0d8703a4585dab76eb9d864/lib/vault/client.rb#L189-L192 | train | List the documents in the specified path. | [
30522,
13366,
2862,
1006,
4130,
1010,
11498,
5244,
1027,
1063,
1065,
1010,
20346,
2015,
1027,
1063,
1065,
1007,
11498,
5244,
1027,
11498,
5244,
1012,
13590,
1006,
2862,
1024,
2995,
1007,
5227,
1006,
1024,
2131,
1010,
4130,
1010,
11498,
5244... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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_signalr/lib/2018-03-01-preview/generated/azure_mgmt_signalr/signal_r.rb | Azure::Signalr::Mgmt::V2018_03_01_preview.SignalR.regenerate_key_async | def regenerate_key_async(resource_group_name, resource_name, parameters:nil, custom_headers:nil)
# Send request
promise = begin_regenerate_key_async(resource_group_name, resource_name, parameters:parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Signalr::Mgmt::V2018_03_01_preview::Models::SignalRKeys.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 regenerate_key_async(resource_group_name, resource_name, parameters:nil, custom_headers:nil)
# Send request
promise = begin_regenerate_key_async(resource_group_name, resource_name, parameters:parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Signalr::Mgmt::V2018_03_01_preview::Models::SignalRKeys.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",
"regenerate_key_async",
"(",
"resource_group_name",
",",
"resource_name",
",",
"parameters",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_regenerate_key_async",
"(",
"resource_group_name",
",",
"resource_name",
",",... | @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 resource_name [String] The name of the SignalR resource.
@param parameters [RegenerateKeyParameters] Parameter that describes the
Regenerate Key Operation.
@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",
"that",
"contains",
"the",
"resource",
".",
"You",
"can",
"obtain",
"this",
"value",
"from",
"the",
"Azure",
"Resource",
"Manager",
"API",
"or",
"the",
"por... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_signalr/lib/2018-03-01-preview/generated/azure_mgmt_signalr/signal_r.rb#L434-L450 | train | Regenerate a key for a managed managed | [
30522,
13366,
19723,
24454,
3686,
1035,
3145,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7692,
1035,
2171,
1010,
11709,
1024,
9152,
2140,
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... |
meew0/discordrb | lib/discordrb/data/webhook.rb | Discordrb.Webhook.update | def update(data)
# Only pass a value for avatar if the key is defined as sending nil will delete the
data[:avatar] = avatarise(data[:avatar]) if data.key?(:avatar)
data[:channel_id] = data[:channel].resolve_id
data.delete(:channel)
update_webhook(data)
end | ruby | def update(data)
# Only pass a value for avatar if the key is defined as sending nil will delete the
data[:avatar] = avatarise(data[:avatar]) if data.key?(:avatar)
data[:channel_id] = data[:channel].resolve_id
data.delete(:channel)
update_webhook(data)
end | [
"def",
"update",
"(",
"data",
")",
"# Only pass a value for avatar if the key is defined as sending nil will delete the",
"data",
"[",
":avatar",
"]",
"=",
"avatarise",
"(",
"data",
"[",
":avatar",
"]",
")",
"if",
"data",
".",
"key?",
"(",
":avatar",
")",
"data",
... | Updates the webhook if you need to edit more than 1 attribute.
@param data [Hash] the data to update.
@option data [String, #read, nil] :avatar The new avatar, in base64-encoded JPG format, or nil to delete the avatar.
@option data [Channel, String, Integer, #resolve_id] :channel The channel the webhook should use.
@option data [String] :name The webhook's new name.
@option data [String] :reason The reason for the webhook changes. | [
"Updates",
"the",
"webhook",
"if",
"you",
"need",
"to",
"edit",
"more",
"than",
"1",
"attribute",
"."
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/data/webhook.rb#L77-L83 | train | Update the webhook | [
30522,
13366,
10651,
1006,
2951,
1007,
1001,
2069,
3413,
1037,
3643,
2005,
22128,
2065,
1996,
3145,
2003,
4225,
2004,
6016,
9152,
2140,
2097,
3972,
12870,
1996,
2951,
1031,
1024,
22128,
1033,
1027,
22128,
5562,
1006,
2951,
1031,
1024,
22128... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | actionpack/lib/abstract_controller/rendering.rb | AbstractController.Rendering._normalize_render | def _normalize_render(*args, &block) # :nodoc:
options = _normalize_args(*args, &block)
_process_variant(options)
_normalize_options(options)
options
end | ruby | def _normalize_render(*args, &block) # :nodoc:
options = _normalize_args(*args, &block)
_process_variant(options)
_normalize_options(options)
options
end | [
"def",
"_normalize_render",
"(",
"*",
"args",
",",
"&",
"block",
")",
"# :nodoc:",
"options",
"=",
"_normalize_args",
"(",
"args",
",",
"block",
")",
"_process_variant",
"(",
"options",
")",
"_normalize_options",
"(",
"options",
")",
"options",
"end"
] | Normalize args and options. | [
"Normalize",
"args",
"and",
"options",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/actionpack/lib/abstract_controller/rendering.rb#L116-L121 | train | Normalize the arguments for the render | [
30522,
13366,
1035,
3671,
4697,
1035,
17552,
1006,
1008,
12098,
5620,
1010,
1004,
3796,
1007,
1001,
1024,
7293,
10085,
1024,
7047,
1027,
1035,
3671,
4697,
1035,
12098,
5620,
1006,
1008,
12098,
5620,
1010,
1004,
3796,
1007,
1035,
2832,
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... |
appium/ruby_lib | lib/appium_lib/android/element/button.rb | Appium.Android.last_button | def last_button
# uiautomator index doesn't support last
# and it's 0 indexed
button_index = tags(BUTTON).length
button_index -= 1 if button_index > 0
image_button_index = tags(IMAGE_BUTTON).length
image_button_index -= 1 if image_button_index > 0
find_element :uiautomator,
_button_visible_selectors(button_index: button_index,
image_button_index: image_button_index)
end | ruby | def last_button
# uiautomator index doesn't support last
# and it's 0 indexed
button_index = tags(BUTTON).length
button_index -= 1 if button_index > 0
image_button_index = tags(IMAGE_BUTTON).length
image_button_index -= 1 if image_button_index > 0
find_element :uiautomator,
_button_visible_selectors(button_index: button_index,
image_button_index: image_button_index)
end | [
"def",
"last_button",
"# uiautomator index doesn't support last",
"# and it's 0 indexed",
"button_index",
"=",
"tags",
"(",
"BUTTON",
")",
".",
"length",
"button_index",
"-=",
"1",
"if",
"button_index",
">",
"0",
"image_button_index",
"=",
"tags",
"(",
"IMAGE_BUTTON",
... | Find the last button.
@return [BUTTON] | [
"Find",
"the",
"last",
"button",
"."
] | 1f5898400dd1928bfe42ddd5f842d1f8738f2f76 | https://github.com/appium/ruby_lib/blob/1f5898400dd1928bfe42ddd5f842d1f8738f2f76/lib/appium_lib/android/element/button.rb#L59-L70 | train | Find the last button element in the list of buttons | [
30522,
13366,
2197,
1035,
6462,
1001,
21318,
4887,
20389,
8844,
5950,
2987,
1005,
1056,
2490,
2197,
1001,
1998,
2009,
1005,
1055,
1014,
25331,
6462,
1035,
5950,
1027,
22073,
1006,
6462,
1007,
1012,
3091,
6462,
1035,
5950,
1011,
1027,
1015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hashicorp/vault-ruby | lib/vault/api/auth.rb | Vault.Authenticate.userpass | def userpass(username, password, options = {})
payload = { password: password }.merge(options)
json = client.post("/v1/auth/userpass/login/#{encode_path(username)}", JSON.fast_generate(payload))
secret = Secret.decode(json)
client.token = secret.auth.client_token
return secret
end | ruby | def userpass(username, password, options = {})
payload = { password: password }.merge(options)
json = client.post("/v1/auth/userpass/login/#{encode_path(username)}", JSON.fast_generate(payload))
secret = Secret.decode(json)
client.token = secret.auth.client_token
return secret
end | [
"def",
"userpass",
"(",
"username",
",",
"password",
",",
"options",
"=",
"{",
"}",
")",
"payload",
"=",
"{",
"password",
":",
"password",
"}",
".",
"merge",
"(",
"options",
")",
"json",
"=",
"client",
".",
"post",
"(",
"\"/v1/auth/userpass/login/#{encode_... | Authenticate via the "userpass" authentication method. If authentication
is successful, the resulting token will be stored on the client and used
for future requests.
@example
Vault.auth.userpass("sethvargo", "s3kr3t") #=> #<Vault::Secret lease_id="">
@example with a custom mount point
Vault.auth.userpass("sethvargo", "s3kr3t", mount: "admin-login") #=> #<Vault::Secret lease_id="">
@param [String] username
@param [String] password
@param [Hash] options
additional options to pass to the authentication call, such as a custom
mount point
@return [Secret] | [
"Authenticate",
"via",
"the",
"userpass",
"authentication",
"method",
".",
"If",
"authentication",
"is",
"successful",
"the",
"resulting",
"token",
"will",
"be",
"stored",
"on",
"the",
"client",
"and",
"used",
"for",
"future",
"requests",
"."
] | 02f0532a802ba1a2a0d8703a4585dab76eb9d864 | https://github.com/hashicorp/vault-ruby/blob/02f0532a802ba1a2a0d8703a4585dab76eb9d864/lib/vault/api/auth.rb#L118-L124 | train | login to a user | [
30522,
13366,
5310,
15194,
1006,
5310,
18442,
1010,
20786,
1010,
7047,
1027,
1063,
1065,
1007,
18093,
1027,
1063,
20786,
1024,
20786,
1065,
1012,
13590,
1006,
7047,
1007,
1046,
3385,
1027,
7396,
1012,
2695,
1006,
1000,
1013,
1058,
2487,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | activerecord/lib/active_record/attribute_methods.rb | ActiveRecord.AttributeMethods.attributes_for_create | def attributes_for_create(attribute_names)
attribute_names &= self.class.column_names
attribute_names.delete_if do |name|
pk_attribute?(name) && id.nil?
end
end | ruby | def attributes_for_create(attribute_names)
attribute_names &= self.class.column_names
attribute_names.delete_if do |name|
pk_attribute?(name) && id.nil?
end
end | [
"def",
"attributes_for_create",
"(",
"attribute_names",
")",
"attribute_names",
"&=",
"self",
".",
"class",
".",
"column_names",
"attribute_names",
".",
"delete_if",
"do",
"|",
"name",
"|",
"pk_attribute?",
"(",
"name",
")",
"&&",
"id",
".",
"nil?",
"end",
"en... | Filters out the primary keys, from the attribute names, when the primary
key is to be generated (e.g. the id attribute has no value). | [
"Filters",
"out",
"the",
"primary",
"keys",
"from",
"the",
"attribute",
"names",
"when",
"the",
"primary",
"key",
"is",
"to",
"be",
"generated",
"(",
"e",
".",
"g",
".",
"the",
"id",
"attribute",
"has",
"no",
"value",
")",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activerecord/lib/active_record/attribute_methods.rb#L446-L451 | train | Returns the attributes that are required to be created. | [
30522,
13366,
12332,
1035,
2005,
1035,
3443,
1006,
17961,
1035,
3415,
1007,
17961,
1035,
3415,
1004,
1027,
2969,
1012,
2465,
1012,
5930,
1035,
3415,
17961,
1035,
3415,
1012,
3972,
12870,
1035,
2065,
2079,
1064,
2171,
1064,
1052,
2243,
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... |
square/connect-ruby-sdk | lib/square_connect/api/orders_api.rb | SquareConnect.OrdersApi.batch_retrieve_orders | def batch_retrieve_orders(location_id, body, opts = {})
data, _status_code, _headers = batch_retrieve_orders_with_http_info(location_id, body, opts)
return data
end | ruby | def batch_retrieve_orders(location_id, body, opts = {})
data, _status_code, _headers = batch_retrieve_orders_with_http_info(location_id, body, opts)
return data
end | [
"def",
"batch_retrieve_orders",
"(",
"location_id",
",",
"body",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"batch_retrieve_orders_with_http_info",
"(",
"location_id",
",",
"body",
",",
"opts",
")",
"return",
"data",
"e... | BatchRetrieveOrders
Retrieves a set of [Order](#type-order)s by their IDs. If a given Order ID does not exist, the ID is ignored instead of generating an error.
@param location_id The ID of the orders' associated location.
@param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
@param [Hash] opts the optional parameters
@return [BatchRetrieveOrdersResponse] | [
"BatchRetrieveOrders",
"Retrieves",
"a",
"set",
"of",
"[",
"Order",
"]",
"(",
"#type",
"-",
"order",
")",
"s",
"by",
"their",
"IDs",
".",
"If",
"a",
"given",
"Order",
"ID",
"does",
"not",
"exist",
"the",
"ID",
"is",
"ignored",
"instead",
"of",
"generat... | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/orders_api.rb#L26-L29 | train | Retrieve a list of orders for a location | [
30522,
13366,
14108,
1035,
12850,
1035,
4449,
1006,
3295,
1035,
8909,
1010,
2303,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
14108,
1035,
12850,
1035,
4449,
1035,
2007,
1035... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/network_interface_tap_configurations.rb | Azure::Network::Mgmt::V2019_02_01.NetworkInterfaceTapConfigurations.begin_create_or_update_with_http_info | def begin_create_or_update_with_http_info(resource_group_name, network_interface_name, tap_configuration_name, tap_configuration_parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, network_interface_name, tap_configuration_name, tap_configuration_parameters, custom_headers:custom_headers).value!
end | ruby | def begin_create_or_update_with_http_info(resource_group_name, network_interface_name, tap_configuration_name, tap_configuration_parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, network_interface_name, tap_configuration_name, tap_configuration_parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_create_or_update_with_http_info",
"(",
"resource_group_name",
",",
"network_interface_name",
",",
"tap_configuration_name",
",",
"tap_configuration_parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
... | Creates or updates a Tap configuration in the specified NetworkInterface.
@param resource_group_name [String] The name of the resource group.
@param network_interface_name [String] The name of the network interface.
@param tap_configuration_name [String] The name of the tap configuration.
@param tap_configuration_parameters [NetworkInterfaceTapConfiguration]
Parameters supplied to the create or update tap configuration 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",
"Tap",
"configuration",
"in",
"the",
"specified",
"NetworkInterface",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/network_interface_tap_configurations.rb#L416-L418 | train | Creates or updates a Tap . | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2897,
1035,
8278,
1035,
2171,
1010,
11112,
1035,
9563,
1035,
2171,
1010,
11112,
1035,
9563,
1035,
11709,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/snapshot.rb | Aws::EC2.Snapshot.reset_attribute | def reset_attribute(options = {})
options = options.merge(snapshot_id: @id)
resp = @client.reset_snapshot_attribute(options)
resp.data
end | ruby | def reset_attribute(options = {})
options = options.merge(snapshot_id: @id)
resp = @client.reset_snapshot_attribute(options)
resp.data
end | [
"def",
"reset_attribute",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"snapshot_id",
":",
"@id",
")",
"resp",
"=",
"@client",
".",
"reset_snapshot_attribute",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
snapshot.reset_attribute({
attribute: "productCodes", # required, accepts productCodes, createVolumePermission
dry_run: false,
})
@param [Hash] options ({})
@option options [required, String] :attribute
The attribute to reset. Currently, only the attribute for permission
to create volumes can be reset.
@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 [EmptyStructure] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/snapshot.rb#L519-L523 | train | Reset the attribute of the snapshot | [
30522,
13366,
25141,
1035,
17961,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
20057,
12326,
1035,
8909,
1024,
1030,
8909,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
25141,
1035,
20057,
12326,
1035,
17961,
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... |
jekyll/jekyll | lib/jekyll/site.rb | Jekyll.Site.documents | def documents
@documents ||= collections.reduce(Set.new) do |docs, (_, collection)|
docs + collection.docs + collection.files
end.to_a
end | ruby | def documents
@documents ||= collections.reduce(Set.new) do |docs, (_, collection)|
docs + collection.docs + collection.files
end.to_a
end | [
"def",
"documents",
"@documents",
"||=",
"collections",
".",
"reduce",
"(",
"Set",
".",
"new",
")",
"do",
"|",
"docs",
",",
"(",
"_",
",",
"collection",
")",
"|",
"docs",
"+",
"collection",
".",
"docs",
"+",
"collection",
".",
"files",
"end",
".",
"t... | Get all the documents
Returns an Array of all Documents | [
"Get",
"all",
"the",
"documents"
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/site.rb#L335-L339 | train | Returns the set of documents that are in the a
. | [
30522,
13366,
5491,
1030,
5491,
1064,
1064,
1027,
6407,
1012,
5547,
1006,
2275,
1012,
2047,
1007,
2079,
1064,
9986,
2015,
1010,
1006,
1035,
1010,
3074,
1007,
1064,
9986,
2015,
1009,
3074,
1012,
9986,
2015,
1009,
3074,
1012,
6764,
2203,
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_advisor/lib/2017-04-19/generated/azure_mgmt_advisor/configurations.rb | Azure::Advisor::Mgmt::V2017_04_19.Configurations.create_in_subscription | def create_in_subscription(config_contract, custom_headers:nil)
response = create_in_subscription_async(config_contract, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_in_subscription(config_contract, custom_headers:nil)
response = create_in_subscription_async(config_contract, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_in_subscription",
"(",
"config_contract",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_in_subscription_async",
"(",
"config_contract",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"... | Create/Overwrite Azure Advisor configuration.
Create/Overwrite Azure Advisor configuration and also delete all
configurations of contained resource groups.
@param config_contract [ConfigData] The Azure Advisor configuration data
structure.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ARMErrorResponseBody] operation results. | [
"Create",
"/",
"Overwrite",
"Azure",
"Advisor",
"configuration",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_advisor/lib/2017-04-19/generated/azure_mgmt_advisor/configurations.rb#L130-L133 | train | Creates a new Central service in the subscription. | [
30522,
13366,
3443,
1035,
1999,
1035,
15002,
1006,
9530,
8873,
2290,
1035,
3206,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3443,
1035,
1999,
1035,
15002,
1035,
2004,
6038,
2278,
1006,
9530,
8873,
2290,
1035,
3206,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/scss-lint | lib/scss_lint/linter/space_between_parens.rb | SCSSLint.Linter::SpaceBetweenParens.feel_for_enclosing_parens | def feel_for_enclosing_parens(node) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
range = node.source_range
original_source = source_from_range(range)
left_offset = -1
right_offset = 0
if original_source[-1] != ')'
right_offset += 1 while character_at(range.end_pos, right_offset) =~ /\s/
return original_source if character_at(range.end_pos, right_offset) != ')'
end
# At this point, we know that we're wrapped on the right by a ')'.
# Are we wrapped on the left by a '('?
left_offset -= 1 while character_at(range.start_pos, left_offset) =~ /\s/
return original_source if character_at(range.start_pos, left_offset) != '('
# At this point, we know we're wrapped on both sides by parens. However,
# those parens may be part of a parent function call. We don't care about
# such parens. This depends on whether the preceding character is part of
# a function name.
return original_source if character_at(range.start_pos, left_offset - 1).match?(/[A-Za-z0-9_]/)
range.start_pos.offset += left_offset
range.end_pos.offset += right_offset
source_from_range(range)
end | ruby | def feel_for_enclosing_parens(node) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
range = node.source_range
original_source = source_from_range(range)
left_offset = -1
right_offset = 0
if original_source[-1] != ')'
right_offset += 1 while character_at(range.end_pos, right_offset) =~ /\s/
return original_source if character_at(range.end_pos, right_offset) != ')'
end
# At this point, we know that we're wrapped on the right by a ')'.
# Are we wrapped on the left by a '('?
left_offset -= 1 while character_at(range.start_pos, left_offset) =~ /\s/
return original_source if character_at(range.start_pos, left_offset) != '('
# At this point, we know we're wrapped on both sides by parens. However,
# those parens may be part of a parent function call. We don't care about
# such parens. This depends on whether the preceding character is part of
# a function name.
return original_source if character_at(range.start_pos, left_offset - 1).match?(/[A-Za-z0-9_]/)
range.start_pos.offset += left_offset
range.end_pos.offset += right_offset
source_from_range(range)
end | [
"def",
"feel_for_enclosing_parens",
"(",
"node",
")",
"# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity",
"range",
"=",
"node",
".",
"source_range",
"original_source",
"=",
"source_from_range",
"(",
"range",
")",
"left_offset",
"=",
"-",
"1",
"right_offset",
... | An expression enclosed in parens will include or not include each paren, depending
on whitespace. Here we feel out for enclosing parens, and return them as the new
source for the node. | [
"An",
"expression",
"enclosed",
"in",
"parens",
"will",
"include",
"or",
"not",
"include",
"each",
"paren",
"depending",
"on",
"whitespace",
".",
"Here",
"we",
"feel",
"out",
"for",
"enclosing",
"parens",
"and",
"return",
"them",
"as",
"the",
"new",
"source"... | e99afe4ede041a431a06e585c12ce82f6ad50116 | https://github.com/sds/scss-lint/blob/e99afe4ede041a431a06e585c12ce82f6ad50116/lib/scss_lint/linter/space_between_parens.rb#L72-L98 | train | This function is used to feel out the parens that are wrapped in parentheses. | [
30522,
13366,
2514,
1035,
2005,
1035,
4372,
20464,
18606,
1035,
11968,
6132,
1006,
13045,
1007,
1001,
14548,
24163,
2361,
1024,
4487,
19150,
12046,
2015,
1013,
5925,
5332,
4371,
1010,
12046,
2015,
1013,
22330,
20464,
9626,
4588,
9006,
19386,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.put | def put(options = {})
options = options.merge(bucket: @bucket_name)
resp = @client.put_bucket_tagging(options)
resp.data
end | ruby | def put(options = {})
options = options.merge(bucket: @bucket_name)
resp = @client.put_bucket_tagging(options)
resp.data
end | [
"def",
"put",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"bucket",
":",
"@bucket_name",
")",
"resp",
"=",
"@client",
".",
"put_bucket_tagging",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
bucket_tagging.put({
content_md5: "ContentMD5",
tagging: { # required
tag_set: [ # required
{
key: "ObjectKey", # required
value: "Value", # required
},
],
},
})
@param [Hash] options ({})
@option options [String] :content_md5
@option options [required, Types::Tagging] :tagging
@return [EmptyStructure] | [
"@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#L199-L203 | train | Put the tagging data to the bucket | [
30522,
13366,
2404,
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,
2404,
1035,
13610,
1035,
6415,
4726,
1006,
7047,
1007,
24501,
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... |
boazsegev/combine_pdf | lib/combine_pdf/pdf_protected.rb | CombinePDF.PDF.merge_outlines | def merge_outlines(old_data, new_data, position)
old_data = actual_object(old_data)
new_data = actual_object(new_data)
if old_data.nil? || old_data.empty? || old_data[:First].nil?
# old_data is a reference to the actual object,
# so if we update old_data, we're done, no need to take any further action
old_data.update new_data
elsif new_data.nil? || new_data.empty? || new_data[:First].nil?
return old_data
else
new_data = new_data.dup # avoid old data corruption
# number of outline nodes, after the merge
old_data[:Count] = old_data[:Count].to_i + new_data[:Count].to_i
# walk the Hash here ...
# I'm just using the start / end insert-position for now...
# first - is going to be the start of the outline base node's :First, after the merge
# last - is going to be the end of the outline base node's :Last, after the merge
# median - the start of what will be appended to the end of the outline base node's :First
# parent - the outline base node of the resulting merged outline
# FIXME implement the possibility to insert somewhere in the middle of the outline
prev = nil
pos = first = actual_object((position.nonzero? ? old_data : new_data)[:First])
last = actual_object((position.nonzero? ? new_data : old_data)[:Last])
median = { is_reference_only: true, referenced_object: actual_object((position.nonzero? ? new_data : old_data)[:First]) }
old_data[:First] = { is_reference_only: true, referenced_object: first }
old_data[:Last] = { is_reference_only: true, referenced_object: last }
parent = { is_reference_only: true, referenced_object: old_data }
while pos
# walking through old_data here and updating the :Parent as we go,
# this updates the inserted new_data :Parent's as well once it is appended and the
# loop keeps walking the appended data.
pos[:Parent] = parent if pos[:Parent]
# connect the two outlines
# if there is no :Next, the end of the outline base node's :First is reached and this is
# where the new data gets appended, the same way you would append to a two-way linked list.
if pos[:Next].nil?
median[:referenced_object][:Prev] = { is_reference_only: true, referenced_object: prev } if median
pos[:Next] = median
# midian becomes 'nil' because this loop keeps going after the appending is done,
# to update the parents of the appended tree and we wouldn't want to keep appending it infinitely.
median = nil
end
# iterating over the outlines main nodes (this is not going into subtrees)
# while keeping every rotations previous node saved
prev = pos
pos = actual_object(pos[:Next])
end
# make sure the last object doesn't have the :Next and the first no :Prev property
prev.delete :Next
actual_object(old_data[:First]).delete :Prev
end
end | ruby | def merge_outlines(old_data, new_data, position)
old_data = actual_object(old_data)
new_data = actual_object(new_data)
if old_data.nil? || old_data.empty? || old_data[:First].nil?
# old_data is a reference to the actual object,
# so if we update old_data, we're done, no need to take any further action
old_data.update new_data
elsif new_data.nil? || new_data.empty? || new_data[:First].nil?
return old_data
else
new_data = new_data.dup # avoid old data corruption
# number of outline nodes, after the merge
old_data[:Count] = old_data[:Count].to_i + new_data[:Count].to_i
# walk the Hash here ...
# I'm just using the start / end insert-position for now...
# first - is going to be the start of the outline base node's :First, after the merge
# last - is going to be the end of the outline base node's :Last, after the merge
# median - the start of what will be appended to the end of the outline base node's :First
# parent - the outline base node of the resulting merged outline
# FIXME implement the possibility to insert somewhere in the middle of the outline
prev = nil
pos = first = actual_object((position.nonzero? ? old_data : new_data)[:First])
last = actual_object((position.nonzero? ? new_data : old_data)[:Last])
median = { is_reference_only: true, referenced_object: actual_object((position.nonzero? ? new_data : old_data)[:First]) }
old_data[:First] = { is_reference_only: true, referenced_object: first }
old_data[:Last] = { is_reference_only: true, referenced_object: last }
parent = { is_reference_only: true, referenced_object: old_data }
while pos
# walking through old_data here and updating the :Parent as we go,
# this updates the inserted new_data :Parent's as well once it is appended and the
# loop keeps walking the appended data.
pos[:Parent] = parent if pos[:Parent]
# connect the two outlines
# if there is no :Next, the end of the outline base node's :First is reached and this is
# where the new data gets appended, the same way you would append to a two-way linked list.
if pos[:Next].nil?
median[:referenced_object][:Prev] = { is_reference_only: true, referenced_object: prev } if median
pos[:Next] = median
# midian becomes 'nil' because this loop keeps going after the appending is done,
# to update the parents of the appended tree and we wouldn't want to keep appending it infinitely.
median = nil
end
# iterating over the outlines main nodes (this is not going into subtrees)
# while keeping every rotations previous node saved
prev = pos
pos = actual_object(pos[:Next])
end
# make sure the last object doesn't have the :Next and the first no :Prev property
prev.delete :Next
actual_object(old_data[:First]).delete :Prev
end
end | [
"def",
"merge_outlines",
"(",
"old_data",
",",
"new_data",
",",
"position",
")",
"old_data",
"=",
"actual_object",
"(",
"old_data",
")",
"new_data",
"=",
"actual_object",
"(",
"new_data",
")",
"if",
"old_data",
".",
"nil?",
"||",
"old_data",
".",
"empty?",
"... | Merges 2 outlines by appending one to the end or start of the other.
old_data - the main outline, which is also the one that will be used in the resulting PDF.
new_data - the outline to be appended
position - an integer representing the position where a PDF is being inserted.
This method only differentiates between inserted at the beginning, or not.
Not at the beginning, means the new outline will be added to the end of the original outline.
An outline base node (tree base) has :Type, :Count, :First, :Last
Every node within the outline base node's :First or :Last can have also have the following pointers to other nodes:
:First or :Last (only if the node has a subtree / subsection)
:Parent (the node's parent)
:Prev, :Next (previous and next node)
Non-node-pointer data in these nodes:
:Title - the node's title displayed in the PDF outline
:Count - Number of nodes in it's subtree (0 if no subtree)
:Dest - node link destination (if the node is linking to something) | [
"Merges",
"2",
"outlines",
"by",
"appending",
"one",
"to",
"the",
"end",
"or",
"start",
"of",
"the",
"other",
".",
"old_data",
"-",
"the",
"main",
"outline",
"which",
"is",
"also",
"the",
"one",
"that",
"will",
"be",
"used",
"in",
"the",
"resulting",
"... | 09054051019c069f551f3e60be789577c0f93900 | https://github.com/boazsegev/combine_pdf/blob/09054051019c069f551f3e60be789577c0f93900/lib/combine_pdf/pdf_protected.rb#L293-L344 | train | merges the outline nodes at the given position. | [
30522,
13366,
13590,
1035,
22106,
1006,
2214,
1035,
2951,
1010,
2047,
1035,
2951,
1010,
2597,
1007,
2214,
1035,
2951,
1027,
5025,
1035,
4874,
1006,
2214,
1035,
2951,
1007,
2047,
1035,
2951,
1027,
5025,
1035,
4874,
1006,
2047,
1035,
2951,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
jnunemaker/httparty | lib/httparty.rb | HTTParty.ClassMethods.options | def options(path, options = {}, &block)
perform_request Net::HTTP::Options, path, options, &block
end | ruby | def options(path, options = {}, &block)
perform_request Net::HTTP::Options, path, options, &block
end | [
"def",
"options",
"(",
"path",
",",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"perform_request",
"Net",
"::",
"HTTP",
"::",
"Options",
",",
"path",
",",
"options",
",",
"block",
"end"
] | Perform an OPTIONS request to a path | [
"Perform",
"an",
"OPTIONS",
"request",
"to",
"a",
"path"
] | b4099defba01231d2faaaa2660476f867e096bfb | https://github.com/jnunemaker/httparty/blob/b4099defba01231d2faaaa2660476f867e096bfb/lib/httparty.rb#L558-L560 | train | Perform an HTTP OPTIONS request to the specified path. | [
30522,
13366,
7047,
1006,
4130,
1010,
7047,
1027,
1063,
1065,
1010,
1004,
3796,
1007,
4685,
1035,
5227,
5658,
1024,
1024,
8299,
1024,
1024,
7047,
1010,
4130,
1010,
7047,
1010,
1004,
3796,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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... |
jeremytregunna/ruby-trello | lib/trello/checklist.rb | Trello.Checklist.update_fields | def update_fields(fields)
attributes[:id] = fields['id'] || attributes[:id]
attributes[:name] = fields['name'] || fields[:name] || attributes[:name]
attributes[:description] = fields['desc'] || attributes[:description]
attributes[:closed] = fields['closed'] if fields.has_key?('closed')
attributes[:url] = fields['url'] || attributes[:url]
attributes[:check_items] = fields['checkItems'] if fields.has_key?('checkItems')
attributes[:position] = fields['pos'] || attributes[:position]
attributes[:board_id] = fields['idBoard'] || attributes[:board_id]
attributes[:card_id] = fields['idCard'] || fields[:card_id] || attributes[:card_id]
attributes[:list_id] = fields['idList'] || attributes[:list_id]
attributes[:member_ids] = fields['idMembers'] || attributes[:member_ids]
self
end | ruby | def update_fields(fields)
attributes[:id] = fields['id'] || attributes[:id]
attributes[:name] = fields['name'] || fields[:name] || attributes[:name]
attributes[:description] = fields['desc'] || attributes[:description]
attributes[:closed] = fields['closed'] if fields.has_key?('closed')
attributes[:url] = fields['url'] || attributes[:url]
attributes[:check_items] = fields['checkItems'] if fields.has_key?('checkItems')
attributes[:position] = fields['pos'] || attributes[:position]
attributes[:board_id] = fields['idBoard'] || attributes[:board_id]
attributes[:card_id] = fields['idCard'] || fields[:card_id] || attributes[:card_id]
attributes[:list_id] = fields['idList'] || attributes[:list_id]
attributes[:member_ids] = fields['idMembers'] || attributes[:member_ids]
self
end | [
"def",
"update_fields",
"(",
"fields",
")",
"attributes",
"[",
":id",
"]",
"=",
"fields",
"[",
"'id'",
"]",
"||",
"attributes",
"[",
":id",
"]",
"attributes",
"[",
":name",
"]",
"=",
"fields",
"[",
"'name'",
"]",
"||",
"fields",
"[",
":name",
"]",
"|... | Update the fields of a checklist.
Supply a hash of string keyed data retrieved from the Trello API representing
a checklist. | [
"Update",
"the",
"fields",
"of",
"a",
"checklist",
"."
] | ad79c9d8152ad5395b3b61c43170908f1912bfb2 | https://github.com/jeremytregunna/ruby-trello/blob/ad79c9d8152ad5395b3b61c43170908f1912bfb2/lib/trello/checklist.rb#L47-L60 | train | Update the fields of the object. | [
30522,
13366,
10651,
1035,
4249,
1006,
4249,
1007,
12332,
1031,
1024,
8909,
1033,
1027,
4249,
1031,
1005,
8909,
1005,
1033,
1064,
1064,
12332,
1031,
1024,
8909,
1033,
12332,
1031,
1024,
2171,
1033,
1027,
4249,
1031,
1005,
2171,
1005,
1033,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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_entity_with_http_info | def get_entity_with_http_info(app_id, version_id, entity_id, custom_headers:nil)
get_entity_async(app_id, version_id, entity_id, custom_headers:custom_headers).value!
end | ruby | def get_entity_with_http_info(app_id, version_id, entity_id, custom_headers:nil)
get_entity_async(app_id, version_id, entity_id, custom_headers:custom_headers).value!
end | [
"def",
"get_entity_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"custom_headers",
":",
"nil",
")",
"get_entity_async",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"e... | Gets information about an entity model in a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param entity_id The entity extractor 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",
"information",
"about",
"an",
"entity",
"model",
"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#L2148-L2150 | train | Gets the entity definition of the entity. | [
30522,
13366,
2131,
1035,
9178,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
9178,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
9178,
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... |
sensu/sensu | lib/sensu/utilities.rb | Sensu.Utilities.object_substitute_tokens | def object_substitute_tokens(object, attributes)
unmatched_tokens = []
case object
when Hash
object.each do |key, value|
object[key], unmatched = object_substitute_tokens(value, attributes)
unmatched_tokens.push(*unmatched)
end
when Array
object.map! do |value|
value, unmatched = object_substitute_tokens(value, attributes)
unmatched_tokens.push(*unmatched)
value
end
when String
object, unmatched_tokens = substitute_tokens(object, attributes)
end
[object, unmatched_tokens.uniq]
end | ruby | def object_substitute_tokens(object, attributes)
unmatched_tokens = []
case object
when Hash
object.each do |key, value|
object[key], unmatched = object_substitute_tokens(value, attributes)
unmatched_tokens.push(*unmatched)
end
when Array
object.map! do |value|
value, unmatched = object_substitute_tokens(value, attributes)
unmatched_tokens.push(*unmatched)
value
end
when String
object, unmatched_tokens = substitute_tokens(object, attributes)
end
[object, unmatched_tokens.uniq]
end | [
"def",
"object_substitute_tokens",
"(",
"object",
",",
"attributes",
")",
"unmatched_tokens",
"=",
"[",
"]",
"case",
"object",
"when",
"Hash",
"object",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"object",
"[",
"key",
"]",
",",
"unmatched",
"=",
"... | Perform token substitution for an object. String values are
passed to `substitute_tokens()`, arrays and sub-hashes are
processed recursively. Numeric values are ignored.
@param object [Object]
@param attributes [Hash]
@return [Array] containing the updated object with substituted
values and an array of unmatched tokens. | [
"Perform",
"token",
"substitution",
"for",
"an",
"object",
".",
"String",
"values",
"are",
"passed",
"to",
"substitute_tokens",
"()",
"arrays",
"and",
"sub",
"-",
"hashes",
"are",
"processed",
"recursively",
".",
"Numeric",
"values",
"are",
"ignored",
"."
] | 51319e4b58c8d9986f101ad71ff729aa3e51e951 | https://github.com/sensu/sensu/blob/51319e4b58c8d9986f101ad71ff729aa3e51e951/lib/sensu/utilities.rb#L212-L230 | train | Substitute tokens in the object | [
30522,
13366,
4874,
1035,
7681,
1035,
19204,
2015,
1006,
4874,
1010,
12332,
1007,
4895,
18900,
7690,
1035,
19204,
2015,
1027,
1031,
1033,
2553,
4874,
2043,
23325,
4874,
1012,
2169,
2079,
1064,
3145,
1010,
3643,
1064,
4874,
1031,
3145,
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... |
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_time_settings | def get_time_settings(device_name, resource_group_name, manager_name, custom_headers:nil)
response = get_time_settings_async(device_name, resource_group_name, manager_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_time_settings(device_name, resource_group_name, manager_name, custom_headers:nil)
response = get_time_settings_async(device_name, resource_group_name, manager_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_time_settings",
"(",
"device_name",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_time_settings_async",
"(",
"device_name",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers... | Gets the time settings of the specified device.
@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 [TimeSettings] operation results. | [
"Gets",
"the",
"time",
"settings",
"of",
"the",
"specified",
"device",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/device_settings.rb#L509-L512 | train | Gets the time settings for the specified device. | [
30522,
13366,
2131,
1035,
2051,
1035,
10906,
1006,
5080,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
2051,
1035,
10906,
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/job_executions.rb | Azure::SQL::Mgmt::V2017_03_01_preview.JobExecutions.list_by_agent | def list_by_agent(resource_group_name, server_name, job_agent_name, create_time_min:nil, create_time_max:nil, end_time_min:nil, end_time_max:nil, is_active:nil, skip:nil, top:nil, custom_headers:nil)
first_page = list_by_agent_as_lazy(resource_group_name, server_name, job_agent_name, create_time_min:create_time_min, create_time_max:create_time_max, end_time_min:end_time_min, end_time_max:end_time_max, is_active:is_active, skip:skip, top:top, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_by_agent(resource_group_name, server_name, job_agent_name, create_time_min:nil, create_time_max:nil, end_time_min:nil, end_time_max:nil, is_active:nil, skip:nil, top:nil, custom_headers:nil)
first_page = list_by_agent_as_lazy(resource_group_name, server_name, job_agent_name, create_time_min:create_time_min, create_time_max:create_time_max, end_time_min:end_time_min, end_time_max:end_time_max, is_active:is_active, skip:skip, top:top, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_by_agent",
"(",
"resource_group_name",
",",
"server_name",
",",
"job_agent_name",
",",
"create_time_min",
":",
"nil",
",",
"create_time_max",
":",
"nil",
",",
"end_time_min",
":",
"nil",
",",
"end_time_max",
":",
"nil",
",",
"is_active",
":",
"nil",... | Lists all executions in a job agent.
@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 job_agent_name [String] The name of the job agent.
@param create_time_min [DateTime] If specified, only job executions created
at or after the specified time are included.
@param create_time_max [DateTime] If specified, only job executions created
before the specified time are included.
@param end_time_min [DateTime] If specified, only job executions completed at
or after the specified time are included.
@param end_time_max [DateTime] If specified, only job executions completed
before the specified time are included.
@param is_active [Boolean] If specified, only active or only completed job
executions are included.
@param skip [Integer] The number of elements in the collection to skip.
@param top [Integer] The number of elements to return from the collection.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<JobExecution>] operation results. | [
"Lists",
"all",
"executions",
"in",
"a",
"job",
"agent",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/job_executions.rb#L52-L55 | train | Gets all the job agents in a server. | [
30522,
13366,
2862,
1035,
2011,
1035,
4005,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
3105,
1035,
4005,
1035,
2171,
1010,
3443,
1035,
2051,
1035,
8117,
1024,
9152,
2140,
1010,
3443,
1035,
2051,
1035,
4098,
1024,
91... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.delete_closed_list_entity_role | def delete_closed_list_entity_role(app_id, version_id, entity_id, role_id, custom_headers:nil)
response = delete_closed_list_entity_role_async(app_id, version_id, entity_id, role_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def delete_closed_list_entity_role(app_id, version_id, entity_id, role_id, custom_headers:nil)
response = delete_closed_list_entity_role_async(app_id, version_id, entity_id, role_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"delete_closed_list_entity_role",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"role_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_closed_list_entity_role_async",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"ro... | Delete a role for a given list entity in a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param entity_id The entity ID.
@param role_id The entity role Id.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OperationStatus] operation results. | [
"Delete",
"a",
"role",
"for",
"a",
"given",
"list",
"entity",
"in",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L9615-L9618 | train | Deletes a list entity role. | [
30522,
13366,
3972,
12870,
1035,
2701,
1035,
2862,
1035,
9178,
1035,
2535,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
9178,
1035,
8909,
1010,
2535,
1035,
8909,
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... |
cloudfoundry/bosh | src/bosh-director/lib/bosh/director/compiled_package_requirement_generator.rb | Bosh::Director.CompiledPackageRequirementGenerator.generate! | def generate!(requirements, instance_group, job, package, stemcell)
# Our assumption here is that package dependency graph
# has no cycles: this is being enforced on release upload.
# Other than that it's a vanilla Depth-First Search (DFS).
@logger.info("Checking whether package '#{package.desc}' needs to be compiled for stemcell '#{stemcell.desc}'")
requirement_key = [package.id, "#{stemcell.os}/#{stemcell.version}"]
requirement = requirements[requirement_key]
if requirement # We already visited this and its dependencies
requirement.add_instance_group(instance_group) # But we still need to register with this instance group
return requirement
end
package_dependency_manager = PackageDependenciesManager.new(job.release.model)
requirement = create_requirement(instance_group, job, package, stemcell, package_dependency_manager)
@logger.info("Processing package '#{package.desc}' dependencies")
dependencies = package_dependency_manager.dependencies(package)
dependencies.each do |dependency|
@logger.info("Package '#{package.desc}' depends on package '#{dependency.desc}'")
dependency_requirement = generate!(requirements, instance_group, job, dependency, stemcell)
requirement.add_dependency(dependency_requirement)
end
requirements[requirement_key] = requirement
requirement
end | ruby | def generate!(requirements, instance_group, job, package, stemcell)
# Our assumption here is that package dependency graph
# has no cycles: this is being enforced on release upload.
# Other than that it's a vanilla Depth-First Search (DFS).
@logger.info("Checking whether package '#{package.desc}' needs to be compiled for stemcell '#{stemcell.desc}'")
requirement_key = [package.id, "#{stemcell.os}/#{stemcell.version}"]
requirement = requirements[requirement_key]
if requirement # We already visited this and its dependencies
requirement.add_instance_group(instance_group) # But we still need to register with this instance group
return requirement
end
package_dependency_manager = PackageDependenciesManager.new(job.release.model)
requirement = create_requirement(instance_group, job, package, stemcell, package_dependency_manager)
@logger.info("Processing package '#{package.desc}' dependencies")
dependencies = package_dependency_manager.dependencies(package)
dependencies.each do |dependency|
@logger.info("Package '#{package.desc}' depends on package '#{dependency.desc}'")
dependency_requirement = generate!(requirements, instance_group, job, dependency, stemcell)
requirement.add_dependency(dependency_requirement)
end
requirements[requirement_key] = requirement
requirement
end | [
"def",
"generate!",
"(",
"requirements",
",",
"instance_group",
",",
"job",
",",
"package",
",",
"stemcell",
")",
"# Our assumption here is that package dependency graph",
"# has no cycles: this is being enforced on release upload.",
"# Other than that it's a vanilla Depth-First Search... | The rquirements hash passed in by the caller will be populated with CompiledPackageRequirement objects | [
"The",
"rquirements",
"hash",
"passed",
"in",
"by",
"the",
"caller",
"will",
"be",
"populated",
"with",
"CompiledPackageRequirement",
"objects"
] | 2eaa7100879ddd20cd909cd698514746195e28b7 | https://github.com/cloudfoundry/bosh/blob/2eaa7100879ddd20cd909cd698514746195e28b7/src/bosh-director/lib/bosh/director/compiled_package_requirement_generator.rb#L12-L40 | train | Generate a requirement for a given package | [
30522,
13366,
9699,
999,
1006,
5918,
1010,
6013,
1035,
2177,
1010,
3105,
1010,
7427,
1010,
7872,
29109,
2140,
1007,
1001,
2256,
11213,
2182,
2003,
2008,
7427,
24394,
10629,
1001,
2038,
2053,
12709,
1024,
2023,
2003,
2108,
16348,
2006,
2713,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | frameit/lib/frameit/editor.rb | Frameit.Editor.title_min_height | def title_min_height
@title_min_height ||= begin
height = fetch_config['title_min_height'] || 0
if height.kind_of?(String) && height.end_with?('%')
height = ([image.width, image.height].min * height.to_f * 0.01).ceil
end
height
end
end | ruby | def title_min_height
@title_min_height ||= begin
height = fetch_config['title_min_height'] || 0
if height.kind_of?(String) && height.end_with?('%')
height = ([image.width, image.height].min * height.to_f * 0.01).ceil
end
height
end
end | [
"def",
"title_min_height",
"@title_min_height",
"||=",
"begin",
"height",
"=",
"fetch_config",
"[",
"'title_min_height'",
"]",
"||",
"0",
"if",
"height",
".",
"kind_of?",
"(",
"String",
")",
"&&",
"height",
".",
"end_with?",
"(",
"'%'",
")",
"height",
"=",
"... | Minimum height for the title | [
"Minimum",
"height",
"for",
"the",
"title"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/frameit/lib/frameit/editor.rb#L213-L221 | train | Returns the minimum height of the title. | [
30522,
13366,
2516,
1035,
8117,
1035,
4578,
1030,
2516,
1035,
8117,
1035,
4578,
1064,
1064,
1027,
4088,
4578,
1027,
18584,
1035,
9530,
8873,
2290,
1031,
1005,
2516,
1035,
8117,
1035,
4578,
1005,
1033,
1064,
1064,
1014,
2065,
4578,
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... |
sds/scss-lint | lib/scss_lint/linter.rb | SCSSLint.Linter.visit_children | def visit_children(parent)
parent.children.each do |child|
child.node_parent = parent
visit(child)
end
end | ruby | def visit_children(parent)
parent.children.each do |child|
child.node_parent = parent
visit(child)
end
end | [
"def",
"visit_children",
"(",
"parent",
")",
"parent",
".",
"children",
".",
"each",
"do",
"|",
"child",
"|",
"child",
".",
"node_parent",
"=",
"parent",
"visit",
"(",
"child",
")",
"end",
"end"
] | Redefine so we can set the `node_parent` of each node
@param parent [Sass::Tree::Node, Sass::Script::Tree::Node,
Sass::Script::Value::Base] | [
"Redefine",
"so",
"we",
"can",
"set",
"the",
"node_parent",
"of",
"each",
"node"
] | e99afe4ede041a431a06e585c12ce82f6ad50116 | https://github.com/sds/scss-lint/blob/e99afe4ede041a431a06e585c12ce82f6ad50116/lib/scss_lint/linter.rb#L151-L156 | train | visit_children ( parent ) | [
30522,
13366,
3942,
1035,
2336,
1006,
6687,
1007,
6687,
1012,
2336,
1012,
2169,
2079,
1064,
2775,
1064,
2775,
1012,
13045,
1035,
6687,
1027,
6687,
3942,
1006,
2775,
1007,
2203,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/elements/element.rb | Watir.Element.center | def center
point = location
dimensions = size
Selenium::WebDriver::Point.new(point.x + (dimensions['width'] / 2),
point.y + (dimensions['height'] / 2))
end | ruby | def center
point = location
dimensions = size
Selenium::WebDriver::Point.new(point.x + (dimensions['width'] / 2),
point.y + (dimensions['height'] / 2))
end | [
"def",
"center",
"point",
"=",
"location",
"dimensions",
"=",
"size",
"Selenium",
"::",
"WebDriver",
"::",
"Point",
".",
"new",
"(",
"point",
".",
"x",
"+",
"(",
"dimensions",
"[",
"'width'",
"]",
"/",
"2",
")",
",",
"point",
".",
"y",
"+",
"(",
"d... | Get centre coordinates of element
@example
browser.button(name: "new_user_button").centre
@return [Selenium::WebDriver::Point] | [
"Get",
"centre",
"coordinates",
"of",
"element"
] | 2d8db09811c6221ae401b85b2f61f5fa66e463a3 | https://github.com/watir/watir/blob/2d8db09811c6221ae401b85b2f61f5fa66e463a3/lib/watir/elements/element.rb#L425-L430 | train | Returns the center of the image in the specified region. | [
30522,
13366,
2415,
2391,
1027,
3295,
9646,
1027,
2946,
7367,
7770,
5007,
1024,
1024,
4773,
23663,
2099,
1024,
1024,
2391,
1012,
2047,
1006,
2391,
1012,
1060,
1009,
1006,
9646,
1031,
1005,
9381,
1005,
1033,
1013,
1016,
1007,
1010,
2391,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
puppetlabs/puppet | lib/puppet/util/rdoc/generators/puppet_generator.rb | Generators.PuppetGenerator.gen_class_index | def gen_class_index
gen_an_index(@classes, 'All Classes', RDoc::Page::CLASS_INDEX, "fr_class_index.html")
@allfiles.each do |file|
unless file['file'].context.file_relative_name =~ /\.rb$/
gen_composite_index(
file,
RDoc::Page::COMBO_INDEX,
"#{MODULE_DIR}/fr_#{file["file"].context.module_name}.html")
end
end
end | ruby | def gen_class_index
gen_an_index(@classes, 'All Classes', RDoc::Page::CLASS_INDEX, "fr_class_index.html")
@allfiles.each do |file|
unless file['file'].context.file_relative_name =~ /\.rb$/
gen_composite_index(
file,
RDoc::Page::COMBO_INDEX,
"#{MODULE_DIR}/fr_#{file["file"].context.module_name}.html")
end
end
end | [
"def",
"gen_class_index",
"gen_an_index",
"(",
"@classes",
",",
"'All Classes'",
",",
"RDoc",
"::",
"Page",
"::",
"CLASS_INDEX",
",",
"\"fr_class_index.html\"",
")",
"@allfiles",
".",
"each",
"do",
"|",
"file",
"|",
"unless",
"file",
"[",
"'file'",
"]",
".",
... | generate the all classes index file and the combo index | [
"generate",
"the",
"all",
"classes",
"index",
"file",
"and",
"the",
"combo",
"index"
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/util/rdoc/generators/puppet_generator.rb#L234-L246 | train | Generate the class index | [
30522,
13366,
8991,
1035,
2465,
1035,
5950,
8991,
1035,
2019,
1035,
5950,
1006,
1030,
4280,
1010,
1005,
2035,
4280,
1005,
1010,
16428,
10085,
1024,
1024,
3931,
1024,
1024,
2465,
1035,
5950,
1010,
1000,
10424,
1035,
2465,
1035,
5950,
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... |
piotrmurach/github | lib/github_api/request.rb | Github.Request.call | def call(current_options, params)
unless HTTP_METHODS.include?(action)
raise ArgumentError, "unknown http method: #{method}"
end
puts "EXECUTED: #{action} - #{path} with PARAMS: #{params.request_params}" if ENV['DEBUG']
request_options = params.options
connection_options = current_options.merge(request_options)
conn = connection(api, connection_options)
self.path = Utils::Url.normalize(self.path)
if conn.path_prefix != '/' && self.path.index(conn.path_prefix) != 0
self.path = (conn.path_prefix + self.path).gsub(/\/(\/)*/, '/')
end
response = conn.send(action) do |request|
case action.to_sym
when *(HTTP_METHODS - METHODS_WITH_BODIES)
request.body = params.data if params.key?('data')
if params.key?('encoder')
request.params.params_encoder(params.encoder)
end
request.url(self.path, params.request_params)
when *METHODS_WITH_BODIES
request.url(self.path, connection_options[:query] || {})
request.body = params.data unless params.empty?
end
end
ResponseWrapper.new(response, api)
end | ruby | def call(current_options, params)
unless HTTP_METHODS.include?(action)
raise ArgumentError, "unknown http method: #{method}"
end
puts "EXECUTED: #{action} - #{path} with PARAMS: #{params.request_params}" if ENV['DEBUG']
request_options = params.options
connection_options = current_options.merge(request_options)
conn = connection(api, connection_options)
self.path = Utils::Url.normalize(self.path)
if conn.path_prefix != '/' && self.path.index(conn.path_prefix) != 0
self.path = (conn.path_prefix + self.path).gsub(/\/(\/)*/, '/')
end
response = conn.send(action) do |request|
case action.to_sym
when *(HTTP_METHODS - METHODS_WITH_BODIES)
request.body = params.data if params.key?('data')
if params.key?('encoder')
request.params.params_encoder(params.encoder)
end
request.url(self.path, params.request_params)
when *METHODS_WITH_BODIES
request.url(self.path, connection_options[:query] || {})
request.body = params.data unless params.empty?
end
end
ResponseWrapper.new(response, api)
end | [
"def",
"call",
"(",
"current_options",
",",
"params",
")",
"unless",
"HTTP_METHODS",
".",
"include?",
"(",
"action",
")",
"raise",
"ArgumentError",
",",
"\"unknown http method: #{method}\"",
"end",
"puts",
"\"EXECUTED: #{action} - #{path} with PARAMS: #{params.request_params}... | Create a new Request
@return [Github::Request]
@api public
Performs a request
@param [Symbol] method - The Symbol the HTTP verb
@param [String] path - String relative URL to access
@param [ParamsHash] params - ParamsHash to configure the request API
@return [Github::ResponseWrapper]
@api private | [
"Create",
"a",
"new",
"Request"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/request.rb#L53-L83 | train | Execute the request | [
30522,
13366,
2655,
1006,
2783,
1035,
7047,
1010,
11498,
5244,
1007,
4983,
8299,
1035,
4725,
1012,
2421,
1029,
1006,
2895,
1007,
5333,
6685,
2121,
29165,
1010,
1000,
4242,
8299,
4118,
1024,
1001,
1063,
4118,
1065,
1000,
2203,
8509,
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... |
puppetlabs/puppet | lib/puppet/environments.rb | Puppet::Environments.Cached.evict_if_expired | def evict_if_expired(name)
if (result = @cache[name]) && (result.expired? || @cache_expiration_service.expired?(name))
Puppet.debug {"Evicting cache entry for environment '#{name}'"}
@cache_expiration_service.evicted(name)
clear(name)
Puppet.settings.clear_environment_settings(name)
end
end | ruby | def evict_if_expired(name)
if (result = @cache[name]) && (result.expired? || @cache_expiration_service.expired?(name))
Puppet.debug {"Evicting cache entry for environment '#{name}'"}
@cache_expiration_service.evicted(name)
clear(name)
Puppet.settings.clear_environment_settings(name)
end
end | [
"def",
"evict_if_expired",
"(",
"name",
")",
"if",
"(",
"result",
"=",
"@cache",
"[",
"name",
"]",
")",
"&&",
"(",
"result",
".",
"expired?",
"||",
"@cache_expiration_service",
".",
"expired?",
"(",
"name",
")",
")",
"Puppet",
".",
"debug",
"{",
"\"Evict... | Evicts the entry if it has expired
Also clears caches in Settings that may prevent the entry from being updated | [
"Evicts",
"the",
"entry",
"if",
"it",
"has",
"expired",
"Also",
"clears",
"caches",
"in",
"Settings",
"that",
"may",
"prevent",
"the",
"entry",
"from",
"being",
"updated"
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/environments.rb#L439-L446 | train | Evict cache entry if it has expired | [
30522,
13366,
23408,
2594,
2102,
1035,
2065,
1035,
13735,
1006,
2171,
1007,
2065,
1006,
2765,
1027,
1030,
17053,
1031,
2171,
1033,
1007,
1004,
1004,
1006,
2765,
1012,
13735,
1029,
1064,
1064,
1030,
17053,
1035,
4654,
16781,
1035,
2326,
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_network/lib/2018-07-01/generated/azure_mgmt_network/express_route_cross_connection_peerings.rb | Azure::Network::Mgmt::V2018_07_01.ExpressRouteCrossConnectionPeerings.get_with_http_info | def get_with_http_info(resource_group_name, cross_connection_name, peering_name, custom_headers:nil)
get_async(resource_group_name, cross_connection_name, peering_name, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, cross_connection_name, peering_name, custom_headers:nil)
get_async(resource_group_name, cross_connection_name, peering_name, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"cross_connection_name",
",",
"peering_name",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"cross_connection_name",
",",
"peering_name",
",",
"custom_headers",
":custom_... | Gets the specified peering for 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.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"specified",
"peering",
"for",
"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#L190-L192 | train | Gets the specified ExpressRouteCrossConnectionExpressRoutePeering. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
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,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/tag.rb | Azure::ApiManagement::Mgmt::V2018_01_01.Tag.get_entity_state_with_http_info | def get_entity_state_with_http_info(resource_group_name, service_name, tag_id, custom_headers:nil)
get_entity_state_async(resource_group_name, service_name, tag_id, custom_headers:custom_headers).value!
end | ruby | def get_entity_state_with_http_info(resource_group_name, service_name, tag_id, custom_headers:nil)
get_entity_state_async(resource_group_name, service_name, tag_id, custom_headers:custom_headers).value!
end | [
"def",
"get_entity_state_with_http_info",
"(",
"resource_group_name",
",",
"service_name",
",",
"tag_id",
",",
"custom_headers",
":",
"nil",
")",
"get_entity_state_async",
"(",
"resource_group_name",
",",
"service_name",
",",
"tag_id",
",",
"custom_headers",
":custom_head... | Gets the entity state version of the tag specified by its identifier.
@param resource_group_name [String] The name of the resource group.
@param service_name [String] The name of the API Management service.
@param tag_id [String] Tag identifier. Must be unique in the current API
Management service instance.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"entity",
"state",
"version",
"of",
"the",
"tag",
"specified",
"by",
"its",
"identifier",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/tag.rb#L176-L178 | train | Gets the entity state of the specified HDInsight tag. | [
30522,
13366,
2131,
1035,
9178,
1035,
2110,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
6415,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
9178,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.delete_entity_role_with_http_info | def delete_entity_role_with_http_info(app_id, version_id, entity_id, role_id, custom_headers:nil)
delete_entity_role_async(app_id, version_id, entity_id, role_id, custom_headers:custom_headers).value!
end | ruby | def delete_entity_role_with_http_info(app_id, version_id, entity_id, role_id, custom_headers:nil)
delete_entity_role_async(app_id, version_id, entity_id, role_id, custom_headers:custom_headers).value!
end | [
"def",
"delete_entity_role_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"role_id",
",",
"custom_headers",
":",
"nil",
")",
"delete_entity_role_async",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"role_id",
",",
"custom_heade... | Delete an entity role in a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param entity_id The entity ID.
@param role_id The entity role 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. | [
"Delete",
"an",
"entity",
"role",
"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#L9010-L9012 | train | Deletes the role of the entity. | [
30522,
13366,
3972,
12870,
1035,
9178,
1035,
2535,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
9178,
1035,
8909,
1010,
2535,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
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... |
Azure/azure-sdk-for-ruby | data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb | Azure::KeyVault::V2016_10_01.KeyVaultClient.set_storage_account_with_http_info | def set_storage_account_with_http_info(vault_base_url, storage_account_name, resource_id, active_key_name, auto_regenerate_key, regeneration_period:nil, storage_account_attributes:nil, tags:nil, custom_headers:nil)
set_storage_account_async(vault_base_url, storage_account_name, resource_id, active_key_name, auto_regenerate_key, regeneration_period:regeneration_period, storage_account_attributes:storage_account_attributes, tags:tags, custom_headers:custom_headers).value!
end | ruby | def set_storage_account_with_http_info(vault_base_url, storage_account_name, resource_id, active_key_name, auto_regenerate_key, regeneration_period:nil, storage_account_attributes:nil, tags:nil, custom_headers:nil)
set_storage_account_async(vault_base_url, storage_account_name, resource_id, active_key_name, auto_regenerate_key, regeneration_period:regeneration_period, storage_account_attributes:storage_account_attributes, tags:tags, custom_headers:custom_headers).value!
end | [
"def",
"set_storage_account_with_http_info",
"(",
"vault_base_url",
",",
"storage_account_name",
",",
"resource_id",
",",
"active_key_name",
",",
"auto_regenerate_key",
",",
"regeneration_period",
":",
"nil",
",",
"storage_account_attributes",
":",
"nil",
",",
"tags",
":"... | Creates or updates a new storage account. This operation requires the
storage/set permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param storage_account_name [String] The name of the storage account.
@param resource_id [String] Storage account resource id.
@param active_key_name [String] Current active storage account key name.
@param auto_regenerate_key [Boolean] whether keyvault should manage the
storage account for the user.
@param regeneration_period [String] The key regeneration time duration
specified in ISO-8601 format.
@param storage_account_attributes [StorageAccountAttributes] The attributes
of the storage account.
@param tags [Hash{String => String}] Application specific metadata in the
form of key-value pairs.
@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",
"new",
"storage",
"account",
".",
"This",
"operation",
"requires",
"the",
"storage",
"/",
"set",
"permission",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb#L7305-L7307 | train | Sets the storage account. | [
30522,
13366,
2275,
1035,
5527,
1035,
4070,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
5527,
1035,
4070,
1035,
2171,
1010,
7692,
1035,
8909,
1010,
3161,
1035,
3145,
1035,
2171,
1010,
8285,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activerecord/lib/active_record/autosave_association.rb | ActiveRecord.AutosaveAssociation.validate_single_association | def validate_single_association(reflection)
association = association_instance_get(reflection.name)
record = association && association.reader
association_valid?(reflection, record) if record
end | ruby | def validate_single_association(reflection)
association = association_instance_get(reflection.name)
record = association && association.reader
association_valid?(reflection, record) if record
end | [
"def",
"validate_single_association",
"(",
"reflection",
")",
"association",
"=",
"association_instance_get",
"(",
"reflection",
".",
"name",
")",
"record",
"=",
"association",
"&&",
"association",
".",
"reader",
"association_valid?",
"(",
"reflection",
",",
"record",... | Validate the association if <tt>:validate</tt> or <tt>:autosave</tt> is
turned on for the association. | [
"Validate",
"the",
"association",
"if",
"<tt",
">",
":",
"validate<",
"/",
"tt",
">",
"or",
"<tt",
">",
":",
"autosave<",
"/",
"tt",
">",
"is",
"turned",
"on",
"for",
"the",
"association",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activerecord/lib/active_record/autosave_association.rb#L304-L308 | train | Validates the association | [
30522,
13366,
9398,
3686,
1035,
2309,
1035,
2523,
1006,
9185,
1007,
2523,
1027,
2523,
1035,
6013,
1035,
2131,
1006,
9185,
1012,
2171,
1007,
2501,
1027,
2523,
1004,
1004,
2523,
1012,
8068,
2523,
1035,
9398,
1029,
1006,
9185,
1010,
2501,
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... |
sds/haml-lint | lib/haml_lint/runner.rb | HamlLint.Runner.process_files | def process_files(report)
files.each do |file|
process_file(file, report)
break if report.failed? && fail_fast?
end
end | ruby | def process_files(report)
files.each do |file|
process_file(file, report)
break if report.failed? && fail_fast?
end
end | [
"def",
"process_files",
"(",
"report",
")",
"files",
".",
"each",
"do",
"|",
"file",
"|",
"process_file",
"(",
"file",
",",
"report",
")",
"break",
"if",
"report",
".",
"failed?",
"&&",
"fail_fast?",
"end",
"end"
] | Process the files and add them to the given report.
@param report [HamlLint::Report]
@return [void] | [
"Process",
"the",
"files",
"and",
"add",
"them",
"to",
"the",
"given",
"report",
"."
] | 024c773667e54cf88db938c2b368977005d70ee8 | https://github.com/sds/haml-lint/blob/024c773667e54cf88db938c2b368977005d70ee8/lib/haml_lint/runner.rb#L111-L116 | train | Process the files | [
30522,
13366,
2832,
1035,
6764,
1006,
3189,
1007,
6764,
1012,
2169,
2079,
1064,
5371,
1064,
2832,
1035,
5371,
1006,
5371,
1010,
3189,
1007,
3338,
2065,
3189,
1012,
3478,
1029,
1004,
1004,
8246,
1035,
3435,
1029,
2203,
2203,
102,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.