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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
daddyz/phonelib | lib/phonelib/phone_analyzer_helper.rb | Phonelib.PhoneAnalyzerHelper.number_match? | def number_match?(number, regex)
match = number.match(cr("^(?:#{regex})$"))
match && match.to_s.length == number.length
end | ruby | def number_match?(number, regex)
match = number.match(cr("^(?:#{regex})$"))
match && match.to_s.length == number.length
end | [
"def",
"number_match?",
"(",
"number",
",",
"regex",
")",
"match",
"=",
"number",
".",
"match",
"(",
"cr",
"(",
"\"^(?:#{regex})$\"",
")",
")",
"match",
"&&",
"match",
".",
"to_s",
".",
"length",
"==",
"number",
".",
"length",
"end"
] | Checks number against regex and compares match length
==== Attributes
* +number+ - phone number for validation
* +regex+ - regex for perfoming a validation | [
"Checks",
"number",
"against",
"regex",
"and",
"compares",
"match",
"length"
] | aa0023eab7c896b71275bf342bc7f49735cbdbbf | https://github.com/daddyz/phonelib/blob/aa0023eab7c896b71275bf342bc7f49735cbdbbf/lib/phonelib/phone_analyzer_helper.rb#L203-L206 | train | Returns true if the number matches the regex | [
30522,
13366,
2193,
1035,
2674,
1029,
1006,
2193,
1010,
19723,
10288,
1007,
2674,
1027,
2193,
1012,
2674,
1006,
13675,
1006,
1000,
1034,
1006,
1029,
1024,
1001,
1063,
19723,
10288,
1065,
1007,
1002,
1000,
1007,
1007,
2674,
1004,
1004,
2674,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_managed_applications/lib/2018-06-01/generated/azure_mgmt_managed_applications/applications.rb | Azure::ManagedApplications::Mgmt::V2018_06_01.Applications.begin_create_or_update | def begin_create_or_update(resource_group_name, application_name, parameters, custom_headers:nil)
response = begin_create_or_update_async(resource_group_name, application_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_create_or_update(resource_group_name, application_name, parameters, custom_headers:nil)
response = begin_create_or_update_async(resource_group_name, application_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_create_or_update",
"(",
"resource_group_name",
",",
"application_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"application_name",
",",
"parameters",
",",
... | Creates a new managed application.
@param resource_group_name [String] The name of the resource group. The name
is case insensitive.
@param application_name [String] The name of the managed application.
@param parameters [Application] Parameters supplied to the create or update a
managed application.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Application] operation results. | [
"Creates",
"a",
"new",
"managed",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_managed_applications/lib/2018-06-01/generated/azure_mgmt_managed_applications/applications.rb#L908-L911 | train | Creates or updates an application. | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4646,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/vpn_connections.rb | Azure::Network::Mgmt::V2019_02_01.VpnConnections.create_or_update | def create_or_update(resource_group_name, gateway_name, connection_name, vpn_connection_parameters, custom_headers:nil)
response = create_or_update_async(resource_group_name, gateway_name, connection_name, vpn_connection_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_or_update(resource_group_name, gateway_name, connection_name, vpn_connection_parameters, custom_headers:nil)
response = create_or_update_async(resource_group_name, gateway_name, connection_name, vpn_connection_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_or_update",
"(",
"resource_group_name",
",",
"gateway_name",
",",
"connection_name",
",",
"vpn_connection_parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_or_update_async",
"(",
"resource_group_name",
",",
"gateway_name",
",",
... | Creates a vpn connection to a scalable vpn gateway if it doesn't exist else
updates the existing connection.
@param resource_group_name [String] The resource group name of the
VpnGateway.
@param gateway_name [String] The name of the gateway.
@param connection_name [String] The name of the connection.
@param vpn_connection_parameters [VpnConnection] Parameters supplied to
create or Update a VPN Connection.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [VpnConnection] operation results. | [
"Creates",
"a",
"vpn",
"connection",
"to",
"a",
"scalable",
"vpn",
"gateway",
"if",
"it",
"doesn",
"t",
"exist",
"else",
"updates",
"the",
"existing",
"connection",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/vpn_connections.rb#L138-L141 | train | Creates or updates a virtual wan vpn connection. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
11909,
1035,
2171,
1010,
4434,
1035,
2171,
1010,
21210,
2078,
1035,
4434,
1035,
11709,
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... |
nathanvda/cocoon | lib/cocoon/view_helpers.rb | Cocoon.ViewHelpers.link_to_remove_association | def link_to_remove_association(*args, &block)
if block_given?
link_to_remove_association(capture(&block), *args)
elsif args.first.respond_to?(:object)
form = args.first
association = form.object.class.to_s.tableize
name = I18n.translate("cocoon.#{association}.remove", default: I18n.translate('cocoon.defaults.remove'))
link_to_remove_association(name, *args)
else
name, f, html_options = *args
html_options ||= {}
is_dynamic = f.object.new_record?
classes = []
classes << "remove_fields"
classes << (is_dynamic ? 'dynamic' : 'existing')
classes << 'destroyed' if f.object.marked_for_destruction?
html_options[:class] = [html_options[:class], classes.join(' ')].compact.join(' ')
wrapper_class = html_options.delete(:wrapper_class)
html_options[:'data-wrapper-class'] = wrapper_class if wrapper_class.present?
hidden_field_tag("#{f.object_name}[_destroy]", f.object._destroy) + link_to(name, '#', html_options)
end
end | ruby | def link_to_remove_association(*args, &block)
if block_given?
link_to_remove_association(capture(&block), *args)
elsif args.first.respond_to?(:object)
form = args.first
association = form.object.class.to_s.tableize
name = I18n.translate("cocoon.#{association}.remove", default: I18n.translate('cocoon.defaults.remove'))
link_to_remove_association(name, *args)
else
name, f, html_options = *args
html_options ||= {}
is_dynamic = f.object.new_record?
classes = []
classes << "remove_fields"
classes << (is_dynamic ? 'dynamic' : 'existing')
classes << 'destroyed' if f.object.marked_for_destruction?
html_options[:class] = [html_options[:class], classes.join(' ')].compact.join(' ')
wrapper_class = html_options.delete(:wrapper_class)
html_options[:'data-wrapper-class'] = wrapper_class if wrapper_class.present?
hidden_field_tag("#{f.object_name}[_destroy]", f.object._destroy) + link_to(name, '#', html_options)
end
end | [
"def",
"link_to_remove_association",
"(",
"*",
"args",
",",
"&",
"block",
")",
"if",
"block_given?",
"link_to_remove_association",
"(",
"capture",
"(",
"block",
")",
",",
"args",
")",
"elsif",
"args",
".",
"first",
".",
"respond_to?",
"(",
":object",
")",
"f... | this will show a link to remove the current association. This should be placed inside the partial.
either you give
- *name* : the text of the link
- *f* : the form this link should be placed in
- *html_options*: html options to be passed to link_to (see <tt>link_to</tt>)
or you use the form without *name* with a *&block*
- *f* : the form this link should be placed in
- *html_options*: html options to be passed to link_to (see <tt>link_to</tt>)
- *&block*: the output of the block will be show in the link, see <tt>link_to</tt> | [
"this",
"will",
"show",
"a",
"link",
"to",
"remove",
"the",
"current",
"association",
".",
"This",
"should",
"be",
"placed",
"inside",
"the",
"partial",
".",
"either",
"you",
"give",
"-",
"*",
"name",
"*",
":",
"the",
"text",
"of",
"the",
"link",
"-",
... | ec18c446a5475aa4959c699c797ee0fe9b0c9136 | https://github.com/nathanvda/cocoon/blob/ec18c446a5475aa4959c699c797ee0fe9b0c9136/lib/cocoon/view_helpers.rb#L16-L42 | train | Returns the HTML for the remove association. | [
30522,
13366,
4957,
1035,
2000,
1035,
6366,
1035,
2523,
1006,
1008,
12098,
5620,
1010,
1004,
3796,
1007,
2065,
3796,
1035,
2445,
1029,
4957,
1035,
2000,
1035,
6366,
1035,
2523,
1006,
5425,
1006,
1004,
3796,
1007,
1010,
1008,
12098,
5620,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb | Azure::KeyVault::V2016_10_01.KeyVaultClient.get_certificate_issuers | def get_certificate_issuers(vault_base_url, maxresults:nil, custom_headers:nil)
first_page = get_certificate_issuers_as_lazy(vault_base_url, maxresults:maxresults, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def get_certificate_issuers(vault_base_url, maxresults:nil, custom_headers:nil)
first_page = get_certificate_issuers_as_lazy(vault_base_url, maxresults:maxresults, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"get_certificate_issuers",
"(",
"vault_base_url",
",",
"maxresults",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"get_certificate_issuers_as_lazy",
"(",
"vault_base_url",
",",
"maxresults",
":",
"maxresults",
",",
"custom_headers",
":... | List certificate issuers for a specified key vault.
The GetCertificateIssuers operation returns the set of certificate issuer
resources in the specified key vault. This operation requires the
certificates/manageissuers/getissuers permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param maxresults [Integer] Maximum number of results to return in a page. If
not specified the service will return up to 25 results.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<CertificateIssuerItem>] operation results. | [
"List",
"certificate",
"issuers",
"for",
"a",
"specified",
"key",
"vault",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb#L4556-L4559 | train | Gets the certificate issuers associated with the specified key vault. | [
30522,
13366,
2131,
1035,
8196,
1035,
3277,
2869,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
4098,
6072,
11314,
2015,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2131,
1035,
8196,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/workflows.rb | Azure::Logic::Mgmt::V2016_06_01.Workflows.generate_upgraded_definition | def generate_upgraded_definition(resource_group_name, workflow_name, parameters, custom_headers:nil)
response = generate_upgraded_definition_async(resource_group_name, workflow_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def generate_upgraded_definition(resource_group_name, workflow_name, parameters, custom_headers:nil)
response = generate_upgraded_definition_async(resource_group_name, workflow_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"generate_upgraded_definition",
"(",
"resource_group_name",
",",
"workflow_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"generate_upgraded_definition_async",
"(",
"resource_group_name",
",",
"workflow_name",
",",
"parameters",
... | Generates the upgraded definition for a workflow.
@param resource_group_name [String] The resource group name.
@param workflow_name [String] The workflow name.
@param parameters [GenerateUpgradedDefinitionParameters] Parameters for
generating an upgraded definition.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Object] operation results. | [
"Generates",
"the",
"upgraded",
"definition",
"for",
"a",
"workflow",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/workflows.rb#L777-L780 | train | Generate a new definition for the specified workflow. | [
30522,
13366,
9699,
1035,
9725,
1035,
6210,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2147,
12314,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
9699,
1035,
9725,
1035,
6210,
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... |
decidim/decidim | decidim-core/lib/decidim/settings_manifest.rb | Decidim.SettingsManifest.attribute | def attribute(name, options = {})
attribute = Attribute.new(options)
attribute.validate!
@attributes[name.to_sym] = attribute
@schema = nil
end | ruby | def attribute(name, options = {})
attribute = Attribute.new(options)
attribute.validate!
@attributes[name.to_sym] = attribute
@schema = nil
end | [
"def",
"attribute",
"(",
"name",
",",
"options",
"=",
"{",
"}",
")",
"attribute",
"=",
"Attribute",
".",
"new",
"(",
"options",
")",
"attribute",
".",
"validate!",
"@attributes",
"[",
"name",
".",
"to_sym",
"]",
"=",
"attribute",
"@schema",
"=",
"nil",
... | Initializes a SettingsManifest.
Public: Adds a new attribute field to the SettingsManifest.
name - The name of the attribute to inject.
options - A set of options to configure the attribute.
:type - The type of the attribute as found in Attribute::TYPES
:default - The default value of this settings field.
Returns nothing. | [
"Initializes",
"a",
"SettingsManifest",
".",
"Public",
":",
"Adds",
"a",
"new",
"attribute",
"field",
"to",
"the",
"SettingsManifest",
"."
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/lib/decidim/settings_manifest.rb#L23-L29 | train | Create an attribute | [
30522,
13366,
17961,
1006,
2171,
1010,
7047,
1027,
1063,
1065,
1007,
17961,
1027,
17961,
1012,
2047,
1006,
7047,
1007,
17961,
1012,
9398,
3686,
999,
1030,
12332,
1031,
2171,
1012,
2000,
1035,
25353,
2213,
1033,
1027,
17961,
1030,
8040,
2843... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-iam/lib/aws-sdk-iam/user.rb | Aws::IAM.User.policies | def policies(options = {})
batches = Enumerator.new do |y|
options = options.merge(user_name: @name)
resp = @client.list_user_policies(options)
resp.each_page do |page|
batch = []
page.data.policy_names.each do |p|
batch << UserPolicy.new(
user_name: @name,
name: p,
client: @client
)
end
y.yield(batch)
end
end
UserPolicy::Collection.new(batches)
end | ruby | def policies(options = {})
batches = Enumerator.new do |y|
options = options.merge(user_name: @name)
resp = @client.list_user_policies(options)
resp.each_page do |page|
batch = []
page.data.policy_names.each do |p|
batch << UserPolicy.new(
user_name: @name,
name: p,
client: @client
)
end
y.yield(batch)
end
end
UserPolicy::Collection.new(batches)
end | [
"def",
"policies",
"(",
"options",
"=",
"{",
"}",
")",
"batches",
"=",
"Enumerator",
".",
"new",
"do",
"|",
"y",
"|",
"options",
"=",
"options",
".",
"merge",
"(",
"user_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"list_user_policies",
"(",
... | @example Request syntax with placeholder values
user.policies()
@param [Hash] options ({})
@return [UserPolicy::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/user.rb#L814-L831 | train | Get all policies for a user | [
30522,
13366,
6043,
1006,
7047,
1027,
1063,
1065,
1007,
14108,
2229,
1027,
4372,
17897,
16259,
1012,
2047,
2079,
1064,
1061,
1064,
7047,
1027,
7047,
1012,
13590,
1006,
5310,
1035,
2171,
1024,
1030,
2171,
1007,
24501,
2361,
1027,
1030,
7396,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_prebuilt_with_http_info | def delete_prebuilt_with_http_info(app_id, version_id, prebuilt_id, custom_headers:nil)
delete_prebuilt_async(app_id, version_id, prebuilt_id, custom_headers:custom_headers).value!
end | ruby | def delete_prebuilt_with_http_info(app_id, version_id, prebuilt_id, custom_headers:nil)
delete_prebuilt_async(app_id, version_id, prebuilt_id, custom_headers:custom_headers).value!
end | [
"def",
"delete_prebuilt_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"prebuilt_id",
",",
"custom_headers",
":",
"nil",
")",
"delete_prebuilt_async",
"(",
"app_id",
",",
"version_id",
",",
"prebuilt_id",
",",
"custom_headers",
":custom_headers",
")",
".",
... | Deletes a prebuilt entity extractor from a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param prebuilt_id The prebuilt 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",
"a",
"prebuilt",
"entity",
"extractor",
"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#L3557-L3559 | train | Deletes the prebuilt product. | [
30522,
13366,
3972,
12870,
1035,
30524,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
3653,
8569,
4014,
2102,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
20346,
2015,
1007,
1012,
3643,
999,
2203,
102,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
chef/chef-zero | lib/chef_zero/rest_base.rb | ChefZero.RestBase.already_json_response | def already_json_response(response_code, json_text, options = {})
version_header = FFI_Yajl::Encoder.encode(
"min_version" => MIN_API_VERSION.to_s,
"max_version" => MAX_API_VERSION.to_s,
"request_version" => options[:request_version] || DEFAULT_REQUEST_VERSION.to_s,
"response_version" => options[:response_version] || DEFAULT_RESPONSE_VERSION.to_s
)
headers = {
"Content-Type" => "application/json",
"X-Ops-Server-API-Version" => version_header,
}
headers.merge!(options[:headers]) if options[:headers]
[ response_code, headers, json_text ]
end | ruby | def already_json_response(response_code, json_text, options = {})
version_header = FFI_Yajl::Encoder.encode(
"min_version" => MIN_API_VERSION.to_s,
"max_version" => MAX_API_VERSION.to_s,
"request_version" => options[:request_version] || DEFAULT_REQUEST_VERSION.to_s,
"response_version" => options[:response_version] || DEFAULT_RESPONSE_VERSION.to_s
)
headers = {
"Content-Type" => "application/json",
"X-Ops-Server-API-Version" => version_header,
}
headers.merge!(options[:headers]) if options[:headers]
[ response_code, headers, json_text ]
end | [
"def",
"already_json_response",
"(",
"response_code",
",",
"json_text",
",",
"options",
"=",
"{",
"}",
")",
"version_header",
"=",
"FFI_Yajl",
"::",
"Encoder",
".",
"encode",
"(",
"\"min_version\"",
"=>",
"MIN_API_VERSION",
".",
"to_s",
",",
"\"max_version\"",
"... | Returns an Array with the response code, HTTP headers, and JSON body.
@param [Fixnum] response_code The HTTP response code
@param [String] json_text The JSON body for the response
@param [Hash] options
@option options [Hash] :headers ({}) HTTP headers (may override default headers)
@option options [Fixnum] :request_version (0) Request API version
@option options [Fixnum] :response_version (0) Response API version
@return [Array(Fixnum, Hash{String => String}, String)] | [
"Returns",
"an",
"Array",
"with",
"the",
"response",
"code",
"HTTP",
"headers",
"and",
"JSON",
"body",
"."
] | 5873d906942770a34f0cf0fed05973ec3240a275 | https://github.com/chef/chef-zero/blob/5873d906942770a34f0cf0fed05973ec3240a275/lib/chef_zero/rest_base.rb#L255-L270 | train | Returns a JSON response object | [
30522,
13366,
2525,
1035,
1046,
3385,
1035,
3433,
1006,
3433,
1035,
3642,
1010,
1046,
3385,
1035,
3793,
1010,
7047,
1027,
1063,
1065,
1007,
2544,
1035,
20346,
1027,
21461,
2072,
1035,
8038,
3501,
2140,
1024,
1024,
30524,
1035,
17928,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb | Azure::Web::Mgmt::V2018_02_01.AppServiceEnvironments.list_multi_role_pool_skus_next | def list_multi_role_pool_skus_next(next_page_link, custom_headers:nil)
response = list_multi_role_pool_skus_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_multi_role_pool_skus_next(next_page_link, custom_headers:nil)
response = list_multi_role_pool_skus_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_multi_role_pool_skus_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_multi_role_pool_skus_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
... | Get available SKUs for scaling a multi-role pool.
Get available SKUs for scaling a multi-role pool.
@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 [SkuInfoCollection] operation results. | [
"Get",
"available",
"SKUs",
"for",
"scaling",
"a",
"multi",
"-",
"role",
"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#L5902-L5905 | train | Gets the list of skus of the managed managed. | [
30522,
13366,
2862,
1035,
4800,
1035,
2535,
1035,
4770,
1035,
15315,
2271,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
4800,
1035,
2535,
1035,
4770,
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_operational_insights/lib/2015-03-20/generated/azure_mgmt_operational_insights/storage_insights.rb | Azure::OperationalInsights::Mgmt::V2015_03_20.StorageInsights.delete_with_http_info | def delete_with_http_info(resource_group_name, workspace_name, storage_insight_name, custom_headers:nil)
delete_async(resource_group_name, workspace_name, storage_insight_name, custom_headers:custom_headers).value!
end | ruby | def delete_with_http_info(resource_group_name, workspace_name, storage_insight_name, custom_headers:nil)
delete_async(resource_group_name, workspace_name, storage_insight_name, custom_headers:custom_headers).value!
end | [
"def",
"delete_with_http_info",
"(",
"resource_group_name",
",",
"workspace_name",
",",
"storage_insight_name",
",",
"custom_headers",
":",
"nil",
")",
"delete_async",
"(",
"resource_group_name",
",",
"workspace_name",
",",
"storage_insight_name",
",",
"custom_headers",
"... | Deletes a storageInsightsConfigs resource
@param resource_group_name [String] The name of the resource group to get.
The name is case insensitive.
@param workspace_name [String] Log Analytics Workspace name that contains the
storageInsightsConfigs resource
@param storage_insight_name [String] Name of the storageInsightsConfigs
resource
@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",
"a",
"storageInsightsConfigs",
"resource"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_operational_insights/lib/2015-03-20/generated/azure_mgmt_operational_insights/storage_insights.rb#L296-L298 | train | Deletes a container in the specified workspace. | [
30522,
13366,
3972,
12870,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2573,
15327,
1035,
2171,
1010,
5527,
1035,
12369,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3972,
12870,
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_sql/lib/2017-10-01-preview/generated/azure_mgmt_sql/managed_database_vulnerability_assessment_scans.rb | Azure::SQL::Mgmt::V2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentScans.initiate_scan | def initiate_scan(resource_group_name, managed_instance_name, database_name, scan_id, custom_headers:nil)
response = initiate_scan_async(resource_group_name, managed_instance_name, database_name, scan_id, custom_headers:custom_headers).value!
nil
end | ruby | def initiate_scan(resource_group_name, managed_instance_name, database_name, scan_id, custom_headers:nil)
response = initiate_scan_async(resource_group_name, managed_instance_name, database_name, scan_id, custom_headers:custom_headers).value!
nil
end | [
"def",
"initiate_scan",
"(",
"resource_group_name",
",",
"managed_instance_name",
",",
"database_name",
",",
"scan_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"initiate_scan_async",
"(",
"resource_group_name",
",",
"managed_instance_name",
",",
"databa... | Executes a Vulnerability Assessment database scan.
@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 managed_instance_name [String] The name of the managed instance.
@param database_name [String] The name of the database.
@param scan_id [String] The vulnerability assessment scan Id of the scan to
retrieve.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Executes",
"a",
"Vulnerability",
"Assessment",
"database",
"scan",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2017-10-01-preview/generated/azure_mgmt_sql/managed_database_vulnerability_assessment_scans.rb#L253-L256 | train | Initializes a scan for a managed database. | [
30522,
13366,
17820,
1035,
13594,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3266,
1035,
6013,
1035,
2171,
1010,
7809,
1035,
2171,
1010,
13594,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
17820,
1035,
13594... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
troessner/reek | samples/smelly_source/inline.rb | Inline.C.c_singleton | def c_singleton src, options = {}
options = {
:expand_types => true,
:singleton => true,
}.merge options
self.generate src, options
end | ruby | def c_singleton src, options = {}
options = {
:expand_types => true,
:singleton => true,
}.merge options
self.generate src, options
end | [
"def",
"c_singleton",
"src",
",",
"options",
"=",
"{",
"}",
"options",
"=",
"{",
":expand_types",
"=>",
"true",
",",
":singleton",
"=>",
"true",
",",
"}",
".",
"merge",
"options",
"self",
".",
"generate",
"src",
",",
"options",
"end"
] | Same as +c+, but adds a class function. | [
"Same",
"as",
"+",
"c",
"+",
"but",
"adds",
"a",
"class",
"function",
"."
] | 8c6b5c0c6228a6981ab48543457889f9ea984054 | https://github.com/troessner/reek/blob/8c6b5c0c6228a6981ab48543457889f9ea984054/samples/smelly_source/inline.rb#L585-L591 | train | Generate a singleton file | [
30522,
13366,
1039,
1035,
28159,
5034,
2278,
1010,
7047,
1027,
1063,
1065,
7047,
1027,
1063,
1024,
7818,
1035,
4127,
1027,
1028,
2995,
1010,
1024,
28159,
1027,
1028,
2995,
1010,
1065,
1012,
13590,
7047,
2969,
1012,
9699,
5034,
2278,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mojombo/chronic | lib/chronic/handlers.rb | Chronic.Handlers.handle_p_s_r | def handle_p_s_r(tokens, options)
new_tokens = [tokens[1], tokens[2], tokens[0]]
handle_s_r_p(new_tokens, options)
end | ruby | def handle_p_s_r(tokens, options)
new_tokens = [tokens[1], tokens[2], tokens[0]]
handle_s_r_p(new_tokens, options)
end | [
"def",
"handle_p_s_r",
"(",
"tokens",
",",
"options",
")",
"new_tokens",
"=",
"[",
"tokens",
"[",
"1",
"]",
",",
"tokens",
"[",
"2",
"]",
",",
"tokens",
"[",
"0",
"]",
"]",
"handle_s_r_p",
"(",
"new_tokens",
",",
"options",
")",
"end"
] | Handle pointer/scalar/repeater | [
"Handle",
"pointer",
"/",
"scalar",
"/",
"repeater"
] | 2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c | https://github.com/mojombo/chronic/blob/2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c/lib/chronic/handlers.rb#L462-L465 | train | Handle the p s r tokens | [
30522,
13366,
5047,
1035,
1052,
1035,
1055,
1035,
1054,
1006,
19204,
2015,
1010,
7047,
1007,
2047,
1035,
19204,
2015,
1027,
1031,
19204,
2015,
1031,
1015,
1033,
1010,
19204,
2015,
1031,
1016,
1033,
1010,
19204,
2015,
1031,
1014,
1033,
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... |
sumoheavy/jira-ruby | lib/jira/base.rb | JIRA.Base.save! | def save!(attrs, path = nil)
path ||= new_record? ? url : patched_url
http_method = new_record? ? :post : :put
response = client.send(http_method, path, attrs.to_json)
set_attrs(attrs, false)
set_attrs_from_response(response)
@expanded = false
true
end | ruby | def save!(attrs, path = nil)
path ||= new_record? ? url : patched_url
http_method = new_record? ? :post : :put
response = client.send(http_method, path, attrs.to_json)
set_attrs(attrs, false)
set_attrs_from_response(response)
@expanded = false
true
end | [
"def",
"save!",
"(",
"attrs",
",",
"path",
"=",
"nil",
")",
"path",
"||=",
"new_record?",
"?",
"url",
":",
"patched_url",
"http_method",
"=",
"new_record?",
"?",
":post",
":",
":put",
"response",
"=",
"client",
".",
"send",
"(",
"http_method",
",",
"path... | Saves the specified resource attributes by sending either a POST or PUT
request to JIRA, depending on resource.new_record?
Accepts an attributes hash of the values to be saved. Will throw a
JIRA::HTTPError if the request fails (response is not HTTP 2xx). | [
"Saves",
"the",
"specified",
"resource",
"attributes",
"by",
"sending",
"either",
"a",
"POST",
"or",
"PUT",
"request",
"to",
"JIRA",
"depending",
"on",
"resource",
".",
"new_record?"
] | 25e896f227ab81c528e9678708cb546d2f62f018 | https://github.com/sumoheavy/jira-ruby/blob/25e896f227ab81c528e9678708cb546d2f62f018/lib/jira/base.rb#L344-L352 | train | Save the attributes to the database. | [
30522,
13366,
3828,
999,
1006,
2012,
16344,
2015,
1010,
4130,
1027,
9152,
2140,
1007,
4130,
1064,
1064,
1027,
2047,
1035,
2501,
1029,
1029,
24471,
2140,
1024,
8983,
2098,
1035,
24471,
2140,
8299,
1035,
4118,
1027,
2047,
1035,
2501,
1029,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb | Azure::Compute::Mgmt::V2016_04_30_preview.VirtualMachineScaleSets.list_skus | def list_skus(resource_group_name, vm_scale_set_name, custom_headers:nil)
first_page = list_skus_as_lazy(resource_group_name, vm_scale_set_name, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_skus(resource_group_name, vm_scale_set_name, custom_headers:nil)
first_page = list_skus_as_lazy(resource_group_name, vm_scale_set_name, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_skus",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_skus_as_lazy",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"custom_headers",
":custom_headers",
")",
"first_page",
"... | Gets a list of SKUs available for your VM scale set, including the minimum
and maximum VM instances allowed for each SKU.
@param resource_group_name [String] The name of the resource group.
@param vm_scale_set_name [String] The name of the VM scale set.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<VirtualMachineScaleSetSku>] operation results. | [
"Gets",
"a",
"list",
"of",
"SKUs",
"available",
"for",
"your",
"VM",
"scale",
"set",
"including",
"the",
"minimum",
"and",
"maximum",
"VM",
"instances",
"allowed",
"for",
"each",
"SKU",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb#L580-L583 | train | Gets the skus of a virtual machine in a VM scale set. | [
30522,
13366,
2862,
1035,
15315,
2271,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
4094,
1035,
2275,
1035,
2171,
30524,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
20346,
2015,
1007,
2034,
1035,
3931,
1012,
2131,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
excon/excon | lib/excon/utils.rb | Excon.Utils.redact | def redact(datum)
datum = datum.dup
if datum.has_key?(:headers) && datum[:headers].has_key?('Authorization')
datum[:headers] = datum[:headers].dup
datum[:headers]['Authorization'] = REDACTED
end
if datum.has_key?(:password)
datum[:password] = REDACTED
end
datum
end | ruby | def redact(datum)
datum = datum.dup
if datum.has_key?(:headers) && datum[:headers].has_key?('Authorization')
datum[:headers] = datum[:headers].dup
datum[:headers]['Authorization'] = REDACTED
end
if datum.has_key?(:password)
datum[:password] = REDACTED
end
datum
end | [
"def",
"redact",
"(",
"datum",
")",
"datum",
"=",
"datum",
".",
"dup",
"if",
"datum",
".",
"has_key?",
"(",
":headers",
")",
"&&",
"datum",
"[",
":headers",
"]",
".",
"has_key?",
"(",
"'Authorization'",
")",
"datum",
"[",
":headers",
"]",
"=",
"datum",... | Redact sensitive info from provided data | [
"Redact",
"sensitive",
"info",
"from",
"provided",
"data"
] | d4975a8a5b49d5901a769b289fb5054a6d064f6d | https://github.com/excon/excon/blob/d4975a8a5b49d5901a769b289fb5054a6d064f6d/lib/excon/utils.rb#L31-L41 | train | Redact the given data object | [
30522,
13366,
2417,
18908,
1006,
23755,
2819,
1007,
23755,
2819,
1027,
23755,
2819,
1012,
4241,
2361,
2065,
23755,
2819,
1012,
2038,
1035,
3145,
1029,
1006,
1024,
20346,
2015,
1007,
1004,
1004,
23755,
2819,
1031,
1024,
20346,
2015,
1033,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
pythonicrubyist/creek | lib/creek/drawing.rb | Creek.Creek::Drawing.images_at | def images_at(cell_name)
coordinate = calc_coordinate(cell_name)
pathnames_at_coordinate = @images_pathnames[coordinate]
return if pathnames_at_coordinate.empty?
pathnames_at_coordinate.map do |image_pathname|
if image_pathname.exist?
image_pathname
else
excel_image_path = "xl/media#{image_pathname.to_path.split(tmpdir).last}"
IO.copy_stream(@book.files.file.open(excel_image_path), image_pathname.to_path)
image_pathname
end
end
end | ruby | def images_at(cell_name)
coordinate = calc_coordinate(cell_name)
pathnames_at_coordinate = @images_pathnames[coordinate]
return if pathnames_at_coordinate.empty?
pathnames_at_coordinate.map do |image_pathname|
if image_pathname.exist?
image_pathname
else
excel_image_path = "xl/media#{image_pathname.to_path.split(tmpdir).last}"
IO.copy_stream(@book.files.file.open(excel_image_path), image_pathname.to_path)
image_pathname
end
end
end | [
"def",
"images_at",
"(",
"cell_name",
")",
"coordinate",
"=",
"calc_coordinate",
"(",
"cell_name",
")",
"pathnames_at_coordinate",
"=",
"@images_pathnames",
"[",
"coordinate",
"]",
"return",
"if",
"pathnames_at_coordinate",
".",
"empty?",
"pathnames_at_coordinate",
".",... | Extracts images from excel to tmpdir for a cell, if the images are not already extracted (multiple calls or same image file in multiple cells).
Returns array of images as Pathname objects or nil. | [
"Extracts",
"images",
"from",
"excel",
"to",
"tmpdir",
"for",
"a",
"cell",
"if",
"the",
"images",
"are",
"not",
"already",
"extracted",
"(",
"multiple",
"calls",
"or",
"same",
"image",
"file",
"in",
"multiple",
"cells",
")",
".",
"Returns",
"array",
"of",
... | 1a5c99032ee736e8f24ebd524adffba068d236b4 | https://github.com/pythonicrubyist/creek/blob/1a5c99032ee736e8f24ebd524adffba068d236b4/lib/creek/drawing.rb#L31-L45 | train | Get the images at the given cell name | [
30522,
13366,
4871,
1035,
2012,
1006,
3526,
1035,
2171,
1007,
13530,
1027,
10250,
2278,
1035,
13530,
1006,
3526,
1035,
2171,
1007,
4130,
18442,
2015,
1035,
2012,
1035,
13530,
1027,
1030,
4871,
1035,
4130,
18442,
2015,
1031,
13530,
1033,
270... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_redis/lib/2017-02-01/generated/azure_mgmt_redis/redis.rb | Azure::Redis::Mgmt::V2017_02_01.Redis.regenerate_key_with_http_info | def regenerate_key_with_http_info(resource_group_name, name, parameters, custom_headers:nil)
regenerate_key_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
end | ruby | def regenerate_key_with_http_info(resource_group_name, name, parameters, custom_headers:nil)
regenerate_key_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"regenerate_key_with_http_info",
"(",
"resource_group_name",
",",
"name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"regenerate_key_async",
"(",
"resource_group_name",
",",
"name",
",",
"parameters",
",",
"custom_headers",
":custom_headers",
")",... | Regenerate Redis cache's access keys. This operation requires write
permission to the cache resource.
@param resource_group_name [String] The name of the resource group.
@param name [String] The name of the Redis cache.
@param parameters [RedisRegenerateKeyParameters] Specifies which key to
regenerate.
@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. | [
"Regenerate",
"Redis",
"cache",
"s",
"access",
"keys",
".",
"This",
"operation",
"requires",
"write",
"permission",
"to",
"the",
"cache",
"resource",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_redis/lib/2017-02-01/generated/azure_mgmt_redis/redis.rb#L605-L607 | train | Regenerate a key for a given resource group. | [
30522,
13366,
19723,
24454,
3686,
1035,
3145,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
19723,
24454,
3686,
1035,
3145,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_redis/lib/2017-02-01/generated/azure_mgmt_redis/redis.rb | Azure::Redis::Mgmt::V2017_02_01.Redis.begin_export_data | def begin_export_data(resource_group_name, name, parameters, custom_headers:nil)
response = begin_export_data_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
nil
end | ruby | def begin_export_data(resource_group_name, name, parameters, custom_headers:nil)
response = begin_export_data_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_export_data",
"(",
"resource_group_name",
",",
"name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_export_data_async",
"(",
"resource_group_name",
",",
"name",
",",
"parameters",
",",
"custom_headers",
":custom_head... | Export data from the redis cache to blobs in a container.
@param resource_group_name [String] The name of the resource group.
@param name [String] The name of the Redis cache.
@param parameters [ExportRDBParameters] Parameters for Redis export
operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Export",
"data",
"from",
"the",
"redis",
"cache",
"to",
"blobs",
"in",
"a",
"container",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_redis/lib/2017-02-01/generated/azure_mgmt_redis/redis.rb#L1182-L1185 | train | Export a collection of data structures to a given CDN. | [
30522,
13366,
4088,
1035,
9167,
1035,
2951,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
9167,
1035,
2951,
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... |
meew0/discordrb | lib/discordrb/data/server.rb | Discordrb.Server.add_member_using_token | def add_member_using_token(user, access_token, nick: nil, roles: [], deaf: false, mute: false)
user_id = user.resolve_id
roles = roles.is_a?(Array) ? roles.map(&:resolve_id) : [roles.resolve_id]
response = JSON.parse(API::Server.add_member(@bot.token, @id, user_id, access_token, nick, roles, deaf, mute))
add_member Member.new(response, self, @bot)
end | ruby | def add_member_using_token(user, access_token, nick: nil, roles: [], deaf: false, mute: false)
user_id = user.resolve_id
roles = roles.is_a?(Array) ? roles.map(&:resolve_id) : [roles.resolve_id]
response = JSON.parse(API::Server.add_member(@bot.token, @id, user_id, access_token, nick, roles, deaf, mute))
add_member Member.new(response, self, @bot)
end | [
"def",
"add_member_using_token",
"(",
"user",
",",
"access_token",
",",
"nick",
":",
"nil",
",",
"roles",
":",
"[",
"]",
",",
"deaf",
":",
"false",
",",
"mute",
":",
"false",
")",
"user_id",
"=",
"user",
".",
"resolve_id",
"roles",
"=",
"roles",
".",
... | Adds a member to this guild that has granted this bot's application an OAuth2 access token
with the `guilds.join` scope.
For more information about Discord's OAuth2 implementation, see: https://discordapp.com/developers/docs/topics/oauth2
@note Your bot must be present in this server, and have permission to create instant invites for this to work.
@param user [Integer, User, #resolve_id] the user, or ID of the user to add to this server
@param access_token [String] the OAuth2 Bearer token that has been granted the `guilds.join` scope
@param nick [String] the nickname to give this member upon joining
@param roles [Role, Array<Integer, Role, #resolve_id>] the role (or roles) to give this member upon joining
@param deaf [true, false] whether this member will be server deafened upon joining
@param mute [true, false] whether this member will be server muted upon joining
@return [Member] the created member | [
"Adds",
"a",
"member",
"to",
"this",
"guild",
"that",
"has",
"granted",
"this",
"bot",
"s",
"application",
"an",
"OAuth2",
"access",
"token",
"with",
"the",
"guilds",
".",
"join",
"scope",
".",
"For",
"more",
"information",
"about",
"Discord",
"s",
"OAuth2... | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/data/server.rb#L265-L270 | train | Add a member using a token | [
30522,
13366,
5587,
1035,
2266,
1035,
2478,
1035,
19204,
1006,
5310,
1010,
3229,
1035,
19204,
1010,
4172,
1024,
9152,
2140,
1010,
4395,
1024,
1031,
1033,
1010,
12419,
1024,
6270,
1010,
20101,
1024,
6270,
1007,
5310,
1035,
8909,
1027,
5310,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
puppetlabs/bolt | lib/plan_executor/orch_client.rb | PlanExecutor.OrchClient.unwrap_bolt_result | def unwrap_bolt_result(target, result)
if result.error_hash
# something went wrong return the failure
return result
end
Bolt::Result.for_command(target, result.value['stdout'], result.value['stderr'], result.value['exit_code'])
end | ruby | def unwrap_bolt_result(target, result)
if result.error_hash
# something went wrong return the failure
return result
end
Bolt::Result.for_command(target, result.value['stdout'], result.value['stderr'], result.value['exit_code'])
end | [
"def",
"unwrap_bolt_result",
"(",
"target",
",",
"result",
")",
"if",
"result",
".",
"error_hash",
"# something went wrong return the failure",
"return",
"result",
"end",
"Bolt",
"::",
"Result",
".",
"for_command",
"(",
"target",
",",
"result",
".",
"value",
"[",
... | run_task generates a result that makes sense for a generic task which
needs to be unwrapped to extract stdout/stderr/exitcode. | [
"run_task",
"generates",
"a",
"result",
"that",
"makes",
"sense",
"for",
"a",
"generic",
"task",
"which",
"needs",
"to",
"be",
"unwrapped",
"to",
"extract",
"stdout",
"/",
"stderr",
"/",
"exitcode",
"."
] | 50689a33699939d262ea7c822a4b24fd8c4f8d8a | https://github.com/puppetlabs/bolt/blob/50689a33699939d262ea7c822a4b24fd8c4f8d8a/lib/plan_executor/orch_client.rb#L227-L234 | train | Unwrap the result of a Bolt command | [
30522,
13366,
4895,
13088,
9331,
1035,
10053,
1035,
2765,
1006,
4539,
1010,
2765,
1007,
2065,
2765,
1012,
30524,
2765,
1012,
3643,
1031,
1005,
2358,
26797,
2102,
1005,
1033,
1010,
2765,
1012,
3643,
1031,
1005,
2358,
4063,
2099,
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.delete_explicit_list_item | def delete_explicit_list_item(app_id, version_id, entity_id, item_id, custom_headers:nil)
response = delete_explicit_list_item_async(app_id, version_id, entity_id, item_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def delete_explicit_list_item(app_id, version_id, entity_id, item_id, custom_headers:nil)
response = delete_explicit_list_item_async(app_id, version_id, entity_id, item_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"delete_explicit_list_item",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"item_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_explicit_list_item_async",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"item_id",
... | Delete an item from the explicit (exception) list for a Pattern.any entity in
a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param entity_id The pattern.any entity id.
@param item_id [Integer] The explicit list item which will be deleted.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OperationStatus] operation results. | [
"Delete",
"an",
"item",
"from",
"the",
"explicit",
"(",
"exception",
")",
"list",
"for",
"a",
"Pattern",
".",
"any",
"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#L11494-L11497 | train | Deletes an explicit list item. | [
30522,
13366,
3972,
12870,
1035,
13216,
1035,
2862,
1035,
8875,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
9178,
1035,
8909,
1010,
8875,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
samvera/hyrax | app/controllers/hyrax/admin/admin_sets_controller.rb | Hyrax.Admin::AdminSetsController.files | def files
result = form.select_files.map { |label, id| { id: id, text: label } }
render json: result
end | ruby | def files
result = form.select_files.map { |label, id| { id: id, text: label } }
render json: result
end | [
"def",
"files",
"result",
"=",
"form",
".",
"select_files",
".",
"map",
"{",
"|",
"label",
",",
"id",
"|",
"{",
"id",
":",
"id",
",",
"text",
":",
"label",
"}",
"}",
"render",
"json",
":",
"result",
"end"
] | Renders a JSON response with a list of files in this admin set.
This is used by the edit form to populate the thumbnail_id dropdown | [
"Renders",
"a",
"JSON",
"response",
"with",
"a",
"list",
"of",
"files",
"in",
"this",
"admin",
"set",
".",
"This",
"is",
"used",
"by",
"the",
"edit",
"form",
"to",
"populate",
"the",
"thumbnail_id",
"dropdown"
] | e2b4f56e829a53b1f11296324736e9d5b8c9ee5f | https://github.com/samvera/hyrax/blob/e2b4f56e829a53b1f11296324736e9d5b8c9ee5f/app/controllers/hyrax/admin/admin_sets_controller.rb#L61-L64 | train | Returns the list of files that are selected in the form | [
30522,
13366,
6764,
2765,
1027,
2433,
1012,
7276,
1035,
6764,
1012,
4949,
1063,
1064,
3830,
1010,
8909,
1064,
1063,
8909,
1024,
8909,
1010,
3793,
1024,
3830,
1065,
1065,
17552,
1046,
3385,
1024,
2765,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.report_node_health_with_http_info | def report_node_health_with_http_info(node_name, health_information, immediate:false, timeout:60, custom_headers:nil)
report_node_health_async(node_name, health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def report_node_health_with_http_info(node_name, health_information, immediate:false, timeout:60, custom_headers:nil)
report_node_health_async(node_name, health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"report_node_health_with_http_info",
"(",
"node_name",
",",
"health_information",
",",
"immediate",
":",
"false",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"report_node_health_async",
"(",
"node_name",
",",
"health_information",
",",
... | Sends a health report on the Service Fabric node.
Reports health state of the specified Service Fabric node. The report must
contain the information about the source of the health report and property on
which it is reported.
The report is sent to a Service Fabric gateway node, which forwards to the
health store.
The report may be accepted by the gateway, but rejected by the health store
after extra validation.
For example, the health store may reject the report because of an invalid
parameter, like a stale sequence number.
To see whether the report was applied in the health store, run GetNodeHealth
and check that the report appears in the HealthEvents section.
@param node_name [String] The name of the node.
@param health_information [HealthInformation] Describes the health
information for the health report. This information needs to be present in
all of the health reports sent to the health manager.
@param immediate [Boolean] A flag which indicates whether the report should
be sent immediately.
A health report is sent to a Service Fabric gateway Application, which
forwards to the health store.
If Immediate is set to true, the report is sent immediately from HTTP Gateway
to the health store, regardless of the fabric client settings that the HTTP
Gateway Application is using.
This is useful for critical reports that should be sent as soon as possible.
Depending on timing and other conditions, sending the report may still fail,
for example if the HTTP Gateway is closed or the message doesn't reach the
Gateway.
If Immediate is set to false, the report is sent based on the health client
settings from the HTTP Gateway. Therefore, it will be batched according to
the HealthReportSendInterval configuration.
This is the recommended setting because it allows the health client to
optimize health reporting messages to health store as well as health report
processing.
By default, reports are not sent immediately.
@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. | [
"Sends",
"a",
"health",
"report",
"on",
"the",
"Service",
"Fabric",
"node",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L3938-L3940 | train | Report node health. | [
30522,
13366,
3189,
1035,
13045,
1035,
2740,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
13045,
1035,
2171,
1010,
2740,
1035,
2592,
1010,
6234,
1024,
6270,
1010,
2051,
5833,
1024,
3438,
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... |
rmosolgo/graphql-ruby | lib/graphql/schema.rb | GraphQL.Schema.multiplex | def multiplex(queries, **kwargs)
with_definition_error_check {
GraphQL::Execution::Multiplex.run_all(self, queries, **kwargs)
}
end | ruby | def multiplex(queries, **kwargs)
with_definition_error_check {
GraphQL::Execution::Multiplex.run_all(self, queries, **kwargs)
}
end | [
"def",
"multiplex",
"(",
"queries",
",",
"**",
"kwargs",
")",
"with_definition_error_check",
"{",
"GraphQL",
"::",
"Execution",
"::",
"Multiplex",
".",
"run_all",
"(",
"self",
",",
"queries",
",",
"**",
"kwargs",
")",
"}",
"end"
] | Execute several queries on itself. Raises an error if the schema definition is invalid.
@example Run several queries at once
context = { ... }
queries = [
{ query: params[:query_1], variables: params[:variables_1], context: context },
{ query: params[:query_2], variables: params[:variables_2], context: context },
]
results = MySchema.multiplex(queries)
render json: {
result_1: results[0],
result_2: results[1],
}
@see {Query#initialize} for query keyword arguments
@see {Execution::Multiplex#run_queries} for multiplex keyword arguments
@param queries [Array<Hash>] Keyword arguments for each query
@param context [Hash] Multiplex-level context
@return [Array<Hash>] One result for each query in the input | [
"Execute",
"several",
"queries",
"on",
"itself",
".",
"Raises",
"an",
"error",
"if",
"the",
"schema",
"definition",
"is",
"invalid",
".",
"@example",
"Run",
"several",
"queries",
"at",
"once",
"context",
"=",
"{",
"...",
"}",
"queries",
"=",
"[",
"{",
"q... | d5be13a816f220b9efbabeaa69a3e56fedf311f5 | https://github.com/rmosolgo/graphql-ruby/blob/d5be13a816f220b9efbabeaa69a3e56fedf311f5/lib/graphql/schema.rb#L374-L378 | train | Runs multiple queries in a single thread. | [
30522,
13366,
3674,
2595,
1006,
10861,
5134,
1010,
1008,
1008,
6448,
2906,
5620,
1007,
2007,
1035,
6210,
1035,
7561,
1035,
4638,
1063,
10629,
4160,
2140,
1024,
1024,
7781,
1024,
1024,
3674,
2595,
1012,
2448,
1035,
2035,
1006,
2969,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
plaid/plaid-ruby | lib/plaid/products/accounts.rb | Plaid.Balance.get | def get(access_token, account_ids: nil, options: nil)
post_with_auth 'accounts/balance/get',
AccountsResponse,
build_payload(access_token,
account_ids: account_ids,
options: options)
end | ruby | def get(access_token, account_ids: nil, options: nil)
post_with_auth 'accounts/balance/get',
AccountsResponse,
build_payload(access_token,
account_ids: account_ids,
options: options)
end | [
"def",
"get",
"(",
"access_token",
",",
"account_ids",
":",
"nil",
",",
"options",
":",
"nil",
")",
"post_with_auth",
"'accounts/balance/get'",
",",
"AccountsResponse",
",",
"build_payload",
"(",
"access_token",
",",
"account_ids",
":",
"account_ids",
",",
"option... | Public: Get information about all available balances.
Does a POST /accounts/balance/get call to get real-time balance
information for all accounts associated with the access_token's item.
access_token - The String access_token for the item to fetch balances
for.
account_ids - The Array with specific account IDs to fetch balances for
(optional).
options - Additional options to be merged into the request
(optional).
Returns the AccountsResponse object with accounts information. | [
"Public",
":",
"Get",
"information",
"about",
"all",
"available",
"balances",
"."
] | ce3da1c5559c739de88c5f59e54eef875f296673 | https://github.com/plaid/plaid-ruby/blob/ce3da1c5559c739de88c5f59e54eef875f296673/lib/plaid/products/accounts.rb#L17-L23 | train | Get balance information | [
30522,
13366,
2131,
1006,
3229,
1035,
19204,
1010,
4070,
1035,
8909,
2015,
1024,
9152,
2140,
1010,
7047,
1024,
9152,
2140,
30524,
6072,
26029,
3366,
1010,
3857,
1035,
18093,
1006,
3229,
1035,
19204,
1010,
4070,
1035,
8909,
2015,
1024,
4070,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/nat_gateways.rb | Azure::Network::Mgmt::V2019_02_01.NatGateways.update_tags_with_http_info | def update_tags_with_http_info(resource_group_name, nat_gateway_name, parameters, custom_headers:nil)
update_tags_async(resource_group_name, nat_gateway_name, parameters, custom_headers:custom_headers).value!
end | ruby | def update_tags_with_http_info(resource_group_name, nat_gateway_name, parameters, custom_headers:nil)
update_tags_async(resource_group_name, nat_gateway_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"update_tags_with_http_info",
"(",
"resource_group_name",
",",
"nat_gateway_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"update_tags_async",
"(",
"resource_group_name",
",",
"nat_gateway_name",
",",
"parameters",
",",
"custom_headers",
":custo... | Updates nat gateway tags.
@param resource_group_name [String] The name of the resource group.
@param nat_gateway_name [String] The name of the nat gateway.
@param parameters [TagsObject] Parameters supplied to update nat gateway
tags.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Updates",
"nat",
"gateway",
"tags",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/nat_gateways.rb#L232-L234 | train | Updates a nat gateway s tags. | [
30522,
13366,
10651,
1035,
22073,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
14085,
1035,
11909,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
10651,
1035,
22073,
1035,
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... |
jekyll/jekyll | lib/jekyll/filters.rb | Jekyll.Filters.parse_binary_comparison | def parse_binary_comparison(parser)
parse_comparison(parser).tap do |condition|
binary_operator = parser.id?("and") || parser.id?("or")
condition.send(binary_operator, parse_comparison(parser)) if binary_operator
end
end | ruby | def parse_binary_comparison(parser)
parse_comparison(parser).tap do |condition|
binary_operator = parser.id?("and") || parser.id?("or")
condition.send(binary_operator, parse_comparison(parser)) if binary_operator
end
end | [
"def",
"parse_binary_comparison",
"(",
"parser",
")",
"parse_comparison",
"(",
"parser",
")",
".",
"tap",
"do",
"|",
"condition",
"|",
"binary_operator",
"=",
"parser",
".",
"id?",
"(",
"\"and\"",
")",
"||",
"parser",
".",
"id?",
"(",
"\"or\"",
")",
"condi... | Generate a Liquid::Condition object from a Liquid::Parser object additionally processing
the parsed expression based on whether the expression consists of binary operations with
Liquid operators `and` or `or`
- parser: an instance of Liquid::Parser
Returns an instance of Liquid::Condition | [
"Generate",
"a",
"Liquid",
"::",
"Condition",
"object",
"from",
"a",
"Liquid",
"::",
"Parser",
"object",
"additionally",
"processing",
"the",
"parsed",
"expression",
"based",
"on",
"whether",
"the",
"expression",
"consists",
"of",
"binary",
"operations",
"with",
... | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/filters.rb#L409-L414 | train | Parse binary comparison | [
30522,
13366,
11968,
3366,
1035,
12441,
1035,
7831,
1006,
11968,
8043,
1007,
11968,
3366,
1035,
7831,
1006,
11968,
8043,
1007,
1012,
11112,
2079,
1064,
4650,
1064,
12441,
1035,
6872,
1027,
11968,
8043,
1012,
8909,
1029,
1006,
1000,
1998,
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_automation/lib/2015-10-31/generated/azure_mgmt_automation/object_data_types.rb | Azure::Automation::Mgmt::V2015_10_31.ObjectDataTypes.list_fields_by_type | def list_fields_by_type(resource_group_name, automation_account_name, type_name, custom_headers:nil)
response = list_fields_by_type_async(resource_group_name, automation_account_name, type_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_fields_by_type(resource_group_name, automation_account_name, type_name, custom_headers:nil)
response = list_fields_by_type_async(resource_group_name, automation_account_name, type_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_fields_by_type",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"type_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_fields_by_type_async",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"type_name",
... | Retrieve a list of fields of a given type across all accessible modules.
@param resource_group_name [String] Name of an Azure Resource group.
@param automation_account_name [String] The name of the automation account.
@param type_name [String] The name of type.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [TypeFieldListResult] operation results. | [
"Retrieve",
"a",
"list",
"of",
"fields",
"of",
"a",
"given",
"type",
"across",
"all",
"accessible",
"modules",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/object_data_types.rb#L138-L141 | train | Gets the list of fields of a given type. | [
30522,
13366,
2862,
1035,
4249,
1035,
2011,
1035,
2828,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
19309,
1035,
4070,
1035,
2171,
1010,
2828,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
4249,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/data_criteria_helpers/dc_post_processing.rb | HQMF2.DataCriteriaPostProcessing.post_processing | def post_processing
extract_code_list_path_and_result_value
# prefix ids that start with numerical values, and strip tokens from others
@id = strip_tokens(@id)
@children_criteria.map! { |cc| strip_tokens(cc) }
# append "_source" to the criteria since all the source criteria are separated from the non-source with the "_source" identifier
# "_source" is added to the SDC ids so that we are not duplicating ids between source and non source data criteria lists
# the derived source data criteria maintain their original ids since they are duplicated in the data criteria and source data criteria lists from the simple xml
@source_data_criteria = "#{@id}_source" unless (@definition == 'derived' || @definition == 'satisfies_all' || @definition == 'satisfies_any')
@source_data_criteria = strip_tokens(@source_data_criteria) unless @source_data_criteria.nil?
@specific_occurrence_const = strip_tokens(@specific_occurrence_const) unless @specific_occurrence_const.nil?
change_xproduct_to_intersection
handle_derived_specific_occurrences
end | ruby | def post_processing
extract_code_list_path_and_result_value
# prefix ids that start with numerical values, and strip tokens from others
@id = strip_tokens(@id)
@children_criteria.map! { |cc| strip_tokens(cc) }
# append "_source" to the criteria since all the source criteria are separated from the non-source with the "_source" identifier
# "_source" is added to the SDC ids so that we are not duplicating ids between source and non source data criteria lists
# the derived source data criteria maintain their original ids since they are duplicated in the data criteria and source data criteria lists from the simple xml
@source_data_criteria = "#{@id}_source" unless (@definition == 'derived' || @definition == 'satisfies_all' || @definition == 'satisfies_any')
@source_data_criteria = strip_tokens(@source_data_criteria) unless @source_data_criteria.nil?
@specific_occurrence_const = strip_tokens(@specific_occurrence_const) unless @specific_occurrence_const.nil?
change_xproduct_to_intersection
handle_derived_specific_occurrences
end | [
"def",
"post_processing",
"extract_code_list_path_and_result_value",
"# prefix ids that start with numerical values, and strip tokens from others",
"@id",
"=",
"strip_tokens",
"(",
"@id",
")",
"@children_criteria",
".",
"map!",
"{",
"|",
"cc",
"|",
"strip_tokens",
"(",
"cc",
... | Handles settings values after (most) values have been setup | [
"Handles",
"settings",
"values",
"after",
"(",
"most",
")",
"values",
"have",
"been",
"setup"
] | 252d4f0927c513eacde6b9ea41b76faa1423c34b | https://github.com/projectcypress/health-data-standards/blob/252d4f0927c513eacde6b9ea41b76faa1423c34b/lib/hqmf-parser/2.0/data_criteria_helpers/dc_post_processing.rb#L5-L20 | train | extract the code list path and result value from the xml object | [
30522,
13366,
2695,
1035,
6364,
14817,
1035,
3642,
1035,
2862,
1035,
4130,
1035,
1998,
1035,
2765,
1035,
3643,
1001,
17576,
8909,
2015,
2008,
2707,
2007,
15973,
5300,
1010,
1998,
6167,
19204,
2015,
2013,
2500,
1030,
8909,
1027,
6167,
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... |
danger/danger | lib/danger/danger_core/dangerfile.rb | Danger.Dangerfile.refresh_plugins | def refresh_plugins
plugins = Plugin.all_plugins
plugins.each do |klass|
next if klass.respond_to?(:singleton_class?) && klass.singleton_class?
plugin = klass.new(self)
next if plugin.nil? || @plugins[klass]
name = plugin.class.instance_name
self.class.send(:attr_reader, name)
instance_variable_set("@#{name}", plugin)
@plugins[klass] = plugin
@core_plugins << plugin if self.class.core_plugin_classes.include? klass
end
end | ruby | def refresh_plugins
plugins = Plugin.all_plugins
plugins.each do |klass|
next if klass.respond_to?(:singleton_class?) && klass.singleton_class?
plugin = klass.new(self)
next if plugin.nil? || @plugins[klass]
name = plugin.class.instance_name
self.class.send(:attr_reader, name)
instance_variable_set("@#{name}", plugin)
@plugins[klass] = plugin
@core_plugins << plugin if self.class.core_plugin_classes.include? klass
end
end | [
"def",
"refresh_plugins",
"plugins",
"=",
"Plugin",
".",
"all_plugins",
"plugins",
".",
"each",
"do",
"|",
"klass",
"|",
"next",
"if",
"klass",
".",
"respond_to?",
"(",
":singleton_class?",
")",
"&&",
"klass",
".",
"singleton_class?",
"plugin",
"=",
"klass",
... | cork_board not being set comes from plugins #585
Iterate through available plugin classes and initialize them with
a reference to this Dangerfile | [
"cork_board",
"not",
"being",
"set",
"comes",
"from",
"plugins",
"#585",
"Iterate",
"through",
"available",
"plugin",
"classes",
"and",
"initialize",
"them",
"with",
"a",
"reference",
"to",
"this",
"Dangerfile"
] | 0d6d09f2d949c287fe75202d947374042b0679f4 | https://github.com/danger/danger/blob/0d6d09f2d949c287fe75202d947374042b0679f4/lib/danger/danger_core/dangerfile.rb#L92-L106 | train | Refresh the plugin objects from the plugin object. | [
30522,
13366,
25416,
21898,
1035,
13354,
7076,
13354,
7076,
1027,
13354,
2378,
1012,
2035,
1035,
13354,
7076,
13354,
7076,
1012,
2169,
2079,
1064,
1047,
27102,
1064,
2279,
2065,
1047,
27102,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
28159,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
thoughtbot/clearance | lib/clearance/rack_session.rb | Clearance.RackSession.call | def call(env)
session = Clearance::Session.new(env)
env[:clearance] = session
response = @app.call(env)
session.add_cookie_to_headers response[1]
response
end | ruby | def call(env)
session = Clearance::Session.new(env)
env[:clearance] = session
response = @app.call(env)
session.add_cookie_to_headers response[1]
response
end | [
"def",
"call",
"(",
"env",
")",
"session",
"=",
"Clearance",
"::",
"Session",
".",
"new",
"(",
"env",
")",
"env",
"[",
":clearance",
"]",
"=",
"session",
"response",
"=",
"@app",
".",
"call",
"(",
"env",
")",
"session",
".",
"add_cookie_to_headers",
"r... | Reads previously existing sessions from a cookie and maintains the cookie
on each response. | [
"Reads",
"previously",
"existing",
"sessions",
"from",
"a",
"cookie",
"and",
"maintains",
"the",
"cookie",
"on",
"each",
"response",
"."
] | 1623cdeb648f33a55f0eb7be17e8f19a4291e1f2 | https://github.com/thoughtbot/clearance/blob/1623cdeb648f33a55f0eb7be17e8f19a4291e1f2/lib/clearance/rack_session.rb#L20-L26 | train | Call the app | [
30522,
13366,
2655,
1006,
4372,
2615,
1007,
5219,
1027,
14860,
1024,
1024,
5219,
1012,
2047,
1006,
4372,
2615,
1007,
4372,
2615,
1031,
1024,
14860,
1033,
1027,
5219,
3433,
1027,
1030,
10439,
1012,
2655,
1006,
4372,
2615,
1007,
5219,
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... |
kpumuk/meta-tags | lib/meta_tags/renderer.rb | MetaTags.Renderer.render_title | def render_title(tags)
normalized_meta_tags[:title] = meta_tags.page_title
normalized_meta_tags[:site] = meta_tags[:site]
title = meta_tags.extract_full_title
normalized_meta_tags[:full_title] = title
tags << ContentTag.new(:title, content: title) if title.present?
end | ruby | def render_title(tags)
normalized_meta_tags[:title] = meta_tags.page_title
normalized_meta_tags[:site] = meta_tags[:site]
title = meta_tags.extract_full_title
normalized_meta_tags[:full_title] = title
tags << ContentTag.new(:title, content: title) if title.present?
end | [
"def",
"render_title",
"(",
"tags",
")",
"normalized_meta_tags",
"[",
":title",
"]",
"=",
"meta_tags",
".",
"page_title",
"normalized_meta_tags",
"[",
":site",
"]",
"=",
"meta_tags",
"[",
":site",
"]",
"title",
"=",
"meta_tags",
".",
"extract_full_title",
"norma... | Renders title tag.
@param [Array<Tag>] tags a buffer object to store tag in. | [
"Renders",
"title",
"tag",
"."
] | 03585f95edf96cd17024c5c155ce46ec8bc47232 | https://github.com/kpumuk/meta-tags/blob/03585f95edf96cd17024c5c155ce46ec8bc47232/lib/meta_tags/renderer.rb#L56-L62 | train | render title | [
30522,
13366,
17552,
1035,
2516,
1006,
22073,
1007,
3671,
3550,
1035,
18804,
1035,
22073,
1031,
1024,
2516,
1033,
1027,
18804,
1035,
22073,
1012,
3931,
1035,
2516,
3671,
3550,
1035,
18804,
1035,
22073,
1031,
1024,
2609,
1033,
1027,
18804,
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... |
cerebris/jsonapi-resources | lib/jsonapi/resource_id_tree.rb | JSONAPI.ResourceIdTree.fetch_related_resource_id_tree | def fetch_related_resource_id_tree(relationship)
relationship_name = relationship.name.to_sym
@related_resource_id_trees[relationship_name] ||= RelatedResourceIdTree.new(relationship, self)
end | ruby | def fetch_related_resource_id_tree(relationship)
relationship_name = relationship.name.to_sym
@related_resource_id_trees[relationship_name] ||= RelatedResourceIdTree.new(relationship, self)
end | [
"def",
"fetch_related_resource_id_tree",
"(",
"relationship",
")",
"relationship_name",
"=",
"relationship",
".",
"name",
".",
"to_sym",
"@related_resource_id_trees",
"[",
"relationship_name",
"]",
"||=",
"RelatedResourceIdTree",
".",
"new",
"(",
"relationship",
",",
"s... | Gets the related Resource Id Tree for a relationship, and creates it first if it does not exist
@param relationship [JSONAPI::Relationship]
@return [JSONAPI::RelatedResourceIdTree] the new or existing resource id tree for the requested relationship | [
"Gets",
"the",
"related",
"Resource",
"Id",
"Tree",
"for",
"a",
"relationship",
"and",
"creates",
"it",
"first",
"if",
"it",
"does",
"not",
"exist"
] | 1ac6bba777e364eaa36706f888792b99b63d8d1a | https://github.com/cerebris/jsonapi-resources/blob/1ac6bba777e364eaa36706f888792b99b63d8d1a/lib/jsonapi/resource_id_tree.rb#L15-L18 | train | Fetch the related resource id tree for a given relationship | [
30522,
13366,
18584,
1035,
3141,
1035,
7692,
1035,
8909,
1035,
3392,
1006,
3276,
1007,
3276,
1035,
2171,
1027,
3276,
1012,
2171,
1012,
2000,
1035,
25353,
2213,
1030,
3141,
1035,
7692,
1035,
8909,
1035,
3628,
1031,
3276,
1035,
2171,
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_logic/lib/2016-06-01/generated/azure_mgmt_logic/workflow_triggers.rb | Azure::Logic::Mgmt::V2016_06_01.WorkflowTriggers.set_state | def set_state(resource_group_name, workflow_name, trigger_name, set_state, custom_headers:nil)
response = set_state_async(resource_group_name, workflow_name, trigger_name, set_state, custom_headers:custom_headers).value!
nil
end | ruby | def set_state(resource_group_name, workflow_name, trigger_name, set_state, custom_headers:nil)
response = set_state_async(resource_group_name, workflow_name, trigger_name, set_state, custom_headers:custom_headers).value!
nil
end | [
"def",
"set_state",
"(",
"resource_group_name",
",",
"workflow_name",
",",
"trigger_name",
",",
"set_state",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"set_state_async",
"(",
"resource_group_name",
",",
"workflow_name",
",",
"trigger_name",
",",
"set_... | Sets the state of a workflow trigger.
@param resource_group_name [String] The resource group name.
@param workflow_name [String] The workflow name.
@param trigger_name [String] The workflow trigger name.
@param set_state [SetTriggerStateActionDefinition] The workflow trigger
state.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Sets",
"the",
"state",
"of",
"a",
"workflow",
"trigger",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/workflow_triggers.rb#L497-L500 | train | Sets the state of a workflow trigger. | [
30522,
13366,
2275,
1035,
2110,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2147,
12314,
1035,
2171,
1010,
9495,
1035,
2171,
1010,
2275,
1035,
2110,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2275,
1035,
2110,
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... |
sds/haml-lint | lib/haml_lint/tree/node.rb | HamlLint::Tree.Node.disabled? | def disabled?(visitor)
visitor.is_a?(HamlLint::Linter) &&
comment_configuration.disabled?(visitor.name)
end | ruby | def disabled?(visitor)
visitor.is_a?(HamlLint::Linter) &&
comment_configuration.disabled?(visitor.name)
end | [
"def",
"disabled?",
"(",
"visitor",
")",
"visitor",
".",
"is_a?",
"(",
"HamlLint",
"::",
"Linter",
")",
"&&",
"comment_configuration",
".",
"disabled?",
"(",
"visitor",
".",
"name",
")",
"end"
] | Checks whether a visitor is disabled due to comment configuration.
@param [HamlLint::HamlVisitor]
@return [true, false] | [
"Checks",
"whether",
"a",
"visitor",
"is",
"disabled",
"due",
"to",
"comment",
"configuration",
"."
] | 024c773667e54cf88db938c2b368977005d70ee8 | https://github.com/sds/haml-lint/blob/024c773667e54cf88db938c2b368977005d70ee8/lib/haml_lint/tree/node.rb#L43-L46 | train | Returns true if the visitor is disabled. | [
30522,
13366,
9776,
1029,
1006,
10367,
1007,
10367,
1012,
2003,
1035,
1037,
1029,
1006,
10654,
21202,
2102,
1024,
1024,
11409,
3334,
1007,
1004,
1004,
7615,
1035,
9563,
1012,
9776,
1029,
1006,
10367,
1012,
2171,
1007,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_datalake_analytics/lib/2015-10-01-preview/generated/azure_mgmt_datalake_analytics/account.rb | Azure::DataLakeAnalytics::Mgmt::V2015_10_01_preview.Account.list_storage_accounts_next | def list_storage_accounts_next(next_page_link, custom_headers:nil)
response = list_storage_accounts_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_storage_accounts_next(next_page_link, custom_headers:nil)
response = list_storage_accounts_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_storage_accounts_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_storage_accounts_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless... | Gets the first page of Azure Storage accounts, if any, linked to the
specified Data Lake Analytics account. The response includes a link to the
next page, if any.
@param 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 [DataLakeAnalyticsAccountListStorageAccountsResult] operation
results. | [
"Gets",
"the",
"first",
"page",
"of",
"Azure",
"Storage",
"accounts",
"if",
"any",
"linked",
"to",
"the",
"specified",
"Data",
"Lake",
"Analytics",
"account",
".",
"The",
"response",
"includes",
"a",
"link",
"to",
"the",
"next",
"page",
"if",
"any",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_datalake_analytics/lib/2015-10-01-preview/generated/azure_mgmt_datalake_analytics/account.rb#L2541-L2544 | train | Gets the storage accounts associated with the specified storage account. | [
30522,
13366,
2862,
1035,
5527,
1035,
6115,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
5527,
1035,
6115,
1035,
2279,
1035,
2004,
6038,
2278,
1006,
2279,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
phusion/passenger | src/ruby_supportlib/phusion_passenger/message_channel.rb | PhusionPassenger.MessageChannel.write | def write(name, *args)
check_argument(name)
args.each do |arg|
check_argument(arg)
end
message = "#{name}#{DELIMITER}"
args.each do |arg|
message << arg.to_s << DELIMITER
end
if message.size > 2 ** 16 - 1
raise ArgumentError, 'Message size too large'
end
@io.write([message.size].pack('n') << message)
@io.flush
end | ruby | def write(name, *args)
check_argument(name)
args.each do |arg|
check_argument(arg)
end
message = "#{name}#{DELIMITER}"
args.each do |arg|
message << arg.to_s << DELIMITER
end
if message.size > 2 ** 16 - 1
raise ArgumentError, 'Message size too large'
end
@io.write([message.size].pack('n') << message)
@io.flush
end | [
"def",
"write",
"(",
"name",
",",
"*",
"args",
")",
"check_argument",
"(",
"name",
")",
"args",
".",
"each",
"do",
"|",
"arg",
"|",
"check_argument",
"(",
"arg",
")",
"end",
"message",
"=",
"\"#{name}#{DELIMITER}\"",
"args",
".",
"each",
"do",
"|",
"ar... | Send an array message, which consists of the given elements, over the underlying
file descriptor. _name_ is the first element in the message, and _args_ are the
other elements. These arguments will internally be converted to strings by calling
to_s().
Might raise SystemCallError, IOError or SocketError when something
goes wrong. | [
"Send",
"an",
"array",
"message",
"which",
"consists",
"of",
"the",
"given",
"elements",
"over",
"the",
"underlying",
"file",
"descriptor",
".",
"_name_",
"is",
"the",
"first",
"element",
"in",
"the",
"message",
"and",
"_args_",
"are",
"the",
"other",
"eleme... | 970964b53e0ba86959acdf40f06c99b0c4a128ca | https://github.com/phusion/passenger/blob/970964b53e0ba86959acdf40f06c99b0c4a128ca/src/ruby_supportlib/phusion_passenger/message_channel.rb#L225-L242 | train | Write a message to the log. | [
30522,
13366,
4339,
1006,
2171,
1010,
1008,
12098,
5620,
1007,
4638,
1035,
6685,
1006,
2171,
1007,
12098,
5620,
1012,
2169,
2079,
1064,
12098,
2290,
1064,
4638,
1035,
6685,
1006,
12098,
2290,
1007,
2203,
4471,
1027,
1000,
1001,
1063,
2171,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_storagesync/lib/2018-07-01/generated/azure_mgmt_storagesync/cloud_endpoints.rb | Azure::StorageSync::Mgmt::V2018_07_01.CloudEndpoints.begin_pre_backup | def begin_pre_backup(resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers:nil)
response = begin_pre_backup_async(resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers:custom_headers).value!
nil
end | ruby | def begin_pre_backup(resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers:nil)
response = begin_pre_backup_async(resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_pre_backup",
"(",
"resource_group_name",
",",
"storage_sync_service_name",
",",
"sync_group_name",
",",
"cloud_endpoint_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_pre_backup_async",
"(",
"resource_group_name",
"... | Pre Backup a given CloudEndpoint.
@param resource_group_name [String] The name of the resource group. The name
is case insensitive.
@param storage_sync_service_name [String] Name of Storage Sync Service
resource.
@param sync_group_name [String] Name of Sync Group resource.
@param cloud_endpoint_name [String] Name of Cloud Endpoint object.
@param parameters [BackupRequest] Body of Backup request.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Pre",
"Backup",
"a",
"given",
"CloudEndpoint",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_storagesync/lib/2018-07-01/generated/azure_mgmt_storagesync/cloud_endpoints.rb#L877-L880 | train | Creates a new instance of the cloud endpoint. | [
30522,
13366,
4088,
1035,
3653,
1035,
10200,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
5527,
1035,
26351,
1035,
2326,
1035,
2171,
1010,
26351,
1035,
2177,
1035,
2171,
1010,
6112,
1035,
2203,
8400,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jeremytregunna/ruby-trello | lib/trello/card.rb | Trello.Card.upvote | def upvote
begin
client.post("/cards/#{id}/membersVoted", {
value: me.id
})
rescue Trello::Error => e
fail e unless e.message =~ /has already voted/i
end
self
end | ruby | def upvote
begin
client.post("/cards/#{id}/membersVoted", {
value: me.id
})
rescue Trello::Error => e
fail e unless e.message =~ /has already voted/i
end
self
end | [
"def",
"upvote",
"begin",
"client",
".",
"post",
"(",
"\"/cards/#{id}/membersVoted\"",
",",
"{",
"value",
":",
"me",
".",
"id",
"}",
")",
"rescue",
"Trello",
"::",
"Error",
"=>",
"e",
"fail",
"e",
"unless",
"e",
".",
"message",
"=~",
"/",
"/i",
"end",
... | Current authenticated user upvotes a card | [
"Current",
"authenticated",
"user",
"upvotes",
"a",
"card"
] | ad79c9d8152ad5395b3b61c43170908f1912bfb2 | https://github.com/jeremytregunna/ruby-trello/blob/ad79c9d8152ad5395b3b61c43170908f1912bfb2/lib/trello/card.rb#L379-L389 | train | upvote the card | [
30522,
13366,
2039,
22994,
2063,
4088,
7396,
1012,
2695,
1006,
1000,
1013,
5329,
1013,
1001,
1063,
8909,
1065,
1013,
2372,
22994,
2098,
1000,
1010,
1063,
3643,
1024,
2033,
1012,
8909,
1065,
1007,
5343,
29461,
7174,
1024,
1024,
7561,
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... |
mongodb/mongoid | lib/mongoid/copyable.rb | Mongoid.Copyable.process_localized_attributes | def process_localized_attributes(klass, attrs)
klass.localized_fields.keys.each do |name|
if value = attrs.delete(name)
attrs["#{name}_translations"] = value
end
end
klass.embedded_relations.each do |_, association|
next unless attrs.present? && attrs[association.key].present?
if association.is_a?(Association::Embedded::EmbedsMany)
attrs[association.key].each do |attr|
embedded_klass = attr.fetch('_type', association.class_name).constantize
process_localized_attributes(embedded_klass, attr)
end
else
process_localized_attributes(association.klass, attrs[association.key])
end
end
end | ruby | def process_localized_attributes(klass, attrs)
klass.localized_fields.keys.each do |name|
if value = attrs.delete(name)
attrs["#{name}_translations"] = value
end
end
klass.embedded_relations.each do |_, association|
next unless attrs.present? && attrs[association.key].present?
if association.is_a?(Association::Embedded::EmbedsMany)
attrs[association.key].each do |attr|
embedded_klass = attr.fetch('_type', association.class_name).constantize
process_localized_attributes(embedded_klass, attr)
end
else
process_localized_attributes(association.klass, attrs[association.key])
end
end
end | [
"def",
"process_localized_attributes",
"(",
"klass",
",",
"attrs",
")",
"klass",
".",
"localized_fields",
".",
"keys",
".",
"each",
"do",
"|",
"name",
"|",
"if",
"value",
"=",
"attrs",
".",
"delete",
"(",
"name",
")",
"attrs",
"[",
"\"#{name}_translations\""... | When cloning, if the document has localized fields we need to ensure they
are properly processed in the clone.
@api private
@example Process localized attributes.
model.process_localized_attributes(attributes)
@param [ Hash ] attrs The attributes.
@since 3.0.20 | [
"When",
"cloning",
"if",
"the",
"document",
"has",
"localized",
"fields",
"we",
"need",
"to",
"ensure",
"they",
"are",
"properly",
"processed",
"in",
"the",
"clone",
"."
] | 56976e32610f4c2450882b0bfe14da099f0703f4 | https://github.com/mongodb/mongoid/blob/56976e32610f4c2450882b0bfe14da099f0703f4/lib/mongoid/copyable.rb#L67-L85 | train | Process the localized attributes of the given class. | [
30522,
13366,
2832,
1035,
22574,
1035,
12332,
1006,
1047,
27102,
1010,
2012,
16344,
2015,
1007,
1047,
27102,
1012,
22574,
1035,
4249,
1012,
6309,
1012,
2169,
2079,
1064,
2171,
1064,
2065,
3643,
1027,
2012,
16344,
2015,
1012,
3972,
12870,
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... |
fluent/fluentd | lib/fluent/plugin/in_monitor_agent.rb | Fluent::Plugin.MonitorAgentInput.plugin_info_by_tag | def plugin_info_by_tag(tag, opts={})
matches = Fluent::Engine.root_agent.event_router.instance_variable_get(:@match_rules)
matches.each { |rule|
if rule.match?(tag)
if rule.collector.is_a?(Fluent::Plugin::Output) || rule.collector.is_a?(Fluent::Output)
return get_monitor_info(rule.collector, opts)
end
end
}
nil
end | ruby | def plugin_info_by_tag(tag, opts={})
matches = Fluent::Engine.root_agent.event_router.instance_variable_get(:@match_rules)
matches.each { |rule|
if rule.match?(tag)
if rule.collector.is_a?(Fluent::Plugin::Output) || rule.collector.is_a?(Fluent::Output)
return get_monitor_info(rule.collector, opts)
end
end
}
nil
end | [
"def",
"plugin_info_by_tag",
"(",
"tag",
",",
"opts",
"=",
"{",
"}",
")",
"matches",
"=",
"Fluent",
"::",
"Engine",
".",
"root_agent",
".",
"event_router",
".",
"instance_variable_get",
"(",
":@match_rules",
")",
"matches",
".",
"each",
"{",
"|",
"rule",
"... | try to match the tag and get the info from the matched output plugin
TODO: Support output in label | [
"try",
"to",
"match",
"the",
"tag",
"and",
"get",
"the",
"info",
"from",
"the",
"matched",
"output",
"plugin",
"TODO",
":",
"Support",
"output",
"in",
"label"
] | add2af9a5b7f74fc36957b8e6138b3c5a2871a92 | https://github.com/fluent/fluentd/blob/add2af9a5b7f74fc36957b8e6138b3c5a2871a92/lib/fluent/plugin/in_monitor_agent.rb#L316-L326 | train | Get the plugin info by tag | [
30522,
13366,
13354,
2378,
1035,
18558,
1035,
2011,
1035,
6415,
1006,
6415,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
3503,
1027,
19376,
1024,
1024,
3194,
1012,
7117,
1035,
4005,
1012,
2724,
1035,
30524,
2169,
1063,
1064,
3627,
1064,
2065,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/vagrantfile.rb | Vagrant.Vagrantfile.machine_names_and_options | def machine_names_and_options
{}.tap do |r|
@config.vm.defined_vms.each do |name, subvm|
r[name] = subvm.options || {}
end
end
end | ruby | def machine_names_and_options
{}.tap do |r|
@config.vm.defined_vms.each do |name, subvm|
r[name] = subvm.options || {}
end
end
end | [
"def",
"machine_names_and_options",
"{",
"}",
".",
"tap",
"do",
"|",
"r",
"|",
"@config",
".",
"vm",
".",
"defined_vms",
".",
"each",
"do",
"|",
"name",
",",
"subvm",
"|",
"r",
"[",
"name",
"]",
"=",
"subvm",
".",
"options",
"||",
"{",
"}",
"end",
... | Returns a list of the machine names as well as the options that
were specified for that machine.
@return [Hash<Symbol, Hash>] | [
"Returns",
"a",
"list",
"of",
"the",
"machine",
"names",
"as",
"well",
"as",
"the",
"options",
"that",
"were",
"specified",
"for",
"that",
"machine",
"."
] | c22a145c59790c098f95d50141d9afb48e1ef55f | https://github.com/hashicorp/vagrant/blob/c22a145c59790c098f95d50141d9afb48e1ef55f/lib/vagrant/vagrantfile.rb#L273-L279 | train | Returns the machine names and options | [
30522,
13366,
3698,
1035,
3415,
1035,
1998,
1035,
7047,
1063,
1065,
1012,
11112,
2079,
1064,
1054,
1064,
1030,
9530,
8873,
2290,
1012,
1058,
2213,
1012,
4225,
1035,
1058,
5244,
1012,
2169,
2079,
1064,
2171,
1010,
4942,
2615,
2213,
1064,
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... |
soundcloud/lhm | lib/lhm/migrator.rb | Lhm.Migrator.remove_index | def remove_index(columns, index_name = nil)
columns = [columns].flatten.map(&:to_sym)
from_origin = @origin.indices.find { |_, cols| cols.map(&:to_sym) == columns }
index_name ||= from_origin[0] unless from_origin.nil?
index_name ||= idx_name(@origin.name, columns)
ddl('drop index `%s` on `%s`' % [index_name, @name])
end | ruby | def remove_index(columns, index_name = nil)
columns = [columns].flatten.map(&:to_sym)
from_origin = @origin.indices.find { |_, cols| cols.map(&:to_sym) == columns }
index_name ||= from_origin[0] unless from_origin.nil?
index_name ||= idx_name(@origin.name, columns)
ddl('drop index `%s` on `%s`' % [index_name, @name])
end | [
"def",
"remove_index",
"(",
"columns",
",",
"index_name",
"=",
"nil",
")",
"columns",
"=",
"[",
"columns",
"]",
".",
"flatten",
".",
"map",
"(",
":to_sym",
")",
"from_origin",
"=",
"@origin",
".",
"indices",
".",
"find",
"{",
"|",
"_",
",",
"cols",
"... | Remove an index from a table
@example
Lhm.change_table(:users) do |m|
m.remove_index(:comment)
m.remove_index([:username, :created_at])
end
@param [String, Symbol, Array<String, Symbol>] columns
A column name given as String or Symbol. An Array of Strings or Symbols
for compound indexes.
@param [String, Symbol] index_name
Optional name of the index to be removed | [
"Remove",
"an",
"index",
"from",
"a",
"table"
] | 50907121eee514649fa944fb300d5d8a64fa873e | https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/lib/lhm/migrator.rb#L159-L165 | train | Remove an index from the index | [
30522,
13366,
6366,
1035,
5950,
1006,
7753,
1010,
5950,
1035,
2171,
1027,
9152,
2140,
1007,
7753,
1027,
1031,
7753,
1033,
1012,
4257,
6528,
1012,
4949,
1006,
1004,
1024,
2000,
1035,
25353,
2213,
1007,
2013,
1035,
4761,
1027,
1030,
4761,
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.internet_gateways | def internet_gateways(options = {})
batches = Enumerator.new do |y|
resp = @client.describe_internet_gateways(options)
resp.each_page do |page|
batch = []
page.data.internet_gateways.each do |i|
batch << InternetGateway.new(
id: i.internet_gateway_id,
data: i,
client: @client
)
end
y.yield(batch)
end
end
InternetGateway::Collection.new(batches)
end | ruby | def internet_gateways(options = {})
batches = Enumerator.new do |y|
resp = @client.describe_internet_gateways(options)
resp.each_page do |page|
batch = []
page.data.internet_gateways.each do |i|
batch << InternetGateway.new(
id: i.internet_gateway_id,
data: i,
client: @client
)
end
y.yield(batch)
end
end
InternetGateway::Collection.new(batches)
end | [
"def",
"internet_gateways",
"(",
"options",
"=",
"{",
"}",
")",
"batches",
"=",
"Enumerator",
".",
"new",
"do",
"|",
"y",
"|",
"resp",
"=",
"@client",
".",
"describe_internet_gateways",
"(",
"options",
")",
"resp",
".",
"each_page",
"do",
"|",
"page",
"|... | @example Request syntax with placeholder values
internet_gateways = ec2.internet_gateways({
filters: [
{
name: "String",
values: ["String"],
},
],
dry_run: false,
internet_gateway_ids: ["String"],
})
@param [Hash] options ({})
@option options [Array<Types::Filter>] :filters
One or more filters.
* `attachment.state` - The current state of the attachment between the
gateway and the VPC (`available`). Present only if a VPC is
attached.
* `attachment.vpc-id` - The ID of an attached VPC.
* `internet-gateway-id` - The ID of the Internet gateway.
* `owner-id` - The ID of the AWS account that owns the internet
gateway.
* `tag`\:<key> - The key/value combination of a tag assigned to
the resource. Use the tag key in the filter name and the tag value
as the filter value. For example, to find all resources that have a
tag with the key `Owner` and the value `TeamA`, specify `tag:Owner`
for the filter name and `TeamA` for the filter value.
* `tag-key` - The key of a tag assigned to the resource. Use this
filter to find all resources assigned a tag with a specific key,
regardless of the tag value.
@option options [Boolean] :dry_run
Checks whether you have the required permissions for the action,
without actually making the request, and provides an error response.
If you have the required permissions, the error response is
`DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
@option options [Array<String>] :internet_gateway_ids
One or more internet gateway IDs.
Default: Describes all your internet gateways.
@return [InternetGateway::Collection] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb#L1861-L1877 | train | Returns an array of InternetGateways | [
30522,
13366,
4274,
1035,
11909,
2015,
1006,
7047,
1027,
1063,
1065,
1007,
14108,
2229,
1027,
4372,
17897,
16259,
1012,
2047,
2079,
1064,
1061,
1064,
24501,
2361,
1027,
1030,
7396,
1012,
6235,
1035,
4274,
1035,
11909,
2015,
1006,
7047,
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... |
rails/sprockets | lib/sprockets/paths.rb | Sprockets.Paths.each_file | def each_file
return to_enum(__method__) unless block_given?
paths.each do |root|
stat_tree(root).each do |filename, stat|
if stat.file?
yield filename
end
end
end
nil
end | ruby | def each_file
return to_enum(__method__) unless block_given?
paths.each do |root|
stat_tree(root).each do |filename, stat|
if stat.file?
yield filename
end
end
end
nil
end | [
"def",
"each_file",
"return",
"to_enum",
"(",
"__method__",
")",
"unless",
"block_given?",
"paths",
".",
"each",
"do",
"|",
"root",
"|",
"stat_tree",
"(",
"root",
")",
".",
"each",
"do",
"|",
"filename",
",",
"stat",
"|",
"if",
"stat",
".",
"file?",
"y... | Public: Iterate over every file under all load paths.
Returns Enumerator if no block is given. | [
"Public",
":",
"Iterate",
"over",
"every",
"file",
"under",
"all",
"load",
"paths",
"."
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/paths.rb#L68-L80 | train | Yields the file objects in the directory. | [
30522,
13366,
2169,
1035,
5371,
2709,
2000,
1035,
4372,
2819,
1006,
1035,
1035,
4118,
1035,
1035,
1007,
4983,
3796,
1035,
2445,
1029,
10425,
1012,
2169,
2079,
1064,
7117,
1064,
28093,
1035,
3392,
1006,
7117,
1007,
1012,
2169,
2079,
1064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
boazsegev/combine_pdf | lib/combine_pdf/page_methods.rb | CombinePDF.Page_Methods.secure_for_copy | def secure_for_copy
# initiate dictionary from old names to new names
names_dictionary = {}
# travel every dictionary to pick up names (keys), change them and add them to the dictionary
res = resources
res.each do |k, v|
next unless actual_value(v).is_a?(Hash)
# if k == :XObject
# self[:Resources][k] = v.dup
# next
# end
new_dictionary = {}
new_name = 'Combine' + SecureRandom.hex(7) + 'PDF'
i = 1
actual_value(v).each do |old_key, value|
new_key = (new_name + i.to_s).to_sym
names_dictionary[old_key] = new_key
new_dictionary[new_key] = value
i += 1
end
res[k] = new_dictionary
end
# now that we have replaced the names in the resources dictionaries,
# it is time to replace the names inside the stream
# we will need to make sure we have access to the stream injected
# we will user PDFFilter.inflate_object
self[:Contents].each do |c|
stream = actual_value(c)
PDFFilter.inflate_object stream
names_dictionary.each do |old_key, new_key|
stream[:raw_stream_content].gsub! object_to_pdf(old_key), object_to_pdf(new_key) ##### PRAY(!) that the parsed datawill be correctly reproduced!
end
# # # the following code isn't needed now that we wrap both the existing and incoming content streams.
# # patch back to PDF defaults, for OCRed PDF files.
# stream[:raw_stream_content] = "q\n0 0 0 rg\n0 0 0 RG\n0 Tr\n1 0 0 1 0 0 cm\n%s\nQ\n" % stream[:raw_stream_content]
end
self
end | ruby | def secure_for_copy
# initiate dictionary from old names to new names
names_dictionary = {}
# travel every dictionary to pick up names (keys), change them and add them to the dictionary
res = resources
res.each do |k, v|
next unless actual_value(v).is_a?(Hash)
# if k == :XObject
# self[:Resources][k] = v.dup
# next
# end
new_dictionary = {}
new_name = 'Combine' + SecureRandom.hex(7) + 'PDF'
i = 1
actual_value(v).each do |old_key, value|
new_key = (new_name + i.to_s).to_sym
names_dictionary[old_key] = new_key
new_dictionary[new_key] = value
i += 1
end
res[k] = new_dictionary
end
# now that we have replaced the names in the resources dictionaries,
# it is time to replace the names inside the stream
# we will need to make sure we have access to the stream injected
# we will user PDFFilter.inflate_object
self[:Contents].each do |c|
stream = actual_value(c)
PDFFilter.inflate_object stream
names_dictionary.each do |old_key, new_key|
stream[:raw_stream_content].gsub! object_to_pdf(old_key), object_to_pdf(new_key) ##### PRAY(!) that the parsed datawill be correctly reproduced!
end
# # # the following code isn't needed now that we wrap both the existing and incoming content streams.
# # patch back to PDF defaults, for OCRed PDF files.
# stream[:raw_stream_content] = "q\n0 0 0 rg\n0 0 0 RG\n0 Tr\n1 0 0 1 0 0 cm\n%s\nQ\n" % stream[:raw_stream_content]
end
self
end | [
"def",
"secure_for_copy",
"# initiate dictionary from old names to new names",
"names_dictionary",
"=",
"{",
"}",
"# travel every dictionary to pick up names (keys), change them and add them to the dictionary",
"res",
"=",
"resources",
"res",
".",
"each",
"do",
"|",
"k",
",",
"v"... | copy_and_secure_for_injection(page)
- page is a page in the pages array, i.e.
pdf.pages[0]
takes a page object and:
makes a deep copy of the page (Ruby defaults to pointers, so this will copy the memory).
then it will rewrite the content stream with renamed resources, so as to avoid name conflicts. | [
"copy_and_secure_for_injection",
"(",
"page",
")",
"-",
"page",
"is",
"a",
"page",
"in",
"the",
"pages",
"array",
"i",
".",
"e",
".",
"pdf",
".",
"pages",
"[",
"0",
"]",
"takes",
"a",
"page",
"object",
"and",
":"
] | 09054051019c069f551f3e60be789577c0f93900 | https://github.com/boazsegev/combine_pdf/blob/09054051019c069f551f3e60be789577c0f93900/lib/combine_pdf/page_methods.rb#L843-L882 | train | This method is used to secure the copy of the PDF file | [
30522,
13366,
5851,
1035,
2005,
1035,
6100,
1001,
17820,
9206,
2013,
2214,
3415,
2000,
2047,
3415,
3415,
1035,
9206,
1027,
1063,
1065,
1001,
3604,
2296,
9206,
2000,
4060,
2039,
3415,
1006,
6309,
1007,
1010,
2689,
2068,
1998,
5587,
2068,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-dynamodb/lib/aws-sdk-dynamodb/table.rb | Aws::DynamoDB.Table.delete | def delete(options = {})
options = options.merge(table_name: @name)
resp = @client.delete_table(options)
resp.data
end | ruby | def delete(options = {})
options = options.merge(table_name: @name)
resp = @client.delete_table(options)
resp.data
end | [
"def",
"delete",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"table_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"delete_table",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @!group Actions
@example Request syntax with placeholder values
table.delete()
@param [Hash] options ({})
@return [Types::DeleteTableOutput] | [
"@!group",
"Actions",
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-dynamodb/lib/aws-sdk-dynamodb/table.rb#L450-L454 | train | Delete the table | [
30522,
13366,
3972,
12870,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
2795,
1035,
2171,
1024,
1030,
2171,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
3972,
12870,
1035,
2795,
1006,
7047,
1007,
24501,
2361,
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... |
randym/axlsx | lib/axlsx/stylesheet/pattern_fill.rb | Axlsx.PatternFill.to_xml_string | def to_xml_string(str = '')
str << ('<patternFill patternType="' << patternType.to_s << '">')
if fgColor.is_a?(Color)
fgColor.to_xml_string str, "fgColor"
end
if bgColor.is_a?(Color)
bgColor.to_xml_string str, "bgColor"
end
str << '</patternFill>'
end | ruby | def to_xml_string(str = '')
str << ('<patternFill patternType="' << patternType.to_s << '">')
if fgColor.is_a?(Color)
fgColor.to_xml_string str, "fgColor"
end
if bgColor.is_a?(Color)
bgColor.to_xml_string str, "bgColor"
end
str << '</patternFill>'
end | [
"def",
"to_xml_string",
"(",
"str",
"=",
"''",
")",
"str",
"<<",
"(",
"'<patternFill patternType=\"'",
"<<",
"patternType",
".",
"to_s",
"<<",
"'\">'",
")",
"if",
"fgColor",
".",
"is_a?",
"(",
"Color",
")",
"fgColor",
".",
"to_xml_string",
"str",
",",
"\"f... | Serializes the object
@param [String] str
@return [String] | [
"Serializes",
"the",
"object"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/stylesheet/pattern_fill.rb#L61-L71 | train | Convert the pattern to XML string. | [
30522,
13366,
2000,
1035,
20950,
1035,
5164,
1006,
2358,
2099,
1027,
1005,
1005,
1007,
2358,
2099,
1026,
1026,
1006,
1005,
1026,
5418,
8873,
3363,
5418,
13874,
1027,
1000,
1005,
1026,
1026,
5418,
13874,
1012,
2000,
1035,
1055,
1026,
1026,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
chef/chef-zero | lib/chef_zero/rest_base.rb | ChefZero.RestBase.json_response | def json_response(response_code, data, options = {})
options = { pretty: true }.merge(options)
do_pretty_json = !!options.delete(:pretty) # make sure we have a proper Boolean.
json = FFI_Yajl::Encoder.encode(data, pretty: do_pretty_json)
already_json_response(response_code, json, options)
end | ruby | def json_response(response_code, data, options = {})
options = { pretty: true }.merge(options)
do_pretty_json = !!options.delete(:pretty) # make sure we have a proper Boolean.
json = FFI_Yajl::Encoder.encode(data, pretty: do_pretty_json)
already_json_response(response_code, json, options)
end | [
"def",
"json_response",
"(",
"response_code",
",",
"data",
",",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"{",
"pretty",
":",
"true",
"}",
".",
"merge",
"(",
"options",
")",
"do_pretty_json",
"=",
"!",
"!",
"options",
".",
"delete",
"(",
":pretty"... | Serializes `data` to JSON and returns an Array with the
response code, HTTP headers and JSON body.
@param [Fixnum] response_code HTTP response code
@param [Hash] data The data for the response body as a Hash
@param [Hash] options
@option options [Hash] :headers (see #already_json_response)
@option options [Boolean] :pretty (true) Pretty-format the JSON
@option options [Fixnum] :request_version (see #already_json_response)
@option options [Fixnum] :response_version (see #already_json_response)
@return (see #already_json_response) | [
"Serializes",
"data",
"to",
"JSON",
"and",
"returns",
"an",
"Array",
"with",
"the",
"response",
"code",
"HTTP",
"headers",
"and",
"JSON",
"body",
"."
] | 5873d906942770a34f0cf0fed05973ec3240a275 | https://github.com/chef/chef-zero/blob/5873d906942770a34f0cf0fed05973ec3240a275/lib/chef_zero/rest_base.rb#L223-L228 | train | Returns the JSON response | [
30522,
13366,
1046,
3385,
1035,
3433,
1006,
3433,
1035,
3642,
1010,
2951,
1010,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
1063,
3492,
1024,
2995,
1065,
1012,
13590,
1006,
7047,
1007,
2079,
1035,
3492,
1035,
1046,
3385,
1027,
999,
999,
704... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | spaceship/lib/spaceship/tunes/tunes_client.rb | Spaceship.TunesClient.pricing_tiers | def pricing_tiers
@pricing_tiers ||= begin
r = request(:get, 'ra/apps/pricing/matrix')
data = parse_response(r, 'data')['pricingTiers']
data.map { |tier| Spaceship::Tunes::PricingTier.factory(tier) }
end
end | ruby | def pricing_tiers
@pricing_tiers ||= begin
r = request(:get, 'ra/apps/pricing/matrix')
data = parse_response(r, 'data')['pricingTiers']
data.map { |tier| Spaceship::Tunes::PricingTier.factory(tier) }
end
end | [
"def",
"pricing_tiers",
"@pricing_tiers",
"||=",
"begin",
"r",
"=",
"request",
"(",
":get",
",",
"'ra/apps/pricing/matrix'",
")",
"data",
"=",
"parse_response",
"(",
"r",
",",
"'data'",
")",
"[",
"'pricingTiers'",
"]",
"data",
".",
"map",
"{",
"|",
"tier",
... | Returns an array of all available pricing tiers
@note Although this information is publicly available, the current spaceship implementation requires you to have a logged in client to access it
@return [Array] the PricingTier objects (Spaceship::Tunes::PricingTier)
[{
"tierStem": "0",
"tierName": "Free",
"pricingInfo": [{
"country": "United States",
"countryCode": "US",
"currencySymbol": "$",
"currencyCode": "USD",
"wholesalePrice": 0.0,
"retailPrice": 0.0,
"fRetailPrice": "$0.00",
"fWholesalePrice": "$0.00"
}, {
...
}, {
... | [
"Returns",
"an",
"array",
"of",
"all",
"available",
"pricing",
"tiers"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/spaceship/lib/spaceship/tunes/tunes_client.rb#L682-L688 | train | Returns the list of pricing tiers | [
30522,
13366,
20874,
1035,
7563,
2015,
1030,
20874,
1035,
7563,
2015,
1064,
1064,
1027,
4088,
1054,
1027,
5227,
1006,
1024,
2131,
1010,
1005,
10958,
1013,
18726,
1013,
20874,
1013,
8185,
1005,
1007,
2951,
1027,
11968,
3366,
1035,
3433,
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... |
SamSaffron/message_bus | lib/message_bus/http_client.rb | MessageBus.HTTPClient.start | def start
@mutex.synchronize do
return if started?
@status = STARTED
thread = Thread.new do
begin
while started?
unless @channels.empty?
poll
@stats.success += 1
@stats.failed = 0
end
sleep interval
end
rescue StandardError => e
@stats.failed += 1
warn("#{e.class} #{e.message}: #{e.backtrace.join("\n")}")
sleep interval
retry
ensure
stop
end
end
thread.abort_on_exception = true
end
self
end | ruby | def start
@mutex.synchronize do
return if started?
@status = STARTED
thread = Thread.new do
begin
while started?
unless @channels.empty?
poll
@stats.success += 1
@stats.failed = 0
end
sleep interval
end
rescue StandardError => e
@stats.failed += 1
warn("#{e.class} #{e.message}: #{e.backtrace.join("\n")}")
sleep interval
retry
ensure
stop
end
end
thread.abort_on_exception = true
end
self
end | [
"def",
"start",
"@mutex",
".",
"synchronize",
"do",
"return",
"if",
"started?",
"@status",
"=",
"STARTED",
"thread",
"=",
"Thread",
".",
"new",
"do",
"begin",
"while",
"started?",
"unless",
"@channels",
".",
"empty?",
"poll",
"@stats",
".",
"success",
"+=",
... | @param base_url [String] Base URL of the message_bus server to connect to
@param enable_long_polling [Boolean] Enable long polling
@param enable_chunked_encoding [Boolean] Enable chunk encoding
@param min_poll_interval [Float, Integer] Min poll interval when long polling in seconds
@param max_poll_interval [Float, Integer] Max poll interval when long polling in seconds.
When requests fail, the client will backoff and this is the upper limit.
@param background_callback_interval [Float, Integer] Interval to poll when
when polling in seconds.
@param headers [Hash] extra HTTP headers to be set on the polling requests.
@return [Object] Instance of MessageBus::HTTPClient
Starts a background thread that polls the message bus endpoint
for the given base_url.
Intervals for long polling can be configured via min_poll_interval and
max_poll_interval.
Intervals for polling can be configured via background_callback_interval.
@return [Object] Instance of MessageBus::HTTPClient | [
"@param",
"base_url",
"[",
"String",
"]",
"Base",
"URL",
"of",
"the",
"message_bus",
"server",
"to",
"connect",
"to",
"@param",
"enable_long_polling",
"[",
"Boolean",
"]",
"Enable",
"long",
"polling",
"@param",
"enable_chunked_encoding",
"[",
"Boolean",
"]",
"En... | 90fba639eb5d332ca8e87fd35f1d603a5743076d | https://github.com/SamSaffron/message_bus/blob/90fba639eb5d332ca8e87fd35f1d603a5743076d/lib/message_bus/http_client.rb#L96-L127 | train | Start a new cluster | [
30522,
13366,
2707,
1030,
20101,
2595,
1012,
26351,
8093,
10698,
4371,
2079,
2709,
2065,
2318,
1029,
1030,
3570,
1027,
2318,
11689,
1027,
11689,
1012,
2047,
2079,
4088,
2096,
2318,
1029,
4983,
1030,
6833,
1012,
4064,
1029,
8554,
1030,
26319... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Shopify/shipit-engine | app/models/shipit/deploy.rb | Shipit.Deploy.trigger_revert | def trigger_revert(force: false)
rollback = Rollback.create!(
user_id: user_id,
stack_id: stack_id,
parent_id: id,
since_commit: until_commit,
until_commit: since_commit,
allow_concurrency: force,
)
rollback.enqueue
lock_reason = "A rollback for #{until_commit.sha} has been triggered. " \
"Please make sure the reason for the rollback has been addressed before deploying again."
stack.update!(lock_reason: lock_reason, lock_author_id: user_id)
rollback
end | ruby | def trigger_revert(force: false)
rollback = Rollback.create!(
user_id: user_id,
stack_id: stack_id,
parent_id: id,
since_commit: until_commit,
until_commit: since_commit,
allow_concurrency: force,
)
rollback.enqueue
lock_reason = "A rollback for #{until_commit.sha} has been triggered. " \
"Please make sure the reason for the rollback has been addressed before deploying again."
stack.update!(lock_reason: lock_reason, lock_author_id: user_id)
rollback
end | [
"def",
"trigger_revert",
"(",
"force",
":",
"false",
")",
"rollback",
"=",
"Rollback",
".",
"create!",
"(",
"user_id",
":",
"user_id",
",",
"stack_id",
":",
"stack_id",
",",
"parent_id",
":",
"id",
",",
"since_commit",
":",
"until_commit",
",",
"until_commit... | Rolls the stack back to the **previous** deploy | [
"Rolls",
"the",
"stack",
"back",
"to",
"the",
"**",
"previous",
"**",
"deploy"
] | f6b93d8a242962016e0f82e99c2eb223bdc75003 | https://github.com/Shopify/shipit-engine/blob/f6b93d8a242962016e0f82e99c2eb223bdc75003/app/models/shipit/deploy.rb#L89-L103 | train | Trigger a rollback | [
30522,
13366,
9495,
1035,
7065,
8743,
1006,
2486,
1024,
6270,
1007,
4897,
5963,
1027,
4897,
5963,
1012,
3443,
999,
1006,
5310,
1035,
8909,
1024,
5310,
1035,
8909,
1010,
9991,
1035,
8909,
1024,
9991,
1035,
8909,
1010,
6687,
1035,
8909,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_customvisiontraining/lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb | Azure::CognitiveServices::Customvisiontraining::V3_0.CustomvisiontrainingClient.get_tagged_image_count_with_http_info | def get_tagged_image_count_with_http_info(project_id, iteration_id:nil, tag_ids:nil, custom_headers:nil)
get_tagged_image_count_async(project_id, iteration_id:iteration_id, tag_ids:tag_ids, custom_headers:custom_headers).value!
end | ruby | def get_tagged_image_count_with_http_info(project_id, iteration_id:nil, tag_ids:nil, custom_headers:nil)
get_tagged_image_count_async(project_id, iteration_id:iteration_id, tag_ids:tag_ids, custom_headers:custom_headers).value!
end | [
"def",
"get_tagged_image_count_with_http_info",
"(",
"project_id",
",",
"iteration_id",
":",
"nil",
",",
"tag_ids",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"get_tagged_image_count_async",
"(",
"project_id",
",",
"iteration_id",
":iteration_id",
",",
"tag_i... | Gets the number of images tagged with the provided {tagIds}.
The filtering is on an and/or relationship. For example, if the provided tag
ids are for the "Dog" and
"Cat" tags, then only images tagged with Dog and/or Cat will be returned
@param project_id The project id.
@param iteration_id The iteration id. Defaults to workspace.
@param tag_ids A list of tags ids to filter the images to count. Defaults to
all tags when null.
@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",
"number",
"of",
"images",
"tagged",
"with",
"the",
"provided",
"{",
"tagIds",
"}",
"."
] | 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#L340-L342 | train | Gets the number of images tagged by an iteration. | [
30522,
13366,
2131,
1035,
26610,
1035,
3746,
1035,
4175,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2622,
1035,
8909,
1010,
27758,
1035,
8909,
1024,
9152,
2140,
1010,
6415,
1035,
8909,
2015,
1024,
9152,
2140,
1010,
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... |
fastlane/fastlane | spaceship/lib/spaceship/client.rb | Spaceship.Client.raise_insufficient_permission_error! | def raise_insufficient_permission_error!(additional_error_string: nil, caller_location: 2)
# get the method name of the request that failed
# `block in` is used very often for requests when surrounded for paging or retrying blocks
# The ! is part of some methods when they modify or delete a resource, so we don't want to show it
# Using `sub` instead of `delete` as we don't want to allow multiple matches
calling_method_name = caller_locations(caller_location, 2).first.label.sub("block in", "").delete("!").strip
# calling the computed property self.team_id can get us into an exception handling loop
team_id = @current_team_id ? "(Team ID #{@current_team_id}) " : ""
error_message = "User #{self.user} #{team_id}doesn't have enough permission for the following action: #{calling_method_name}"
error_message += " (#{additional_error_string})" if additional_error_string.to_s.length > 0
raise InsufficientPermissions, error_message
end | ruby | def raise_insufficient_permission_error!(additional_error_string: nil, caller_location: 2)
# get the method name of the request that failed
# `block in` is used very often for requests when surrounded for paging or retrying blocks
# The ! is part of some methods when they modify or delete a resource, so we don't want to show it
# Using `sub` instead of `delete` as we don't want to allow multiple matches
calling_method_name = caller_locations(caller_location, 2).first.label.sub("block in", "").delete("!").strip
# calling the computed property self.team_id can get us into an exception handling loop
team_id = @current_team_id ? "(Team ID #{@current_team_id}) " : ""
error_message = "User #{self.user} #{team_id}doesn't have enough permission for the following action: #{calling_method_name}"
error_message += " (#{additional_error_string})" if additional_error_string.to_s.length > 0
raise InsufficientPermissions, error_message
end | [
"def",
"raise_insufficient_permission_error!",
"(",
"additional_error_string",
":",
"nil",
",",
"caller_location",
":",
"2",
")",
"# get the method name of the request that failed",
"# `block in` is used very often for requests when surrounded for paging or retrying blocks",
"# The ! is pa... | This also gets called from subclasses | [
"This",
"also",
"gets",
"called",
"from",
"subclasses"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/spaceship/lib/spaceship/client.rb#L747-L760 | train | Raise an exception if the user has not enough permissions for the requested action. | [
30522,
13366,
5333,
1035,
13990,
1035,
6656,
1035,
7561,
999,
1006,
3176,
1035,
7561,
1035,
5164,
1024,
9152,
2140,
1010,
20587,
1035,
3295,
1024,
1016,
1007,
1001,
2131,
1996,
4118,
2171,
1997,
1996,
5227,
2008,
3478,
1001,
1036,
3796,
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_web/lib/2018-02-01/generated/azure_mgmt_web/diagnostics.rb | Azure::Web::Mgmt::V2018_02_01.Diagnostics.get_site_analysis_with_http_info | def get_site_analysis_with_http_info(resource_group_name, site_name, diagnostic_category, analysis_name, custom_headers:nil)
get_site_analysis_async(resource_group_name, site_name, diagnostic_category, analysis_name, custom_headers:custom_headers).value!
end | ruby | def get_site_analysis_with_http_info(resource_group_name, site_name, diagnostic_category, analysis_name, custom_headers:nil)
get_site_analysis_async(resource_group_name, site_name, diagnostic_category, analysis_name, custom_headers:custom_headers).value!
end | [
"def",
"get_site_analysis_with_http_info",
"(",
"resource_group_name",
",",
"site_name",
",",
"diagnostic_category",
",",
"analysis_name",
",",
"custom_headers",
":",
"nil",
")",
"get_site_analysis_async",
"(",
"resource_group_name",
",",
"site_name",
",",
"diagnostic_categ... | Get Site Analysis
Get Site Analysis
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param site_name [String] Site Name
@param diagnostic_category [String] Diagnostic Category
@param analysis_name [String] Analysis Name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Get",
"Site",
"Analysis"
] | 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#L823-L825 | train | Gets the specified site analysis. | [
30522,
13366,
2131,
1035,
2609,
1035,
4106,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2609,
1035,
2171,
1010,
16474,
1035,
4696,
1010,
4106,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mikel/mail | lib/mail/fields/common_address_field.rb | Mail.CommonAddressField.encoded_group_addresses | def encoded_group_addresses
groups.map { |k,v| v.map { |a| a.encoded } }.flatten
end | ruby | def encoded_group_addresses
groups.map { |k,v| v.map { |a| a.encoded } }.flatten
end | [
"def",
"encoded_group_addresses",
"groups",
".",
"map",
"{",
"|",
"k",
",",
"v",
"|",
"v",
".",
"map",
"{",
"|",
"a",
"|",
"a",
".",
"encoded",
"}",
"}",
".",
"flatten",
"end"
] | Returns a list of encoded group addresses | [
"Returns",
"a",
"list",
"of",
"encoded",
"group",
"addresses"
] | fb53fb369eb2bf0494ac70675970c90cdcc3f495 | https://github.com/mikel/mail/blob/fb53fb369eb2bf0494ac70675970c90cdcc3f495/lib/mail/fields/common_address_field.rb#L85-L87 | train | Returns an array of encoded group addresses in the order they were added to the group. | [
30522,
13366,
12359,
1035,
2177,
1035,
11596,
2967,
1012,
4949,
1063,
1064,
1047,
1010,
1058,
1064,
1058,
1012,
4949,
1063,
1064,
1037,
1064,
1037,
1012,
12359,
1065,
1065,
1012,
4257,
6528,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/server.rb | Discordrb.Server.create_channel | def create_channel(name, type = 0, topic: nil, bitrate: nil, user_limit: nil, permission_overwrites: nil, parent: nil, nsfw: false, rate_limit_per_user: nil, position: nil, reason: nil)
type = Channel::TYPES[type] if type.is_a?(Symbol)
raise ArgumentError, 'Channel type must be either 0 (text), 2 (voice), 4 (category), news (5), or store (6)!' unless [0, 2, 4, 5, 6].include?(type)
permission_overwrites.map! { |e| e.is_a?(Overwrite) ? e.to_hash : e } if permission_overwrites.is_a?(Array)
parent_id = parent.respond_to?(:resolve_id) ? parent.resolve_id : nil
response = API::Server.create_channel(@bot.token, @id, name, type, topic, bitrate, user_limit, permission_overwrites, parent_id, nsfw, rate_limit_per_user, position, reason)
Channel.new(JSON.parse(response), @bot)
end | ruby | def create_channel(name, type = 0, topic: nil, bitrate: nil, user_limit: nil, permission_overwrites: nil, parent: nil, nsfw: false, rate_limit_per_user: nil, position: nil, reason: nil)
type = Channel::TYPES[type] if type.is_a?(Symbol)
raise ArgumentError, 'Channel type must be either 0 (text), 2 (voice), 4 (category), news (5), or store (6)!' unless [0, 2, 4, 5, 6].include?(type)
permission_overwrites.map! { |e| e.is_a?(Overwrite) ? e.to_hash : e } if permission_overwrites.is_a?(Array)
parent_id = parent.respond_to?(:resolve_id) ? parent.resolve_id : nil
response = API::Server.create_channel(@bot.token, @id, name, type, topic, bitrate, user_limit, permission_overwrites, parent_id, nsfw, rate_limit_per_user, position, reason)
Channel.new(JSON.parse(response), @bot)
end | [
"def",
"create_channel",
"(",
"name",
",",
"type",
"=",
"0",
",",
"topic",
":",
"nil",
",",
"bitrate",
":",
"nil",
",",
"user_limit",
":",
"nil",
",",
"permission_overwrites",
":",
"nil",
",",
"parent",
":",
"nil",
",",
"nsfw",
":",
"false",
",",
"ra... | Creates a channel on this server with the given name.
@note If parent is provided, permission overwrites have the follow behavior:
1. If overwrites is null, the new channel inherits the parent's permissions.
2. If overwrites is [], the new channel inherits the parent's permissions.
3. If you supply one or more overwrites, the channel will be created with those permissions and ignore the parents.
@param name [String] Name of the channel to create
@param type [Integer, Symbol] Type of channel to create (0: text, 2: voice, 4: category, 5: news, 6: store)
@param topic [String] the topic of this channel, if it will be a text channel
@param bitrate [Integer] the bitrate of this channel, if it will be a voice channel
@param user_limit [Integer] the user limit of this channel, if it will be a voice channel
@param permission_overwrites [Array<Hash>, Array<Overwrite>] permission overwrites for this channel
@param parent [Channel, #resolve_id] parent category for this channel to be created in.
@param nsfw [true, false] whether this channel should be created as nsfw
@param rate_limit_per_user [Integer] how many seconds users need to wait in between messages.
@param reason [String] The reason the for the creation of this channel.
@return [Channel] the created channel.
@raise [ArgumentError] if type is not 0 (text), 2 (voice), 4 (category), 5 (news), or 6 (store) | [
"Creates",
"a",
"channel",
"on",
"this",
"server",
"with",
"the",
"given",
"name",
".",
"@note",
"If",
"parent",
"is",
"provided",
"permission",
"overwrites",
"have",
"the",
"follow",
"behavior",
":"
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/data/server.rb#L464-L472 | train | Create a channel | [
30522,
13366,
3443,
1035,
3149,
1006,
2171,
1010,
2828,
1027,
1014,
1010,
8476,
1024,
9152,
2140,
1010,
2978,
11657,
1024,
9152,
2140,
1010,
5310,
1035,
5787,
1024,
9152,
2140,
1010,
6656,
1035,
2058,
26373,
2015,
1024,
9152,
2140,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sinatra/sinatra | sinatra-contrib/lib/sinatra/link_header.rb | Sinatra.LinkHeader.link | def link(*urls)
opts = urls.last.respond_to?(:to_hash) ? urls.pop : {}
opts[:rel] = urls.shift unless urls.first.respond_to? :to_str
options = opts.map { |k, v| " #{k}=#{v.to_s.inspect}" }
html_pattern = "<link href=\"%s\"#{options.join} />"
http_pattern = ["<%s>", *options].join ";"
link = (response["Link"] ||= "")
urls.map do |url|
link << ",\n" unless link.empty?
link << (http_pattern % url)
html_pattern % url
end.join "\n"
end | ruby | def link(*urls)
opts = urls.last.respond_to?(:to_hash) ? urls.pop : {}
opts[:rel] = urls.shift unless urls.first.respond_to? :to_str
options = opts.map { |k, v| " #{k}=#{v.to_s.inspect}" }
html_pattern = "<link href=\"%s\"#{options.join} />"
http_pattern = ["<%s>", *options].join ";"
link = (response["Link"] ||= "")
urls.map do |url|
link << ",\n" unless link.empty?
link << (http_pattern % url)
html_pattern % url
end.join "\n"
end | [
"def",
"link",
"(",
"*",
"urls",
")",
"opts",
"=",
"urls",
".",
"last",
".",
"respond_to?",
"(",
":to_hash",
")",
"?",
"urls",
".",
"pop",
":",
"{",
"}",
"opts",
"[",
":rel",
"]",
"=",
"urls",
".",
"shift",
"unless",
"urls",
".",
"first",
".",
... | Sets Link HTTP header and returns corresponding HTML tags.
Example:
# Sets header:
# Link: </foo>; rel="next"
# Returns String:
# '<link href="/foo" rel="next" />'
link '/foo', :rel => :next
# Multiple URLs
link :stylesheet, '/a.css', '/b.css' | [
"Sets",
"Link",
"HTTP",
"header",
"and",
"returns",
"corresponding",
"HTML",
"tags",
"."
] | 1aa64f9858edc3f93cc8d46e26f724c1ae103b1c | https://github.com/sinatra/sinatra/blob/1aa64f9858edc3f93cc8d46e26f724c1ae103b1c/sinatra-contrib/lib/sinatra/link_header.rb#L84-L97 | train | Creates a new Link object with the given urls. | [
30522,
13366,
4957,
1006,
1008,
24471,
4877,
1007,
23569,
2015,
1027,
24471,
4877,
1012,
2197,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
2000,
1035,
23325,
1007,
1029,
24471,
4877,
1012,
3769,
1024,
1063,
1065,
23569,
2015,
1031,
1024,
2128... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | railties/lib/rails/application.rb | Rails.Application.message_verifier | def message_verifier(verifier_name)
@message_verifiers[verifier_name] ||= begin
secret = key_generator.generate_key(verifier_name.to_s)
ActiveSupport::MessageVerifier.new(secret)
end
end | ruby | def message_verifier(verifier_name)
@message_verifiers[verifier_name] ||= begin
secret = key_generator.generate_key(verifier_name.to_s)
ActiveSupport::MessageVerifier.new(secret)
end
end | [
"def",
"message_verifier",
"(",
"verifier_name",
")",
"@message_verifiers",
"[",
"verifier_name",
"]",
"||=",
"begin",
"secret",
"=",
"key_generator",
".",
"generate_key",
"(",
"verifier_name",
".",
"to_s",
")",
"ActiveSupport",
"::",
"MessageVerifier",
".",
"new",
... | Returns a message verifier object.
This verifier can be used to generate and verify signed messages in the application.
It is recommended not to use the same verifier for different things, so you can get different
verifiers passing the +verifier_name+ argument.
==== Parameters
* +verifier_name+ - the name of the message verifier.
==== Examples
message = Rails.application.message_verifier('sensitive_data').generate('my sensible data')
Rails.application.message_verifier('sensitive_data').verify(message)
# => 'my sensible data'
See the +ActiveSupport::MessageVerifier+ documentation for more information. | [
"Returns",
"a",
"message",
"verifier",
"object",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/railties/lib/rails/application.rb#L199-L204 | train | Returns a message verifier for the given name. | [
30522,
13366,
4471,
1035,
2310,
3089,
8873,
2121,
1006,
2310,
3089,
8873,
2121,
1035,
30524,
2121,
1035,
2171,
1033,
1064,
1064,
1027,
4088,
3595,
1027,
3145,
1035,
13103,
1012,
9699,
1035,
3145,
1006,
2310,
3089,
8873,
2121,
1035,
2171,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_face/lib/1.0/generated/azure_cognitiveservices_face/face_list_operations.rb | Azure::CognitiveServices::Face::V1_0.FaceListOperations.add_face_from_url_with_http_info | def add_face_from_url_with_http_info(face_list_id, url, user_data:nil, target_face:nil, custom_headers:nil)
add_face_from_url_async(face_list_id, url, user_data:user_data, target_face:target_face, custom_headers:custom_headers).value!
end | ruby | def add_face_from_url_with_http_info(face_list_id, url, user_data:nil, target_face:nil, custom_headers:nil)
add_face_from_url_async(face_list_id, url, user_data:user_data, target_face:target_face, custom_headers:custom_headers).value!
end | [
"def",
"add_face_from_url_with_http_info",
"(",
"face_list_id",
",",
"url",
",",
"user_data",
":",
"nil",
",",
"target_face",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"add_face_from_url_async",
"(",
"face_list_id",
",",
"url",
",",
"user_data",
":user_d... | Add a face to a face list. The input face is specified as an image with a
targetFace rectangle. It returns a persistedFaceId representing the added
face, and persistedFaceId will not expire.
@param face_list_id [String] Id referencing a particular face list.
@param url [String] Publicly reachable URL of an image
@param user_data [String] User-specified data about the face for any purpose.
The maximum length is 1KB.
@param target_face [Array<Integer>] A face rectangle to specify the target
face to be added to a person in the format of
"targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there
is more than one face in the image, targetFace is required to specify which
face to add. No targetFace means there is only one face detected in the
entire image.
@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. | [
"Add",
"a",
"face",
"to",
"a",
"face",
"list",
".",
"The",
"input",
"face",
"is",
"specified",
"as",
"an",
"image",
"with",
"a",
"targetFace",
"rectangle",
".",
"It",
"returns",
"a",
"persistedFaceId",
"representing",
"the",
"added",
"face",
"and",
"persis... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_face/lib/1.0/generated/azure_cognitiveservices_face/face_list_operations.rb#L744-L746 | train | Adds a face to a face list. | [
30522,
13366,
5587,
1035,
2227,
1035,
2013,
1035,
24471,
2140,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2227,
1035,
2862,
1035,
8909,
1010,
24471,
2140,
1010,
5310,
1035,
2951,
1024,
9152,
2140,
1010,
4539,
1035,
2227,
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... |
plaid/plaid-ruby | lib/plaid/products/institutions.rb | Plaid.Institutions.search | def search(query, products = nil, options: nil)
payload = {
query: query,
products: products
}
payload[:options] = options unless options.nil?
post_with_public_key 'institutions/search',
MultipleInstitutionsResponse,
payload
end | ruby | def search(query, products = nil, options: nil)
payload = {
query: query,
products: products
}
payload[:options] = options unless options.nil?
post_with_public_key 'institutions/search',
MultipleInstitutionsResponse,
payload
end | [
"def",
"search",
"(",
"query",
",",
"products",
"=",
"nil",
",",
"options",
":",
"nil",
")",
"payload",
"=",
"{",
"query",
":",
"query",
",",
"products",
":",
"products",
"}",
"payload",
"[",
":options",
"]",
"=",
"options",
"unless",
"options",
".",
... | Public: Get information about all available institutions matching your
query.
Does a POST /institutions/search call which allows you to pull a list of
institutions using a query parameter.
query - Search query to attempt to match institutions to.
products - Product supported filter (optional).
options - Options for filtering institutions.
Returns a MultipleInstitutionsResponse instance. | [
"Public",
":",
"Get",
"information",
"about",
"all",
"available",
"institutions",
"matching",
"your",
"query",
"."
] | ce3da1c5559c739de88c5f59e54eef875f296673 | https://github.com/plaid/plaid-ruby/blob/ce3da1c5559c739de88c5f59e54eef875f296673/lib/plaid/products/institutions.rb#L54-L65 | train | Search for a set of products | [
30522,
13366,
3945,
1006,
23032,
1010,
3688,
1027,
9152,
2140,
1010,
7047,
1024,
9152,
2140,
1007,
18093,
1027,
1063,
23032,
1024,
23032,
1010,
3688,
1024,
3688,
1065,
18093,
1031,
1024,
7047,
1033,
1027,
7047,
4983,
7047,
1012,
9152,
2140,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_machine_learning_services/lib/2018-03-01-preview/generated/azure_mgmt_machine_learning_services/machine_learning_compute.rb | Azure::MachineLearningServices::Mgmt::V2018_03_01_preview.MachineLearningCompute.begin_system_update | def begin_system_update(resource_group_name, workspace_name, compute_name, custom_headers:nil)
response = begin_system_update_async(resource_group_name, workspace_name, compute_name, custom_headers:custom_headers).value!
nil
end | ruby | def begin_system_update(resource_group_name, workspace_name, compute_name, custom_headers:nil)
response = begin_system_update_async(resource_group_name, workspace_name, compute_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_system_update",
"(",
"resource_group_name",
",",
"workspace_name",
",",
"compute_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_system_update_async",
"(",
"resource_group_name",
",",
"workspace_name",
",",
"compute_name",
",",
"cust... | System Update On Machine Learning compute.
@param resource_group_name [String] Name of the resource group in which
workspace is located.
@param workspace_name [String] Name of Azure Machine Learning workspace.
@param compute_name [String] Name of the Azure Machine Learning compute.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"System",
"Update",
"On",
"Machine",
"Learning",
"compute",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_machine_learning_services/lib/2018-03-01-preview/generated/azure_mgmt_machine_learning_services/machine_learning_compute.rb#L691-L694 | train | Updates a compute. | [
30522,
13366,
4088,
1035,
2291,
1035,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2573,
15327,
1035,
2171,
1010,
24134,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
2291,
1035,
10651,
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... |
sds/overcommit | lib/overcommit/hook_context/pre_commit.rb | Overcommit::HookContext.PreCommit.clear_working_tree | def clear_working_tree
removed_submodules = Overcommit::GitRepo.staged_submodule_removals
result = Overcommit::Utils.execute(%w[git reset --hard])
unless result.success?
raise Overcommit::Exceptions::HookCleanupFailed,
"Unable to cleanup working tree after #{hook_script_name} hooks run:" \
"\nSTDOUT:#{result.stdout}\nSTDERR:#{result.stderr}"
end
# Hard-resetting a staged submodule removal results in the index being
# reset but the submodule being restored as an empty directory. This empty
# directory prevents us from stashing on a subsequent run if a hook fails.
#
# Work around this by removing these empty submodule directories as there
# doesn't appear any reason to keep them around.
removed_submodules.each do |submodule|
FileUtils.rmdir(submodule.path)
end
end | ruby | def clear_working_tree
removed_submodules = Overcommit::GitRepo.staged_submodule_removals
result = Overcommit::Utils.execute(%w[git reset --hard])
unless result.success?
raise Overcommit::Exceptions::HookCleanupFailed,
"Unable to cleanup working tree after #{hook_script_name} hooks run:" \
"\nSTDOUT:#{result.stdout}\nSTDERR:#{result.stderr}"
end
# Hard-resetting a staged submodule removal results in the index being
# reset but the submodule being restored as an empty directory. This empty
# directory prevents us from stashing on a subsequent run if a hook fails.
#
# Work around this by removing these empty submodule directories as there
# doesn't appear any reason to keep them around.
removed_submodules.each do |submodule|
FileUtils.rmdir(submodule.path)
end
end | [
"def",
"clear_working_tree",
"removed_submodules",
"=",
"Overcommit",
"::",
"GitRepo",
".",
"staged_submodule_removals",
"result",
"=",
"Overcommit",
"::",
"Utils",
".",
"execute",
"(",
"%w[",
"git",
"reset",
"--hard",
"]",
")",
"unless",
"result",
".",
"success?"... | Clears the working tree so that the stash can be applied. | [
"Clears",
"the",
"working",
"tree",
"so",
"that",
"the",
"stash",
"can",
"be",
"applied",
"."
] | 35d60adb41da942178b789560968e3ad030b0ac7 | https://github.com/sds/overcommit/blob/35d60adb41da942178b789560968e3ad030b0ac7/lib/overcommit/hook_context/pre_commit.rb#L141-L160 | train | Clear the working tree. | [
30522,
13366,
3154,
1035,
2551,
1035,
3392,
3718,
1035,
4942,
5302,
8566,
4244,
1027,
2058,
9006,
22930,
1024,
1024,
21025,
7913,
6873,
1012,
9813,
1035,
4942,
5302,
8566,
2571,
1035,
8208,
2015,
2765,
1027,
2058,
9006,
22930,
1024,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/scss-lint | lib/scss_lint/linter/qualifying_element.rb | SCSSLint.Linter::QualifyingElement.seq_contains_sel_class? | def seq_contains_sel_class?(seq, selector_class)
seq.members.any? do |simple|
simple.is_a?(selector_class)
end
end | ruby | def seq_contains_sel_class?(seq, selector_class)
seq.members.any? do |simple|
simple.is_a?(selector_class)
end
end | [
"def",
"seq_contains_sel_class?",
"(",
"seq",
",",
"selector_class",
")",
"seq",
".",
"members",
".",
"any?",
"do",
"|",
"simple",
"|",
"simple",
".",
"is_a?",
"(",
"selector_class",
")",
"end",
"end"
] | Checks if a simple sequence contains a
simple selector of a certain class.
@param seq [Sass::Selector::SimpleSequence]
@param selector_class [Sass::Selector::Simple]
@returns [Boolean] | [
"Checks",
"if",
"a",
"simple",
"sequence",
"contains",
"a",
"simple",
"selector",
"of",
"a",
"certain",
"class",
"."
] | e99afe4ede041a431a06e585c12ce82f6ad50116 | https://github.com/sds/scss-lint/blob/e99afe4ede041a431a06e585c12ce82f6ad50116/lib/scss_lint/linter/qualifying_element.rb#L21-L25 | train | Returns true if the given sequence contains the given selector class. | [
30522,
13366,
7367,
4160,
1035,
3397,
1035,
7367,
2140,
1035,
2465,
1029,
1006,
7367,
4160,
1010,
27000,
1035,
2465,
1007,
7367,
4160,
1012,
2372,
1012,
2151,
1029,
2079,
1064,
3722,
1064,
3722,
1012,
2003,
1035,
1037,
1029,
1006,
27000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
restforce/restforce | lib/restforce/collection.rb | Restforce.Collection.each | def each
@raw_page['records'].each { |record| yield Restforce::Mash.build(record, @client) }
np = next_page
while np
np.current_page.each { |record| yield record }
np = np.next_page
end
end | ruby | def each
@raw_page['records'].each { |record| yield Restforce::Mash.build(record, @client) }
np = next_page
while np
np.current_page.each { |record| yield record }
np = np.next_page
end
end | [
"def",
"each",
"@raw_page",
"[",
"'records'",
"]",
".",
"each",
"{",
"|",
"record",
"|",
"yield",
"Restforce",
"::",
"Mash",
".",
"build",
"(",
"record",
",",
"@client",
")",
"}",
"np",
"=",
"next_page",
"while",
"np",
"np",
".",
"current_page",
".",
... | Given a hash and client, will create an Enumerator that will lazily
request Salesforce for the next page of results.
Yield each value on each page. | [
"Given",
"a",
"hash",
"and",
"client",
"will",
"create",
"an",
"Enumerator",
"that",
"will",
"lazily",
"request",
"Salesforce",
"for",
"the",
"next",
"page",
"of",
"results",
".",
"Yield",
"each",
"value",
"on",
"each",
"page",
"."
] | 74cbc9c745320dbea5117e2e3cc8d54d66db6562 | https://github.com/restforce/restforce/blob/74cbc9c745320dbea5117e2e3cc8d54d66db6562/lib/restforce/collection.rb#L15-L23 | train | Yields all the records in the page. | [
30522,
13366,
2169,
1030,
6315,
1035,
3931,
1031,
1005,
2636,
1005,
1033,
1012,
2169,
1063,
1064,
2501,
1064,
10750,
2717,
14821,
1024,
1024,
16137,
2232,
1012,
3857,
1006,
2501,
1010,
1030,
7396,
1007,
1065,
27937,
1027,
2279,
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... |
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.report_deployed_service_package_health | def report_deployed_service_package_health(node_name, application_id, service_package_name, health_information, immediate:false, timeout:60, custom_headers:nil)
response = report_deployed_service_package_health_async(node_name, application_id, service_package_name, health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
nil
end | ruby | def report_deployed_service_package_health(node_name, application_id, service_package_name, health_information, immediate:false, timeout:60, custom_headers:nil)
response = report_deployed_service_package_health_async(node_name, application_id, service_package_name, health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
nil
end | [
"def",
"report_deployed_service_package_health",
"(",
"node_name",
",",
"application_id",
",",
"service_package_name",
",",
"health_information",
",",
"immediate",
":",
"false",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"rep... | Sends a health report on the Service Fabric deployed service package.
Reports health state of the service package of the application deployed on a
Service Fabric node. The report must contain the information about the source
of the health report and property on which it is reported.
The report is sent to a Service Fabric gateway Service, which forwards to the
health store.
The report may be accepted by the gateway, but rejected by the health store
after extra validation.
For example, the health store may reject the report because of an invalid
parameter, like a stale sequence number.
To see whether the report was applied in the health store, get deployed
service package health and check that the report appears in the HealthEvents
section.
@param node_name [String] The name of the node.
@param application_id [String] The identity of the application. This is
typically the full name of the application without the 'fabric:' URI scheme.
Starting from version 6.0, hierarchical names are delimited with the "~"
character.
For example, if the application name is "fabric:/myapp/app1", the application
identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
@param service_package_name [String] The name of the service package.
@param health_information [HealthInformation] Describes the health
information for the health report. This information needs to be present in
all of the health reports sent to the health manager.
@param immediate [Boolean] A flag which indicates whether the report should
be sent immediately.
A health report is sent to a Service Fabric gateway Application, which
forwards to the health store.
If Immediate is set to true, the report is sent immediately from HTTP Gateway
to the health store, regardless of the fabric client settings that the HTTP
Gateway Application is using.
This is useful for critical reports that should be sent as soon as possible.
Depending on timing and other conditions, sending the report may still fail,
for example if the HTTP Gateway is closed or the message doesn't reach the
Gateway.
If Immediate is set to false, the report is sent based on the health client
settings from the HTTP Gateway. Therefore, it will be batched according to
the HealthReportSendInterval configuration.
This is the recommended setting because it allows the health client to
optimize health reporting messages to health store as well as health report
processing.
By default, reports are not sent immediately.
@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. | [
"Sends",
"a",
"health",
"report",
"on",
"the",
"Service",
"Fabric",
"deployed",
"service",
"package",
"."
] | 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#L16763-L16766 | train | Report health of deployed service package. | [
30522,
13366,
3189,
1035,
7333,
1035,
2326,
1035,
7427,
1035,
2740,
1006,
13045,
1035,
2171,
1010,
4646,
1035,
8909,
1010,
2326,
1035,
7427,
1035,
2171,
1010,
2740,
1035,
2592,
1010,
6234,
1024,
6270,
1010,
2051,
5833,
1024,
3438,
1010,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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 | def list_by_reservation_order(reservation_order_id, grain, filter:nil, custom_headers:nil)
first_page = list_by_reservation_order_as_lazy(reservation_order_id, grain, filter:filter, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_by_reservation_order(reservation_order_id, grain, filter:nil, custom_headers:nil)
first_page = list_by_reservation_order_as_lazy(reservation_order_id, grain, filter:filter, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_by_reservation_order",
"(",
"reservation_order_id",
",",
"grain",
",",
"filter",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_by_reservation_order_as_lazy",
"(",
"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 [Array<ReservationSummaries>] operation results. | [
"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#L39-L42 | train | Gets all the segmentation terms of a given reservation order. | [
30522,
13366,
2862,
1035,
2011,
1035,
11079,
1035,
2344,
1006,
11079,
1035,
2344,
1035,
8909,
1010,
8982,
1010,
11307,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2862,
1035,
2011,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
decidim/decidim | decidim-core/app/jobs/decidim/email_notification_generator_job.rb | Decidim.EmailNotificationGeneratorJob.perform | def perform(event, event_class_name, resource, followers, affected_users, extra)
return if event_class_name.nil?
event_class = event_class_name.constantize
EmailNotificationGenerator.new(event, event_class, resource, followers, affected_users, extra).generate
end | ruby | def perform(event, event_class_name, resource, followers, affected_users, extra)
return if event_class_name.nil?
event_class = event_class_name.constantize
EmailNotificationGenerator.new(event, event_class, resource, followers, affected_users, extra).generate
end | [
"def",
"perform",
"(",
"event",
",",
"event_class_name",
",",
"resource",
",",
"followers",
",",
"affected_users",
",",
"extra",
")",
"return",
"if",
"event_class_name",
".",
"nil?",
"event_class",
"=",
"event_class_name",
".",
"constantize",
"EmailNotificationGener... | rubocop:disable Metrics/ParameterLists | [
"rubocop",
":",
"disable",
"Metrics",
"/",
"ParameterLists"
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/app/jobs/decidim/email_notification_generator_job.rb#L8-L13 | train | Perform an email notification | [
30522,
13366,
4685,
1006,
2724,
1010,
2724,
1035,
2465,
1035,
2171,
1010,
7692,
1010,
8771,
1010,
5360,
1035,
5198,
1010,
4469,
1007,
2709,
2065,
2724,
1035,
2465,
1035,
2171,
1012,
9152,
2140,
1029,
2724,
1035,
2465,
1027,
2724,
1035,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.3.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_3_0_9.ServiceFabricClientAPIs.create_application_resource | def create_application_resource(application_resource_name, application_resource_description, custom_headers:nil)
response = create_application_resource_async(application_resource_name, application_resource_description, custom_headers:custom_headers).value!
nil
end | ruby | def create_application_resource(application_resource_name, application_resource_description, custom_headers:nil)
response = create_application_resource_async(application_resource_name, application_resource_description, custom_headers:custom_headers).value!
nil
end | [
"def",
"create_application_resource",
"(",
"application_resource_name",
",",
"application_resource_description",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_application_resource_async",
"(",
"application_resource_name",
",",
"application_resource_description",
... | Creates or updates an application resource.
Creates an application with the specified name and description. If an
application with the same name already exists, then its description are
updated to the one indicated in this request.
@param application_resource_name [String] Service Fabric application resource
name.
@param application_resource_description [ApplicationResourceDescription]
Description for creating an application resource.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Creates",
"or",
"updates",
"an",
"application",
"resource",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.3.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L29343-L29346 | train | Creates an application resource. | [
30522,
13366,
3443,
1035,
4646,
1035,
7692,
1006,
4646,
1035,
7692,
1035,
2171,
1010,
4646,
1035,
7692,
1035,
6412,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3443,
1035,
4646,
1035,
7692,
1035,
2004,
6038,
2278,
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... |
decidim/decidim | decidim-core/app/helpers/decidim/decidim_form_helper.rb | Decidim.DecidimFormHelper.translated_field_tag | def translated_field_tag(type, object_name, name, value = {}, options = {})
locales = available_locales
field_label = label_tag(name, options[:label])
if locales.count == 1
field_name = "#{name}_#{locales.first.to_s.gsub("-", "__")}"
field_input = send(
type,
"#{object_name}[#{field_name}]",
value[locales.first.to_s]
)
return safe_join [field_label, field_input]
end
tabs_id = options[:tabs_id] || "#{object_name}-#{name}-tabs".underscore
enabled_tabs = options[:enable_tabs].nil? ? true : options[:enable_tabs]
tabs_panels_data = enabled_tabs ? { tabs: true } : {}
label_tabs = content_tag(:div, class: "label--tabs") do
tabs_panels = "".html_safe
if options[:label] != false
tabs_panels = content_tag(:ul, class: "tabs tabs--lang", id: tabs_id, data: tabs_panels_data) do
locales.each_with_index.inject("".html_safe) do |string, (locale, index)|
string + content_tag(:li, class: tab_element_class_for("title", index)) do
title = I18n.with_locale(locale) { I18n.t("name", scope: "locale") }
element_class = nil
element_class = "is-tab-error" if form_field_has_error?(options[:object], name_with_locale(name, locale))
tab_content_id = "#{tabs_id}-#{name}-panel-#{index}"
content_tag(:a, title, href: "##{tab_content_id}", class: element_class)
end
end
end
end
safe_join [field_label, tabs_panels]
end
tabs_content = content_tag(:div, class: "tabs-content", data: { tabs_content: tabs_id }) do
locales.each_with_index.inject("".html_safe) do |string, (locale, index)|
tab_content_id = "#{tabs_id}-#{name}-panel-#{index}"
string + content_tag(:div, class: tab_element_class_for("panel", index), id: tab_content_id) do
send(type, "#{object_name}[#{name_with_locale(name, locale)}]", value[locale.to_s], options.merge(id: "#{tabs_id}_#{name}_#{locale}", label: false))
end
end
end
safe_join [label_tabs, tabs_content]
end | ruby | def translated_field_tag(type, object_name, name, value = {}, options = {})
locales = available_locales
field_label = label_tag(name, options[:label])
if locales.count == 1
field_name = "#{name}_#{locales.first.to_s.gsub("-", "__")}"
field_input = send(
type,
"#{object_name}[#{field_name}]",
value[locales.first.to_s]
)
return safe_join [field_label, field_input]
end
tabs_id = options[:tabs_id] || "#{object_name}-#{name}-tabs".underscore
enabled_tabs = options[:enable_tabs].nil? ? true : options[:enable_tabs]
tabs_panels_data = enabled_tabs ? { tabs: true } : {}
label_tabs = content_tag(:div, class: "label--tabs") do
tabs_panels = "".html_safe
if options[:label] != false
tabs_panels = content_tag(:ul, class: "tabs tabs--lang", id: tabs_id, data: tabs_panels_data) do
locales.each_with_index.inject("".html_safe) do |string, (locale, index)|
string + content_tag(:li, class: tab_element_class_for("title", index)) do
title = I18n.with_locale(locale) { I18n.t("name", scope: "locale") }
element_class = nil
element_class = "is-tab-error" if form_field_has_error?(options[:object], name_with_locale(name, locale))
tab_content_id = "#{tabs_id}-#{name}-panel-#{index}"
content_tag(:a, title, href: "##{tab_content_id}", class: element_class)
end
end
end
end
safe_join [field_label, tabs_panels]
end
tabs_content = content_tag(:div, class: "tabs-content", data: { tabs_content: tabs_id }) do
locales.each_with_index.inject("".html_safe) do |string, (locale, index)|
tab_content_id = "#{tabs_id}-#{name}-panel-#{index}"
string + content_tag(:div, class: tab_element_class_for("panel", index), id: tab_content_id) do
send(type, "#{object_name}[#{name_with_locale(name, locale)}]", value[locale.to_s], options.merge(id: "#{tabs_id}_#{name}_#{locale}", label: false))
end
end
end
safe_join [label_tabs, tabs_content]
end | [
"def",
"translated_field_tag",
"(",
"type",
",",
"object_name",
",",
"name",
",",
"value",
"=",
"{",
"}",
",",
"options",
"=",
"{",
"}",
")",
"locales",
"=",
"available_locales",
"field_label",
"=",
"label_tag",
"(",
"name",
",",
"options",
"[",
":label",
... | A custom helper to include a translated field without requiring a form object.
type - The type of the translated input field.
object_name - The object name used to identify the Foundation tabs.
name - The name of the input which will be suffixed with the corresponding locales.
value - A hash containing the value for each locale.
options - An optional hash of options.
* enable_tabs: Adds the data-tabs attribute so Foundation picks up automatically.
* tabs_id: The id to identify the Foundation tabs element.
* label: The label used for the field.
Returns a Foundation tabs element with the translated input field. | [
"A",
"custom",
"helper",
"to",
"include",
"a",
"translated",
"field",
"without",
"requiring",
"a",
"form",
"object",
"."
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/app/helpers/decidim/decidim_form_helper.rb#L94-L143 | train | Returns a translated field tag | [
30522,
13366,
5421,
1035,
2492,
1035,
6415,
1006,
2828,
1010,
4874,
1035,
2171,
1010,
2171,
1010,
3643,
1027,
1063,
1065,
1010,
7047,
1027,
1063,
1065,
1007,
2334,
2229,
1027,
2800,
1035,
2334,
2229,
2492,
1035,
3830,
1027,
3830,
1035,
64... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Katello/katello | app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb | Katello.Api::Rhsm::CandlepinProxiesController.consumer_destroy | def consumer_destroy
User.as_anonymous_admin do
Katello::RegistrationManager.unregister_host(@host, :unregistering => !Setting['unregister_delete_host'])
end
render :plain => _("Deleted consumer '%s'") % params[:id], :status => :no_content
end | ruby | def consumer_destroy
User.as_anonymous_admin do
Katello::RegistrationManager.unregister_host(@host, :unregistering => !Setting['unregister_delete_host'])
end
render :plain => _("Deleted consumer '%s'") % params[:id], :status => :no_content
end | [
"def",
"consumer_destroy",
"User",
".",
"as_anonymous_admin",
"do",
"Katello",
"::",
"RegistrationManager",
".",
"unregister_host",
"(",
"@host",
",",
":unregistering",
"=>",
"!",
"Setting",
"[",
"'unregister_delete_host'",
"]",
")",
"end",
"render",
":plain",
"=>",... | api :DELETE, "/consumers/:id", N_("Unregister a consumer")
param :id, String, :desc => N_("UUID of the consumer"), :required => true | [
"api",
":",
"DELETE",
"/",
"consumers",
"/",
":",
"id",
"N_",
"(",
"Unregister",
"a",
"consumer",
")",
"param",
":",
"id",
"String",
":",
"desc",
"=",
">",
"N_",
"(",
"UUID",
"of",
"the",
"consumer",
")",
":",
"required",
"=",
">",
"true"
] | a1c9280067607999cae43bab89b53ba870856b76 | https://github.com/Katello/katello/blob/a1c9280067607999cae43bab89b53ba870856b76/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb#L214-L219 | train | Delete a consumer | [
30522,
13366,
7325,
1035,
6033,
5310,
1012,
2004,
1035,
10812,
1035,
4748,
10020,
2079,
5736,
7174,
1024,
1024,
8819,
24805,
4590,
1012,
4895,
2890,
24063,
2121,
1035,
3677,
1006,
1030,
3677,
1010,
1024,
4895,
2890,
24063,
7999,
1027,
1028,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/sprockets | lib/sprockets/directive_processor.rb | Sprockets.DirectiveProcessor.process_directives | def process_directives(directives)
directives.each do |line_number, name, *args|
begin
send("process_#{name}_directive", *args)
rescue Exception => e
e.set_backtrace(["#{@filename}:#{line_number}"] + e.backtrace)
raise e
end
end
end | ruby | def process_directives(directives)
directives.each do |line_number, name, *args|
begin
send("process_#{name}_directive", *args)
rescue Exception => e
e.set_backtrace(["#{@filename}:#{line_number}"] + e.backtrace)
raise e
end
end
end | [
"def",
"process_directives",
"(",
"directives",
")",
"directives",
".",
"each",
"do",
"|",
"line_number",
",",
"name",
",",
"*",
"args",
"|",
"begin",
"send",
"(",
"\"process_#{name}_directive\"",
",",
"args",
")",
"rescue",
"Exception",
"=>",
"e",
"e",
".",... | Gathers comment directives in the source and processes them.
Any directive method matching `process_*_directive` will
automatically be available. This makes it easy to extend the
processor.
To implement a custom directive called `require_glob`, subclass
`Sprockets::DirectiveProcessor`, then add a method called
`process_require_glob_directive`.
class DirectiveProcessor < Sprockets::DirectiveProcessor
def process_require_glob_directive(glob)
Dir["#{dirname}/#{glob}"].sort.each do |filename|
require(filename)
end
end
end
Replace the current processor on the environment with your own:
env.unregister_processor('text/css', Sprockets::DirectiveProcessor)
env.register_processor('text/css', DirectiveProcessor) | [
"Gathers",
"comment",
"directives",
"in",
"the",
"source",
"and",
"processes",
"them",
".",
"Any",
"directive",
"method",
"matching",
"process_",
"*",
"_directive",
"will",
"automatically",
"be",
"available",
".",
"This",
"makes",
"it",
"easy",
"to",
"extend",
... | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/directive_processor.rb#L186-L195 | train | Process directives | [
30522,
13366,
2832,
1035,
16449,
2015,
1006,
16449,
2015,
1007,
16449,
2015,
1012,
2169,
2079,
1064,
2240,
1035,
2193,
1010,
30524,
1001,
1063,
2240,
1035,
2193,
1065,
1000,
1033,
1009,
1041,
1012,
2067,
6494,
3401,
1007,
5333,
1041,
2203,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/volumes.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.Volumes.list_by_volume_container | def list_by_volume_container(device_name, volume_container_name, resource_group_name, manager_name, custom_headers:nil)
response = list_by_volume_container_async(device_name, volume_container_name, resource_group_name, manager_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_volume_container(device_name, volume_container_name, resource_group_name, manager_name, custom_headers:nil)
response = list_by_volume_container_async(device_name, volume_container_name, resource_group_name, manager_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_volume_container",
"(",
"device_name",
",",
"volume_container_name",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_volume_container_async",
"(",
"device_name",
",",
"volume_container_name",... | Retrieves all the volumes in a volume container.
@param device_name [String] The device name
@param volume_container_name [String] The volume container 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 [VolumeList] operation results. | [
"Retrieves",
"all",
"the",
"volumes",
"in",
"a",
"volume",
"container",
"."
] | 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/volumes.rb#L36-L39 | train | Gets the list of all the available virtual network volumes. | [
30522,
13366,
2862,
1035,
2011,
1035,
3872,
1035,
11661,
1006,
5080,
1035,
2171,
1010,
3872,
1035,
11661,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
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... |
mongodb/mongo-ruby-driver | lib/mongo/retryable.rb | Mongo.Retryable.log_retry | def log_retry(e, options = nil)
message = if options && options[:message]
options[:message]
else
"Retry"
end
Logger.logger.warn "#{message} due to: #{e.class.name} #{e.message}"
end | ruby | def log_retry(e, options = nil)
message = if options && options[:message]
options[:message]
else
"Retry"
end
Logger.logger.warn "#{message} due to: #{e.class.name} #{e.message}"
end | [
"def",
"log_retry",
"(",
"e",
",",
"options",
"=",
"nil",
")",
"message",
"=",
"if",
"options",
"&&",
"options",
"[",
":message",
"]",
"options",
"[",
":message",
"]",
"else",
"\"Retry\"",
"end",
"Logger",
".",
"logger",
".",
"warn",
"\"#{message} due to: ... | Log a warning so that any application slow down is immediately obvious. | [
"Log",
"a",
"warning",
"so",
"that",
"any",
"application",
"slow",
"down",
"is",
"immediately",
"obvious",
"."
] | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/retryable.rb#L358-L365 | train | Log a retry exception | [
30522,
13366,
8833,
1035,
2128,
11129,
1006,
1041,
1010,
7047,
1027,
9152,
2140,
1007,
4471,
1027,
2065,
7047,
1004,
1004,
7047,
1031,
1024,
4471,
1033,
7047,
1031,
1024,
4471,
1033,
2842,
1000,
2128,
11129,
1000,
2203,
8833,
4590,
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... |
decidim/decidim | decidim-core/app/services/decidim/open_data_exporter.rb | Decidim.OpenDataExporter.export | def export
dirname = File.dirname(path)
FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
File.open(path, "wb") { |file| file.write(data) }
end | ruby | def export
dirname = File.dirname(path)
FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
File.open(path, "wb") { |file| file.write(data) }
end | [
"def",
"export",
"dirname",
"=",
"File",
".",
"dirname",
"(",
"path",
")",
"FileUtils",
".",
"mkdir_p",
"(",
"dirname",
")",
"unless",
"File",
".",
"directory?",
"(",
"dirname",
")",
"File",
".",
"open",
"(",
"path",
",",
"\"wb\"",
")",
"{",
"|",
"fi... | Public: Initializes the class.
organization - The Organization to export the data from.
path - The String path where to write the zip file. | [
"Public",
":",
"Initializes",
"the",
"class",
"."
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/app/services/decidim/open_data_exporter.rb#L19-L23 | train | Export the data to a file | [
30522,
13366,
9167,
16101,
18442,
1027,
5371,
1012,
16101,
18442,
1006,
4130,
1007,
5371,
21823,
4877,
1012,
12395,
4305,
2099,
1035,
1052,
1006,
16101,
18442,
1007,
4983,
5371,
1012,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-08-01/generated/azure_mgmt_network/network_watchers.rb | Azure::Network::Mgmt::V2018_08_01.NetworkWatchers.begin_set_flow_log_configuration_with_http_info | def begin_set_flow_log_configuration_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
begin_set_flow_log_configuration_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
end | ruby | def begin_set_flow_log_configuration_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
begin_set_flow_log_configuration_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_set_flow_log_configuration_with_http_info",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_set_flow_log_configuration_async",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
... | Configures flow log and traffic analytics (optional) on a specified
resource.
@param resource_group_name [String] The name of the network watcher resource
group.
@param network_watcher_name [String] The name of the network watcher
resource.
@param parameters [FlowLogInformation] Parameters that define the
configuration of flow log.
@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. | [
"Configures",
"flow",
"log",
"and",
"traffic",
"analytics",
"(",
"optional",
")",
"on",
"a",
"specified",
"resource",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/network_watchers.rb#L1895-L1897 | train | Sets the flow log configuration for the specified resource group. | [
30522,
13366,
4088,
1035,
2275,
1035,
4834,
1035,
8833,
1035,
9563,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2897,
1035,
3422,
2121,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
randym/axlsx | lib/axlsx/workbook/worksheet/auto_filter/filters.rb | Axlsx.Filters.to_xml_string | def to_xml_string(str = '')
str << "<filters #{serialized_attributes}>"
filter_items.each { |filter| filter.to_xml_string(str) }
date_group_items.each { |date_group_item| date_group_item.to_xml_string(str) }
str << '</filters>'
end | ruby | def to_xml_string(str = '')
str << "<filters #{serialized_attributes}>"
filter_items.each { |filter| filter.to_xml_string(str) }
date_group_items.each { |date_group_item| date_group_item.to_xml_string(str) }
str << '</filters>'
end | [
"def",
"to_xml_string",
"(",
"str",
"=",
"''",
")",
"str",
"<<",
"\"<filters #{serialized_attributes}>\"",
"filter_items",
".",
"each",
"{",
"|",
"filter",
"|",
"filter",
".",
"to_xml_string",
"(",
"str",
")",
"}",
"date_group_items",
".",
"each",
"{",
"|",
... | Serialize the object to xml | [
"Serialize",
"the",
"object",
"to",
"xml"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/worksheet/auto_filter/filters.rb#L77-L82 | train | Serialize the filter object to XML string. | [
30522,
13366,
2000,
1035,
20950,
1035,
5164,
1006,
2358,
2099,
1027,
1005,
1005,
1007,
2358,
2099,
1026,
1026,
1000,
1026,
17736,
1001,
1063,
27289,
1035,
12332,
1065,
1028,
1000,
11307,
1035,
5167,
1012,
2169,
1063,
1064,
11307,
1064,
1130... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
haml/haml | lib/haml/filters.rb | Haml.Filters.register_tilt_filter | def register_tilt_filter(name, options = {})
if constants.map(&:to_s).include?(name.to_s)
raise "#{name} filter already defined"
end
filter = const_set(name, Module.new)
filter.extend const_get(options[:extend] || "Plain")
filter.extend TiltFilter
filter.extend PrecompiledTiltFilter if options.has_key? :precompiled
if options.has_key? :template_class
filter.template_class = options[:template_class]
else
filter.tilt_extension = options.fetch(:extension) { name.downcase }
end
# All ":coffeescript" as alias for ":coffee", etc.
if options.has_key?(:alias)
[options[:alias]].flatten.each {|x| Filters.defined[x.to_s] = filter}
end
filter
end | ruby | def register_tilt_filter(name, options = {})
if constants.map(&:to_s).include?(name.to_s)
raise "#{name} filter already defined"
end
filter = const_set(name, Module.new)
filter.extend const_get(options[:extend] || "Plain")
filter.extend TiltFilter
filter.extend PrecompiledTiltFilter if options.has_key? :precompiled
if options.has_key? :template_class
filter.template_class = options[:template_class]
else
filter.tilt_extension = options.fetch(:extension) { name.downcase }
end
# All ":coffeescript" as alias for ":coffee", etc.
if options.has_key?(:alias)
[options[:alias]].flatten.each {|x| Filters.defined[x.to_s] = filter}
end
filter
end | [
"def",
"register_tilt_filter",
"(",
"name",
",",
"options",
"=",
"{",
"}",
")",
"if",
"constants",
".",
"map",
"(",
":to_s",
")",
".",
"include?",
"(",
"name",
".",
"to_s",
")",
"raise",
"\"#{name} filter already defined\"",
"end",
"filter",
"=",
"const_set"... | Loads an external template engine from
[Tilt](https://github.com/rtomayko/tilt) as a filter. This method is used
internally by Haml to set up filters for Sass, SCSS, Less, Coffeescript,
and others. It's left public to make it easy for developers to add their
own Tilt-based filters if they choose.
@return [Module] The generated filter.
@param [Hash] options Options for generating the filter module.
@option options [Boolean] :precompiled Whether the filter should be
precompiled. Erb, Nokogiri and Builder use this, for example.
@option options [Class] :template_class The Tilt template class to use,
in the event it can't be inferred from an extension.
@option options [String] :extension The extension associated with the
content, for example "markdown". This lets Tilt choose the preferred
engine when there are more than one.
@option options [String,Array<String>] :alias Any aliases for the filter.
For example, :coffee is also available as :coffeescript.
@option options [String] :extend The name of a module to extend when
defining the filter. Defaults to "Plain". This allows filters such as
Coffee to "inherit" from Javascript, wrapping its output in script tags.
@since 4.0 | [
"Loads",
"an",
"external",
"template",
"engine",
"from",
"[",
"Tilt",
"]",
"(",
"https",
":",
"//",
"github",
".",
"com",
"/",
"rtomayko",
"/",
"tilt",
")",
"as",
"a",
"filter",
".",
"This",
"method",
"is",
"used",
"internally",
"by",
"Haml",
"to",
"... | 9aa0fbe4a91b999978927be569d2ad0cd39076f1 | https://github.com/haml/haml/blob/9aa0fbe4a91b999978927be569d2ad0cd39076f1/lib/haml/filters.rb#L39-L60 | train | Register a TiltFilter | [
30522,
13366,
4236,
1035,
17010,
1035,
11307,
1006,
2171,
1010,
7047,
1027,
1063,
1065,
1007,
2065,
5377,
2015,
1012,
4949,
1006,
1004,
1024,
2000,
1035,
1055,
1007,
1012,
2421,
1029,
1006,
2171,
1012,
2000,
1035,
1055,
1007,
5333,
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... |
fastlane/fastlane | frameit/lib/frameit/editor.rb | Frameit.Editor.modify_offset | def modify_offset(multiplicator)
# Format: "+133+50"
hash = offset['offset']
x = hash.split("+")[1].to_f * multiplicator
y = hash.split("+")[2].to_f * multiplicator
new_offset = "+#{x.round}+#{y.round}"
@offset_information['offset'] = new_offset
end | ruby | def modify_offset(multiplicator)
# Format: "+133+50"
hash = offset['offset']
x = hash.split("+")[1].to_f * multiplicator
y = hash.split("+")[2].to_f * multiplicator
new_offset = "+#{x.round}+#{y.round}"
@offset_information['offset'] = new_offset
end | [
"def",
"modify_offset",
"(",
"multiplicator",
")",
"# Format: \"+133+50\"",
"hash",
"=",
"offset",
"[",
"'offset'",
"]",
"x",
"=",
"hash",
".",
"split",
"(",
"\"+\"",
")",
"[",
"1",
"]",
".",
"to_f",
"*",
"multiplicator",
"y",
"=",
"hash",
".",
"split",
... | Everything below is related to title, background, etc. and is not used in the easy mode
this is used to correct the 1:1 offset information
the offset information is stored to work for the template images
since we resize the template images to have higher quality screenshots
we need to modify the offset information by a certain factor | [
"Everything",
"below",
"is",
"related",
"to",
"title",
"background",
"etc",
".",
"and",
"is",
"not",
"used",
"in",
"the",
"easy",
"mode"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/frameit/lib/frameit/editor.rb#L140-L147 | train | Modify the offset information | [
30522,
13366,
19933,
1035,
16396,
1006,
4800,
24759,
5555,
4263,
1007,
1001,
4289,
1024,
1000,
1009,
14506,
1009,
2753,
1000,
23325,
1027,
16396,
1031,
1005,
16396,
1005,
1033,
1060,
1027,
23325,
1012,
3975,
1006,
1000,
1009,
1000,
1007,
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... |
Katello/katello | app/models/katello/content_view_docker_filter.rb | Katello.ContentViewDockerFilter.generate_clauses | def generate_clauses(repo)
manifest_tags = []
self.docker_rules.each do |rule|
manifest_tags.concat(query_manifests(repo, rule))
end
{ "_id" => { "$in" => manifest_tags } } unless manifest_tags.empty?
end | ruby | def generate_clauses(repo)
manifest_tags = []
self.docker_rules.each do |rule|
manifest_tags.concat(query_manifests(repo, rule))
end
{ "_id" => { "$in" => manifest_tags } } unless manifest_tags.empty?
end | [
"def",
"generate_clauses",
"(",
"repo",
")",
"manifest_tags",
"=",
"[",
"]",
"self",
".",
"docker_rules",
".",
"each",
"do",
"|",
"rule",
"|",
"manifest_tags",
".",
"concat",
"(",
"query_manifests",
"(",
"repo",
",",
"rule",
")",
")",
"end",
"{",
"\"_id\... | Returns a set of Pulp/MongoDB conditions to filter out manifests in the
repo repository that match parameters
@param repo [Repository] a repository containing manifests to filter
@return [Array] an array of hashes with MongoDB conditions | [
"Returns",
"a",
"set",
"of",
"Pulp",
"/",
"MongoDB",
"conditions",
"to",
"filter",
"out",
"manifests",
"in",
"the",
"repo",
"repository",
"that",
"match",
"parameters"
] | a1c9280067607999cae43bab89b53ba870856b76 | https://github.com/Katello/katello/blob/a1c9280067607999cae43bab89b53ba870856b76/app/models/katello/content_view_docker_filter.rb#L14-L22 | train | Generate the clauses for the given repository | [
30522,
13366,
9699,
1035,
24059,
1006,
16360,
2080,
1007,
19676,
1035,
22073,
1027,
1031,
1033,
2969,
1012,
8946,
2121,
1035,
3513,
1012,
2169,
2079,
1064,
3627,
1064,
19676,
1035,
22073,
1012,
9530,
11266,
1006,
23032,
1035,
19676,
2015,
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... |
ruby/rake | lib/rake/application.rb | Rake.Application.handle_options | def handle_options(argv) # :nodoc:
set_default_options
OptionParser.new do |opts|
opts.banner = "#{Rake.application.name} [-f rakefile] {options} targets..."
opts.separator ""
opts.separator "Options are ..."
opts.on_tail("-h", "--help", "-H", "Display this help message.") do
puts opts
exit
end
standard_rake_options.each { |args| opts.on(*args) }
opts.environment("RAKEOPT")
end.parse(argv)
end | ruby | def handle_options(argv) # :nodoc:
set_default_options
OptionParser.new do |opts|
opts.banner = "#{Rake.application.name} [-f rakefile] {options} targets..."
opts.separator ""
opts.separator "Options are ..."
opts.on_tail("-h", "--help", "-H", "Display this help message.") do
puts opts
exit
end
standard_rake_options.each { |args| opts.on(*args) }
opts.environment("RAKEOPT")
end.parse(argv)
end | [
"def",
"handle_options",
"(",
"argv",
")",
"# :nodoc:",
"set_default_options",
"OptionParser",
".",
"new",
"do",
"|",
"opts",
"|",
"opts",
".",
"banner",
"=",
"\"#{Rake.application.name} [-f rakefile] {options} targets...\"",
"opts",
".",
"separator",
"\"\"",
"opts",
... | Read and handle the command line options. Returns the command line
arguments that we didn't understand, which should (in theory) be just
task names and env vars. | [
"Read",
"and",
"handle",
"the",
"command",
"line",
"options",
".",
"Returns",
"the",
"command",
"line",
"arguments",
"that",
"we",
"didn",
"t",
"understand",
"which",
"should",
"(",
"in",
"theory",
")",
"be",
"just",
"task",
"names",
"and",
"env",
"vars",
... | 1c22b490ee6cb8bd614fa8d0d6145f671466206b | https://github.com/ruby/rake/blob/1c22b490ee6cb8bd614fa8d0d6145f671466206b/lib/rake/application.rb#L637-L653 | train | Parse the command line options | [
30522,
13366,
5047,
1035,
7047,
1006,
12098,
2290,
2615,
1007,
1001,
1024,
7293,
10085,
1024,
2275,
1035,
12398,
1035,
7047,
5724,
19362,
8043,
1012,
2047,
2079,
1064,
23569,
2015,
1064,
23569,
2015,
1012,
9484,
1027,
1000,
1001,
1063,
2600... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
airbnb/synapse | lib/synapse.rb | Synapse.Synapse.run | def run
log.info "synapse: starting..."
statsd_increment('synapse.start')
# start all the watchers
statsd_time('synapse.watchers.start.time') do
@service_watchers.map do |watcher|
begin
watcher.start
statsd_increment("synapse.watcher.start", ['start_result:success', "watcher_name:#{watcher.name}"])
rescue Exception => e
statsd_increment("synapse.watcher.start", ['start_result:fail', "watcher_name:#{watcher.name}", "exception_name:#{e.class.name}", "exception_message:#{e.message}"])
raise e
end
end
end
statsd_time('synapse.main_loop.elapsed_time') do
# main loop
loops = 0
loop do
@service_watchers.each do |w|
alive = w.ping?
statsd_increment('synapse.watcher.ping.count', ["watcher_name:#{w.name}", "ping_result:#{alive ? "success" : "failure"}"])
raise "synapse: service watcher #{w.name} failed ping!" unless alive
end
if @config_updated
@config_updated = false
statsd_increment('synapse.config.update')
@config_generators.each do |config_generator|
log.info "synapse: configuring #{config_generator.name}"
begin
config_generator.update_config(@service_watchers)
rescue StandardError => e
statsd_increment("synapse.config.update_failed", ["config_name:#{config_generator.name}"])
log.error "synapse: update config failed for config #{config_generator.name} with exception #{e}"
raise e
end
end
end
sleep 1
@config_generators.each do |config_generator|
config_generator.tick(@service_watchers)
end
loops += 1
log.debug "synapse: still running at #{Time.now}" if (loops % 60) == 0
end
end
rescue StandardError => e
statsd_increment('synapse.stop', ['stop_avenue:abort', 'stop_location:main_loop', "exception_name:#{e.class.name}", "exception_message:#{e.message}"])
log.error "synapse: encountered unexpected exception #{e.inspect} in main thread"
raise e
ensure
log.warn "synapse: exiting; sending stop signal to all watchers"
# stop all the watchers
@service_watchers.map do |w|
begin
w.stop
statsd_increment("synapse.watcher.stop", ['stop_avenue:clean', 'stop_location:main_loop', "watcher_name:#{w.name}"])
rescue Exception => e
statsd_increment("synapse.watcher.stop", ['stop_avenue:exception', 'stop_location:main_loop', "watcher_name:#{w.name}", "exception_name:#{e.class.name}", "exception_message:#{e.message}"])
raise e
end
end
statsd_increment('synapse.stop', ['stop_avenue:clean', 'stop_location:main_loop'])
end | ruby | def run
log.info "synapse: starting..."
statsd_increment('synapse.start')
# start all the watchers
statsd_time('synapse.watchers.start.time') do
@service_watchers.map do |watcher|
begin
watcher.start
statsd_increment("synapse.watcher.start", ['start_result:success', "watcher_name:#{watcher.name}"])
rescue Exception => e
statsd_increment("synapse.watcher.start", ['start_result:fail', "watcher_name:#{watcher.name}", "exception_name:#{e.class.name}", "exception_message:#{e.message}"])
raise e
end
end
end
statsd_time('synapse.main_loop.elapsed_time') do
# main loop
loops = 0
loop do
@service_watchers.each do |w|
alive = w.ping?
statsd_increment('synapse.watcher.ping.count', ["watcher_name:#{w.name}", "ping_result:#{alive ? "success" : "failure"}"])
raise "synapse: service watcher #{w.name} failed ping!" unless alive
end
if @config_updated
@config_updated = false
statsd_increment('synapse.config.update')
@config_generators.each do |config_generator|
log.info "synapse: configuring #{config_generator.name}"
begin
config_generator.update_config(@service_watchers)
rescue StandardError => e
statsd_increment("synapse.config.update_failed", ["config_name:#{config_generator.name}"])
log.error "synapse: update config failed for config #{config_generator.name} with exception #{e}"
raise e
end
end
end
sleep 1
@config_generators.each do |config_generator|
config_generator.tick(@service_watchers)
end
loops += 1
log.debug "synapse: still running at #{Time.now}" if (loops % 60) == 0
end
end
rescue StandardError => e
statsd_increment('synapse.stop', ['stop_avenue:abort', 'stop_location:main_loop', "exception_name:#{e.class.name}", "exception_message:#{e.message}"])
log.error "synapse: encountered unexpected exception #{e.inspect} in main thread"
raise e
ensure
log.warn "synapse: exiting; sending stop signal to all watchers"
# stop all the watchers
@service_watchers.map do |w|
begin
w.stop
statsd_increment("synapse.watcher.stop", ['stop_avenue:clean', 'stop_location:main_loop', "watcher_name:#{w.name}"])
rescue Exception => e
statsd_increment("synapse.watcher.stop", ['stop_avenue:exception', 'stop_location:main_loop', "watcher_name:#{w.name}", "exception_name:#{e.class.name}", "exception_message:#{e.message}"])
raise e
end
end
statsd_increment('synapse.stop', ['stop_avenue:clean', 'stop_location:main_loop'])
end | [
"def",
"run",
"log",
".",
"info",
"\"synapse: starting...\"",
"statsd_increment",
"(",
"'synapse.start'",
")",
"# start all the watchers",
"statsd_time",
"(",
"'synapse.watchers.start.time'",
")",
"do",
"@service_watchers",
".",
"map",
"do",
"|",
"watcher",
"|",
"begin"... | start all the watchers and enable haproxy configuration | [
"start",
"all",
"the",
"watchers",
"and",
"enable",
"haproxy",
"configuration"
] | 8d1f38236db1fc5ae1b3bf141090dddde42ccdbc | https://github.com/airbnb/synapse/blob/8d1f38236db1fc5ae1b3bf141090dddde42ccdbc/lib/synapse.rb#L42-L112 | train | run the synapse service | [
30522,
13366,
2448,
8833,
1012,
18558,
1000,
19962,
9331,
3366,
1024,
3225,
1012,
1012,
1012,
1000,
26319,
2094,
1035,
4297,
28578,
4765,
1006,
1005,
19962,
9331,
3366,
1012,
2707,
1005,
1007,
1001,
2707,
2035,
1996,
3422,
2545,
26319,
2094... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activesupport/lib/active_support/core_ext/date_and_time/calculations.rb | DateAndTime.Calculations.next_week | def next_week(given_day_in_next_week = Date.beginning_of_week, same_time: false)
result = first_hour(weeks_since(1).beginning_of_week.days_since(days_span(given_day_in_next_week)))
same_time ? copy_time_to(result) : result
end | ruby | def next_week(given_day_in_next_week = Date.beginning_of_week, same_time: false)
result = first_hour(weeks_since(1).beginning_of_week.days_since(days_span(given_day_in_next_week)))
same_time ? copy_time_to(result) : result
end | [
"def",
"next_week",
"(",
"given_day_in_next_week",
"=",
"Date",
".",
"beginning_of_week",
",",
"same_time",
":",
"false",
")",
"result",
"=",
"first_hour",
"(",
"weeks_since",
"(",
"1",
")",
".",
"beginning_of_week",
".",
"days_since",
"(",
"days_span",
"(",
"... | Returns a new date/time representing the given day in the next week.
today = Date.today # => Thu, 07 May 2015
today.next_week # => Mon, 11 May 2015
The +given_day_in_next_week+ defaults to the beginning of the week
which is determined by +Date.beginning_of_week+ or +config.beginning_of_week+
when set.
today = Date.today # => Thu, 07 May 2015
today.next_week(:friday) # => Fri, 15 May 2015
+DateTime+ objects have their time set to 0:00 unless +same_time+ is true.
now = DateTime.current # => Thu, 07 May 2015 13:31:16 +0000
now.next_week # => Mon, 11 May 2015 00:00:00 +0000 | [
"Returns",
"a",
"new",
"date",
"/",
"time",
"representing",
"the",
"given",
"day",
"in",
"the",
"next",
"week",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/core_ext/date_and_time/calculations.rb#L187-L190 | train | Returns the next week of the week | [
30522,
13366,
2279,
1035,
2733,
1006,
2445,
1035,
2154,
1035,
1999,
1035,
2279,
1035,
2733,
1027,
3058,
1012,
2927,
1035,
1997,
1035,
2733,
1010,
2168,
1035,
2051,
1024,
6270,
1007,
2765,
1027,
2034,
1035,
3178,
1006,
3134,
1035,
2144,
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... |
meew0/discordrb | lib/discordrb/data/channel.rb | Discordrb.Channel.update_data | def update_data(new_data = nil)
new_data ||= JSON.parse(API::Channel.resolve(@bot.token, @id))
@name = new_data[:name] || new_data['name'] || @name
@topic = new_data[:topic] || new_data['topic'] || @topic
@position = new_data[:position] || new_data['position'] || @position
@bitrate = new_data[:bitrate] || new_data['bitrate'] || @bitrate
@user_limit = new_data[:user_limit] || new_data['user_limit'] || @user_limit
new_nsfw = new_data.key?(:nsfw) ? new_data[:nsfw] : new_data['nsfw']
@nsfw = new_nsfw.nil? ? @nsfw : new_nsfw
@parent_id = new_data[:parent_id] || new_data['parent_id'] || @parent_id
process_permission_overwrites(new_data[:permission_overwrites] || new_data['permission_overwrites'])
@rate_limit_per_user = new_data[:rate_limit_per_user] || new_data['rate_limit_per_user'] || @rate_limit_per_user
end | ruby | def update_data(new_data = nil)
new_data ||= JSON.parse(API::Channel.resolve(@bot.token, @id))
@name = new_data[:name] || new_data['name'] || @name
@topic = new_data[:topic] || new_data['topic'] || @topic
@position = new_data[:position] || new_data['position'] || @position
@bitrate = new_data[:bitrate] || new_data['bitrate'] || @bitrate
@user_limit = new_data[:user_limit] || new_data['user_limit'] || @user_limit
new_nsfw = new_data.key?(:nsfw) ? new_data[:nsfw] : new_data['nsfw']
@nsfw = new_nsfw.nil? ? @nsfw : new_nsfw
@parent_id = new_data[:parent_id] || new_data['parent_id'] || @parent_id
process_permission_overwrites(new_data[:permission_overwrites] || new_data['permission_overwrites'])
@rate_limit_per_user = new_data[:rate_limit_per_user] || new_data['rate_limit_per_user'] || @rate_limit_per_user
end | [
"def",
"update_data",
"(",
"new_data",
"=",
"nil",
")",
"new_data",
"||=",
"JSON",
".",
"parse",
"(",
"API",
"::",
"Channel",
".",
"resolve",
"(",
"@bot",
".",
"token",
",",
"@id",
")",
")",
"@name",
"=",
"new_data",
"[",
":name",
"]",
"||",
"new_dat... | Updates the cached data with new data
@note For internal use only
@!visibility private | [
"Updates",
"the",
"cached",
"data",
"with",
"new",
"data"
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/data/channel.rb#L750-L762 | train | Update the channel s data | [
30522,
13366,
10651,
1035,
2951,
1006,
2047,
1035,
2951,
1027,
9152,
2140,
1007,
2047,
1035,
2951,
1064,
1064,
1027,
1046,
3385,
1012,
11968,
3366,
1006,
17928,
1024,
1024,
3149,
1012,
10663,
1006,
1030,
28516,
1012,
19204,
1010,
1030,
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_recovery_services_site_recovery/lib/2018-01-10/generated/azure_mgmt_recovery_services_site_recovery/replication_protection_containers.rb | Azure::RecoveryServicesSiteRecovery::Mgmt::V2018_01_10.ReplicationProtectionContainers.list_by_replication_fabrics_as_lazy | def list_by_replication_fabrics_as_lazy(fabric_name, custom_headers:nil)
response = list_by_replication_fabrics_async(fabric_name, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_replication_fabrics_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_by_replication_fabrics_as_lazy(fabric_name, custom_headers:nil)
response = list_by_replication_fabrics_async(fabric_name, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_replication_fabrics_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_by_replication_fabrics_as_lazy",
"(",
"fabric_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_replication_fabrics_async",
"(",
"fabric_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"unless",
"response",
".",
"... | Gets the list of protection container for a fabric.
Lists the protection containers in the specified fabric.
@param fabric_name [String] Fabric name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ProtectionContainerCollection] which provide lazy access to pages of
the response. | [
"Gets",
"the",
"list",
"of",
"protection",
"container",
"for",
"a",
"fabric",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_recovery_services_site_recovery/lib/2018-01-10/generated/azure_mgmt_recovery_services_site_recovery/replication_protection_containers.rb#L1144-L1153 | train | Gets all the fabrics in a service registry. | [
30522,
13366,
2862,
1035,
2011,
1035,
21647,
1035,
25123,
1035,
2004,
1035,
13971,
1006,
8313,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
21647,
1035,
25123,
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_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/device_settings.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.DeviceSettings.create_or_update_time_settings_async | def create_or_update_time_settings_async(device_name, parameters, resource_group_name, manager_name, custom_headers:nil)
# Send request
promise = begin_create_or_update_time_settings_async(device_name, parameters, resource_group_name, manager_name, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::StorSimple8000Series::Mgmt::V2017_06_01::Models::TimeSettings.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | ruby | def create_or_update_time_settings_async(device_name, parameters, resource_group_name, manager_name, custom_headers:nil)
# Send request
promise = begin_create_or_update_time_settings_async(device_name, parameters, resource_group_name, manager_name, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::StorSimple8000Series::Mgmt::V2017_06_01::Models::TimeSettings.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | [
"def",
"create_or_update_time_settings_async",
"(",
"device_name",
",",
"parameters",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_create_or_update_time_settings_async",
"(",
"device_name",
... | @param device_name [String] The device name
@param parameters [TimeSettings] The time settings to be added or updated.
@param resource_group_name [String] The resource group name
@param manager_name [String] The manager name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"device_name",
"[",
"String",
"]",
"The",
"device",
"name",
"@param",
"parameters",
"[",
"TimeSettings",
"]",
"The",
"time",
"settings",
"to",
"be",
"added",
"or",
"updated",
".",
"@param",
"resource_group_name",
"[",
"String",
"]",
"The",
"resource"... | 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#L624-L640 | train | Creates or updates the time settings of the specified device. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1035,
2051,
1035,
10906,
1035,
2004,
6038,
2278,
1006,
5080,
1035,
2171,
1010,
11709,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.get_node_transition_progress | def get_node_transition_progress(node_name, operation_id, timeout:60, custom_headers:nil)
response = get_node_transition_progress_async(node_name, operation_id, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_node_transition_progress(node_name, operation_id, timeout:60, custom_headers:nil)
response = get_node_transition_progress_async(node_name, operation_id, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_node_transition_progress",
"(",
"node_name",
",",
"operation_id",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_node_transition_progress_async",
"(",
"node_name",
",",
"operation_id",
",",
"timeout",
":",
"timeo... | Gets the progress of an operation started using StartNodeTransition.
Gets the progress of an operation started with StartNodeTransition using the
provided OperationId.
@param node_name [String] The name of the node.
@param operation_id A GUID that identifies a call of this API. This is
passed into the corresponding GetProgress API
@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 [NodeTransitionProgress] operation results. | [
"Gets",
"the",
"progress",
"of",
"an",
"operation",
"started",
"using",
"StartNodeTransition",
"."
] | 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#L21756-L21759 | train | Gets the progress of the node transition. | [
30522,
13366,
2131,
1035,
13045,
1035,
6653,
1035,
5082,
1006,
13045,
1035,
2171,
1010,
3169,
1035,
8909,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
13045,
1035,
6653,
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... |
toptal/chewy | lib/chewy/query.rb | Chewy.Query.decay | def decay(function, field, options = {})
field_options = options.extract!(:origin, :scale, :offset, :decay).delete_if { |_, v| v.nil? }
scoring = options.merge(function => {
field => field_options
})
chain { criteria.update_scores scoring }
end | ruby | def decay(function, field, options = {})
field_options = options.extract!(:origin, :scale, :offset, :decay).delete_if { |_, v| v.nil? }
scoring = options.merge(function => {
field => field_options
})
chain { criteria.update_scores scoring }
end | [
"def",
"decay",
"(",
"function",
",",
"field",
",",
"options",
"=",
"{",
"}",
")",
"field_options",
"=",
"options",
".",
"extract!",
"(",
":origin",
",",
":scale",
",",
":offset",
",",
":decay",
")",
".",
"delete_if",
"{",
"|",
"_",
",",
"v",
"|",
... | Add a decay scoring to the search. All scores are
added to the search request and combinded according to
`boost_mode` and `score_mode`
The parameters have default values, but those may not
be very useful for most applications.
@example
UsersIndex.decay(
:gauss,
:field,
origin: '11, 12',
scale: '2km',
offset: '5km',
decay: 0.4,
filter: { foo: :bar})
# => {body:
query: {
gauss: {
query: { ...},
functions: [{
gauss: {
field: {
origin: '11, 12',
scale: '2km',
offset: '5km',
decay: 0.4
}
},
filter: { foo: :bar }
}]
} } } | [
"Add",
"a",
"decay",
"scoring",
"to",
"the",
"search",
".",
"All",
"scores",
"are",
"added",
"to",
"the",
"search",
"request",
"and",
"combinded",
"according",
"to",
"boost_mode",
"and",
"score_mode"
] | cb1bb3efb1bd8a31e7e31add6072189cb1f4f01b | https://github.com/toptal/chewy/blob/cb1bb3efb1bd8a31e7e31add6072189cb1f4f01b/lib/chewy/query.rb#L537-L543 | train | Decay a given field using the given function. | [
30522,
13366,
13121,
1006,
3853,
1010,
2492,
1010,
7047,
1027,
1063,
1065,
1007,
2492,
1035,
7047,
1027,
7047,
1012,
14817,
999,
1006,
1024,
4761,
1010,
1024,
4094,
1010,
1024,
16396,
1010,
1024,
13121,
1007,
1012,
3972,
12870,
1035,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
danger/danger | lib/danger/danger_core/plugins/dangerfile_danger_plugin.rb | Danger.DangerfileDangerPlugin.download | def download(path_or_url)
raise "`download` requires a string" unless path_or_url.kind_of?(String)
raise "URL is not https, for security reasons `danger` only supports encrypted requests" if URI.parse(path_or_url).scheme != "https"
require "tmpdir"
require "faraday"
@http_client ||= Faraday.new do |b|
b.adapter :net_http
end
content = @http_client.get(path_or_url)
path = File.join(Dir.mktmpdir, "temporary_danger.rb")
File.write(path, content.body)
return path
end | ruby | def download(path_or_url)
raise "`download` requires a string" unless path_or_url.kind_of?(String)
raise "URL is not https, for security reasons `danger` only supports encrypted requests" if URI.parse(path_or_url).scheme != "https"
require "tmpdir"
require "faraday"
@http_client ||= Faraday.new do |b|
b.adapter :net_http
end
content = @http_client.get(path_or_url)
path = File.join(Dir.mktmpdir, "temporary_danger.rb")
File.write(path, content.body)
return path
end | [
"def",
"download",
"(",
"path_or_url",
")",
"raise",
"\"`download` requires a string\"",
"unless",
"path_or_url",
".",
"kind_of?",
"(",
"String",
")",
"raise",
"\"URL is not https, for security reasons `danger` only supports encrypted requests\"",
"if",
"URI",
".",
"parse",
"... | @!group Plugins
Download a local or remote plugin or Dangerfile.
This method will not import the file for you, use plugin.import instead
@param [String] path_or_url
a local path or a https URL to the Ruby file to import
a danger plugin from.
@return [String] The path to the downloaded Ruby file | [
"@!group",
"Plugins",
"Download",
"a",
"local",
"or",
"remote",
"plugin",
"or",
"Dangerfile",
".",
"This",
"method",
"will",
"not",
"import",
"the",
"file",
"for",
"you",
"use",
"plugin",
".",
"import",
"instead"
] | 0d6d09f2d949c287fe75202d947374042b0679f4 | https://github.com/danger/danger/blob/0d6d09f2d949c287fe75202d947374042b0679f4/lib/danger/danger_core/plugins/dangerfile_danger_plugin.rb#L173-L188 | train | Download a file or URL to a temporary directory | [
30522,
13366,
8816,
1006,
4130,
1035,
2030,
1035,
24471,
2140,
1007,
5333,
1000,
1036,
8816,
1036,
5942,
1037,
5164,
1000,
4983,
4130,
1035,
2030,
1035,
24471,
2140,
1012,
2785,
1035,
1997,
1029,
1006,
5164,
1007,
5333,
1000,
24471,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_recovery_services_site_recovery/lib/2016-08-10/generated/azure_mgmt_recovery_services_site_recovery/replication_jobs.rb | Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10.ReplicationJobs.cancel_async | def cancel_async(job_name, custom_headers:nil)
# Send request
promise = begin_cancel_async(job_name, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::Job.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 cancel_async(job_name, custom_headers:nil)
# Send request
promise = begin_cancel_async(job_name, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10::Models::Job.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",
"cancel_async",
"(",
"job_name",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_cancel_async",
"(",
"job_name",
",",
"custom_headers",
":custom_headers",
")",
"promise",
"=",
"promise",
".",
"then",
"do",
"|",
"response",
... | @param job_name [String] Job indentifier.
@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",
"job_name",
"[",
"String",
"]",
"Job",
"indentifier",
".",
"@param",
"custom_headers",
"[",
"Hash",
"{",
"String",
"=",
">",
"String",
"}",
"]",
"A",
"hash",
"of",
"custom",
"headers",
"that",
"will",
"be",
"added",
"to",
"the",
"HTTP",
"reques... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_recovery_services_site_recovery/lib/2016-08-10/generated/azure_mgmt_recovery_services_site_recovery/replication_jobs.rb#L134-L150 | train | Cancels a job. | [
30522,
13366,
17542,
1035,
2004,
6038,
2278,
1006,
3105,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,
4088,
1035,
17542,
1035,
2004,
6038,
2278,
1006,
3105,
1035,
2171,
1010,
7661,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
piotrmurach/github | lib/github_api/client/git_data/references.rb | Github.Client::GitData::References.delete | def delete(*args)
arguments(args, required: [:user, :repo, :ref])
params = arguments.params
delete_request("/repos/#{arguments.user}/#{arguments.repo}/git/refs/#{arguments.ref}", params)
end | ruby | def delete(*args)
arguments(args, required: [:user, :repo, :ref])
params = arguments.params
delete_request("/repos/#{arguments.user}/#{arguments.repo}/git/refs/#{arguments.ref}", params)
end | [
"def",
"delete",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":ref",
"]",
")",
"params",
"=",
"arguments",
".",
"params",
"delete_request",
"(",
"\"/repos/#{arguments.user}/#{arguments.repo}/git/refs/#{... | Delete a reference
@example
github = Github.new
github.git_data.references.delete 'user-name', 'repo-name',
"heads/master"
@api public | [
"Delete",
"a",
"reference"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/git_data/references.rb#L130-L135 | train | Delete a reference | [
30522,
13366,
3972,
12870,
1006,
1008,
12098,
5620,
1007,
9918,
1006,
12098,
5620,
1010,
3223,
1024,
1031,
1024,
5310,
1010,
1024,
16360,
2080,
1010,
1024,
25416,
1033,
1007,
11498,
5244,
1027,
9918,
1012,
11498,
5244,
3972,
12870,
1035,
52... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Katello/katello | app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb | Katello.Api::Rhsm::CandlepinProxiesController.consumer_activate | def consumer_activate
# Activation keys are userless by definition so use the internal generic user
# Set it before calling find_activation_keys to allow communication with candlepin
User.current = User.anonymous_admin
additional_set_taxonomy
activation_keys = find_activation_keys
host = Katello::Host::SubscriptionFacet.find_or_create_host(activation_keys.first.organization, rhsm_params)
Katello::RegistrationManager.register_host(host, rhsm_params, nil, activation_keys)
update_host_registered_through(host, request.headers)
host.reload
render :json => Resources::Candlepin::Consumer.get(host.subscription_facet.uuid)
end | ruby | def consumer_activate
# Activation keys are userless by definition so use the internal generic user
# Set it before calling find_activation_keys to allow communication with candlepin
User.current = User.anonymous_admin
additional_set_taxonomy
activation_keys = find_activation_keys
host = Katello::Host::SubscriptionFacet.find_or_create_host(activation_keys.first.organization, rhsm_params)
Katello::RegistrationManager.register_host(host, rhsm_params, nil, activation_keys)
update_host_registered_through(host, request.headers)
host.reload
render :json => Resources::Candlepin::Consumer.get(host.subscription_facet.uuid)
end | [
"def",
"consumer_activate",
"# Activation keys are userless by definition so use the internal generic user",
"# Set it before calling find_activation_keys to allow communication with candlepin",
"User",
".",
"current",
"=",
"User",
".",
"anonymous_admin",
"additional_set_taxonomy",
"activati... | used for registering with activation keys
api :POST, "/consumers", N_("Register a system with activation key (compatibility)")
param :activation_keys, String, :required => true | [
"used",
"for",
"registering",
"with",
"activation",
"keys",
"api",
":",
"POST",
"/",
"consumers",
"N_",
"(",
"Register",
"a",
"system",
"with",
"activation",
"key",
"(",
"compatibility",
")",
")",
"param",
":",
"activation_keys",
"String",
":",
"required",
"... | a1c9280067607999cae43bab89b53ba870856b76 | https://github.com/Katello/katello/blob/a1c9280067607999cae43bab89b53ba870856b76/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb#L224-L238 | train | This method is called by the consumer to activate a candlepin | [
30522,
13366,
7325,
1035,
20544,
1001,
13791,
6309,
2024,
5310,
3238,
2011,
6210,
2061,
2224,
1996,
4722,
12391,
5310,
1001,
2275,
2009,
2077,
4214,
2424,
1035,
13791,
1035,
6309,
2000,
3499,
4807,
2007,
13541,
8091,
5310,
1012,
2783,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.get_explicit_list_item | def get_explicit_list_item(app_id, version_id, entity_id, item_id, custom_headers:nil)
response = get_explicit_list_item_async(app_id, version_id, entity_id, item_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_explicit_list_item(app_id, version_id, entity_id, item_id, custom_headers:nil)
response = get_explicit_list_item_async(app_id, version_id, entity_id, item_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_explicit_list_item",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"item_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_explicit_list_item_async",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"item_id",
",",
... | Get the explicit (exception) list of the pattern.any entity in a version of
the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param entity_id The Pattern.Any entity Id.
@param item_id [Integer] The explicit list item Id.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ExplicitListItem] operation results. | [
"Get",
"the",
"explicit",
"(",
"exception",
")",
"list",
"of",
"the",
"pattern",
".",
"any",
"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#L11279-L11282 | train | Gets the specified list item. | [
30522,
13366,
2131,
1035,
13216,
1035,
2862,
1035,
8875,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
9178,
1035,
8909,
1010,
8875,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
13216,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/runner.rb | SCSSLint.Runner.run_linter | def run_linter(linter, engine, file_path)
return if @config.excluded_file_for_linter?(file_path, linter)
@lints += linter.run(engine, @config.linter_options(linter))
end | ruby | def run_linter(linter, engine, file_path)
return if @config.excluded_file_for_linter?(file_path, linter)
@lints += linter.run(engine, @config.linter_options(linter))
end | [
"def",
"run_linter",
"(",
"linter",
",",
"engine",
",",
"file_path",
")",
"return",
"if",
"@config",
".",
"excluded_file_for_linter?",
"(",
"file_path",
",",
"linter",
")",
"@lints",
"+=",
"linter",
".",
"run",
"(",
"engine",
",",
"@config",
".",
"linter_opt... | For stubbing in tests. | [
"For",
"stubbing",
"in",
"tests",
"."
] | e99afe4ede041a431a06e585c12ce82f6ad50116 | https://github.com/sds/scss-lint/blob/e99afe4ede041a431a06e585c12ce82f6ad50116/lib/scss_lint/runner.rb#L51-L54 | train | Runs the linter | [
30522,
13366,
2448,
1035,
11409,
3334,
1006,
11409,
3334,
1010,
3194,
1010,
5371,
1035,
4130,
1007,
2709,
2065,
1030,
9530,
8873,
2290,
30524,
1007,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.store_merge_state | def store_merge_state
merge_head = `git rev-parse MERGE_HEAD 2> #{File::NULL}`.chomp
# Store the merge state if we're in the middle of resolving a merge
# conflict. This is necessary since stashing removes the merge state.
if merge_head != 'MERGE_HEAD'
@merge_head = merge_head
end
merge_msg_file = File.expand_path('MERGE_MSG', Overcommit::Utils.git_dir)
@merge_msg = File.open(merge_msg_file).read if File.exist?(merge_msg_file)
end | ruby | def store_merge_state
merge_head = `git rev-parse MERGE_HEAD 2> #{File::NULL}`.chomp
# Store the merge state if we're in the middle of resolving a merge
# conflict. This is necessary since stashing removes the merge state.
if merge_head != 'MERGE_HEAD'
@merge_head = merge_head
end
merge_msg_file = File.expand_path('MERGE_MSG', Overcommit::Utils.git_dir)
@merge_msg = File.open(merge_msg_file).read if File.exist?(merge_msg_file)
end | [
"def",
"store_merge_state",
"merge_head",
"=",
"`",
"#{",
"File",
"::",
"NULL",
"}",
"`",
".",
"chomp",
"# Store the merge state if we're in the middle of resolving a merge",
"# conflict. This is necessary since stashing removes the merge state.",
"if",
"merge_head",
"!=",
"'MERG... | Store any relevant files that are present when repo is in the middle of a
merge.
Restored via [#restore_merge_state]. | [
"Store",
"any",
"relevant",
"files",
"that",
"are",
"present",
"when",
"repo",
"is",
"in",
"the",
"middle",
"of",
"a",
"merge",
"."
] | 35d60adb41da942178b789560968e3ad030b0ac7 | https://github.com/sds/overcommit/blob/35d60adb41da942178b789560968e3ad030b0ac7/lib/overcommit/git_repo.rb#L146-L157 | train | Store the merge state of the current branch. | [
30522,
13366,
3573,
1035,
13590,
1035,
2110,
13590,
1035,
2132,
1027,
1036,
21025,
2102,
7065,
1011,
11968,
3366,
13590,
1035,
2132,
1016,
1028,
1001,
1063,
5371,
1024,
1024,
19701,
1065,
1036,
1012,
16480,
8737,
1001,
3573,
1996,
13590,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb | Aws::AutoScaling.AutoScalingGroup.set_desired_capacity | def set_desired_capacity(options = {})
options = options.merge(auto_scaling_group_name: @name)
resp = @client.set_desired_capacity(options)
resp.data
end | ruby | def set_desired_capacity(options = {})
options = options.merge(auto_scaling_group_name: @name)
resp = @client.set_desired_capacity(options)
resp.data
end | [
"def",
"set_desired_capacity",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"auto_scaling_group_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"set_desired_capacity",
"(",
"options",
")",
"resp",
".",
"data",
"end... | @example Request syntax with placeholder values
auto_scaling_group.set_desired_capacity({
desired_capacity: 1, # required
honor_cooldown: false,
})
@param [Hash] options ({})
@option options [required, Integer] :desired_capacity
The number of EC2 instances that should be running in the Auto Scaling
group.
@option options [Boolean] :honor_cooldown
Indicates whether Amazon EC2 Auto Scaling waits for the cooldown
period to complete before initiating a scaling activity to set your
Auto Scaling group to its new capacity. By default, Amazon EC2 Auto
Scaling does not honor the cooldown period during manual scaling
activities.
@return [EmptyStructure] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb#L733-L737 | train | Set the desired capacity of the Auto Scaling Group. | [
30522,
13366,
2275,
1035,
9059,
1035,
3977,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
8285,
1035,
25169,
1035,
2177,
1035,
2171,
1024,
1030,
2171,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
2275,
1035,
9059,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2017-12-01/generated/azure_mgmt_compute/virtual_machine_scale_set_vms.rb | Azure::Compute::Mgmt::V2017_12_01.VirtualMachineScaleSetVMs.list_with_http_info | def list_with_http_info(resource_group_name, virtual_machine_scale_set_name, filter:nil, select:nil, expand:nil, custom_headers:nil)
list_async(resource_group_name, virtual_machine_scale_set_name, filter:filter, select:select, expand:expand, custom_headers:custom_headers).value!
end | ruby | def list_with_http_info(resource_group_name, virtual_machine_scale_set_name, filter:nil, select:nil, expand:nil, custom_headers:nil)
list_async(resource_group_name, virtual_machine_scale_set_name, filter:filter, select:select, expand:expand, custom_headers:custom_headers).value!
end | [
"def",
"list_with_http_info",
"(",
"resource_group_name",
",",
"virtual_machine_scale_set_name",
",",
"filter",
":",
"nil",
",",
"select",
":",
"nil",
",",
"expand",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"list_async",
"(",
"resource_group_name",
",",... | Gets a list of all virtual machines in a VM scale sets.
@param resource_group_name [String] The name of the resource group.
@param virtual_machine_scale_set_name [String] The name of the VM scale set.
@param filter [String] The filter to apply to the operation.
@param select [String] The list parameters.
@param expand [String] The expand expression to apply to 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. | [
"Gets",
"a",
"list",
"of",
"all",
"virtual",
"machines",
"in",
"a",
"VM",
"scale",
"sets",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2017-12-01/generated/azure_mgmt_compute/virtual_machine_scale_set_vms.rb#L478-L480 | train | Gets a list of all the virtual machine scale sets in a virtual machine scale set. | [
30522,
13366,
2862,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7484,
1035,
3698,
1035,
4094,
1035,
2275,
1035,
2171,
1010,
11307,
1024,
9152,
2140,
1010,
7276,
1024,
9152,
2140,
1010,
7818,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.