repo stringclasses 237 values | path stringlengths 11 168 | func_name stringlengths 10 147 | original_string stringlengths 79 124k | language stringclasses 1 value | code stringlengths 79 124k | code_tokens listlengths 16 45.3k | docstring stringlengths 4 23.5k | docstring_tokens listlengths 1 452 | sha stringclasses 237 values | url stringlengths 95 268 | partition stringclasses 1 value | summary stringlengths 8 229 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
puppetlabs/puppet | lib/puppet/util/windows/service.rb | Puppet::Util::Windows.Service.exists? | def exists?(service_name)
open_service(service_name, SC_MANAGER_CONNECT, SERVICE_QUERY_STATUS) do |_|
true
end
rescue Puppet::Util::Windows::Error => e
return false if e.code == ERROR_SERVICE_DOES_NOT_EXIST
raise e
end | ruby | def exists?(service_name)
open_service(service_name, SC_MANAGER_CONNECT, SERVICE_QUERY_STATUS) do |_|
true
end
rescue Puppet::Util::Windows::Error => e
return false if e.code == ERROR_SERVICE_DOES_NOT_EXIST
raise e
end | [
"def",
"exists?",
"(",
"service_name",
")",
"open_service",
"(",
"service_name",
",",
"SC_MANAGER_CONNECT",
",",
"SERVICE_QUERY_STATUS",
")",
"do",
"|",
"_",
"|",
"true",
"end",
"rescue",
"Puppet",
"::",
"Util",
"::",
"Windows",
"::",
"Error",
"=>",
"e",
"re... | Returns true if the service exists, false otherwise.
@param [String] service_name name of the service | [
"Returns",
"true",
"if",
"the",
"service",
"exists",
"false",
"otherwise",
"."
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/util/windows/service.rb#L286-L293 | train | Returns true if the specified service exists. | [
30522,
13366,
6526,
1029,
1006,
2326,
1035,
2171,
1007,
2330,
1035,
2326,
1006,
2326,
1035,
2171,
1010,
8040,
1035,
3208,
1035,
7532,
1010,
2326,
1035,
23032,
1035,
3570,
1007,
2079,
1064,
1035,
1064,
2995,
2203,
5343,
13997,
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... |
opal/opal | lib/opal/compiler.rb | Opal.Compiler.compile | def compile
parse
@fragments = re_raise_with_location { process(@sexp).flatten }
@fragments << fragment("\n", nil, s(:newline)) unless @fragments.last.code.end_with?("\n")
@result = @fragments.map(&:code).join('')
end | ruby | def compile
parse
@fragments = re_raise_with_location { process(@sexp).flatten }
@fragments << fragment("\n", nil, s(:newline)) unless @fragments.last.code.end_with?("\n")
@result = @fragments.map(&:code).join('')
end | [
"def",
"compile",
"parse",
"@fragments",
"=",
"re_raise_with_location",
"{",
"process",
"(",
"@sexp",
")",
".",
"flatten",
"}",
"@fragments",
"<<",
"fragment",
"(",
"\"\\n\"",
",",
"nil",
",",
"s",
"(",
":newline",
")",
")",
"unless",
"@fragments",
".",
"l... | Compile some ruby code to a string.
@return [String] javascript code | [
"Compile",
"some",
"ruby",
"code",
"to",
"a",
"string",
"."
] | 41aedc0fd62aab00d3c117ba0caf00206bedd981 | https://github.com/opal/opal/blob/41aedc0fd62aab00d3c117ba0caf00206bedd981/lib/opal/compiler.rb#L172-L179 | train | Parse the sequence of code and return the result. | [
30522,
13366,
4012,
22090,
11968,
3366,
1030,
10341,
1027,
2128,
1035,
5333,
1035,
2007,
1035,
3295,
1063,
2832,
1006,
1030,
3348,
2361,
1007,
1012,
4257,
6528,
1065,
1030,
10341,
1026,
1026,
15778,
1006,
1000,
1032,
1050,
1000,
1010,
9152,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb | Azure::Web::Mgmt::V2018_02_01.AppServiceEnvironments.list_usages_next | def list_usages_next(next_page_link, custom_headers:nil)
response = list_usages_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_usages_next(next_page_link, custom_headers:nil)
response = list_usages_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_usages_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_usages_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"response",
"... | Get global usage metrics of an App Service Environment.
Get global usage metrics of an App Service Environment.
@param next_page_link [String] The NextLink from the previous successful call
to List operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [CsmUsageQuotaCollection] operation results. | [
"Get",
"global",
"usage",
"metrics",
"of",
"an",
"App",
"Service",
"Environment",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb#L6366-L6369 | train | Gets the list of all the available usages for a given resource group. | [
30522,
13366,
2862,
1035,
8192,
2015,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
8192,
2015,
1035,
2279,
1035,
2004,
6038,
2278,
1006,
2279,
1035,
3931,
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_marketplace_ordering/lib/2015-06-01/generated/azure_mgmt_marketplace_ordering/marketplace_agreements.rb | Azure::MarketplaceOrdering::Mgmt::V2015_06_01.MarketplaceAgreements.get_with_http_info | def get_with_http_info(publisher_id, offer_id, plan_id, custom_headers:nil)
get_async(publisher_id, offer_id, plan_id, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(publisher_id, offer_id, plan_id, custom_headers:nil)
get_async(publisher_id, offer_id, plan_id, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"publisher_id",
",",
"offer_id",
",",
"plan_id",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"publisher_id",
",",
"offer_id",
",",
"plan_id",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"end"
] | Get marketplace terms.
@param publisher_id [String] Publisher identifier string of image being
deployed.
@param offer_id [String] Offer identifier string of image being deployed.
@param plan_id [String] Plan identifier string of image being deployed.
@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",
"marketplace",
"terms",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_marketplace_ordering/lib/2015-06-01/generated/azure_mgmt_marketplace_ordering/marketplace_agreements.rb#L53-L55 | train | Gets the specified resource group. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
6674,
1035,
30524,
2004,
6038,
2278,
1006,
6674,
1035,
8909,
1010,
3749,
1035,
8909,
1010,
2933,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
20346,
2015,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/recommendations.rb | Azure::Web::Mgmt::V2018_02_01.Recommendations.list_with_http_info | def list_with_http_info(featured:nil, filter:nil, custom_headers:nil)
list_async(featured:featured, filter:filter, custom_headers:custom_headers).value!
end | ruby | def list_with_http_info(featured:nil, filter:nil, custom_headers:nil)
list_async(featured:featured, filter:filter, custom_headers:custom_headers).value!
end | [
"def",
"list_with_http_info",
"(",
"featured",
":",
"nil",
",",
"filter",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"list_async",
"(",
"featured",
":",
"featured",
",",
"filter",
":",
"filter",
",",
"custom_headers",
":custom_headers",
")",
".",
"v... | List all recommendations for a subscription.
List all recommendations for a subscription.
@param featured [Boolean] Specify <code>true</code> to return only the most
critical recommendations. The default is <code>false</code>, which returns
all recommendations.
@param filter [String] Filter is specified by using OData syntax. Example:
$filter=channel eq 'Api' or channel eq 'Notification' and startTime eq
2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain eq
duration'[PT1H|PT1M|P1D]
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"List",
"all",
"recommendations",
"for",
"a",
"subscription",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/recommendations.rb#L63-L65 | train | Gets a list of all the feature vectors in a given feature set. | [
30522,
13366,
2862,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2956,
1024,
9152,
2140,
1010,
11307,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2862,
1035,
2004,
6038,
2278,
1006,
2956,
1024,
2956,
1010,
11307,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_dns/lib/2017-09-01/generated/azure_mgmt_dns/zones.rb | Azure::Dns::Mgmt::V2017_09_01.Zones.begin_delete_with_http_info | def begin_delete_with_http_info(resource_group_name, zone_name, if_match:nil, custom_headers:nil)
begin_delete_async(resource_group_name, zone_name, if_match:if_match, custom_headers:custom_headers).value!
end | ruby | def begin_delete_with_http_info(resource_group_name, zone_name, if_match:nil, custom_headers:nil)
begin_delete_async(resource_group_name, zone_name, if_match:if_match, custom_headers:custom_headers).value!
end | [
"def",
"begin_delete_with_http_info",
"(",
"resource_group_name",
",",
"zone_name",
",",
"if_match",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"begin_delete_async",
"(",
"resource_group_name",
",",
"zone_name",
",",
"if_match",
":if_match",
",",
"custom_head... | Deletes a DNS zone. WARNING: All DNS records in the zone will also be
deleted. This operation cannot be undone.
@param resource_group_name [String] The name of the resource group. The name
is case insensitive.
@param zone_name [String] The name of the DNS zone (without a terminating
dot).
@param if_match [String] The etag of the DNS zone. Omit this value to always
delete the current zone. Specify the last-seen etag value to prevent
accidentally deleting any concurrent changes.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Deletes",
"a",
"DNS",
"zone",
".",
"WARNING",
":",
"All",
"DNS",
"records",
"in",
"the",
"zone",
"will",
"also",
"be",
"deleted",
".",
"This",
"operation",
"cannot",
"be",
"undone",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_dns/lib/2017-09-01/generated/azure_mgmt_dns/zones.rb#L553-L555 | train | Deletes a DNS zone. | [
30522,
13366,
4088,
1035,
3972,
12870,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4224,
1035,
2171,
1010,
2065,
1035,
2674,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/collection.rb | Jekyll.Collection.rearrange_docs! | def rearrange_docs!
docs_table = {}
custom_order = {}
# pre-sort to normalize default array across platforms and then proceed to create a Hash
# from that sorted array.
docs.sort.each do |doc|
docs_table[doc.relative_path] = doc
end
metadata["order"].each do |entry|
custom_order[File.join(relative_directory, entry)] = nil
end
result = Jekyll::Utils.deep_merge_hashes(custom_order, docs_table).values
result.compact!
self.docs = result
end | ruby | def rearrange_docs!
docs_table = {}
custom_order = {}
# pre-sort to normalize default array across platforms and then proceed to create a Hash
# from that sorted array.
docs.sort.each do |doc|
docs_table[doc.relative_path] = doc
end
metadata["order"].each do |entry|
custom_order[File.join(relative_directory, entry)] = nil
end
result = Jekyll::Utils.deep_merge_hashes(custom_order, docs_table).values
result.compact!
self.docs = result
end | [
"def",
"rearrange_docs!",
"docs_table",
"=",
"{",
"}",
"custom_order",
"=",
"{",
"}",
"# pre-sort to normalize default array across platforms and then proceed to create a Hash",
"# from that sorted array.",
"docs",
".",
"sort",
".",
"each",
"do",
"|",
"doc",
"|",
"docs_tabl... | Rearrange documents within the `docs` array as listed in the `metadata["order"]` array.
Involves converting the two arrays into hashes based on relative_paths as keys first, then
merging them to remove duplicates and finally retrieving the Document instances from the
merged array. | [
"Rearrange",
"documents",
"within",
"the",
"docs",
"array",
"as",
"listed",
"in",
"the",
"metadata",
"[",
"order",
"]",
"array",
"."
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/collection.rb#L273-L290 | train | rearrange the docs array | [
30522,
13366,
4373,
24388,
2063,
1035,
9986,
2015,
999,
9986,
2015,
1035,
2795,
1027,
1063,
1065,
7661,
1035,
2344,
1027,
1063,
1065,
1001,
3653,
1011,
4066,
2000,
3671,
4697,
12398,
9140,
2408,
7248,
1998,
2059,
10838,
2000,
3443,
1037,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
github/linguist | samples/Ruby/sinatra.rb | Sinatra.Base.dispatch! | def dispatch!
invoke do
static! if settings.static? && (request.get? || request.head?)
filter! :before
route!
end
rescue ::Exception => boom
invoke { handle_exception!(boom) }
ensure
filter! :after unless env['sinatra.static_file']
end | ruby | def dispatch!
invoke do
static! if settings.static? && (request.get? || request.head?)
filter! :before
route!
end
rescue ::Exception => boom
invoke { handle_exception!(boom) }
ensure
filter! :after unless env['sinatra.static_file']
end | [
"def",
"dispatch!",
"invoke",
"do",
"static!",
"if",
"settings",
".",
"static?",
"&&",
"(",
"request",
".",
"get?",
"||",
"request",
".",
"head?",
")",
"filter!",
":before",
"route!",
"end",
"rescue",
"::",
"Exception",
"=>",
"boom",
"invoke",
"{",
"handle... | Dispatch a request with error handling. | [
"Dispatch",
"a",
"request",
"with",
"error",
"handling",
"."
] | 9116c90fcbb82ac03b4b33c58cfbde1fcf745e99 | https://github.com/github/linguist/blob/9116c90fcbb82ac03b4b33c58cfbde1fcf745e99/samples/Ruby/sinatra.rb#L945-L955 | train | Dispatches the request to the controller. | [
30522,
13366,
18365,
999,
1999,
6767,
3489,
2079,
10763,
999,
2065,
10906,
1012,
10763,
1029,
1004,
1004,
1006,
5227,
1012,
2131,
1029,
1064,
1064,
5227,
1012,
2132,
1029,
1007,
11307,
999,
1024,
2077,
2799,
999,
2203,
5343,
1024,
1024,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GeorgeKaraszi/ActiveRecordExtended | lib/active_record_extended/utilities.rb | ActiveRecordExtended.Utilities.from_clause_constructor | def from_clause_constructor(from, reference_key)
case from
when /\s.?#{reference_key}.?$/ # The from clause is a string and has the tbl reference key
@scope.unscoped.from(from)
when String, Symbol
@scope.unscoped.from("#{from} #{reference_key}")
else
replicate_klass = from.respond_to?(:unscoped) ? from.unscoped : @scope.unscoped
replicate_klass.from(from.dup, reference_key)
end
end | ruby | def from_clause_constructor(from, reference_key)
case from
when /\s.?#{reference_key}.?$/ # The from clause is a string and has the tbl reference key
@scope.unscoped.from(from)
when String, Symbol
@scope.unscoped.from("#{from} #{reference_key}")
else
replicate_klass = from.respond_to?(:unscoped) ? from.unscoped : @scope.unscoped
replicate_klass.from(from.dup, reference_key)
end
end | [
"def",
"from_clause_constructor",
"(",
"from",
",",
"reference_key",
")",
"case",
"from",
"when",
"/",
"\\s",
"#{",
"reference_key",
"}",
"/",
"# The from clause is a string and has the tbl reference key",
"@scope",
".",
"unscoped",
".",
"from",
"(",
"from",
")",
"w... | Will attempt to digest and resolve the from clause
If the from clause is a String, it will check to see if a table reference key has been assigned.
- If one cannot be detected, one will be appended.
- Rails does not allow assigning table references using the `.from/2` method, when its a string / sym type.
If the from clause is an AR relation; it will duplicate the object.
- Ensures any memorizers are reset (ex: `.to_sql` sets a memorizer on the instance)
- Key's can be assigned using the `.from/2` method. | [
"Will",
"attempt",
"to",
"digest",
"and",
"resolve",
"the",
"from",
"clause"
] | aca74eebb64b9957a2c8765bef6e43c7d5736fd8 | https://github.com/GeorgeKaraszi/ActiveRecordExtended/blob/aca74eebb64b9957a2c8765bef6e43c7d5736fd8/lib/active_record_extended/utilities.rb#L65-L75 | train | This method is called when the from clause is a string or symbol | [
30522,
13366,
2013,
1035,
11075,
1035,
9570,
2953,
1006,
2013,
1010,
4431,
1035,
3145,
1007,
2553,
2013,
2043,
1013,
1032,
1055,
1012,
1029,
1001,
1063,
4431,
1035,
3145,
1065,
1012,
1029,
1002,
1013,
1001,
1996,
2013,
11075,
2003,
1037,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hashicorp/vagrant | lib/vagrant/machine.rb | Vagrant.Machine.reload | def reload
old_id = @id
@id = nil
if @data_dir
# Read the id file from the data directory if it exists as the
# ID for the pre-existing physical representation of this machine.
id_file = @data_dir.join("id")
id_content = id_file.read.strip if id_file.file?
if !id_content.to_s.empty?
@id = id_content
end
end
if @id != old_id && @provider
# It changed, notify the provider
@provider.machine_id_changed
end
@id
end | ruby | def reload
old_id = @id
@id = nil
if @data_dir
# Read the id file from the data directory if it exists as the
# ID for the pre-existing physical representation of this machine.
id_file = @data_dir.join("id")
id_content = id_file.read.strip if id_file.file?
if !id_content.to_s.empty?
@id = id_content
end
end
if @id != old_id && @provider
# It changed, notify the provider
@provider.machine_id_changed
end
@id
end | [
"def",
"reload",
"old_id",
"=",
"@id",
"@id",
"=",
"nil",
"if",
"@data_dir",
"# Read the id file from the data directory if it exists as the",
"# ID for the pre-existing physical representation of this machine.",
"id_file",
"=",
"@data_dir",
".",
"join",
"(",
"\"id\"",
")",
"... | This reloads the ID of the underlying machine. | [
"This",
"reloads",
"the",
"ID",
"of",
"the",
"underlying",
"machine",
"."
] | c22a145c59790c098f95d50141d9afb48e1ef55f | https://github.com/hashicorp/vagrant/blob/c22a145c59790c098f95d50141d9afb48e1ef55f/lib/vagrant/machine.rb#L394-L414 | train | Reload the id file from the data directory if it exists. | [
30522,
13366,
2128,
11066,
2214,
1035,
8909,
1027,
1030,
8909,
1030,
8909,
1027,
9152,
2140,
2065,
1030,
2951,
1035,
30524,
4493,
3558,
6630,
1997,
2023,
3698,
1012,
8909,
1035,
5371,
1027,
1030,
2951,
1035,
16101,
1012,
3693,
1006,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb | Azure::KeyVault::V2016_10_01.KeyVaultClient.delete_certificate_issuer | def delete_certificate_issuer(vault_base_url, issuer_name, custom_headers:nil)
response = delete_certificate_issuer_async(vault_base_url, issuer_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def delete_certificate_issuer(vault_base_url, issuer_name, custom_headers:nil)
response = delete_certificate_issuer_async(vault_base_url, issuer_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"delete_certificate_issuer",
"(",
"vault_base_url",
",",
"issuer_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_certificate_issuer_async",
"(",
"vault_base_url",
",",
"issuer_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"val... | Deletes the specified certificate issuer.
The DeleteCertificateIssuer operation permanently removes the specified
certificate issuer from the vault. This operation requires the
certificates/manageissuers/deleteissuers permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param issuer_name [String] The name of the issuer.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [IssuerBundle] operation results. | [
"Deletes",
"the",
"specified",
"certificate",
"issuer",
"."
] | 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#L5048-L5051 | train | Deletes the certificate issuer. | [
30522,
13366,
3972,
12870,
1035,
8196,
1035,
3277,
2099,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
3277,
2099,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
1035,
8196,
1035,
3277,
2099,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
guard/guard | lib/guard/runner.rb | Guard.Runner._supervise | def _supervise(plugin, task, *args)
catch self.class.stopping_symbol_for(plugin) do
plugin.hook("#{ task }_begin", *args)
result = UI.options.with_progname(plugin.class.name) do
begin
plugin.send(task, *args)
rescue Interrupt
throw(:task_has_failed)
end
end
plugin.hook("#{ task }_end", result)
result
end
rescue ScriptError, StandardError, RuntimeError
UI.error("#{ plugin.class.name } failed to achieve its"\
" <#{ task }>, exception was:" \
"\n#{ $!.class }: #{ $!.message }" \
"\n#{ $!.backtrace.join("\n") }")
Guard.state.session.plugins.remove(plugin)
UI.info("\n#{ plugin.class.name } has just been fired")
$!
end | ruby | def _supervise(plugin, task, *args)
catch self.class.stopping_symbol_for(plugin) do
plugin.hook("#{ task }_begin", *args)
result = UI.options.with_progname(plugin.class.name) do
begin
plugin.send(task, *args)
rescue Interrupt
throw(:task_has_failed)
end
end
plugin.hook("#{ task }_end", result)
result
end
rescue ScriptError, StandardError, RuntimeError
UI.error("#{ plugin.class.name } failed to achieve its"\
" <#{ task }>, exception was:" \
"\n#{ $!.class }: #{ $!.message }" \
"\n#{ $!.backtrace.join("\n") }")
Guard.state.session.plugins.remove(plugin)
UI.info("\n#{ plugin.class.name } has just been fired")
$!
end | [
"def",
"_supervise",
"(",
"plugin",
",",
"task",
",",
"*",
"args",
")",
"catch",
"self",
".",
"class",
".",
"stopping_symbol_for",
"(",
"plugin",
")",
"do",
"plugin",
".",
"hook",
"(",
"\"#{ task }_begin\"",
",",
"args",
")",
"result",
"=",
"UI",
".",
... | Run a Guard plugin task, but remove the Guard plugin when his work leads
to a system failure.
When the Group has `:halt_on_fail` disabled, we've to catch
`:task_has_failed` here in order to avoid an uncaught throw error.
@param [Guard::Plugin] plugin guard the Guard to execute
@param [Symbol] task the task to run
@param [Array] args the arguments for the task
@raise [:task_has_failed] when task has failed | [
"Run",
"a",
"Guard",
"plugin",
"task",
"but",
"remove",
"the",
"Guard",
"plugin",
"when",
"his",
"work",
"leads",
"to",
"a",
"system",
"failure",
"."
] | e2508cd83badf0d537dbaba35d307adc35d92e4f | https://github.com/guard/guard/blob/e2508cd83badf0d537dbaba35d307adc35d92e4f/lib/guard/runner.rb#L78-L99 | train | This method is called by the supervise method. | [
30522,
13366,
1035,
28589,
1006,
13354,
2378,
1010,
4708,
1010,
1008,
12098,
5620,
1007,
4608,
2969,
1012,
2465,
1012,
7458,
1035,
6454,
1035,
2005,
1006,
13354,
2378,
1007,
2079,
13354,
2378,
1012,
8103,
1006,
1000,
1001,
1063,
4708,
1065,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_usages_as_lazy | def list_multi_role_usages_as_lazy(resource_group_name, name, custom_headers:nil)
response = list_multi_role_usages_async(resource_group_name, name, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_multi_role_usages_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_multi_role_usages_as_lazy(resource_group_name, name, custom_headers:nil)
response = list_multi_role_usages_async(resource_group_name, name, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_multi_role_usages_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_multi_role_usages_as_lazy",
"(",
"resource_group_name",
",",
"name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_multi_role_usages_async",
"(",
"resource_group_name",
",",
"name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value... | Get usage metrics for a multi-role pool of an App Service Environment.
Get usage metrics for a multi-role pool of an App Service Environment.
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param name [String] Name of the App Service Environment.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [UsageCollection] which provide lazy access to pages of the response. | [
"Get",
"usage",
"metrics",
"for",
"a",
"multi",
"-",
"role",
"pool",
"of",
"an",
"App",
"Service",
"Environment",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb#L7720-L7729 | train | Gets a list of all the managed managed | [
30522,
13366,
2862,
1035,
4800,
1035,
2535,
1035,
8192,
2015,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
4800,
1035,
2535,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/jobs.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.Jobs.list_by_device | def list_by_device(device_name, resource_group_name, manager_name, filter:nil, custom_headers:nil)
first_page = list_by_device_as_lazy(device_name, resource_group_name, manager_name, filter:filter, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_by_device(device_name, resource_group_name, manager_name, filter:nil, custom_headers:nil)
first_page = list_by_device_as_lazy(device_name, resource_group_name, manager_name, filter:filter, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_by_device",
"(",
"device_name",
",",
"resource_group_name",
",",
"manager_name",
",",
"filter",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_by_device_as_lazy",
"(",
"device_name",
",",
"resource_group_name",
",",
"manage... | Gets all the jobs for specified device. With optional OData query parameters,
a filtered set of jobs is returned.
@param device_name [String] The device name
@param resource_group_name [String] The resource group name
@param manager_name [String] The manager name
@param filter [String] OData Filter options
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<Job>] operation results. | [
"Gets",
"all",
"the",
"jobs",
"for",
"specified",
"device",
".",
"With",
"optional",
"OData",
"query",
"parameters",
"a",
"filtered",
"set",
"of",
"jobs",
"is",
"returned",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/jobs.rb#L37-L40 | train | Gets all the segmentation of the virtual machine. | [
30522,
13366,
2862,
1035,
2011,
1035,
5080,
1006,
5080,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
11307,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
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... |
square/connect-ruby-sdk | lib/square_connect/models/catalog_modifier_override.rb | SquareConnect.CatalogModifierOverride.modifier_id= | def modifier_id=(modifier_id)
if modifier_id.nil?
fail ArgumentError, "modifier_id cannot be nil"
end
if modifier_id.to_s.length < 1
fail ArgumentError, "invalid value for 'modifier_id', the character length must be great than or equal to 1."
end
@modifier_id = modifier_id
end | ruby | def modifier_id=(modifier_id)
if modifier_id.nil?
fail ArgumentError, "modifier_id cannot be nil"
end
if modifier_id.to_s.length < 1
fail ArgumentError, "invalid value for 'modifier_id', the character length must be great than or equal to 1."
end
@modifier_id = modifier_id
end | [
"def",
"modifier_id",
"=",
"(",
"modifier_id",
")",
"if",
"modifier_id",
".",
"nil?",
"fail",
"ArgumentError",
",",
"\"modifier_id cannot be nil\"",
"end",
"if",
"modifier_id",
".",
"to_s",
".",
"length",
"<",
"1",
"fail",
"ArgumentError",
",",
"\"invalid value fo... | Custom attribute writer method with validation
@param [Object] modifier_id Value to be assigned | [
"Custom",
"attribute",
"writer",
"method",
"with",
"validation"
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/models/catalog_modifier_override.rb#L81-L91 | train | Set the modifier_id of the object. | [
30522,
13366,
16913,
18095,
1035,
8909,
1027,
1006,
16913,
18095,
1035,
8909,
1007,
2065,
16913,
18095,
1035,
8909,
1012,
9152,
2140,
1029,
8246,
6685,
2121,
29165,
1010,
1000,
16913,
18095,
1035,
8909,
3685,
2022,
9152,
2140,
1000,
2203,
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... |
backup/backup | lib/backup/model.rb | Backup.Model.store_with | def store_with(name, storage_id = nil, &block)
@storages << get_class_from_scope(Storage, name)
.new(self, storage_id, &block)
end | ruby | def store_with(name, storage_id = nil, &block)
@storages << get_class_from_scope(Storage, name)
.new(self, storage_id, &block)
end | [
"def",
"store_with",
"(",
"name",
",",
"storage_id",
"=",
"nil",
",",
"&",
"block",
")",
"@storages",
"<<",
"get_class_from_scope",
"(",
"Storage",
",",
"name",
")",
".",
"new",
"(",
"self",
",",
"storage_id",
",",
"block",
")",
"end"
] | Adds an Storage. Multiple Storages may be added to the model. | [
"Adds",
"an",
"Storage",
".",
"Multiple",
"Storages",
"may",
"be",
"added",
"to",
"the",
"model",
"."
] | 64370f925e859f858766b674717a3dbee0de7a26 | https://github.com/backup/backup/blob/64370f925e859f858766b674717a3dbee0de7a26/lib/backup/model.rb#L149-L152 | train | Stores a new object in the storage. | [
30522,
13366,
3573,
1035,
2007,
1006,
2171,
1010,
5527,
1035,
8909,
1027,
9152,
2140,
1010,
1004,
3796,
1007,
1030,
5527,
2015,
1026,
1026,
2131,
1035,
2465,
1035,
2013,
1035,
9531,
1006,
5527,
1010,
2171,
1007,
1012,
2047,
1006,
2969,
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_compute/lib/2018-09-30/generated/azure_mgmt_compute/disks.rb | Azure::Compute::Mgmt::V2018_09_30.Disks.begin_create_or_update_with_http_info | def begin_create_or_update_with_http_info(resource_group_name, disk_name, disk, custom_headers:nil)
begin_create_or_update_async(resource_group_name, disk_name, disk, custom_headers:custom_headers).value!
end | ruby | def begin_create_or_update_with_http_info(resource_group_name, disk_name, disk, custom_headers:nil)
begin_create_or_update_async(resource_group_name, disk_name, disk, custom_headers:custom_headers).value!
end | [
"def",
"begin_create_or_update_with_http_info",
"(",
"resource_group_name",
",",
"disk_name",
",",
"disk",
",",
"custom_headers",
":",
"nil",
")",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"disk_name",
",",
"disk",
",",
"custom_headers",
":custom_he... | Creates or updates a disk.
@param resource_group_name [String] The name of the resource group.
@param disk_name [String] The name of the managed disk that is being created.
The name can't be changed after the disk is created. Supported characters for
the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters.
@param disk [Disk] Disk object supplied in the body of the Put disk
operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Creates",
"or",
"updates",
"a",
"disk",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2018-09-30/generated/azure_mgmt_compute/disks.rb#L561-L563 | train | Creates or updates a disk in a resource group. | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
9785,
1035,
2171,
1010,
9785,
1010,
7661,
1035,
20346,
2015,
30524,
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... |
square/connect-ruby-sdk | lib/square_connect/models/refund.rb | SquareConnect.Refund.valid? | def valid?
return false if @id.nil?
return false if @location_id.nil?
return false if @transaction_id.nil?
return false if @tender_id.nil?
return false if @reason.nil?
return false if @amount_money.nil?
return false if @status.nil?
status_validator = EnumAttributeValidator.new('String', ["PENDING", "APPROVED", "REJECTED", "FAILED"])
return false unless status_validator.valid?(@status)
return true
end | ruby | def valid?
return false if @id.nil?
return false if @location_id.nil?
return false if @transaction_id.nil?
return false if @tender_id.nil?
return false if @reason.nil?
return false if @amount_money.nil?
return false if @status.nil?
status_validator = EnumAttributeValidator.new('String', ["PENDING", "APPROVED", "REJECTED", "FAILED"])
return false unless status_validator.valid?(@status)
return true
end | [
"def",
"valid?",
"return",
"false",
"if",
"@id",
".",
"nil?",
"return",
"false",
"if",
"@location_id",
".",
"nil?",
"return",
"false",
"if",
"@transaction_id",
".",
"nil?",
"return",
"false",
"if",
"@tender_id",
".",
"nil?",
"return",
"false",
"if",
"@reason... | Check to see if the all the properties in the model are valid
@return true if the model is valid | [
"Check",
"to",
"see",
"if",
"the",
"all",
"the",
"properties",
"in",
"the",
"model",
"are",
"valid"
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/models/refund.rb#L188-L199 | train | Returns true if the object is valid for the given order. | [
30522,
13366,
9398,
1029,
2709,
6270,
2065,
1030,
8909,
1012,
9152,
2140,
1029,
2709,
6270,
2065,
1030,
3295,
1035,
8909,
1012,
9152,
2140,
1029,
2709,
6270,
2065,
1030,
12598,
1035,
8909,
1012,
9152,
2140,
1029,
2709,
6270,
2065,
1030,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb | Aws::EC2.Resource.create_security_group | def create_security_group(options = {})
resp = @client.create_security_group(options)
SecurityGroup.new(
id: resp.data.group_id,
client: @client
)
end | ruby | def create_security_group(options = {})
resp = @client.create_security_group(options)
SecurityGroup.new(
id: resp.data.group_id,
client: @client
)
end | [
"def",
"create_security_group",
"(",
"options",
"=",
"{",
"}",
")",
"resp",
"=",
"@client",
".",
"create_security_group",
"(",
"options",
")",
"SecurityGroup",
".",
"new",
"(",
"id",
":",
"resp",
".",
"data",
".",
"group_id",
",",
"client",
":",
"@client",... | @example Request syntax with placeholder values
securitygroup = ec2.create_security_group({
description: "String", # required
group_name: "String", # required
vpc_id: "String",
dry_run: false,
})
@param [Hash] options ({})
@option options [required, String] :description
A description for the security group. This is informational only.
Constraints: Up to 255 characters in length
Constraints for EC2-Classic: ASCII characters
Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and
.\_-:/()#,@\[\]+=&;\\\{\\}!$*
@option options [required, String] :group_name
The name of the security group.
Constraints: Up to 255 characters in length. Cannot start with `sg-`.
Constraints for EC2-Classic: ASCII characters
Constraints for EC2-VPC: a-z, A-Z, 0-9, spaces, and
.\_-:/()#,@\[\]+=&;\\\{\\}!$*
@option options [String] :vpc_id
\[EC2-VPC\] The ID of the VPC. Required for EC2-VPC.
@option options [Boolean] :dry_run
Checks whether you have the required permissions for the action,
without actually making the request, and provides an error response.
If you have the required permissions, the error response is
`DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
@return [SecurityGroup] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb#L715-L721 | train | Creates a new security group | [
30522,
13366,
3443,
1035,
3036,
1035,
2177,
1006,
7047,
1027,
1063,
1065,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
3443,
1035,
3036,
1035,
2177,
1006,
7047,
1007,
3036,
17058,
1012,
2047,
1006,
8909,
1024,
24501,
2361,
1012,
2951,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rmosolgo/graphql-ruby | lib/graphql/dig.rb | GraphQL.Dig.dig | def dig(own_key, *rest_keys)
val = self[own_key]
if val.nil? || rest_keys.empty?
val
else
val.dig(*rest_keys)
end
end | ruby | def dig(own_key, *rest_keys)
val = self[own_key]
if val.nil? || rest_keys.empty?
val
else
val.dig(*rest_keys)
end
end | [
"def",
"dig",
"(",
"own_key",
",",
"*",
"rest_keys",
")",
"val",
"=",
"self",
"[",
"own_key",
"]",
"if",
"val",
".",
"nil?",
"||",
"rest_keys",
".",
"empty?",
"val",
"else",
"val",
".",
"dig",
"(",
"rest_keys",
")",
"end",
"end"
] | implemented using the old activesupport #dig instead of the ruby built-in
so we can use some of the magic in Schema::InputObject and Query::Arguments
to handle stringified/symbolized keys.
@param args [Array<[String, Symbol>] Retrieves the value object corresponding to the each key objects repeatedly
@return [Object] | [
"implemented",
"using",
"the",
"old",
"activesupport",
"#dig",
"instead",
"of",
"the",
"ruby",
"built",
"-",
"in",
"so",
"we",
"can",
"use",
"some",
"of",
"the",
"magic",
"in",
"Schema",
"::",
"InputObject",
"and",
"Query",
"::",
"Arguments",
"to",
"handle... | d5be13a816f220b9efbabeaa69a3e56fedf311f5 | https://github.com/rmosolgo/graphql-ruby/blob/d5be13a816f220b9efbabeaa69a3e56fedf311f5/lib/graphql/dig.rb#L10-L17 | train | dig returns a new object with the given key and rest keys | [
30522,
13366,
10667,
1006,
2219,
1035,
3145,
1010,
1008,
2717,
1035,
6309,
1007,
11748,
1027,
2969,
1031,
2219,
1035,
3145,
1033,
2065,
11748,
1012,
9152,
2140,
1029,
1064,
1064,
2717,
1035,
6309,
1012,
4064,
1029,
11748,
2842,
11748,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jekyll/jekyll | lib/jekyll/page.rb | Jekyll.Page.process | def process(name)
self.ext = File.extname(name)
self.basename = name[0..-ext.length - 1].gsub(%r!\.*\z!, "")
end | ruby | def process(name)
self.ext = File.extname(name)
self.basename = name[0..-ext.length - 1].gsub(%r!\.*\z!, "")
end | [
"def",
"process",
"(",
"name",
")",
"self",
".",
"ext",
"=",
"File",
".",
"extname",
"(",
"name",
")",
"self",
".",
"basename",
"=",
"name",
"[",
"0",
"..",
"-",
"ext",
".",
"length",
"-",
"1",
"]",
".",
"gsub",
"(",
"%r!",
"\\.",
"\\z",
"!",
... | Extract information from the page filename.
name - The String filename of the page file.
NOTE: `String#gsub` removes all trailing periods (in comparison to `String#chomp`)
Returns nothing. | [
"Extract",
"information",
"from",
"the",
"page",
"filename",
"."
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/page.rb#L121-L124 | train | process the file name | [
30522,
13366,
2832,
1006,
2171,
1007,
2969,
1012,
4654,
2102,
1027,
5371,
1012,
4654,
2102,
18442,
1006,
2171,
1007,
2969,
1012,
2918,
18442,
1027,
2171,
1031,
1014,
1012,
1012,
1011,
4654,
2102,
1012,
3091,
1011,
1015,
1033,
1012,
28177,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_link_tree_directive | def process_link_tree_directive(path = ".", accept = nil)
path = expand_relative_dirname(:link_tree, path)
accept = expand_accept_shorthand(accept)
link_paths(*@environment.stat_sorted_tree_with_dependencies(path), accept)
end | ruby | def process_link_tree_directive(path = ".", accept = nil)
path = expand_relative_dirname(:link_tree, path)
accept = expand_accept_shorthand(accept)
link_paths(*@environment.stat_sorted_tree_with_dependencies(path), accept)
end | [
"def",
"process_link_tree_directive",
"(",
"path",
"=",
"\".\"",
",",
"accept",
"=",
"nil",
")",
"path",
"=",
"expand_relative_dirname",
"(",
":link_tree",
",",
"path",
")",
"accept",
"=",
"expand_accept_shorthand",
"(",
"accept",
")",
"link_paths",
"(",
"@envir... | `link_tree` links all the nested files in a directory.
Its glob equivalent is `path/**/*`.
//= link_tree "./images"
Use caution when linking against JS or CSS assets. Include an explicit
extension or content type in these cases.
//= link_tree "./styles" .css | [
"link_tree",
"links",
"all",
"the",
"nested",
"files",
"in",
"a",
"directory",
".",
"Its",
"glob",
"equivalent",
"is",
"path",
"/",
"**",
"/",
"*",
"."
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/directive_processor.rb#L340-L344 | train | Process the link_tree directive | [
30522,
13366,
2832,
1035,
4957,
1035,
3392,
1035,
16449,
1006,
4130,
1027,
1000,
1012,
1000,
1010,
5138,
1027,
9152,
2140,
1007,
4130,
1027,
7818,
1035,
5816,
1035,
16101,
18442,
1006,
1024,
4957,
1035,
3392,
1010,
4130,
1007,
5138,
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... |
palkan/logidze | lib/logidze/model.rb | Logidze.Model.redo! | def redo!
version = log_data.next_version
return false if version.nil?
switch_to!(version.version)
end | ruby | def redo!
version = log_data.next_version
return false if version.nil?
switch_to!(version.version)
end | [
"def",
"redo!",
"version",
"=",
"log_data",
".",
"next_version",
"return",
"false",
"if",
"version",
".",
"nil?",
"switch_to!",
"(",
"version",
".",
"version",
")",
"end"
] | Restore record to the _future_ version (if `undo!` was applied)
Return false if no future version found, otherwise return updated record. | [
"Restore",
"record",
"to",
"the",
"_future_",
"version",
"(",
"if",
"undo!",
"was",
"applied",
")",
"Return",
"false",
"if",
"no",
"future",
"version",
"found",
"otherwise",
"return",
"updated",
"record",
"."
] | ffa0f793cb9c6fab96fa67a285341ca9aaa7ded8 | https://github.com/palkan/logidze/blob/ffa0f793cb9c6fab96fa67a285341ca9aaa7ded8/lib/logidze/model.rb#L158-L163 | train | Redo the current version of the current version of the current version. | [
30522,
13366,
2417,
2080,
999,
2544,
1027,
8833,
1035,
2951,
1012,
2279,
1035,
2544,
2709,
6270,
2065,
2544,
1012,
9152,
2140,
1029,
6942,
1035,
2000,
999,
1006,
2544,
1012,
2544,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
plataformatec/simple_form | lib/simple_form/form_builder.rb | SimpleForm.FormBuilder.input_field | def input_field(attribute_name, options = {})
components = (wrapper.components.map(&:namespace) & ATTRIBUTE_COMPONENTS)
options = options.dup
options[:input_html] = options.except(:as, :boolean_style, :collection, :disabled, :label_method, :value_method, :prompt, *components)
options = @defaults.deep_dup.deep_merge(options) if @defaults
input = find_input(attribute_name, options)
wrapper = find_wrapper(input.input_type, options)
components = build_input_field_components(components.push(:input))
SimpleForm::Wrappers::Root.new(components, wrapper.options.merge(wrapper: false)).render input
end | ruby | def input_field(attribute_name, options = {})
components = (wrapper.components.map(&:namespace) & ATTRIBUTE_COMPONENTS)
options = options.dup
options[:input_html] = options.except(:as, :boolean_style, :collection, :disabled, :label_method, :value_method, :prompt, *components)
options = @defaults.deep_dup.deep_merge(options) if @defaults
input = find_input(attribute_name, options)
wrapper = find_wrapper(input.input_type, options)
components = build_input_field_components(components.push(:input))
SimpleForm::Wrappers::Root.new(components, wrapper.options.merge(wrapper: false)).render input
end | [
"def",
"input_field",
"(",
"attribute_name",
",",
"options",
"=",
"{",
"}",
")",
"components",
"=",
"(",
"wrapper",
".",
"components",
".",
"map",
"(",
":namespace",
")",
"&",
"ATTRIBUTE_COMPONENTS",
")",
"options",
"=",
"options",
".",
"dup",
"options",
"... | Creates a input tag for the given attribute. All the given options
are sent as :input_html.
== Examples
simple_form_for @user do |f|
f.input_field :name
end
This is the output html (only the input portion, not the form):
<input class="string required" id="user_name" maxlength="100"
name="user[name]" type="text" value="Carlos" />
It also support validation classes once it is configured.
# config/initializers/simple_form.rb
SimpleForm.setup do |config|
config.input_field_valid_class = 'is-valid'
config.input_field_error_class = 'is-invalid'
end
simple_form_for @user do |f|
f.input_field :name
end
When the validation happens, the input will be rendered with
the class configured according to the validation:
- when the input is valid:
<input class="is-valid string required" id="user_name" value="Carlos" />
- when the input is invalid:
<input class="is-invalid string required" id="user_name" value="" /> | [
"Creates",
"a",
"input",
"tag",
"for",
"the",
"given",
"attribute",
".",
"All",
"the",
"given",
"options",
"are",
"sent",
"as",
":",
"input_html",
"."
] | 4dd9261ebb392e46a9beeefe8d83081e7c6e56b5 | https://github.com/plataformatec/simple_form/blob/4dd9261ebb392e46a9beeefe8d83081e7c6e56b5/lib/simple_form/form_builder.rb#L164-L176 | train | Returns the input field for the given attribute name. | [
30522,
13366,
7953,
1035,
2492,
1006,
17961,
1035,
2171,
1010,
7047,
1027,
1063,
1065,
1007,
6177,
1027,
1006,
10236,
4842,
1012,
6177,
1012,
4949,
1006,
1004,
1024,
3415,
15327,
1007,
1004,
17961,
1035,
6177,
1007,
7047,
1027,
7047,
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... |
fastlane/fastlane | spaceship/lib/spaceship/tunes/tunes_client.rb | Spaceship.TunesClient.update_iap! | def update_iap!(app_id: nil, purchase_id: nil, data: nil)
with_tunes_retry do
r = request(:put) do |req|
req.url("ra/apps/#{app_id}/iaps/#{purchase_id}")
req.body = data.to_json
req.headers['Content-Type'] = 'application/json'
end
handle_itc_response(r.body)
end
end | ruby | def update_iap!(app_id: nil, purchase_id: nil, data: nil)
with_tunes_retry do
r = request(:put) do |req|
req.url("ra/apps/#{app_id}/iaps/#{purchase_id}")
req.body = data.to_json
req.headers['Content-Type'] = 'application/json'
end
handle_itc_response(r.body)
end
end | [
"def",
"update_iap!",
"(",
"app_id",
":",
"nil",
",",
"purchase_id",
":",
"nil",
",",
"data",
":",
"nil",
")",
"with_tunes_retry",
"do",
"r",
"=",
"request",
"(",
":put",
")",
"do",
"|",
"req",
"|",
"req",
".",
"url",
"(",
"\"ra/apps/#{app_id}/iaps/#{pur... | updates an In-App-Purchases | [
"updates",
"an",
"In",
"-",
"App",
"-",
"Purchases"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/spaceship/lib/spaceship/tunes/tunes_client.rb#L1239-L1248 | train | Update an existing IAP in the specified app. | [
30522,
13366,
10651,
1035,
24264,
2361,
999,
1006,
10439,
1035,
8909,
1024,
9152,
2140,
1010,
5309,
1035,
8909,
1024,
9152,
2140,
1010,
2951,
1024,
9152,
2140,
1007,
2007,
1035,
13281,
1035,
2128,
11129,
2079,
1054,
1027,
5227,
1006,
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... |
cucumber/aruba | lib/aruba/hooks.rb | Aruba.Hooks.execute | def execute(label, context, *args)
Array(store[label.to_sym]).each do |block|
context.instance_exec(*args, &block)
end
end | ruby | def execute(label, context, *args)
Array(store[label.to_sym]).each do |block|
context.instance_exec(*args, &block)
end
end | [
"def",
"execute",
"(",
"label",
",",
"context",
",",
"*",
"args",
")",
"Array",
"(",
"store",
"[",
"label",
".",
"to_sym",
"]",
")",
".",
"each",
"do",
"|",
"block",
"|",
"context",
".",
"instance_exec",
"(",
"args",
",",
"block",
")",
"end",
"end"... | Run hook
@param [String, Symbol] label
The name of the hook
@param [Object] context
The context in which the hook is run
@param [Array] args
Other arguments | [
"Run",
"hook"
] | add17615322f575588aef1fccce875396cdf36e9 | https://github.com/cucumber/aruba/blob/add17615322f575588aef1fccce875396cdf36e9/lib/aruba/hooks.rb#L42-L46 | train | Execute the given block in the context. | [
30522,
13366,
15389,
1006,
3830,
1010,
6123,
1010,
1008,
12098,
5620,
1007,
9140,
1006,
3573,
1031,
3830,
1012,
2000,
1035,
25353,
2213,
1033,
1007,
1012,
2169,
2079,
1064,
3796,
1064,
6123,
1012,
6013,
1035,
4654,
8586,
1006,
1008,
12098,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/gateway.rb | Discordrb.Gateway.handle_dispatch | def handle_dispatch(packet)
data = packet['d']
type = packet['t'].intern
case type
when :READY
LOGGER.info("Discord using gateway protocol version: #{data['v']}, requested: #{GATEWAY_VERSION}")
@session = Session.new(data['session_id'])
@session.sequence = 0
when :RESUMED
# The RESUMED event is received after a successful op 6 (resume). It does nothing except tell the bot the
# connection is initiated (like READY would). Starting with v5, it doesn't set a new heartbeat interval anymore
# since that is handled by op 10 (HELLO).
LOGGER.info 'Resumed'
return
end
@bot.dispatch(type, data)
end | ruby | def handle_dispatch(packet)
data = packet['d']
type = packet['t'].intern
case type
when :READY
LOGGER.info("Discord using gateway protocol version: #{data['v']}, requested: #{GATEWAY_VERSION}")
@session = Session.new(data['session_id'])
@session.sequence = 0
when :RESUMED
# The RESUMED event is received after a successful op 6 (resume). It does nothing except tell the bot the
# connection is initiated (like READY would). Starting with v5, it doesn't set a new heartbeat interval anymore
# since that is handled by op 10 (HELLO).
LOGGER.info 'Resumed'
return
end
@bot.dispatch(type, data)
end | [
"def",
"handle_dispatch",
"(",
"packet",
")",
"data",
"=",
"packet",
"[",
"'d'",
"]",
"type",
"=",
"packet",
"[",
"'t'",
"]",
".",
"intern",
"case",
"type",
"when",
":READY",
"LOGGER",
".",
"info",
"(",
"\"Discord using gateway protocol version: #{data['v']}, re... | Op 0 | [
"Op",
"0"
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/gateway.rb#L694-L713 | train | Handle dispatch packet | [
30522,
13366,
5047,
1035,
18365,
1006,
14771,
1007,
2951,
1027,
14771,
1031,
1005,
1040,
1005,
1033,
2828,
1027,
14771,
1031,
1005,
1056,
1005,
1033,
1012,
25204,
2553,
2828,
2043,
1024,
3201,
8833,
4590,
1012,
18558,
1006,
1000,
12532,
410... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/changeable.rb | Mongoid.Changeable.attribute_change | def attribute_change(attr)
attr = database_field_name(attr)
[changed_attributes[attr], attributes[attr]] if attribute_changed?(attr)
end | ruby | def attribute_change(attr)
attr = database_field_name(attr)
[changed_attributes[attr], attributes[attr]] if attribute_changed?(attr)
end | [
"def",
"attribute_change",
"(",
"attr",
")",
"attr",
"=",
"database_field_name",
"(",
"attr",
")",
"[",
"changed_attributes",
"[",
"attr",
"]",
",",
"attributes",
"[",
"attr",
"]",
"]",
"if",
"attribute_changed?",
"(",
"attr",
")",
"end"
] | Get the old and new value for the provided attribute.
@example Get the attribute change.
model.attribute_change("name")
@param [ String ] attr The name of the attribute.
@return [ Array<Object> ] The old and new values.
@since 2.1.0 | [
"Get",
"the",
"old",
"and",
"new",
"value",
"for",
"the",
"provided",
"attribute",
"."
] | 56976e32610f4c2450882b0bfe14da099f0703f4 | https://github.com/mongodb/mongoid/blob/56976e32610f4c2450882b0bfe14da099f0703f4/lib/mongoid/changeable.rb#L169-L172 | train | Returns the changed attributes and the attributes. | [
30522,
13366,
17961,
1035,
2689,
1006,
2012,
16344,
1007,
2012,
16344,
1027,
7809,
1035,
2492,
1035,
2171,
1006,
2012,
16344,
1007,
1031,
2904,
1035,
12332,
1031,
2012,
16344,
1033,
1010,
12332,
1031,
2012,
16344,
1033,
1033,
2065,
17961,
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... |
rails/rails | activesupport/lib/active_support/dependencies.rb | ActiveSupport.Dependencies.autoload_module! | def autoload_module!(into, const_name, qualified_name, path_suffix)
return nil unless base_path = autoloadable_module?(path_suffix)
mod = Module.new
into.const_set const_name, mod
log("constant #{qualified_name} autoloaded (module autovivified from #{File.join(base_path, path_suffix)})")
autoloaded_constants << qualified_name unless autoload_once_paths.include?(base_path)
autoloaded_constants.uniq!
mod
end | ruby | def autoload_module!(into, const_name, qualified_name, path_suffix)
return nil unless base_path = autoloadable_module?(path_suffix)
mod = Module.new
into.const_set const_name, mod
log("constant #{qualified_name} autoloaded (module autovivified from #{File.join(base_path, path_suffix)})")
autoloaded_constants << qualified_name unless autoload_once_paths.include?(base_path)
autoloaded_constants.uniq!
mod
end | [
"def",
"autoload_module!",
"(",
"into",
",",
"const_name",
",",
"qualified_name",
",",
"path_suffix",
")",
"return",
"nil",
"unless",
"base_path",
"=",
"autoloadable_module?",
"(",
"path_suffix",
")",
"mod",
"=",
"Module",
".",
"new",
"into",
".",
"const_set",
... | Attempt to autoload the provided module name by searching for a directory
matching the expected path suffix. If found, the module is created and
assigned to +into+'s constants with the name +const_name+. Provided that
the directory was loaded from a reloadable base path, it is added to the
set of constants that are to be unloaded. | [
"Attempt",
"to",
"autoload",
"the",
"provided",
"module",
"name",
"by",
"searching",
"for",
"a",
"directory",
"matching",
"the",
"expected",
"path",
"suffix",
".",
"If",
"found",
"the",
"module",
"is",
"created",
"and",
"assigned",
"to",
"+",
"into",
"+",
... | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/dependencies.rb#L464-L472 | train | automatically autoload a module | [
30522,
13366,
8285,
11066,
1035,
11336,
999,
1006,
2046,
1010,
9530,
3367,
1035,
2171,
1010,
4591,
1035,
2171,
1010,
4130,
1035,
16809,
1007,
2709,
9152,
2140,
4983,
2918,
1035,
4130,
1027,
8285,
11066,
3085,
1035,
11336,
1029,
1006,
4130,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/haml-lint | lib/haml_lint/runner.rb | HamlLint.Runner.load_applicable_config | def load_applicable_config(options)
if options[:config]
options[:config]
elsif options[:auto_gen_config]
HamlLint::ConfigurationLoader.load_applicable_config(
options[:config_file],
exclude_files: [HamlLint::ConfigurationLoader::AUTO_GENERATED_FILE]
)
else
HamlLint::ConfigurationLoader.load_applicable_config(options[:config_file])
end
end | ruby | def load_applicable_config(options)
if options[:config]
options[:config]
elsif options[:auto_gen_config]
HamlLint::ConfigurationLoader.load_applicable_config(
options[:config_file],
exclude_files: [HamlLint::ConfigurationLoader::AUTO_GENERATED_FILE]
)
else
HamlLint::ConfigurationLoader.load_applicable_config(options[:config_file])
end
end | [
"def",
"load_applicable_config",
"(",
"options",
")",
"if",
"options",
"[",
":config",
"]",
"options",
"[",
":config",
"]",
"elsif",
"options",
"[",
":auto_gen_config",
"]",
"HamlLint",
"::",
"ConfigurationLoader",
".",
"load_applicable_config",
"(",
"options",
"[... | Returns the {HamlLint::Configuration} that should be used given the
specified options.
@param options [Hash]
@return [HamlLint::Configuration] | [
"Returns",
"the",
"{",
"HamlLint",
"::",
"Configuration",
"}",
"that",
"should",
"be",
"used",
"given",
"the",
"specified",
"options",
"."
] | 024c773667e54cf88db938c2b368977005d70ee8 | https://github.com/sds/haml-lint/blob/024c773667e54cf88db938c2b368977005d70ee8/lib/haml_lint/runner.rb#L61-L72 | train | Load the appropriate configuration file | [
30522,
13366,
7170,
1035,
12711,
1035,
9530,
8873,
2290,
1006,
7047,
1007,
2065,
7047,
1031,
1024,
9530,
8873,
2290,
1033,
7047,
1031,
1024,
9530,
8873,
2290,
1033,
3449,
5332,
2546,
7047,
1031,
1024,
8285,
1035,
8991,
1035,
9530,
8873,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/databases.rb | Azure::SQL::Mgmt::V2014_04_01.Databases.export_async | def export_async(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
# Send request
promise = begin_export_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::SQL::Mgmt::V2014_04_01::Models::ImportExportResponse.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 export_async(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
# Send request
promise = begin_export_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::SQL::Mgmt::V2014_04_01::Models::ImportExportResponse.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",
"export_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"database_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_export_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"databa... | @param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param server_name [String] The name of the server.
@param database_name [String] The name of the database to be exported.
@param parameters [ExportRequest] The required parameters for exporting a
database.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"resource_group_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"resource",
"group",
"that",
"contains",
"the",
"resource",
".",
"You",
"can",
"obtain",
"this",
"value",
"from",
"the",
"Azure",
"Resource",
"Manager",
"API",
"or",
"the",
"por... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/databases.rb#L1101-L1117 | train | Export a database to a SQL server. | [
30522,
13366,
9167,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
7809,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,
4088,
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_serialconsole/lib/2018-05-01/generated/azure_mgmt_serialconsole/console.rb | Azure::Serialconsole::Mgmt::V2018_05_01.Console.enable_console | def enable_console(custom_headers:nil)
response = enable_console_async(custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def enable_console(custom_headers:nil)
response = enable_console_async(custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"enable_console",
"(",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"enable_console_async",
"(",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"response",
".",
"nil?",
"end"
] | Enables Serial Console for a subscription
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [SetDisabledResult] operation results. | [
"Enables",
"Serial",
"Console",
"for",
"a",
"subscription"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_serialconsole/lib/2018-05-01/generated/azure_mgmt_serialconsole/console.rb#L33-L36 | train | Enables console for a container. | [
30522,
13366,
9585,
1035,
10122,
1006,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
9585,
1035,
10122,
1035,
2004,
6038,
2278,
1006,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
20346,
2015,
1007,
1012,
3643,
999,
3433,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
randym/axlsx | lib/axlsx/workbook/worksheet/worksheet.rb | Axlsx.Worksheet.initialize_page_options | def initialize_page_options(options)
@page_margins = PageMargins.new options[:page_margins] if options[:page_margins]
@page_setup = PageSetup.new options[:page_setup] if options[:page_setup]
@print_options = PrintOptions.new options[:print_options] if options[:print_options]
@header_footer = HeaderFooter.new options[:header_footer] if options[:header_footer]
@row_breaks = RowBreaks.new
@col_breaks = ColBreaks.new
end | ruby | def initialize_page_options(options)
@page_margins = PageMargins.new options[:page_margins] if options[:page_margins]
@page_setup = PageSetup.new options[:page_setup] if options[:page_setup]
@print_options = PrintOptions.new options[:print_options] if options[:print_options]
@header_footer = HeaderFooter.new options[:header_footer] if options[:header_footer]
@row_breaks = RowBreaks.new
@col_breaks = ColBreaks.new
end | [
"def",
"initialize_page_options",
"(",
"options",
")",
"@page_margins",
"=",
"PageMargins",
".",
"new",
"options",
"[",
":page_margins",
"]",
"if",
"options",
"[",
":page_margins",
"]",
"@page_setup",
"=",
"PageSetup",
".",
"new",
"options",
"[",
":page_setup",
... | Initalizes page margin, setup and print options
@param [Hash] options Options passed in from the initializer | [
"Initalizes",
"page",
"margin",
"setup",
"and",
"print",
"options"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/worksheet/worksheet.rb#L34-L41 | train | Initialize the page options | [
30522,
13366,
3988,
4697,
1035,
3931,
1035,
7047,
1006,
7047,
1007,
1030,
3931,
1035,
17034,
1027,
3931,
7849,
16529,
1012,
2047,
7047,
1031,
1024,
3931,
1035,
17034,
1033,
2065,
7047,
1031,
1024,
3931,
1035,
17034,
1033,
1030,
3931,
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... |
mongodb/mongoid | lib/mongoid/threaded.rb | Mongoid.Threaded.current_scope | def current_scope(klass = nil)
if klass && Thread.current[CURRENT_SCOPE_KEY].respond_to?(:keys)
Thread.current[CURRENT_SCOPE_KEY][
Thread.current[CURRENT_SCOPE_KEY].keys.find { |k| k <= klass }
]
else
Thread.current[CURRENT_SCOPE_KEY]
end
end | ruby | def current_scope(klass = nil)
if klass && Thread.current[CURRENT_SCOPE_KEY].respond_to?(:keys)
Thread.current[CURRENT_SCOPE_KEY][
Thread.current[CURRENT_SCOPE_KEY].keys.find { |k| k <= klass }
]
else
Thread.current[CURRENT_SCOPE_KEY]
end
end | [
"def",
"current_scope",
"(",
"klass",
"=",
"nil",
")",
"if",
"klass",
"&&",
"Thread",
".",
"current",
"[",
"CURRENT_SCOPE_KEY",
"]",
".",
"respond_to?",
"(",
":keys",
")",
"Thread",
".",
"current",
"[",
"CURRENT_SCOPE_KEY",
"]",
"[",
"Thread",
".",
"curren... | Get the current Mongoid scope.
@example Get the scope.
Threaded.current_scope(klass)
Threaded.current_scope
@param [ Klass ] klass The class type of the scope.
@return [ Criteria ] The scope.
@since 5.0.0 | [
"Get",
"the",
"current",
"Mongoid",
"scope",
"."
] | 56976e32610f4c2450882b0bfe14da099f0703f4 | https://github.com/mongodb/mongoid/blob/56976e32610f4c2450882b0bfe14da099f0703f4/lib/mongoid/threaded.rb#L228-L236 | train | Returns the current scope of the current thread | [
30522,
13366,
2783,
1035,
9531,
1006,
1047,
27102,
1027,
9152,
2140,
1007,
2065,
1047,
27102,
1004,
1004,
11689,
1012,
2783,
1031,
2783,
1035,
9531,
1035,
3145,
1033,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
6309,
1007,
11689,
1012,
2783,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
heroku/legacy-cli | lib/heroku/command/domains.rb | Heroku::Command.Domains.add | def add
unless domain = shift_argument
error("Usage: heroku domains:add DOMAIN\nMust specify DOMAIN to add.")
end
validate_arguments!
domain = action("Adding #{domain} to #{app}") do
api.post_domains_v3_domain_cname(app, domain).body
end
output_with_bang "Configure your app's DNS provider to point to the DNS Target #{domain['cname']}"
output_with_bang "For help, see https://devcenter.heroku.com/articles/custom-domains"
end | ruby | def add
unless domain = shift_argument
error("Usage: heroku domains:add DOMAIN\nMust specify DOMAIN to add.")
end
validate_arguments!
domain = action("Adding #{domain} to #{app}") do
api.post_domains_v3_domain_cname(app, domain).body
end
output_with_bang "Configure your app's DNS provider to point to the DNS Target #{domain['cname']}"
output_with_bang "For help, see https://devcenter.heroku.com/articles/custom-domains"
end | [
"def",
"add",
"unless",
"domain",
"=",
"shift_argument",
"error",
"(",
"\"Usage: heroku domains:add DOMAIN\\nMust specify DOMAIN to add.\"",
")",
"end",
"validate_arguments!",
"domain",
"=",
"action",
"(",
"\"Adding #{domain} to #{app}\"",
")",
"do",
"api",
".",
"post_domai... | domains:add DOMAIN
add a custom domain to an app
Examples:
$ heroku domains:add example.com
Adding example.com to example... done
! Configure your app's DNS provider to point to the DNS Target example.herokuapp.com
! For help with custom domains, see https://devcenter.heroku.com/articles/custom-domains | [
"domains",
":",
"add",
"DOMAIN"
] | 6f18521a258394bfb79e6b36f7160ad8559a8e16 | https://github.com/heroku/legacy-cli/blob/6f18521a258394bfb79e6b36f7160ad8559a8e16/lib/heroku/command/domains.rb#L61-L71 | train | Add a domain to the app | [
30522,
13366,
5587,
4983,
5884,
1027,
5670,
1035,
6685,
7561,
1006,
1000,
8192,
1024,
5394,
5283,
13100,
1024,
5587,
5884,
1032,
13221,
19966,
20648,
5884,
2000,
5587,
1012,
1000,
1007,
2203,
9398,
3686,
1035,
9918,
999,
5884,
1027,
2895,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/box_metadata.rb | Vagrant.BoxMetadata.version | def version(version, **opts)
requirements = version.split(",").map do |v|
Gem::Requirement.new(v.strip)
end
providers = nil
providers = Array(opts[:provider]).map(&:to_sym) if opts[:provider]
@version_map.keys.sort.reverse.each do |v|
next if !requirements.all? { |r| r.satisfied_by?(v) }
version = Version.new(@version_map[v])
next if (providers & version.providers).empty? if providers
return version
end
nil
end | ruby | def version(version, **opts)
requirements = version.split(",").map do |v|
Gem::Requirement.new(v.strip)
end
providers = nil
providers = Array(opts[:provider]).map(&:to_sym) if opts[:provider]
@version_map.keys.sort.reverse.each do |v|
next if !requirements.all? { |r| r.satisfied_by?(v) }
version = Version.new(@version_map[v])
next if (providers & version.providers).empty? if providers
return version
end
nil
end | [
"def",
"version",
"(",
"version",
",",
"**",
"opts",
")",
"requirements",
"=",
"version",
".",
"split",
"(",
"\",\"",
")",
".",
"map",
"do",
"|",
"v",
"|",
"Gem",
"::",
"Requirement",
".",
"new",
"(",
"v",
".",
"strip",
")",
"end",
"providers",
"="... | Loads the metadata associated with the box from the given
IO.
@param [IO] io An IO object to read the metadata from.
Returns data about a single version that is included in this
metadata.
@param [String] version The version to return, this can also
be a constraint.
@return [Version] The matching version or nil if a matching
version was not found. | [
"Loads",
"the",
"metadata",
"associated",
"with",
"the",
"box",
"from",
"the",
"given",
"IO",
"."
] | c22a145c59790c098f95d50141d9afb48e1ef55f | https://github.com/hashicorp/vagrant/blob/c22a145c59790c098f95d50141d9afb48e1ef55f/lib/vagrant/box_metadata.rb#L51-L67 | train | Returns the version object for the given version. | [
30522,
13366,
2544,
1006,
2544,
1010,
1008,
1008,
23569,
2015,
1007,
5918,
1027,
2544,
1012,
3975,
1006,
1000,
1010,
1000,
1007,
1012,
4949,
2079,
1064,
1058,
1064,
17070,
1024,
1024,
9095,
1012,
2047,
1006,
1058,
1012,
6167,
1007,
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... |
mojombo/chronic | lib/chronic/handlers.rb | Chronic.Handlers.handle_s_r_p_a | def handle_s_r_p_a(tokens, options)
anchor_span = get_anchor(tokens[3..tokens.size - 1], options)
handle_srp(tokens, anchor_span, options)
end | ruby | def handle_s_r_p_a(tokens, options)
anchor_span = get_anchor(tokens[3..tokens.size - 1], options)
handle_srp(tokens, anchor_span, options)
end | [
"def",
"handle_s_r_p_a",
"(",
"tokens",
",",
"options",
")",
"anchor_span",
"=",
"get_anchor",
"(",
"tokens",
"[",
"3",
"..",
"tokens",
".",
"size",
"-",
"1",
"]",
",",
"options",
")",
"handle_srp",
"(",
"tokens",
",",
"anchor_span",
",",
"options",
")",... | Handle scalar/repeater/pointer/anchor | [
"Handle",
"scalar",
"/",
"repeater",
"/",
"pointer",
"/",
"anchor"
] | 2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c | https://github.com/mojombo/chronic/blob/2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c/lib/chronic/handlers.rb#L468-L471 | train | Handles the SRP and SRP tokens. | [
30522,
13366,
5047,
1035,
1055,
1035,
1054,
1035,
1052,
1035,
1037,
1006,
19204,
2015,
1010,
7047,
1007,
8133,
1035,
8487,
1027,
2131,
1035,
8133,
1006,
19204,
2015,
1031,
1017,
1012,
1012,
19204,
2015,
1012,
2946,
1011,
1015,
1033,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb | Azure::CognitiveServices::ComputerVision::V2_0.ComputerVisionClient.tag_image | def tag_image(url, language:nil, custom_headers:nil)
response = tag_image_async(url, language:language, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def tag_image(url, language:nil, custom_headers:nil)
response = tag_image_async(url, language:language, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"tag_image",
"(",
"url",
",",
"language",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"tag_image_async",
"(",
"url",
",",
"language",
":",
"language",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
"... | This operation generates a list of words, or tags, that are relevant to the
content of the supplied image. The Computer Vision API can return tags based
on objects, living beings, scenery or actions found in images. Unlike
categories, tags are not organized according to a hierarchical classification
system, but correspond to image content. Tags may contain hints to avoid
ambiguity or provide context, for example the tag "cello" may be accompanied
by the hint "musical instrument". All tags are in English.
Two input methods are supported -- (1) Uploading an image or (2) specifying
an image URL.
A successful response will be returned in JSON. If the request failed, the
response will contain an error code and a message to help understand what
went wrong.
@param url [String] Publicly reachable URL of an image.
@param language [Enum] The desired language for output generation. If this
parameter is not specified, the default value is "en".Supported
languages:en - English, Default. es - Spanish, ja - Japanese, pt -
Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es',
'ja', 'pt', 'zh'
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [TagResult] operation results. | [
"This",
"operation",
"generates",
"a",
"list",
"of",
"words",
"or",
"tags",
"that",
"are",
"relevant",
"to",
"the",
"content",
"of",
"the",
"supplied",
"image",
".",
"The",
"Computer",
"Vision",
"API",
"can",
"return",
"tags",
"based",
"on",
"objects",
"li... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb#L978-L981 | train | Tags an image. | [
30522,
13366,
6415,
1035,
3746,
1006,
24471,
2140,
1010,
2653,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
6415,
1035,
3746,
1035,
2004,
6038,
2278,
1006,
24471,
2140,
1010,
2653,
1024,
2653,
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... |
activeadmin/activeadmin | lib/active_admin/resource_dsl.rb | ActiveAdmin.ResourceDSL.index | def index(options = {}, &block)
options[:as] ||= :table
config.set_page_presenter :index, ActiveAdmin::PagePresenter.new(options, &block)
end | ruby | def index(options = {}, &block)
options[:as] ||= :table
config.set_page_presenter :index, ActiveAdmin::PagePresenter.new(options, &block)
end | [
"def",
"index",
"(",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"options",
"[",
":as",
"]",
"||=",
":table",
"config",
".",
"set_page_presenter",
":index",
",",
"ActiveAdmin",
"::",
"PagePresenter",
".",
"new",
"(",
"options",
",",
"block",
")",
... | Configure the index page for the resource | [
"Configure",
"the",
"index",
"page",
"for",
"the",
"resource"
] | 0759c8dcf97865748c9344459162ac3c7e65a6cd | https://github.com/activeadmin/activeadmin/blob/0759c8dcf97865748c9344459162ac3c7e65a6cd/lib/active_admin/resource_dsl.rb#L83-L86 | train | Set the page presenter to be used for the index | [
30522,
13366,
5950,
1006,
7047,
1027,
1063,
1065,
1010,
1004,
3796,
1007,
7047,
1031,
1024,
2004,
1033,
1064,
1064,
1027,
1024,
2795,
9530,
8873,
2290,
1012,
2275,
1035,
3931,
1035,
10044,
1024,
5950,
1010,
3161,
4215,
10020,
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... |
decidim/decidim | decidim-core/app/controllers/concerns/decidim/participatory_space_context.rb | Decidim.ParticipatorySpaceContext.current_user_can_visit_space? | def current_user_can_visit_space?
return true unless current_participatory_space.try(:private_space?) &&
!current_participatory_space.try(:is_transparent?)
return false unless current_user
current_user.admin || current_participatory_space.users.include?(current_user)
end | ruby | def current_user_can_visit_space?
return true unless current_participatory_space.try(:private_space?) &&
!current_participatory_space.try(:is_transparent?)
return false unless current_user
current_user.admin || current_participatory_space.users.include?(current_user)
end | [
"def",
"current_user_can_visit_space?",
"return",
"true",
"unless",
"current_participatory_space",
".",
"try",
"(",
":private_space?",
")",
"&&",
"!",
"current_participatory_space",
".",
"try",
"(",
":is_transparent?",
")",
"return",
"false",
"unless",
"current_user",
"... | Method for current user can visit the space (assembly or proces) | [
"Method",
"for",
"current",
"user",
"can",
"visit",
"the",
"space",
"(",
"assembly",
"or",
"proces",
")"
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/app/controllers/concerns/decidim/participatory_space_context.rb#L65-L71 | train | Returns true if the current user can visit the current space | [
30522,
13366,
2783,
1035,
5310,
1035,
2064,
1035,
3942,
1035,
2686,
1029,
2709,
2995,
4983,
2783,
1035,
2112,
28775,
4502,
7062,
1035,
2686,
1012,
3046,
1006,
1024,
2797,
1035,
2686,
1029,
1007,
1004,
1004,
999,
2783,
1035,
2112,
28775,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/application_security_groups.rb | Azure::Network::Mgmt::V2019_02_01.ApplicationSecurityGroups.begin_create_or_update_with_http_info | def begin_create_or_update_with_http_info(resource_group_name, application_security_group_name, parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, application_security_group_name, parameters, custom_headers:custom_headers).value!
end | ruby | def begin_create_or_update_with_http_info(resource_group_name, application_security_group_name, parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, application_security_group_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_create_or_update_with_http_info",
"(",
"resource_group_name",
",",
"application_security_group_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"application_security_group_name",
",",
... | Creates or updates an application security group.
@param resource_group_name [String] The name of the resource group.
@param application_security_group_name [String] The name of the application
security group.
@param parameters [ApplicationSecurityGroup] Parameters supplied to the
create or update ApplicationSecurityGroup operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Creates",
"or",
"updates",
"an",
"application",
"security",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/application_security_groups.rb#L542-L544 | train | Creates or updates an application security group. | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4646,
1035,
3036,
1035,
2177,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/spring | lib/spring/json.rb | Spring.OkJson.arrparse | def arrparse(ts)
ts = eat('[', ts)
arr = []
if ts[0][0] == ']'
return arr, ts[1..-1]
end
v, ts = valparse(ts)
arr << v
if ts[0][0] == ']'
return arr, ts[1..-1]
end
loop do
ts = eat(',', ts)
v, ts = valparse(ts)
arr << v
if ts[0][0] == ']'
return arr, ts[1..-1]
end
end
end | ruby | def arrparse(ts)
ts = eat('[', ts)
arr = []
if ts[0][0] == ']'
return arr, ts[1..-1]
end
v, ts = valparse(ts)
arr << v
if ts[0][0] == ']'
return arr, ts[1..-1]
end
loop do
ts = eat(',', ts)
v, ts = valparse(ts)
arr << v
if ts[0][0] == ']'
return arr, ts[1..-1]
end
end
end | [
"def",
"arrparse",
"(",
"ts",
")",
"ts",
"=",
"eat",
"(",
"'['",
",",
"ts",
")",
"arr",
"=",
"[",
"]",
"if",
"ts",
"[",
"0",
"]",
"[",
"0",
"]",
"==",
"']'",
"return",
"arr",
",",
"ts",
"[",
"1",
"..",
"-",
"1",
"]",
"end",
"v",
",",
"t... | Parses an "array" in the sense of RFC 4627.
Returns the parsed value and any trailing tokens. | [
"Parses",
"an",
"array",
"in",
"the",
"sense",
"of",
"RFC",
"4627",
".",
"Returns",
"the",
"parsed",
"value",
"and",
"any",
"trailing",
"tokens",
"."
] | e7a36afa436fcc59b6945f68dbc08f1076e65585 | https://github.com/rails/spring/blob/e7a36afa436fcc59b6945f68dbc08f1076e65585/lib/spring/json.rb#L197-L222 | train | Parse an array of tokens | [
30522,
13366,
12098,
14536,
11650,
2063,
1006,
24529,
1007,
24529,
1027,
4521,
1006,
1005,
1031,
1005,
1010,
24529,
1007,
12098,
2099,
1027,
1031,
1033,
2065,
24529,
1031,
1014,
1033,
1031,
1014,
1033,
1027,
1027,
1005,
1033,
1005,
2709,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/virtual_wans.rb | Azure::Network::Mgmt::V2018_07_01.VirtualWANs.begin_update_tags_with_http_info | def begin_update_tags_with_http_info(resource_group_name, virtual_wanname, wanparameters, custom_headers:nil)
begin_update_tags_async(resource_group_name, virtual_wanname, wanparameters, custom_headers:custom_headers).value!
end | ruby | def begin_update_tags_with_http_info(resource_group_name, virtual_wanname, wanparameters, custom_headers:nil)
begin_update_tags_async(resource_group_name, virtual_wanname, wanparameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_update_tags_with_http_info",
"(",
"resource_group_name",
",",
"virtual_wanname",
",",
"wanparameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_update_tags_async",
"(",
"resource_group_name",
",",
"virtual_wanname",
",",
"wanparameters",
",",
"custom_hea... | Updates a VirtualWAN tags.
@param resource_group_name [String] The resource group name of the
VirtualWan.
@param virtual_wanname [String] The name of the VirtualWAN being updated.
@param wanparameters [TagsObject] Parameters supplied to Update VirtualWAN
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",
"a",
"VirtualWAN",
"tags",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/virtual_wans.rb#L589-L591 | train | Updates a virtual wan s tags. | [
30522,
13366,
4088,
1035,
10651,
1035,
22073,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7484,
1035,
10587,
4168,
1010,
14071,
28689,
22828,
2015,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
40... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cloudfoundry/bosh | src/bosh-director/lib/bosh/director/dns/power_dns_manager.rb | Bosh::Director.PowerDnsManager.flush_dns_cache | def flush_dns_cache
if @flush_command && !@flush_command.empty?
stdout, stderr, status = Open3.capture3(@flush_command)
if status == 0
@logger.debug("Flushed #{stdout.chomp} records from DNS cache")
else
@logger.warn("Failed to flush DNS cache: #{stderr.chomp}")
end
end
end | ruby | def flush_dns_cache
if @flush_command && !@flush_command.empty?
stdout, stderr, status = Open3.capture3(@flush_command)
if status == 0
@logger.debug("Flushed #{stdout.chomp} records from DNS cache")
else
@logger.warn("Failed to flush DNS cache: #{stderr.chomp}")
end
end
end | [
"def",
"flush_dns_cache",
"if",
"@flush_command",
"&&",
"!",
"@flush_command",
".",
"empty?",
"stdout",
",",
"stderr",
",",
"status",
"=",
"Open3",
".",
"capture3",
"(",
"@flush_command",
")",
"if",
"status",
"==",
"0",
"@logger",
".",
"debug",
"(",
"\"Flush... | Purge cached DNS records | [
"Purge",
"cached",
"DNS",
"records"
] | 2eaa7100879ddd20cd909cd698514746195e28b7 | https://github.com/cloudfoundry/bosh/blob/2eaa7100879ddd20cd909cd698514746195e28b7/src/bosh-director/lib/bosh/director/dns/power_dns_manager.rb#L101-L110 | train | Flushes the DNS cache | [
30522,
13366,
13862,
1035,
1040,
3619,
1035,
17053,
2065,
1030,
13862,
1035,
3094,
1004,
1004,
999,
1030,
13862,
1035,
3094,
1012,
4064,
1029,
2358,
26797,
2102,
1010,
2358,
4063,
2099,
1010,
3570,
1027,
2330,
2509,
1012,
5425,
2509,
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... |
resque/resque | lib/resque/worker.rb | Resque.Worker.perform | def perform(job)
begin
if fork_per_job?
reconnect
run_hook :after_fork, job
end
job.perform
rescue Object => e
report_failed_job(job,e)
else
log_with_severity :info, "done: #{job.inspect}"
ensure
yield job if block_given?
end
end | ruby | def perform(job)
begin
if fork_per_job?
reconnect
run_hook :after_fork, job
end
job.perform
rescue Object => e
report_failed_job(job,e)
else
log_with_severity :info, "done: #{job.inspect}"
ensure
yield job if block_given?
end
end | [
"def",
"perform",
"(",
"job",
")",
"begin",
"if",
"fork_per_job?",
"reconnect",
"run_hook",
":after_fork",
",",
"job",
"end",
"job",
".",
"perform",
"rescue",
"Object",
"=>",
"e",
"report_failed_job",
"(",
"job",
",",
"e",
")",
"else",
"log_with_severity",
"... | Processes a given job in the child. | [
"Processes",
"a",
"given",
"job",
"in",
"the",
"child",
"."
] | adb633a0f6b98b1eb5a5a85bb36ebac9309978fd | https://github.com/resque/resque/blob/adb633a0f6b98b1eb5a5a85bb36ebac9309978fd/lib/resque/worker.rb#L302-L316 | train | Perform a job | [
30522,
13366,
4685,
1006,
3105,
1007,
4088,
2065,
9292,
1035,
2566,
1035,
3105,
1029,
28667,
18256,
6593,
2448,
1035,
8103,
1024,
2044,
1035,
9292,
1010,
3105,
2203,
3105,
1012,
4685,
5343,
4874,
1027,
1028,
1041,
3189,
1035,
3478,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-10-01/generated/azure_mgmt_network/packet_captures.rb | Azure::Network::Mgmt::V2018_10_01.PacketCaptures.get_with_http_info | def get_with_http_info(resource_group_name, network_watcher_name, packet_capture_name, custom_headers:nil)
get_async(resource_group_name, network_watcher_name, packet_capture_name, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, network_watcher_name, packet_capture_name, custom_headers:nil)
get_async(resource_group_name, network_watcher_name, packet_capture_name, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"packet_capture_name",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"packet_capture_name",
",",
"custom_headers",... | Gets a packet capture session by name.
@param resource_group_name [String] The name of the resource group.
@param network_watcher_name [String] The name of the network watcher.
@param packet_capture_name [String] The name of the packet capture session.
@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",
"packet",
"capture",
"session",
"by",
"name",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-10-01/generated/azure_mgmt_network/packet_captures.rb#L99-L101 | train | Gets the specified packet capture specification. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2897,
1035,
3422,
2121,
1035,
2171,
1010,
14771,
1035,
5425,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activerecord/lib/active_record/relation/batches.rb | ActiveRecord.Batches.find_each | def find_each(start: nil, finish: nil, batch_size: 1000, error_on_ignore: nil)
if block_given?
find_in_batches(start: start, finish: finish, batch_size: batch_size, error_on_ignore: error_on_ignore) do |records|
records.each { |record| yield record }
end
else
enum_for(:find_each, start: start, finish: finish, batch_size: batch_size, error_on_ignore: error_on_ignore) do
relation = self
apply_limits(relation, start, finish).size
end
end
end | ruby | def find_each(start: nil, finish: nil, batch_size: 1000, error_on_ignore: nil)
if block_given?
find_in_batches(start: start, finish: finish, batch_size: batch_size, error_on_ignore: error_on_ignore) do |records|
records.each { |record| yield record }
end
else
enum_for(:find_each, start: start, finish: finish, batch_size: batch_size, error_on_ignore: error_on_ignore) do
relation = self
apply_limits(relation, start, finish).size
end
end
end | [
"def",
"find_each",
"(",
"start",
":",
"nil",
",",
"finish",
":",
"nil",
",",
"batch_size",
":",
"1000",
",",
"error_on_ignore",
":",
"nil",
")",
"if",
"block_given?",
"find_in_batches",
"(",
"start",
":",
"start",
",",
"finish",
":",
"finish",
",",
"bat... | Looping through a collection of records from the database
(using the Scoping::Named::ClassMethods.all method, for example)
is very inefficient since it will try to instantiate all the objects at once.
In that case, batch processing methods allow you to work
with the records in batches, thereby greatly reducing memory consumption.
The #find_each method uses #find_in_batches with a batch size of 1000 (or as
specified by the +:batch_size+ option).
Person.find_each do |person|
person.do_awesome_stuff
end
Person.where("age > 21").find_each do |person|
person.party_all_night!
end
If you do not provide a block to #find_each, it will return an Enumerator
for chaining with other methods:
Person.find_each.with_index do |person, index|
person.award_trophy(index + 1)
end
==== Options
* <tt>:batch_size</tt> - Specifies the size of the batch. Defaults to 1000.
* <tt>:start</tt> - Specifies the primary key value to start from, inclusive of the value.
* <tt>:finish</tt> - Specifies the primary key value to end at, inclusive of the value.
* <tt>:error_on_ignore</tt> - Overrides the application config to specify if an error should be raised when
an order is present in the relation.
Limits are honored, and if present there is no requirement for the batch
size: it can be less than, equal to, or greater than the limit.
The options +start+ and +finish+ are especially useful if you want
multiple workers dealing with the same processing queue. You can make
worker 1 handle all the records between id 1 and 9999 and worker 2
handle from 10000 and beyond by setting the +:start+ and +:finish+
option on each worker.
# In worker 1, let's process until 9999 records.
Person.find_each(finish: 9_999) do |person|
person.party_all_night!
end
# In worker 2, let's process from record 10_000 and onwards.
Person.find_each(start: 10_000) do |person|
person.party_all_night!
end
NOTE: It's not possible to set the order. That is automatically set to
ascending on the primary key ("id ASC") to make the batch ordering
work. This also means that this method only works when the primary key is
orderable (e.g. an integer or string).
NOTE: By its nature, batch processing is subject to race conditions if
other processes are modifying the database. | [
"Looping",
"through",
"a",
"collection",
"of",
"records",
"from",
"the",
"database",
"(",
"using",
"the",
"Scoping",
"::",
"Named",
"::",
"ClassMethods",
".",
"all",
"method",
"for",
"example",
")",
"is",
"very",
"inefficient",
"since",
"it",
"will",
"try",
... | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activerecord/lib/active_record/relation/batches.rb#L67-L78 | train | Find all records in a batch | [
30522,
13366,
2424,
1035,
2169,
1006,
2707,
1024,
9152,
2140,
1010,
3926,
1024,
9152,
2140,
1010,
14108,
1035,
2946,
1024,
6694,
1010,
7561,
1035,
2006,
1035,
8568,
1024,
9152,
2140,
1007,
2065,
3796,
1035,
2445,
1029,
2424,
1035,
1999,
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... |
fastlane/fastlane | fastlane/lib/fastlane/fast_file.rb | Fastlane.FastFile.lane | def lane(lane_name, &block)
UI.user_error!("You have to pass a block using 'do' for lane '#{lane_name}'. Make sure you read the docs on GitHub.") unless block
self.runner.add_lane(Lane.new(platform: self.current_platform,
block: block,
description: desc_collection,
name: lane_name,
is_private: false))
@desc_collection = nil # reset the collected description again for the next lane
end | ruby | def lane(lane_name, &block)
UI.user_error!("You have to pass a block using 'do' for lane '#{lane_name}'. Make sure you read the docs on GitHub.") unless block
self.runner.add_lane(Lane.new(platform: self.current_platform,
block: block,
description: desc_collection,
name: lane_name,
is_private: false))
@desc_collection = nil # reset the collected description again for the next lane
end | [
"def",
"lane",
"(",
"lane_name",
",",
"&",
"block",
")",
"UI",
".",
"user_error!",
"(",
"\"You have to pass a block using 'do' for lane '#{lane_name}'. Make sure you read the docs on GitHub.\"",
")",
"unless",
"block",
"self",
".",
"runner",
".",
"add_lane",
"(",
"Lane",
... | @!group DSL
User defines a new lane | [
"@!group",
"DSL"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/fastlane/lib/fastlane/fast_file.rb#L78-L88 | train | Add a lane to the runner | [
30522,
13366,
4644,
1006,
4644,
1035,
2171,
1010,
1004,
3796,
1007,
21318,
1012,
5310,
1035,
7561,
999,
1006,
1000,
2017,
2031,
2000,
3413,
1037,
3796,
2478,
1005,
2079,
1005,
2005,
4644,
1005,
1001,
1063,
4644,
1035,
2171,
1065,
1005,
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... |
resque/resque | lib/resque/worker.rb | Resque.Worker.prune_dead_workers | def prune_dead_workers
return unless data_store.acquire_pruning_dead_worker_lock(self, Resque.heartbeat_interval)
all_workers = Worker.all
unless all_workers.empty?
known_workers = worker_pids
all_workers_with_expired_heartbeats = Worker.all_workers_with_expired_heartbeats
end
all_workers.each do |worker|
# If the worker hasn't sent a heartbeat, remove it from the registry.
#
# If the worker hasn't ever sent a heartbeat, we won't remove it since
# the first heartbeat is sent before the worker is registred it means
# that this is a worker that doesn't support heartbeats, e.g., another
# client library or an older version of Resque. We won't touch these.
if all_workers_with_expired_heartbeats.include?(worker)
log_with_severity :info, "Pruning dead worker: #{worker}"
job_class = worker.job(false)['payload']['class'] rescue nil
worker.unregister_worker(PruneDeadWorkerDirtyExit.new(worker.to_s, job_class))
next
end
host, pid, worker_queues_raw = worker.id.split(':')
worker_queues = worker_queues_raw.split(",")
unless @queues.include?("*") || (worker_queues.to_set == @queues.to_set)
# If the worker we are trying to prune does not belong to the queues
# we are listening to, we should not touch it.
# Attempt to prune a worker from different queues may easily result in
# an unknown class exception, since that worker could easily be even
# written in different language.
next
end
next unless host == hostname
next if known_workers.include?(pid)
log_with_severity :debug, "Pruning dead worker: #{worker}"
worker.unregister_worker
end
end | ruby | def prune_dead_workers
return unless data_store.acquire_pruning_dead_worker_lock(self, Resque.heartbeat_interval)
all_workers = Worker.all
unless all_workers.empty?
known_workers = worker_pids
all_workers_with_expired_heartbeats = Worker.all_workers_with_expired_heartbeats
end
all_workers.each do |worker|
# If the worker hasn't sent a heartbeat, remove it from the registry.
#
# If the worker hasn't ever sent a heartbeat, we won't remove it since
# the first heartbeat is sent before the worker is registred it means
# that this is a worker that doesn't support heartbeats, e.g., another
# client library or an older version of Resque. We won't touch these.
if all_workers_with_expired_heartbeats.include?(worker)
log_with_severity :info, "Pruning dead worker: #{worker}"
job_class = worker.job(false)['payload']['class'] rescue nil
worker.unregister_worker(PruneDeadWorkerDirtyExit.new(worker.to_s, job_class))
next
end
host, pid, worker_queues_raw = worker.id.split(':')
worker_queues = worker_queues_raw.split(",")
unless @queues.include?("*") || (worker_queues.to_set == @queues.to_set)
# If the worker we are trying to prune does not belong to the queues
# we are listening to, we should not touch it.
# Attempt to prune a worker from different queues may easily result in
# an unknown class exception, since that worker could easily be even
# written in different language.
next
end
next unless host == hostname
next if known_workers.include?(pid)
log_with_severity :debug, "Pruning dead worker: #{worker}"
worker.unregister_worker
end
end | [
"def",
"prune_dead_workers",
"return",
"unless",
"data_store",
".",
"acquire_pruning_dead_worker_lock",
"(",
"self",
",",
"Resque",
".",
"heartbeat_interval",
")",
"all_workers",
"=",
"Worker",
".",
"all",
"unless",
"all_workers",
".",
"empty?",
"known_workers",
"=",
... | Looks for any workers which should be running on this server
and, if they're not, removes them from Redis.
This is a form of garbage collection. If a server is killed by a
hard shutdown, power failure, or something else beyond our
control, the Resque workers will not die gracefully and therefore
will leave stale state information in Redis.
By checking the current Redis state against the actual
environment, we can determine if Redis is old and clean it up a bit. | [
"Looks",
"for",
"any",
"workers",
"which",
"should",
"be",
"running",
"on",
"this",
"server",
"and",
"if",
"they",
"re",
"not",
"removes",
"them",
"from",
"Redis",
"."
] | adb633a0f6b98b1eb5a5a85bb36ebac9309978fd | https://github.com/resque/resque/blob/adb633a0f6b98b1eb5a5a85bb36ebac9309978fd/lib/resque/worker.rb#L594-L636 | train | Pruning dead workers | [
30522,
13366,
10975,
9816,
1035,
2757,
1035,
3667,
2709,
4983,
2951,
1035,
3573,
1012,
9878,
1035,
10975,
19496,
3070,
1035,
2757,
1035,
7309,
1035,
5843,
1006,
2969,
1010,
24501,
4226,
1012,
12251,
1035,
13483,
1007,
2035,
1035,
3667,
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... |
fastlane/fastlane | spaceship/lib/spaceship/two_step_or_factor_client.rb | Spaceship.Client.handle_two_step_for_device | def handle_two_step_for_device(device_id)
# Request token to device
r = request(:put) do |req|
req.url("https://idmsa.apple.com/appleauth/auth/verify/device/#{device_id}/securitycode")
update_request_headers(req)
end
# we use `Spaceship::TunesClient.new.handle_itc_response`
# since this might be from the Dev Portal, but for 2 step
Spaceship::TunesClient.new.handle_itc_response(r.body)
puts("Successfully requested notification")
code = ask("Please enter the 4 digit code: ")
puts("Requesting session...")
# Send token to server to get a valid session
r = request(:post) do |req|
req.url("https://idmsa.apple.com/appleauth/auth/verify/device/#{device_id}/securitycode")
req.headers['Content-Type'] = 'application/json'
req.body = { "code" => code.to_s }.to_json
update_request_headers(req)
end
begin
Spaceship::TunesClient.new.handle_itc_response(r.body) # this will fail if the code is invalid
rescue => ex
# If the code was entered wrong
# {
# "securityCode": {
# "code": "1234"
# },
# "securityCodeLocked": false,
# "recoveryKeyLocked": false,
# "recoveryKeySupported": true,
# "manageTrustedDevicesLinkName": "appleid.apple.com",
# "suppressResend": false,
# "authType": "hsa",
# "accountLocked": false,
# "validationErrors": [{
# "code": "-21669",
# "title": "Incorrect Verification Code",
# "message": "Incorrect verification code."
# }]
# }
if ex.to_s.include?("verification code") # to have a nicer output
puts("Error: Incorrect verification code")
return handle_two_step_for_device(device_id)
end
raise ex
end
store_session
return true
end | ruby | def handle_two_step_for_device(device_id)
# Request token to device
r = request(:put) do |req|
req.url("https://idmsa.apple.com/appleauth/auth/verify/device/#{device_id}/securitycode")
update_request_headers(req)
end
# we use `Spaceship::TunesClient.new.handle_itc_response`
# since this might be from the Dev Portal, but for 2 step
Spaceship::TunesClient.new.handle_itc_response(r.body)
puts("Successfully requested notification")
code = ask("Please enter the 4 digit code: ")
puts("Requesting session...")
# Send token to server to get a valid session
r = request(:post) do |req|
req.url("https://idmsa.apple.com/appleauth/auth/verify/device/#{device_id}/securitycode")
req.headers['Content-Type'] = 'application/json'
req.body = { "code" => code.to_s }.to_json
update_request_headers(req)
end
begin
Spaceship::TunesClient.new.handle_itc_response(r.body) # this will fail if the code is invalid
rescue => ex
# If the code was entered wrong
# {
# "securityCode": {
# "code": "1234"
# },
# "securityCodeLocked": false,
# "recoveryKeyLocked": false,
# "recoveryKeySupported": true,
# "manageTrustedDevicesLinkName": "appleid.apple.com",
# "suppressResend": false,
# "authType": "hsa",
# "accountLocked": false,
# "validationErrors": [{
# "code": "-21669",
# "title": "Incorrect Verification Code",
# "message": "Incorrect verification code."
# }]
# }
if ex.to_s.include?("verification code") # to have a nicer output
puts("Error: Incorrect verification code")
return handle_two_step_for_device(device_id)
end
raise ex
end
store_session
return true
end | [
"def",
"handle_two_step_for_device",
"(",
"device_id",
")",
"# Request token to device",
"r",
"=",
"request",
"(",
":put",
")",
"do",
"|",
"req",
"|",
"req",
".",
"url",
"(",
"\"https://idmsa.apple.com/appleauth/auth/verify/device/#{device_id}/securitycode\"",
")",
"updat... | this is extracted into its own method so it can be called multiple times (see end) | [
"this",
"is",
"extracted",
"into",
"its",
"own",
"method",
"so",
"it",
"can",
"be",
"called",
"multiple",
"times",
"(",
"see",
"end",
")"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/spaceship/lib/spaceship/two_step_or_factor_client.rb#L46-L101 | train | This method handles two step notifications for a device | [
30522,
13366,
5047,
1035,
2048,
1035,
3357,
1035,
2005,
1035,
5080,
1006,
5080,
1035,
8909,
1007,
1001,
5227,
19204,
2000,
5080,
1054,
1027,
5227,
1006,
1024,
2404,
1007,
2079,
1064,
2128,
4160,
1064,
2128,
4160,
1012,
24471,
2140,
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... |
cloudfoundry/bosh | src/bosh-director/lib/bosh/director/links/links_manager.rb | Bosh::Director::Links.LinksManager.consumer? | def consumer?(provider_intent, deployment_plan)
return true if provider_intent.shared
link_consumers = deployment_plan.model.link_consumers
link_consumers = link_consumers.select do |consumer|
consumer.serial_id == @serial_id
end
link_consumers.any? do |consumer|
consumer.intents.any? do |consumer_intent|
can_be_consumed?(consumer, provider_intent, consumer_intent, @serial_id)
end
end
end | ruby | def consumer?(provider_intent, deployment_plan)
return true if provider_intent.shared
link_consumers = deployment_plan.model.link_consumers
link_consumers = link_consumers.select do |consumer|
consumer.serial_id == @serial_id
end
link_consumers.any? do |consumer|
consumer.intents.any? do |consumer_intent|
can_be_consumed?(consumer, provider_intent, consumer_intent, @serial_id)
end
end
end | [
"def",
"consumer?",
"(",
"provider_intent",
",",
"deployment_plan",
")",
"return",
"true",
"if",
"provider_intent",
".",
"shared",
"link_consumers",
"=",
"deployment_plan",
".",
"model",
".",
"link_consumers",
"link_consumers",
"=",
"link_consumers",
".",
"select",
... | A consumer which is within the same deployment | [
"A",
"consumer",
"which",
"is",
"within",
"the",
"same",
"deployment"
] | 2eaa7100879ddd20cd909cd698514746195e28b7 | https://github.com/cloudfoundry/bosh/blob/2eaa7100879ddd20cd909cd698514746195e28b7/src/bosh-director/lib/bosh/director/links/links_manager.rb#L466-L479 | train | Returns true if the consumer is a consumer of the specified provider_intent. | [
30522,
13366,
7325,
1029,
1006,
10802,
1035,
7848,
1010,
10813,
1035,
2933,
1007,
2709,
2995,
2065,
10802,
1035,
7848,
1012,
4207,
4957,
1035,
10390,
1027,
10813,
1035,
2933,
1012,
2944,
1012,
4957,
1035,
10390,
4957,
1035,
10390,
1027,
495... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-assemblies/app/models/decidim/assembly.rb | Decidim.Assembly.update_children_paths | def update_children_paths
self.class.where(
["#{self.class.table_name}.parents_path <@ :old_path AND #{self.class.table_name}.id != :id", old_path: parents_path_before_last_save, id: id]
).update_all(
["parents_path = :new_path || subpath(parents_path, nlevel(:old_path))", new_path: parents_path, old_path: parents_path_before_last_save]
)
end | ruby | def update_children_paths
self.class.where(
["#{self.class.table_name}.parents_path <@ :old_path AND #{self.class.table_name}.id != :id", old_path: parents_path_before_last_save, id: id]
).update_all(
["parents_path = :new_path || subpath(parents_path, nlevel(:old_path))", new_path: parents_path, old_path: parents_path_before_last_save]
)
end | [
"def",
"update_children_paths",
"self",
".",
"class",
".",
"where",
"(",
"[",
"\"#{self.class.table_name}.parents_path <@ :old_path AND #{self.class.table_name}.id != :id\"",
",",
"old_path",
":",
"parents_path_before_last_save",
",",
"id",
":",
"id",
"]",
")",
".",
"update... | rubocop:enable Rails/SkipsModelValidations
When an assembly changes their parent, we need to update the parents_path attribute on their descendants
E.g. If we have the following tree:
A (root assembly) parent = null, parents_path = A
B (root assembly) parent = null, parents_path = B
|- C (child assembly of B, descendant of B) parent = B, parents_path = B.C
|- D (child assembly of C, descendant of B,C) parent = C, parents_path = B.C.D
|- E (child assembly of C, descendant of B,C) parent = C, parents_path = B.C.E
|- F (child assembly of E, descendant of B,C,E) parent = E, parents_path = B.C.E.F
And we change the parent of C to A, this function updates the parents_path attribute in their
descendants assemblies (D, E and F):
|- D (child assembly of C, descendant of *A*,C) parent = C, parents_path = *A*.C.D
|- E (child assembly of C, descendant of *A*,C) parent = C, parents_path = *A*.C.E
|- F (child assembly of E, descendant of *A*,C,E) parent = E, parents_path = *A*.C.E.F
Note: updating parents_path of C (the assembly in which we have changed the parent) is done in the `set_parents_path` function.
rubocop:disable Rails/SkipsModelValidations | [
"rubocop",
":",
"enable",
"Rails",
"/",
"SkipsModelValidations",
"When",
"an",
"assembly",
"changes",
"their",
"parent",
"we",
"need",
"to",
"update",
"the",
"parents_path",
"attribute",
"on",
"their",
"descendants",
"E",
".",
"g",
".",
"If",
"we",
"have",
"... | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-assemblies/app/models/decidim/assembly.rb#L181-L187 | train | Update the parents_path and parents_path_before_last_save | [
30522,
13366,
10651,
1035,
2336,
1035,
10425,
2969,
1012,
2465,
1012,
2073,
1006,
1031,
1000,
1001,
1063,
2969,
1012,
2465,
1012,
2795,
1035,
2171,
1065,
1012,
3008,
1035,
4130,
1026,
1030,
1024,
2214,
1035,
4130,
1998,
1001,
1063,
2969,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_jobs.rb | Azure::RecoveryServicesSiteRecovery::Mgmt::V2018_01_10.ReplicationJobs.begin_cancel | def begin_cancel(job_name, custom_headers:nil)
response = begin_cancel_async(job_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_cancel(job_name, custom_headers:nil)
response = begin_cancel_async(job_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_cancel",
"(",
"job_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_cancel_async",
"(",
"job_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"response",
".",
"nil?",
"end... | Cancels the specified job.
The operation to cancel an Azure Site Recovery job.
@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 [Job] operation results. | [
"Cancels",
"the",
"specified",
"job",
"."
] | 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_jobs.rb#L397-L400 | train | Cancels a job. | [
30522,
13366,
4088,
1035,
17542,
1006,
3105,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
17542,
1035,
2004,
6038,
2278,
1006,
3105,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mongodb/mongo-ruby-driver | lib/mongo/address.rb | Mongo.Address.create_resolver | def create_resolver(ssl_options)
return Unix.new(seed.downcase) if seed.downcase =~ Unix::MATCH
family = (host == LOCALHOST) ? ::Socket::AF_INET : ::Socket::AF_UNSPEC
error = nil
::Socket.getaddrinfo(host, nil, family, ::Socket::SOCK_STREAM).each do |info|
begin
specific_address = FAMILY_MAP[info[4]].new(info[3], port, host)
socket = specific_address.socket(
connect_timeout, ssl_options, connect_timeout: connect_timeout)
socket.close
return specific_address
rescue IOError, SystemCallError, Error::SocketTimeoutError, Error::SocketError => e
error = e
end
end
raise error
end | ruby | def create_resolver(ssl_options)
return Unix.new(seed.downcase) if seed.downcase =~ Unix::MATCH
family = (host == LOCALHOST) ? ::Socket::AF_INET : ::Socket::AF_UNSPEC
error = nil
::Socket.getaddrinfo(host, nil, family, ::Socket::SOCK_STREAM).each do |info|
begin
specific_address = FAMILY_MAP[info[4]].new(info[3], port, host)
socket = specific_address.socket(
connect_timeout, ssl_options, connect_timeout: connect_timeout)
socket.close
return specific_address
rescue IOError, SystemCallError, Error::SocketTimeoutError, Error::SocketError => e
error = e
end
end
raise error
end | [
"def",
"create_resolver",
"(",
"ssl_options",
")",
"return",
"Unix",
".",
"new",
"(",
"seed",
".",
"downcase",
")",
"if",
"seed",
".",
"downcase",
"=~",
"Unix",
"::",
"MATCH",
"family",
"=",
"(",
"host",
"==",
"LOCALHOST",
")",
"?",
"::",
"Socket",
"::... | To determine which address the socket will connect to, the driver will
attempt to connect to each IP address returned by Socket::getaddrinfo in
sequence. Once a successful connection is made, a resolver with that
IP address specified is returned. If no successful connection is
made, the error made by the last connection attempt is raised. | [
"To",
"determine",
"which",
"address",
"the",
"socket",
"will",
"connect",
"to",
"the",
"driver",
"will",
"attempt",
"to",
"connect",
"to",
"each",
"IP",
"address",
"returned",
"by",
"Socket",
"::",
"getaddrinfo",
"in",
"sequence",
".",
"Once",
"a",
"success... | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/address.rb#L193-L210 | train | Create a resolver for the given host and port | [
30522,
13366,
3443,
1035,
10663,
2099,
1006,
7020,
2140,
1035,
7047,
1007,
2709,
19998,
1012,
2047,
1006,
6534,
1012,
2091,
18382,
1007,
2065,
6534,
1012,
2091,
18382,
1027,
1066,
19998,
1024,
1024,
2674,
2155,
1027,
1006,
3677,
1027,
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... |
jeremytregunna/ruby-trello | lib/trello/board.rb | Trello.Board.flat_prefs | def flat_prefs
separator = id ? "/" : "_"
attributes[:prefs].inject({}) do |hash, (pref, v)|
hash.merge("prefs#{separator}#{pref}" => v)
end
end | ruby | def flat_prefs
separator = id ? "/" : "_"
attributes[:prefs].inject({}) do |hash, (pref, v)|
hash.merge("prefs#{separator}#{pref}" => v)
end
end | [
"def",
"flat_prefs",
"separator",
"=",
"id",
"?",
"\"/\"",
":",
"\"_\"",
"attributes",
"[",
":prefs",
"]",
".",
"inject",
"(",
"{",
"}",
")",
"do",
"|",
"hash",
",",
"(",
"pref",
",",
"v",
")",
"|",
"hash",
".",
"merge",
"(",
"\"prefs#{separator}#{pr... | On creation
https://trello.com/docs/api/board/#post-1-boards
- permissionLevel
- voting
- comments
- invitations
- selfJoin
- cardCovers
- background
- cardAging
On update
https://trello.com/docs/api/board/#put-1-boards-board-id
Same as above plus:
- calendarFeedEnabled | [
"On",
"creation",
"https",
":",
"//",
"trello",
".",
"com",
"/",
"docs",
"/",
"api",
"/",
"board",
"/",
"#post",
"-",
"1",
"-",
"boards",
"-",
"permissionLevel",
"-",
"voting",
"-",
"comments",
"-",
"invitations",
"-",
"selfJoin",
"-",
"cardCovers",
"-... | ad79c9d8152ad5395b3b61c43170908f1912bfb2 | https://github.com/jeremytregunna/ruby-trello/blob/ad79c9d8152ad5395b3b61c43170908f1912bfb2/lib/trello/board.rb#L207-L212 | train | Returns a hash of all the preferences that are in the current record. | [
30522,
13366,
4257,
1035,
3653,
10343,
19802,
25879,
2953,
1027,
8909,
1029,
1000,
1013,
1000,
1024,
1000,
1035,
1000,
12332,
1031,
1024,
3653,
10343,
1033,
1012,
1999,
20614,
1006,
1063,
1065,
1007,
2079,
1064,
23325,
1010,
1006,
3653,
254... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_policy_insights/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/policy_tracked_resources.rb | Azure::PolicyInsights::Mgmt::V2018_07_01_preview.PolicyTrackedResources.list_query_results_for_resource_group_as_lazy | def list_query_results_for_resource_group_as_lazy(resource_group_name, query_options:nil, custom_headers:nil)
response = list_query_results_for_resource_group_async(resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_query_results_for_resource_group_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_query_results_for_resource_group_as_lazy(resource_group_name, query_options:nil, custom_headers:nil)
response = list_query_results_for_resource_group_async(resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_query_results_for_resource_group_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_query_results_for_resource_group_as_lazy",
"(",
"resource_group_name",
",",
"query_options",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_query_results_for_resource_group_async",
"(",
"resource_group_name",
",",
"query_options",
":qu... | Queries policy tracked resources under the resource group.
@param resource_group_name [String] Resource group name.
@param query_options [QueryOptions] Additional parameters for the operation
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [PolicyTrackedResourcesQueryResults] which provide lazy access to
pages of the response. | [
"Queries",
"policy",
"tracked",
"resources",
"under",
"the",
"resource",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_policy_insights/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/policy_tracked_resources.rb#L826-L835 | train | Gets the list of all the resources under the resource group. | [
30522,
13366,
2862,
1035,
23032,
30524,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
23032,
1035,
7047,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
23032,
1035,
3463,
1035,
2005... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
tongueroo/ufo | lib/ufo/param.rb | Ufo.Param.upgrade_message! | def upgrade_message!
return if File.exist?(@params_path)
puts "ERROR: Your project is missing the .ufo/params.yml.".color(:red)
puts "This was added in ufo version 3.4"
puts "You can find more info about the params file here: http://ufoships.com/docs/params/"
puts "To upgrade run:"
puts " ufo upgrade v3_3to3_4"
exit 1
end | ruby | def upgrade_message!
return if File.exist?(@params_path)
puts "ERROR: Your project is missing the .ufo/params.yml.".color(:red)
puts "This was added in ufo version 3.4"
puts "You can find more info about the params file here: http://ufoships.com/docs/params/"
puts "To upgrade run:"
puts " ufo upgrade v3_3to3_4"
exit 1
end | [
"def",
"upgrade_message!",
"return",
"if",
"File",
".",
"exist?",
"(",
"@params_path",
")",
"puts",
"\"ERROR: Your project is missing the .ufo/params.yml.\"",
".",
"color",
"(",
":red",
")",
"puts",
"\"This was added in ufo version 3.4\"",
"puts",
"\"You can find more info ab... | Ufo version 3.3 to 3.4 added a concept of a .ufo/params.yml file to support
fargate: https://github.com/tongueroo/ufo/pull/31
Warn user and tell them to run the `ufo upgrade v3_3to3_4` command to upgrade. | [
"Ufo",
"version",
"3",
".",
"3",
"to",
"3",
".",
"4",
"added",
"a",
"concept",
"of",
"a",
".",
"ufo",
"/",
"params",
".",
"yml",
"file",
"to",
"support",
"fargate",
":",
"https",
":",
"//",
"github",
".",
"com",
"/",
"tongueroo",
"/",
"ufo",
"/",... | 16ac3dad28edcab2693c0e7d89a1971aca65b8f9 | https://github.com/tongueroo/ufo/blob/16ac3dad28edcab2693c0e7d89a1971aca65b8f9/lib/ufo/param.rb#L28-L37 | train | This function is used to upgrade the message to the latest version of the ufo project. | [
30522,
13366,
12200,
1035,
4471,
999,
2709,
2065,
5371,
1012,
4839,
1029,
1006,
1030,
11498,
5244,
1035,
4130,
1007,
8509,
1000,
7561,
1024,
2115,
2622,
2003,
4394,
1996,
1012,
24321,
1013,
11498,
5244,
1012,
1061,
19968,
1012,
1000,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sporkmonger/addressable | lib/addressable/uri.rb | Addressable.URI.host= | def host=(new_host)
if new_host && !new_host.respond_to?(:to_str)
raise TypeError, "Can't convert #{new_host.class} into String."
end
@host = new_host ? new_host.to_str : nil
# Reset dependent values
remove_instance_variable(:@authority) if defined?(@authority)
remove_instance_variable(:@normalized_host) if defined?(@normalized_host)
remove_composite_values
# Ensure we haven't created an invalid URI
validate()
end | ruby | def host=(new_host)
if new_host && !new_host.respond_to?(:to_str)
raise TypeError, "Can't convert #{new_host.class} into String."
end
@host = new_host ? new_host.to_str : nil
# Reset dependent values
remove_instance_variable(:@authority) if defined?(@authority)
remove_instance_variable(:@normalized_host) if defined?(@normalized_host)
remove_composite_values
# Ensure we haven't created an invalid URI
validate()
end | [
"def",
"host",
"=",
"(",
"new_host",
")",
"if",
"new_host",
"&&",
"!",
"new_host",
".",
"respond_to?",
"(",
":to_str",
")",
"raise",
"TypeError",
",",
"\"Can't convert #{new_host.class} into String.\"",
"end",
"@host",
"=",
"new_host",
"?",
"new_host",
".",
"to_... | Sets the host component for this URI.
@param [String, #to_str] new_host The new host component. | [
"Sets",
"the",
"host",
"component",
"for",
"this",
"URI",
"."
] | 5894c95a7768435cb46d1355954611dbd194832e | https://github.com/sporkmonger/addressable/blob/5894c95a7768435cb46d1355954611dbd194832e/lib/addressable/uri.rb#L1125-L1138 | train | Set the host attribute of this URI. | [
30522,
13366,
3677,
1027,
1006,
2047,
1035,
3677,
1007,
2065,
2047,
1035,
3677,
1004,
1004,
999,
2047,
1035,
3677,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
2000,
1035,
2358,
2099,
1007,
5333,
2828,
2121,
29165,
1010,
1000,
2064,
1005,
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_web/lib/2016-09-01/generated/azure_mgmt_web/app_service_environments.rb | Azure::Web::Mgmt::V2016_09_01.AppServiceEnvironments.resume_async | def resume_async(resource_group_name, name, custom_headers:nil)
# Send request
promise = begin_resume_async(resource_group_name, name, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Web::Mgmt::V2016_09_01::Models::WebAppCollection.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 resume_async(resource_group_name, name, custom_headers:nil)
# Send request
promise = begin_resume_async(resource_group_name, name, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Web::Mgmt::V2016_09_01::Models::WebAppCollection.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",
"resume_async",
"(",
"resource_group_name",
",",
"name",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_resume_async",
"(",
"resource_group_name",
",",
"name",
",",
"custom_headers",
":custom_headers",
")",
"promise",
"=",
"p... | @param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param name [String] Name of the App Service Environment.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"resource_group_name",
"[",
"String",
"]",
"Name",
"of",
"the",
"resource",
"group",
"to",
"which",
"the",
"resource",
"belongs",
".",
"@param",
"name",
"[",
"String",
"]",
"Name",
"of",
"the",
"App",
"Service",
"Environment",
".",
"@param",
"custo... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2016-09-01/generated/azure_mgmt_web/app_service_environments.rb#L2541-L2557 | train | Resumes an App Service Environment. | [
30522,
13366,
13746,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,
4088,
1035,
13746,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
thoughtbot/clearance | lib/clearance/session.rb | Clearance.Session.add_cookie_to_headers | def add_cookie_to_headers(headers)
if signed_in_with_remember_token?
Rack::Utils.set_cookie_header!(
headers,
remember_token_cookie,
cookie_options.merge(
value: current_user.remember_token,
),
)
end
end | ruby | def add_cookie_to_headers(headers)
if signed_in_with_remember_token?
Rack::Utils.set_cookie_header!(
headers,
remember_token_cookie,
cookie_options.merge(
value: current_user.remember_token,
),
)
end
end | [
"def",
"add_cookie_to_headers",
"(",
"headers",
")",
"if",
"signed_in_with_remember_token?",
"Rack",
"::",
"Utils",
".",
"set_cookie_header!",
"(",
"headers",
",",
"remember_token_cookie",
",",
"cookie_options",
".",
"merge",
"(",
"value",
":",
"current_user",
".",
... | @param env The current rack environment
Called by {RackSession} to add the Clearance session cookie to a response.
@return [void] | [
"@param",
"env",
"The",
"current",
"rack",
"environment",
"Called",
"by",
"{",
"RackSession",
"}",
"to",
"add",
"the",
"Clearance",
"session",
"cookie",
"to",
"a",
"response",
"."
] | 1623cdeb648f33a55f0eb7be17e8f19a4291e1f2 | https://github.com/thoughtbot/clearance/blob/1623cdeb648f33a55f0eb7be17e8f19a4291e1f2/lib/clearance/session.rb#L17-L27 | train | Adds a cookie to the headers | [
30522,
13366,
5587,
1035,
17387,
1035,
2000,
1035,
20346,
2015,
1006,
20346,
2015,
1007,
2065,
2772,
1035,
1999,
1035,
2007,
1035,
3342,
1035,
19204,
1029,
14513,
1024,
1024,
21183,
12146,
1012,
2275,
1035,
17387,
1035,
20346,
999,
1006,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb | Aws::EC2.Resource.create_internet_gateway | def create_internet_gateway(options = {})
resp = @client.create_internet_gateway(options)
InternetGateway.new(
id: resp.data.internet_gateway.internet_gateway_id,
data: resp.data.internet_gateway,
client: @client
)
end | ruby | def create_internet_gateway(options = {})
resp = @client.create_internet_gateway(options)
InternetGateway.new(
id: resp.data.internet_gateway.internet_gateway_id,
data: resp.data.internet_gateway,
client: @client
)
end | [
"def",
"create_internet_gateway",
"(",
"options",
"=",
"{",
"}",
")",
"resp",
"=",
"@client",
".",
"create_internet_gateway",
"(",
"options",
")",
"InternetGateway",
".",
"new",
"(",
"id",
":",
"resp",
".",
"data",
".",
"internet_gateway",
".",
"internet_gatew... | @example Request syntax with placeholder values
internetgateway = ec2.create_internet_gateway({
dry_run: false,
})
@param [Hash] options ({})
@option options [Boolean] :dry_run
Checks whether you have the required permissions for the action,
without actually making the request, and provides an error response.
If you have the required permissions, the error response is
`DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
@return [InternetGateway] | [
"@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#L478-L485 | train | Create an internet gateway | [
30522,
13366,
3443,
1035,
4274,
1035,
11909,
1006,
7047,
1027,
1063,
1065,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
3443,
1035,
4274,
1035,
11909,
1006,
7047,
1007,
4274,
5867,
4576,
1012,
2047,
1006,
8909,
1024,
24501,
2361,
1012,
2951,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/sprockets | lib/sprockets/manifest.rb | Sprockets.Manifest.find_sources | def find_sources(*args)
return to_enum(__method__, *args) unless block_given?
if environment
find(*args).each do |asset|
yield asset.source
end
else
args.each do |path|
asset = assets[path]
yield File.binread(File.join(dir, asset)) if asset
end
end
end | ruby | def find_sources(*args)
return to_enum(__method__, *args) unless block_given?
if environment
find(*args).each do |asset|
yield asset.source
end
else
args.each do |path|
asset = assets[path]
yield File.binread(File.join(dir, asset)) if asset
end
end
end | [
"def",
"find_sources",
"(",
"*",
"args",
")",
"return",
"to_enum",
"(",
"__method__",
",",
"args",
")",
"unless",
"block_given?",
"if",
"environment",
"find",
"(",
"args",
")",
".",
"each",
"do",
"|",
"asset",
"|",
"yield",
"asset",
".",
"source",
"end",... | Public: Find the source of assets by paths.
Returns Enumerator of assets file content. | [
"Public",
":",
"Find",
"the",
"source",
"of",
"assets",
"by",
"paths",
"."
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/manifest.rb#L138-L151 | train | Returns an enumerator of Asset objects. | [
30522,
13366,
2424,
1035,
4216,
1006,
1008,
12098,
5620,
1007,
2709,
2000,
1035,
4372,
2819,
1006,
1035,
1035,
4118,
1035,
1035,
1010,
1008,
12098,
5620,
1007,
4983,
3796,
1035,
2445,
1029,
2065,
4044,
2424,
1006,
1008,
12098,
5620,
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/rails | activerecord/lib/active_record/autosave_association.rb | ActiveRecord.AutosaveAssociation.validate_collection_association | def validate_collection_association(reflection)
if association = association_instance_get(reflection.name)
if records = associated_records_to_validate_or_save(association, new_record?, reflection.options[:autosave])
records.each_with_index { |record, index| association_valid?(reflection, record, index) }
end
end
end | ruby | def validate_collection_association(reflection)
if association = association_instance_get(reflection.name)
if records = associated_records_to_validate_or_save(association, new_record?, reflection.options[:autosave])
records.each_with_index { |record, index| association_valid?(reflection, record, index) }
end
end
end | [
"def",
"validate_collection_association",
"(",
"reflection",
")",
"if",
"association",
"=",
"association_instance_get",
"(",
"reflection",
".",
"name",
")",
"if",
"records",
"=",
"associated_records_to_validate_or_save",
"(",
"association",
",",
"new_record?",
",",
"ref... | Validate the associated records if <tt>:validate</tt> or
<tt>:autosave</tt> is turned on for the association specified by
+reflection+. | [
"Validate",
"the",
"associated",
"records",
"if",
"<tt",
">",
":",
"validate<",
"/",
"tt",
">",
"or",
"<tt",
">",
":",
"autosave<",
"/",
"tt",
">",
"is",
"turned",
"on",
"for",
"the",
"association",
"specified",
"by",
"+",
"reflection",
"+",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activerecord/lib/active_record/autosave_association.rb#L313-L319 | train | Validate the association | [
30522,
13366,
9398,
3686,
1035,
3074,
1035,
2523,
1006,
9185,
1007,
2065,
2523,
1027,
2523,
1035,
6013,
1035,
2131,
1006,
9185,
1012,
2171,
1007,
2065,
2636,
1027,
3378,
1035,
2636,
1035,
2000,
1035,
9398,
3686,
1035,
2030,
1035,
3828,
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... |
opal/opal | stdlib/racc/parser.rb | Racc.Parser._racc_evalact | def _racc_evalact(act, arg)
action_table, action_check, _, action_pointer,
_, _, _, _,
_, _, _, shift_n, reduce_n,
_, _, * = arg
if act > 0 and act < shift_n
#
# shift
#
if @racc_error_status > 0
@racc_error_status -= 1 unless @racc_t == 1 # error token
end
@racc_vstack.push @racc_val
@racc_state.push act
@racc_read_next = true
if @yydebug
@racc_tstack.push @racc_t
racc_shift @racc_t, @racc_tstack, @racc_vstack
end
elsif act < 0 and act > -reduce_n
#
# reduce
#
code = catch(:racc_jump) {
@racc_state.push _racc_do_reduce(arg, act)
false
}
if code
case code
when 1 # yyerror
@racc_user_yyerror = true # user_yyerror
return -reduce_n
when 2 # yyaccept
return shift_n
else
raise '[Racc Bug] unknown jump code'
end
end
elsif act == shift_n
#
# accept
#
racc_accept if @yydebug
throw :racc_end_parse, @racc_vstack[0]
elsif act == -reduce_n
#
# error
#
case @racc_error_status
when 0
unless arg[21] # user_yyerror
on_error @racc_t, @racc_val, @racc_vstack
end
when 3
if @racc_t == 0 # is $
throw :racc_end_parse, nil
end
@racc_read_next = true
end
@racc_user_yyerror = false
@racc_error_status = 3
while true
if i = action_pointer[@racc_state[-1]]
i += 1 # error token
if i >= 0 and
(act = action_table[i]) and
action_check[i] == @racc_state[-1]
break
end
end
throw :racc_end_parse, nil if @racc_state.size <= 1
@racc_state.pop
@racc_vstack.pop
if @yydebug
@racc_tstack.pop
racc_e_pop @racc_state, @racc_tstack, @racc_vstack
end
end
return act
else
raise "[Racc Bug] unknown action #{act.inspect}"
end
racc_next_state(@racc_state[-1], @racc_state) if @yydebug
nil
end | ruby | def _racc_evalact(act, arg)
action_table, action_check, _, action_pointer,
_, _, _, _,
_, _, _, shift_n, reduce_n,
_, _, * = arg
if act > 0 and act < shift_n
#
# shift
#
if @racc_error_status > 0
@racc_error_status -= 1 unless @racc_t == 1 # error token
end
@racc_vstack.push @racc_val
@racc_state.push act
@racc_read_next = true
if @yydebug
@racc_tstack.push @racc_t
racc_shift @racc_t, @racc_tstack, @racc_vstack
end
elsif act < 0 and act > -reduce_n
#
# reduce
#
code = catch(:racc_jump) {
@racc_state.push _racc_do_reduce(arg, act)
false
}
if code
case code
when 1 # yyerror
@racc_user_yyerror = true # user_yyerror
return -reduce_n
when 2 # yyaccept
return shift_n
else
raise '[Racc Bug] unknown jump code'
end
end
elsif act == shift_n
#
# accept
#
racc_accept if @yydebug
throw :racc_end_parse, @racc_vstack[0]
elsif act == -reduce_n
#
# error
#
case @racc_error_status
when 0
unless arg[21] # user_yyerror
on_error @racc_t, @racc_val, @racc_vstack
end
when 3
if @racc_t == 0 # is $
throw :racc_end_parse, nil
end
@racc_read_next = true
end
@racc_user_yyerror = false
@racc_error_status = 3
while true
if i = action_pointer[@racc_state[-1]]
i += 1 # error token
if i >= 0 and
(act = action_table[i]) and
action_check[i] == @racc_state[-1]
break
end
end
throw :racc_end_parse, nil if @racc_state.size <= 1
@racc_state.pop
@racc_vstack.pop
if @yydebug
@racc_tstack.pop
racc_e_pop @racc_state, @racc_tstack, @racc_vstack
end
end
return act
else
raise "[Racc Bug] unknown action #{act.inspect}"
end
racc_next_state(@racc_state[-1], @racc_state) if @yydebug
nil
end | [
"def",
"_racc_evalact",
"(",
"act",
",",
"arg",
")",
"action_table",
",",
"action_check",
",",
"_",
",",
"action_pointer",
",",
"_",
",",
"_",
",",
"_",
",",
"_",
",",
"_",
",",
"_",
",",
"_",
",",
"shift_n",
",",
"reduce_n",
",",
"_",
",",
"_",
... | common | [
"common"
] | 41aedc0fd62aab00d3c117ba0caf00206bedd981 | https://github.com/opal/opal/blob/41aedc0fd62aab00d3c117ba0caf00206bedd981/stdlib/racc/parser.rb#L384-L475 | train | evaluate a action | [
30522,
13366,
1035,
10958,
9468,
1035,
9345,
2721,
6593,
1006,
2552,
1010,
12098,
2290,
1007,
2895,
1035,
2795,
1010,
2895,
1035,
4638,
1010,
1035,
1010,
2895,
1035,
20884,
1010,
1035,
1010,
1035,
1010,
1035,
1010,
1035,
1010,
1035,
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... |
GeorgeKaraszi/ActiveRecordExtended | lib/active_record_extended/utilities.rb | ActiveRecordExtended.Utilities.pipe_cte_with! | def pipe_cte_with!(subquery)
return self unless subquery.try(:with_values?)
cte_ary = flatten_safely(subquery.with_values)
subquery.with_values = nil # Remove nested queries with values
# Add subquery's CTE's to the parents query stack. (READ THE SPECIAL NOTE ABOVE!)
if @scope.with_values?
# combine top-level and lower level queries `.with` values into 1 structure
with_hash = cte_ary.each_with_object(@scope.with_values.first) do |from_cte, hash|
hash.reverse_merge!(from_cte)
end
@scope.with_values = [with_hash]
else
# Top level has no with values
@scope.with!(*cte_ary)
end
self
end | ruby | def pipe_cte_with!(subquery)
return self unless subquery.try(:with_values?)
cte_ary = flatten_safely(subquery.with_values)
subquery.with_values = nil # Remove nested queries with values
# Add subquery's CTE's to the parents query stack. (READ THE SPECIAL NOTE ABOVE!)
if @scope.with_values?
# combine top-level and lower level queries `.with` values into 1 structure
with_hash = cte_ary.each_with_object(@scope.with_values.first) do |from_cte, hash|
hash.reverse_merge!(from_cte)
end
@scope.with_values = [with_hash]
else
# Top level has no with values
@scope.with!(*cte_ary)
end
self
end | [
"def",
"pipe_cte_with!",
"(",
"subquery",
")",
"return",
"self",
"unless",
"subquery",
".",
"try",
"(",
":with_values?",
")",
"cte_ary",
"=",
"flatten_safely",
"(",
"subquery",
".",
"with_values",
")",
"subquery",
".",
"with_values",
"=",
"nil",
"# Remove nested... | Will carry defined CTE tables from the nested sub-query and gradually pushes it up to the parents query stack
I.E: It pushes `WITH [:cte_name:] AS(...), ..` to the top of the query structure tree
SPECIAL GOTCHA NOTE: (if duplicate keys are found) This will favor the parents query `with's` over nested ones! | [
"Will",
"carry",
"defined",
"CTE",
"tables",
"from",
"the",
"nested",
"sub",
"-",
"query",
"and",
"gradually",
"pushes",
"it",
"up",
"to",
"the",
"parents",
"query",
"stack",
"I",
".",
"E",
":",
"It",
"pushes",
"WITH",
"[",
":",
"cte_name",
":",
"]",
... | aca74eebb64b9957a2c8765bef6e43c7d5736fd8 | https://github.com/GeorgeKaraszi/ActiveRecordExtended/blob/aca74eebb64b9957a2c8765bef6e43c7d5736fd8/lib/active_record_extended/utilities.rb#L81-L101 | train | Pipes a CTE with another subquery. | [
30522,
13366,
8667,
1035,
14931,
2063,
1035,
2007,
999,
1006,
4942,
4226,
2854,
1007,
2709,
2969,
4983,
30524,
2007,
1035,
5300,
1029,
1007,
14931,
2063,
1035,
12098,
2100,
1027,
4257,
6528,
1035,
9689,
1006,
4942,
4226,
2854,
1012,
2007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/active_utils | lib/active_utils/validateable.rb | ActiveUtils.Validateable.valid? | def valid?
errors.clear
before_validate if respond_to?(:before_validate, true)
validate if respond_to?(:validate, true)
errors.empty?
end | ruby | def valid?
errors.clear
before_validate if respond_to?(:before_validate, true)
validate if respond_to?(:validate, true)
errors.empty?
end | [
"def",
"valid?",
"errors",
".",
"clear",
"before_validate",
"if",
"respond_to?",
"(",
":before_validate",
",",
"true",
")",
"validate",
"if",
"respond_to?",
"(",
":validate",
",",
"true",
")",
"errors",
".",
"empty?",
"end"
] | :nodoc: | [
":",
"nodoc",
":"
] | 2f3a2187fa32230242639bc922a3c22e659d896f | https://github.com/Shopify/active_utils/blob/2f3a2187fa32230242639bc922a3c22e659d896f/lib/active_utils/validateable.rb#L3-L10 | train | Validate the object. | [
30522,
13366,
9398,
1029,
10697,
1012,
3154,
2077,
1035,
9398,
3686,
2065,
6869,
1035,
2000,
1029,
1006,
1024,
2077,
1035,
9398,
3686,
1010,
2995,
1007,
9398,
3686,
2065,
6869,
1035,
2000,
1029,
1006,
1024,
9398,
3686,
1010,
2995,
1007,
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... |
rmagick/rmagick | lib/rvg/rvg.rb | Magick.RVG.draw | def draw
raise StandardError, 'draw not permitted in nested RVG objects' if @nested
@canvas ||= new_canvas # allow drawing over existing canvas
gc = Utility::GraphicContext.new
add_outermost_primitives(gc)
pp(self) if ENV['debug_rvg']
print_gc(gc) if ENV['debug_prim']
gc.draw(@canvas)
@canvas
end | ruby | def draw
raise StandardError, 'draw not permitted in nested RVG objects' if @nested
@canvas ||= new_canvas # allow drawing over existing canvas
gc = Utility::GraphicContext.new
add_outermost_primitives(gc)
pp(self) if ENV['debug_rvg']
print_gc(gc) if ENV['debug_prim']
gc.draw(@canvas)
@canvas
end | [
"def",
"draw",
"raise",
"StandardError",
",",
"'draw not permitted in nested RVG objects'",
"if",
"@nested",
"@canvas",
"||=",
"new_canvas",
"# allow drawing over existing canvas",
"gc",
"=",
"Utility",
"::",
"GraphicContext",
".",
"new",
"add_outermost_primitives",
"(",
"g... | Draw a +width+ x +height+ image. The image is specified by calling
one or more drawing methods on the RVG object.
You can group the drawing method calls in the optional associated block.
The +x+ and +y+ arguments have no meaning for the outermost RVG object.
On nested RVG objects [+x+, +y+] is the coordinate of the upper-left
corner in the containing canvas on which the nested RVG object is placed.
Drawing occurs on a +canvas+ created by the #draw method. By default the
canvas is transparent. You can specify a different canvas with the
#background_fill= or #background_image= methods.
RVG objects are _containers_. That is, styles and transforms defined
on the object are used by contained objects such as shapes, text, and
groups unless overridden by an inner container or the object itself.
Construct a canvas or reuse an existing canvas.
Execute drawing commands. Return the canvas. | [
"Draw",
"a",
"+",
"width",
"+",
"x",
"+",
"height",
"+",
"image",
".",
"The",
"image",
"is",
"specified",
"by",
"calling",
"one",
"or",
"more",
"drawing",
"methods",
"on",
"the",
"RVG",
"object",
".",
"You",
"can",
"group",
"the",
"drawing",
"method",
... | ef6688ed9d76bf123c2ea1a483eff8635051adb7 | https://github.com/rmagick/rmagick/blob/ef6688ed9d76bf123c2ea1a483eff8635051adb7/lib/rvg/rvg.rb#L231-L241 | train | draw the current object in the specified array of objects | [
30522,
13366,
4009,
5333,
3115,
2121,
29165,
1010,
1005,
4009,
2025,
7936,
1999,
9089,
2098,
27634,
2290,
5200,
1005,
2065,
1030,
9089,
2098,
1030,
10683,
1064,
1064,
1027,
2047,
1035,
10683,
1001,
3499,
5059,
2058,
4493,
10683,
1043,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-ec2/lib/aws-sdk-ec2/image.rb | Aws::EC2.Image.reset_attribute | def reset_attribute(options = {})
options = options.merge(image_id: @id)
resp = @client.reset_image_attribute(options)
resp.data
end | ruby | def reset_attribute(options = {})
options = options.merge(image_id: @id)
resp = @client.reset_image_attribute(options)
resp.data
end | [
"def",
"reset_attribute",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"image_id",
":",
"@id",
")",
"resp",
"=",
"@client",
".",
"reset_image_attribute",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
image.reset_attribute({
attribute: "launchPermission", # required, accepts launchPermission
dry_run: false,
})
@param [Hash] options ({})
@option options [required, String] :attribute
The attribute to reset (currently you can only reset the launch
permission attribute).
@option options [Boolean] :dry_run
Checks whether you have the required permissions for the action,
without actually making the request, and provides an error response.
If you have the required permissions, the error response is
`DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
@return [EmptyStructure] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/image.rb#L503-L507 | train | Reset the attribute of an image | [
30522,
13366,
25141,
1035,
17961,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
3746,
1035,
8909,
1024,
1030,
8909,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
25141,
1035,
3746,
1035,
17961,
1006,
7047,
1007,
2450... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-s3/lib/aws-sdk-s3/object_version.rb | Aws::S3.ObjectVersion.head | def head(options = {})
options = options.merge(
bucket: @bucket_name,
key: @object_key,
version_id: @id
)
resp = @client.head_object(options)
resp.data
end | ruby | def head(options = {})
options = options.merge(
bucket: @bucket_name,
key: @object_key,
version_id: @id
)
resp = @client.head_object(options)
resp.data
end | [
"def",
"head",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"bucket",
":",
"@bucket_name",
",",
"key",
":",
"@object_key",
",",
"version_id",
":",
"@id",
")",
"resp",
"=",
"@client",
".",
"head_object",
"(",
"option... | @example Request syntax with placeholder values
object_version.head({
if_match: "IfMatch",
if_modified_since: Time.now,
if_none_match: "IfNoneMatch",
if_unmodified_since: Time.now,
range: "Range",
sse_customer_algorithm: "SSECustomerAlgorithm",
sse_customer_key: "SSECustomerKey",
sse_customer_key_md5: "SSECustomerKeyMD5",
request_payer: "requester", # accepts requester
part_number: 1,
})
@param [Hash] options ({})
@option options [String] :if_match
Return the object only if its entity tag (ETag) is the same as the one
specified, otherwise return a 412 (precondition failed).
@option options [Time,DateTime,Date,Integer,String] :if_modified_since
Return the object only if it has been modified since the specified
time, otherwise return a 304 (not modified).
@option options [String] :if_none_match
Return the object only if its entity tag (ETag) is different from the
one specified, otherwise return a 304 (not modified).
@option options [Time,DateTime,Date,Integer,String] :if_unmodified_since
Return the object only if it has not been modified since the specified
time, otherwise return a 412 (precondition failed).
@option options [String] :range
Downloads the specified range bytes of an object. For more information
about the HTTP Range header, go to
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.
@option options [String] :sse_customer_algorithm
Specifies the algorithm to use to when encrypting the object (e.g.,
AES256).
@option options [String] :sse_customer_key
Specifies the customer-provided encryption key for Amazon S3 to use in
encrypting data. This value is used to store the object and then it is
discarded; Amazon does not store the encryption key. The key must be
appropriate for use with the algorithm specified in the
x-amz-server-side-encryption-customer-algorithm header.
@option options [String] :sse_customer_key_md5
Specifies the 128-bit MD5 digest of the encryption key according to
RFC 1321. Amazon S3 uses this header for a message integrity check to
ensure the encryption key was transmitted without error.
@option options [String] :request_payer
Confirms that the requester knows that she or he will be charged for
the request. Bucket owners need not specify this parameter in their
requests. Documentation on downloading objects from requester pays
buckets can be found at
http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
@option options [Integer] :part_number
Part number of the object being read. This is a positive integer
between 1 and 10,000. Effectively performs a 'ranged' HEAD request
for the part specified. Useful querying about the size of the part and
the number of parts in this object.
@return [Types::HeadObjectOutput] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-s3/lib/aws-sdk-s3/object_version.rb#L396-L404 | train | Returns the data for the object in the bucket. | [
30522,
13366,
2132,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
13610,
1024,
1030,
13610,
1035,
2171,
1010,
3145,
1024,
1030,
4874,
1035,
3145,
1010,
2544,
1035,
8909,
1024,
1030,
8909,
1007,
24501,
2361,
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... |
square/connect-ruby-sdk | lib/square_connect/api/customers_api.rb | SquareConnect.CustomersApi.update_customer | def update_customer(customer_id, body, opts = {})
data, _status_code, _headers = update_customer_with_http_info(customer_id, body, opts)
return data
end | ruby | def update_customer(customer_id, body, opts = {})
data, _status_code, _headers = update_customer_with_http_info(customer_id, body, opts)
return data
end | [
"def",
"update_customer",
"(",
"customer_id",
",",
"body",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"update_customer_with_http_info",
"(",
"customer_id",
",",
"body",
",",
"opts",
")",
"return",
"data",
"end"
] | UpdateCustomer
Updates the details of an existing customer. When two profiles are merged into a single profile, that profile is assigned a new `customer_id`. You must use the new `customer_id` to update merged profiles. You cannot edit a customer's cards on file with this endpoint. To make changes to a card on file, you must delete the existing card on file with the [DeleteCustomerCard](#endpoint-customers-deletecustomercard) endpoint, then create a new one with the [CreateCustomerCard](#endpoint-customers-createcustomercard) endpoint.
@param customer_id The ID of the customer to update.
@param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
@param [Hash] opts the optional parameters
@return [UpdateCustomerResponse] | [
"UpdateCustomer",
"Updates",
"the",
"details",
"of",
"an",
"existing",
"customer",
".",
"When",
"two",
"profiles",
"are",
"merged",
"into",
"a",
"single",
"profile",
"that",
"profile",
"is",
"assigned",
"a",
"new",
"customer_id",
".",
"You",
"must",
"use",
"... | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/customers_api.rb#L430-L433 | train | UpdateCustomer Updates a customer | [
30522,
13366,
10651,
1035,
8013,
1006,
8013,
1035,
8909,
1010,
2303,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
10651,
1035,
8013,
1035,
2007,
1035,
8299,
1035,
18558,
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... |
piotrmurach/github | lib/github_api/page_iterator.rb | Github.PageIterator.parse_page_params | def parse_page_params(uri, attr) # :nodoc:
return -1 if uri.nil? || uri.empty?
parsed = nil
begin
parsed = URI.parse(uri)
rescue URI::Error
return -1
end
param = parse_query_for_param(parsed.query, attr)
return -1 if param.nil? || param.empty?
begin
return param.to_i
rescue ArgumentError
return -1
end
end | ruby | def parse_page_params(uri, attr) # :nodoc:
return -1 if uri.nil? || uri.empty?
parsed = nil
begin
parsed = URI.parse(uri)
rescue URI::Error
return -1
end
param = parse_query_for_param(parsed.query, attr)
return -1 if param.nil? || param.empty?
begin
return param.to_i
rescue ArgumentError
return -1
end
end | [
"def",
"parse_page_params",
"(",
"uri",
",",
"attr",
")",
"# :nodoc:",
"return",
"-",
"1",
"if",
"uri",
".",
"nil?",
"||",
"uri",
".",
"empty?",
"parsed",
"=",
"nil",
"begin",
"parsed",
"=",
"URI",
".",
"parse",
"(",
"uri",
")",
"rescue",
"URI",
"::"... | Extracts query string parameter for given name | [
"Extracts",
"query",
"string",
"parameter",
"for",
"given",
"name"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/page_iterator.rb#L113-L128 | train | Parse the page params from the URI. | [
30522,
13366,
11968,
3366,
1035,
3931,
1035,
11498,
5244,
1006,
24471,
2072,
1010,
2012,
16344,
1007,
1001,
1024,
7293,
10085,
1024,
2709,
1011,
1015,
2065,
24471,
2072,
1012,
9152,
2140,
1029,
1064,
1064,
24471,
2072,
1012,
4064,
1029,
119... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/content_for.rb | Sinatra.ContentFor.yield_content | def yield_content(key, *args, &block)
if block_given? && !content_for?(key)
haml? ? capture_haml(*args, &block) : yield(*args)
else
content = content_blocks[key.to_sym].map { |b| capture(*args, &b) }
content.join.tap do |c|
if block_given? && (erb? || erubi? || erubis?)
@_out_buf << c
end
end
end
end | ruby | def yield_content(key, *args, &block)
if block_given? && !content_for?(key)
haml? ? capture_haml(*args, &block) : yield(*args)
else
content = content_blocks[key.to_sym].map { |b| capture(*args, &b) }
content.join.tap do |c|
if block_given? && (erb? || erubi? || erubis?)
@_out_buf << c
end
end
end
end | [
"def",
"yield_content",
"(",
"key",
",",
"*",
"args",
",",
"&",
"block",
")",
"if",
"block_given?",
"&&",
"!",
"content_for?",
"(",
"key",
")",
"haml?",
"?",
"capture_haml",
"(",
"args",
",",
"block",
")",
":",
"yield",
"(",
"args",
")",
"else",
"con... | Render the captured blocks for a given key. For example:
<head>
<title>Example</title>
<%= yield_content :head %>
</head>
Would render everything you declared with <tt>content_for
:head</tt> before closing the <tt><head></tt> tag.
You can also pass values to the content blocks by passing them
as arguments after the key:
<%= yield_content :head, 1, 2 %>
Would pass <tt>1</tt> and <tt>2</tt> to all the blocks registered
for <tt>:head</tt>. | [
"Render",
"the",
"captured",
"blocks",
"for",
"a",
"given",
"key",
".",
"For",
"example",
":"
] | 1aa64f9858edc3f93cc8d46e26f724c1ae103b1c | https://github.com/sinatra/sinatra/blob/1aa64f9858edc3f93cc8d46e26f724c1ae103b1c/sinatra-contrib/lib/sinatra/content_for.rb#L175-L186 | train | Yields the content for the given key. | [
30522,
13366,
10750,
1035,
4180,
1006,
3145,
1010,
1008,
12098,
5620,
1010,
1004,
3796,
1007,
2065,
3796,
1035,
2445,
1029,
1004,
1004,
999,
4180,
1035,
2005,
1029,
1006,
3145,
1007,
10654,
2140,
1029,
1029,
5425,
1035,
10654,
2140,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/job_target_executions.rb | Azure::SQL::Mgmt::V2017_03_01_preview.JobTargetExecutions.list_by_job_execution | def list_by_job_execution(resource_group_name, server_name, job_agent_name, job_name, job_execution_id, create_time_min:nil, create_time_max:nil, end_time_min:nil, end_time_max:nil, is_active:nil, skip:nil, top:nil, custom_headers:nil)
first_page = list_by_job_execution_as_lazy(resource_group_name, server_name, job_agent_name, job_name, job_execution_id, create_time_min:create_time_min, create_time_max:create_time_max, end_time_min:end_time_min, end_time_max:end_time_max, is_active:is_active, skip:skip, top:top, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_by_job_execution(resource_group_name, server_name, job_agent_name, job_name, job_execution_id, create_time_min:nil, create_time_max:nil, end_time_min:nil, end_time_max:nil, is_active:nil, skip:nil, top:nil, custom_headers:nil)
first_page = list_by_job_execution_as_lazy(resource_group_name, server_name, job_agent_name, job_name, job_execution_id, create_time_min:create_time_min, create_time_max:create_time_max, end_time_min:end_time_min, end_time_max:end_time_max, is_active:is_active, skip:skip, top:top, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_by_job_execution",
"(",
"resource_group_name",
",",
"server_name",
",",
"job_agent_name",
",",
"job_name",
",",
"job_execution_id",
",",
"create_time_min",
":",
"nil",
",",
"create_time_max",
":",
"nil",
",",
"end_time_min",
":",
"nil",
",",
"end_time_m... | Lists target executions for all steps of a job execution.
@param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param server_name [String] The name of the server.
@param job_agent_name [String] The name of the job agent.
@param job_name [String] The name of the job to get.
@param job_execution_id The id of the job execution
@param create_time_min [DateTime] If specified, only job executions created
at or after the specified time are included.
@param create_time_max [DateTime] If specified, only job executions created
before the specified time are included.
@param end_time_min [DateTime] If specified, only job executions completed at
or after the specified time are included.
@param end_time_max [DateTime] If specified, only job executions completed
before the specified time are included.
@param is_active [Boolean] If specified, only active or only completed job
executions are included.
@param skip [Integer] The number of elements in the collection to skip.
@param top [Integer] The number of elements to return from the collection.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<JobExecution>] operation results. | [
"Lists",
"target",
"executions",
"for",
"all",
"steps",
"of",
"a",
"job",
"execution",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/job_target_executions.rb#L54-L57 | train | Gets all the job execution details. | [
30522,
13366,
2862,
1035,
2011,
1035,
3105,
1035,
7781,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
3105,
1035,
4005,
1035,
2171,
1010,
3105,
1035,
2171,
1010,
3105,
1035,
7781,
1035,
8909,
1010,
3443,
1035,
2051,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/haml-lint | lib/haml_lint/utils.rb | HamlLint.Utils.any_glob_matches? | def any_glob_matches?(globs_or_glob, file)
get_abs_and_rel_path(file).any? do |path|
Array(globs_or_glob).any? do |glob|
::File.fnmatch?(glob, path,
::File::FNM_PATHNAME | # Wildcards don't match path separators
::File::FNM_DOTMATCH) # `*` wildcard matches dotfiles
end
end
end | ruby | def any_glob_matches?(globs_or_glob, file)
get_abs_and_rel_path(file).any? do |path|
Array(globs_or_glob).any? do |glob|
::File.fnmatch?(glob, path,
::File::FNM_PATHNAME | # Wildcards don't match path separators
::File::FNM_DOTMATCH) # `*` wildcard matches dotfiles
end
end
end | [
"def",
"any_glob_matches?",
"(",
"globs_or_glob",
",",
"file",
")",
"get_abs_and_rel_path",
"(",
"file",
")",
".",
"any?",
"do",
"|",
"path",
"|",
"Array",
"(",
"globs_or_glob",
")",
".",
"any?",
"do",
"|",
"glob",
"|",
"::",
"File",
".",
"fnmatch?",
"("... | Returns whether a glob pattern (or any of a list of patterns) matches the
specified file.
This is defined here so our file globbing options are consistent
everywhere we perform globbing.
@param glob [String, Array]
@param file [String]
@return [Boolean] | [
"Returns",
"whether",
"a",
"glob",
"pattern",
"(",
"or",
"any",
"of",
"a",
"list",
"of",
"patterns",
")",
"matches",
"the",
"specified",
"file",
"."
] | 024c773667e54cf88db938c2b368977005d70ee8 | https://github.com/sds/haml-lint/blob/024c773667e54cf88db938c2b368977005d70ee8/lib/haml_lint/utils.rb#L19-L27 | train | Returns true if the given globs or globs match the given file. | [
30522,
13366,
2151,
1035,
1043,
4135,
2497,
1035,
3503,
1029,
1006,
1043,
4135,
5910,
1035,
2030,
1035,
1043,
4135,
2497,
1010,
5371,
1007,
2131,
1035,
14689,
1035,
1998,
1035,
2128,
2140,
1035,
4130,
1006,
5371,
1007,
1012,
2151,
1029,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/event_subscriptions.rb | Azure::EventGrid::Mgmt::V2018_01_01.EventSubscriptions.get_full_url | def get_full_url(scope, event_subscription_name, custom_headers:nil)
response = get_full_url_async(scope, event_subscription_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_full_url(scope, event_subscription_name, custom_headers:nil)
response = get_full_url_async(scope, event_subscription_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_full_url",
"(",
"scope",
",",
"event_subscription_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_full_url_async",
"(",
"scope",
",",
"event_subscription_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
... | Get full URL of an event subscription
Get the full endpoint URL for an event subscription
@param scope [String] The scope of the event subscription. The scope can be a
subscription, or a resource group, or a top level resource belonging to a
resource provider namespace, or an EventGrid topic. For example, use
'/subscriptions/{subscriptionId}/' for a subscription,
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
resource group, and
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
for a resource, and
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
for an EventGrid topic.
@param event_subscription_name [String] Name of the event subscription
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [EventSubscriptionFullUrl] operation results. | [
"Get",
"full",
"URL",
"of",
"an",
"event",
"subscription"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/event_subscriptions.rb#L369-L372 | train | Gets the full URL of the specified event subscription. | [
30522,
13366,
2131,
1035,
2440,
1035,
24471,
2140,
1006,
9531,
1010,
2724,
1035,
15002,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
2440,
1035,
24471,
2140,
1035,
2004,
6038,
2278,
1006,
9531,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-10-01/generated/azure_mgmt_network/connection_monitors.rb | Azure::Network::Mgmt::V2018_10_01.ConnectionMonitors.begin_create_or_update | def begin_create_or_update(resource_group_name, network_watcher_name, connection_monitor_name, parameters, custom_headers:nil)
response = begin_create_or_update_async(resource_group_name, network_watcher_name, connection_monitor_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_create_or_update(resource_group_name, network_watcher_name, connection_monitor_name, parameters, custom_headers:nil)
response = begin_create_or_update_async(resource_group_name, network_watcher_name, connection_monitor_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_create_or_update",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"connection_monitor_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"network_wa... | Create or update a connection monitor.
@param resource_group_name [String] The name of the resource group containing
Network Watcher.
@param network_watcher_name [String] The name of the Network Watcher
resource.
@param connection_monitor_name [String] The name of the connection monitor.
@param parameters [ConnectionMonitor] Parameters that define the operation to
create a connection monitor.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ConnectionMonitorResult] operation results. | [
"Create",
"or",
"update",
"a",
"connection",
"monitor",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-10-01/generated/azure_mgmt_network/connection_monitors.rb#L473-L476 | train | Creates or updates a connection monitor. | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2897,
1035,
3422,
2121,
1035,
2171,
30524,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
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... |
sensu/sensu | lib/sensu/daemon.rb | Sensu.Daemon.load_settings | def load_settings(options={})
@settings = Settings.get(options)
validate_settings!(@settings) if options[:validate_config]
log_notices(@settings.warnings)
log_notices(@settings.errors, :fatal)
print_settings!(@settings) if options[:print_config]
unless @settings.errors.empty?
@logger.fatal("SENSU NOT RUNNING!")
exit 2
end
@settings.set_env!
end | ruby | def load_settings(options={})
@settings = Settings.get(options)
validate_settings!(@settings) if options[:validate_config]
log_notices(@settings.warnings)
log_notices(@settings.errors, :fatal)
print_settings!(@settings) if options[:print_config]
unless @settings.errors.empty?
@logger.fatal("SENSU NOT RUNNING!")
exit 2
end
@settings.set_env!
end | [
"def",
"load_settings",
"(",
"options",
"=",
"{",
"}",
")",
"@settings",
"=",
"Settings",
".",
"get",
"(",
"options",
")",
"validate_settings!",
"(",
"@settings",
")",
"if",
"options",
"[",
":validate_config",
"]",
"log_notices",
"(",
"@settings",
".",
"warn... | Load Sensu settings. This method creates the settings instance
variable: `@settings`. If the `validate_config` option is true,
this method calls `validate_settings!()` to validate the latest
compiled configuration settings and will then exit the process.
If the `print_config` option is true, this method calls
`print_settings!()` to output the compiled configuration
settings and will then exit the process. If there are loading or
validation errors, they will be logged (notices), and this
method will exit(2) the process.
https://github.com/sensu/sensu-settings
@param options [Hash] | [
"Load",
"Sensu",
"settings",
".",
"This",
"method",
"creates",
"the",
"settings",
"instance",
"variable",
":",
"@settings",
".",
"If",
"the",
"validate_config",
"option",
"is",
"true",
"this",
"method",
"calls",
"validate_settings!",
"()",
"to",
"validate",
"the... | 51319e4b58c8d9986f101ad71ff729aa3e51e951 | https://github.com/sensu/sensu/blob/51319e4b58c8d9986f101ad71ff729aa3e51e951/lib/sensu/daemon.rb#L165-L176 | train | Load settings from the settings file | [
30522,
13366,
7170,
1035,
10906,
1006,
7047,
1027,
1063,
1065,
1007,
1030,
10906,
1027,
10906,
1012,
2131,
1006,
7047,
1007,
9398,
3686,
1035,
10906,
999,
1006,
1030,
10906,
1007,
2065,
7047,
1031,
1024,
9398,
3686,
1035,
9530,
8873,
2290,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
puppetlabs/puppet | lib/puppet/util/windows/sid.rb | Puppet::Util::Windows.SID.valid_sid? | def valid_sid?(string_sid)
valid = false
begin
string_to_sid_ptr(string_sid) { |ptr| valid = ! ptr.nil? && ! ptr.null? }
rescue Puppet::Util::Windows::Error => e
raise if e.code != ERROR_INVALID_SID_STRUCTURE
end
valid
end | ruby | def valid_sid?(string_sid)
valid = false
begin
string_to_sid_ptr(string_sid) { |ptr| valid = ! ptr.nil? && ! ptr.null? }
rescue Puppet::Util::Windows::Error => e
raise if e.code != ERROR_INVALID_SID_STRUCTURE
end
valid
end | [
"def",
"valid_sid?",
"(",
"string_sid",
")",
"valid",
"=",
"false",
"begin",
"string_to_sid_ptr",
"(",
"string_sid",
")",
"{",
"|",
"ptr",
"|",
"valid",
"=",
"!",
"ptr",
".",
"nil?",
"&&",
"!",
"ptr",
".",
"null?",
"}",
"rescue",
"Puppet",
"::",
"Util"... | Return true if the string is a valid SID, e.g. "S-1-5-32-544", false otherwise. | [
"Return",
"true",
"if",
"the",
"string",
"is",
"a",
"valid",
"SID",
"e",
".",
"g",
".",
"S",
"-",
"1",
"-",
"5",
"-",
"32",
"-",
"544",
"false",
"otherwise",
"."
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/util/windows/sid.rb#L200-L210 | train | Returns true if the string_sid is valid for this object. | [
30522,
13366,
9398,
1035,
15765,
1029,
1006,
5164,
1035,
15765,
1007,
9398,
1027,
6270,
4088,
5164,
1035,
2000,
1035,
15765,
1035,
13866,
2099,
1006,
5164,
1035,
15765,
1007,
1063,
1064,
13866,
2099,
1064,
9398,
1027,
999,
13866,
2099,
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... |
awesome-print/awesome_print | lib/awesome_print/ext/ripple.rb | AwesomePrint.Ripple.awesome_ripple_document_class | def awesome_ripple_document_class(object)
return object.inspect if !defined?(::ActiveSupport::OrderedHash) || !object.respond_to?(:properties)
name = "class #{awesome_simple(object.to_s, :class)}"
base = "< #{awesome_simple(object.superclass.to_s, :class)}"
[name, base, awesome_hash(data)].join(' ')
end | ruby | def awesome_ripple_document_class(object)
return object.inspect if !defined?(::ActiveSupport::OrderedHash) || !object.respond_to?(:properties)
name = "class #{awesome_simple(object.to_s, :class)}"
base = "< #{awesome_simple(object.superclass.to_s, :class)}"
[name, base, awesome_hash(data)].join(' ')
end | [
"def",
"awesome_ripple_document_class",
"(",
"object",
")",
"return",
"object",
".",
"inspect",
"if",
"!",
"defined?",
"(",
"::",
"ActiveSupport",
"::",
"OrderedHash",
")",
"||",
"!",
"object",
".",
"respond_to?",
"(",
":properties",
")",
"name",
"=",
"\"class... | Format Ripple class object.
------------------------------------------------------------------------------ | [
"Format",
"Ripple",
"class",
"object",
".",
"------------------------------------------------------------------------------"
] | 4564fd74721562cbef2443f7d97109bf9192343d | https://github.com/awesome-print/awesome_print/blob/4564fd74721562cbef2443f7d97109bf9192343d/lib/awesome_print/ext/ripple.rb#L60-L67 | train | Returns the class name base and data for the given object. | [
30522,
13366,
12476,
1035,
24644,
1035,
6254,
1035,
2465,
1006,
4874,
1007,
2709,
4874,
1012,
22459,
2065,
999,
4225,
1029,
1006,
1024,
1024,
3161,
6342,
9397,
11589,
1024,
1024,
3641,
14949,
2232,
1007,
1064,
1064,
999,
4874,
1012,
6869,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_media_services/lib/2018-07-01/generated/azure_mgmt_media_services/assets.rb | Azure::MediaServices::Mgmt::V2018_07_01.Assets.list_container_sas_with_http_info | def list_container_sas_with_http_info(resource_group_name, account_name, asset_name, parameters, custom_headers:nil)
list_container_sas_async(resource_group_name, account_name, asset_name, parameters, custom_headers:custom_headers).value!
end | ruby | def list_container_sas_with_http_info(resource_group_name, account_name, asset_name, parameters, custom_headers:nil)
list_container_sas_async(resource_group_name, account_name, asset_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"list_container_sas_with_http_info",
"(",
"resource_group_name",
",",
"account_name",
",",
"asset_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"list_container_sas_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"asset_name",
",",
... | List the Asset URLs
Lists storage container URLs with shared access signatures (SAS) for
uploading and downloading Asset content. The signatures are derived from the
storage account keys.
@param resource_group_name [String] The name of the resource group within the
Azure subscription.
@param account_name [String] The Media Services account name.
@param asset_name [String] The Asset name.
@param parameters [ListContainerSasInput] The request parameters
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"List",
"the",
"Asset",
"URLs"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_media_services/lib/2018-07-01/generated/azure_mgmt_media_services/assets.rb#L626-L628 | train | Gets the SAS of the specified container. | [
30522,
13366,
2862,
1035,
11661,
1035,
21871,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
11412,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2862... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.get_cluster_event_list | def get_cluster_event_list(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
response = get_cluster_event_list_async(start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_cluster_event_list(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
response = get_cluster_event_list_async(start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_cluster_event_list",
"(",
"start_time_utc",
",",
"end_time_utc",
",",
"timeout",
":",
"60",
",",
"events_types_filter",
":",
"nil",
",",
"exclude_analysis_events",
":",
"nil",
",",
"skip_correlation_lookup",
":",
"nil",
",",
"custom_headers",
":",
"nil",... | Gets all Cluster-related events.
The response is list of ClusterEvent objects.
@param start_time_utc [String] The start time of a lookup query in ISO UTC
yyyy-MM-ddTHH:mm:ssZ.
@param end_time_utc [String] The end time of a lookup query in ISO UTC
yyyy-MM-ddTHH:mm:ssZ.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param events_types_filter [String] This is a comma separated string
specifying the types of FabricEvents that should only be included in the
response.
@param exclude_analysis_events [Boolean] This param disables the retrieval of
AnalysisEvents if true is passed.
@param skip_correlation_lookup [Boolean] This param disables the search of
CorrelatedEvents information if true is passed. otherwise the
CorrelationEvents get processed and HasCorrelatedEvents field in every
FabricEvent gets populated.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array] operation results. | [
"Gets",
"all",
"Cluster",
"-",
"related",
"events",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L27211-L27214 | train | Gets the cluster event list. | [
30522,
13366,
2131,
1035,
9324,
1035,
2724,
1035,
2862,
1006,
2707,
1035,
2051,
1035,
11396,
1010,
2203,
1035,
2051,
1035,
11396,
1010,
2051,
5833,
1024,
3438,
1010,
2824,
1035,
4127,
1035,
11307,
1024,
9152,
2140,
1010,
23329,
1035,
4106,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_api_management/lib/2016-07-07/generated/azure_mgmt_api_management/apis.rb | Azure::ApiManagement::Mgmt::V2016_07_07.Apis.export | def export(resource_group_name, service_name, api_id, custom_headers:nil)
response = export_async(resource_group_name, service_name, api_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def export(resource_group_name, service_name, api_id, custom_headers:nil)
response = export_async(resource_group_name, service_name, api_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"export",
"(",
"resource_group_name",
",",
"service_name",
",",
"api_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"export_async",
"(",
"resource_group_name",
",",
"service_name",
",",
"api_id",
",",
"custom_headers",
":custom_headers",
")",
... | Gets the details of the API specified by its identifier.
@param resource_group_name [String] The name of the resource group.
@param service_name [String] The name of the API Management service.
@param api_id [String] API identifier. Must be unique in the current API
Management service instance.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ApiExportResult] operation results. | [
"Gets",
"the",
"details",
"of",
"the",
"API",
"specified",
"by",
"its",
"identifier",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2016-07-07/generated/azure_mgmt_api_management/apis.rb#L607-L610 | train | Export a single API. | [
30522,
13366,
9167,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
17928,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
9167,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
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 | management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/network_watchers.rb | Azure::Network::Mgmt::V2018_08_01.NetworkWatchers.get_topology | def get_topology(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
response = get_topology_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_topology(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
response = get_topology_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_topology",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_topology_async",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"parameters",
",",
"custom_hea... | Gets the current network topology by resource group.
@param resource_group_name [String] The name of the resource group.
@param network_watcher_name [String] The name of the network watcher.
@param parameters [TopologyParameters] Parameters that define the
representation of topology.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Topology] operation results. | [
"Gets",
"the",
"current",
"network",
"topology",
"by",
"resource",
"group",
"."
] | 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#L560-L563 | train | Gets the topology of the specified virtual network interface. | [
30522,
13366,
2131,
1035,
19587,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2897,
1035,
3422,
2121,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
19587,
1035,
2004,
6038,
2278,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-10-01/generated/azure_mgmt_network/connection_monitors.rb | Azure::Network::Mgmt::V2018_10_01.ConnectionMonitors.begin_stop_with_http_info | def begin_stop_with_http_info(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
begin_stop_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers).value!
end | ruby | def begin_stop_with_http_info(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
begin_stop_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers).value!
end | [
"def",
"begin_stop_with_http_info",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"connection_monitor_name",
",",
"custom_headers",
":",
"nil",
")",
"begin_stop_async",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"connection_monitor_name",
",... | Stops the specified connection monitor.
@param resource_group_name [String] The name of the resource group containing
Network Watcher.
@param network_watcher_name [String] The name of the Network Watcher
resource.
@param connection_monitor_name [String] The name of the connection monitor.
@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. | [
"Stops",
"the",
"specified",
"connection",
"monitor",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-10-01/generated/azure_mgmt_network/connection_monitors.rb#L705-L707 | train | Stops the specified connection monitor. | [
30522,
13366,
4088,
1035,
2644,
1035,
2007,
1035,
30524,
2171,
1010,
2897,
1035,
3422,
2121,
1035,
2171,
1010,
4434,
1035,
8080,
1035,
2171,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | fastlane/lib/fastlane/setup/setup_ios.rb | Fastlane.SetupIos.find_and_setup_xcode_project | def find_and_setup_xcode_project(ask_for_scheme: true)
UI.message("Parsing your local Xcode project to find the available schemes and the app identifier")
config = {} # this is needed as the first method call will store information in there
if self.project_path.end_with?("xcworkspace")
config[:workspace] = self.project_path
else
config[:project] = self.project_path
end
FastlaneCore::Project.detect_projects(config)
self.project = FastlaneCore::Project.new(config)
if ask_for_scheme
self.scheme = self.project.select_scheme(preferred_to_include: self.project.project_name)
end
self.app_identifier = self.project.default_app_identifier # These two vars need to be accessed in order to be set
if self.app_identifier.to_s.length == 0
ask_for_bundle_identifier
end
end | ruby | def find_and_setup_xcode_project(ask_for_scheme: true)
UI.message("Parsing your local Xcode project to find the available schemes and the app identifier")
config = {} # this is needed as the first method call will store information in there
if self.project_path.end_with?("xcworkspace")
config[:workspace] = self.project_path
else
config[:project] = self.project_path
end
FastlaneCore::Project.detect_projects(config)
self.project = FastlaneCore::Project.new(config)
if ask_for_scheme
self.scheme = self.project.select_scheme(preferred_to_include: self.project.project_name)
end
self.app_identifier = self.project.default_app_identifier # These two vars need to be accessed in order to be set
if self.app_identifier.to_s.length == 0
ask_for_bundle_identifier
end
end | [
"def",
"find_and_setup_xcode_project",
"(",
"ask_for_scheme",
":",
"true",
")",
"UI",
".",
"message",
"(",
"\"Parsing your local Xcode project to find the available schemes and the app identifier\"",
")",
"config",
"=",
"{",
"}",
"# this is needed as the first method call will stor... | Helpers
Every installation setup that needs an Xcode project should
call this method | [
"Helpers",
"Every",
"installation",
"setup",
"that",
"needs",
"an",
"Xcode",
"project",
"should",
"call",
"this",
"method"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/fastlane/lib/fastlane/setup/setup_ios.rb#L265-L285 | train | This method is called by the Xcode project class to find the available schemes and the app identifier. | [
30522,
13366,
2424,
1035,
1998,
1035,
16437,
1035,
1060,
16044,
1035,
2622,
1006,
3198,
1035,
2005,
1035,
5679,
1024,
2995,
1007,
21318,
1012,
4471,
1006,
1000,
11968,
7741,
2115,
2334,
1060,
16044,
2622,
2000,
2424,
1996,
2800,
11683,
1998... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fluent/fluentd | lib/fluent/plugin/in_monitor_agent.rb | Fluent::Plugin.MonitorAgentInput.plugins_info_by_type | def plugins_info_by_type(type, opts={})
array = all_plugins.select {|pe|
(pe.config['@type'] == type) rescue nil
}
array.map {|pe|
get_monitor_info(pe, opts)
}
end | ruby | def plugins_info_by_type(type, opts={})
array = all_plugins.select {|pe|
(pe.config['@type'] == type) rescue nil
}
array.map {|pe|
get_monitor_info(pe, opts)
}
end | [
"def",
"plugins_info_by_type",
"(",
"type",
",",
"opts",
"=",
"{",
"}",
")",
"array",
"=",
"all_plugins",
".",
"select",
"{",
"|",
"pe",
"|",
"(",
"pe",
".",
"config",
"[",
"'@type'",
"]",
"==",
"type",
")",
"rescue",
"nil",
"}",
"array",
".",
"map... | This method returns an array because
multiple plugins could have the same type | [
"This",
"method",
"returns",
"an",
"array",
"because",
"multiple",
"plugins",
"could",
"have",
"the",
"same",
"type"
] | add2af9a5b7f74fc36957b8e6138b3c5a2871a92 | https://github.com/fluent/fluentd/blob/add2af9a5b7f74fc36957b8e6138b3c5a2871a92/lib/fluent/plugin/in_monitor_agent.rb#L342-L349 | train | Get the information about the plugins with the given type | [
30522,
13366,
13354,
7076,
1035,
18558,
1035,
2011,
1035,
2828,
1006,
2828,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
9140,
1027,
2035,
1035,
13354,
7076,
1012,
7276,
1063,
1064,
21877,
1064,
1006,
21877,
1012,
9530,
8873,
2290,
1031,
1005... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2018-04-01/generated/azure_mgmt_compute/virtual_machine_scale_set_rolling_upgrades.rb | Azure::Compute::Mgmt::V2018_04_01.VirtualMachineScaleSetRollingUpgrades.cancel | def cancel(resource_group_name, vm_scale_set_name, custom_headers:nil)
response = cancel_async(resource_group_name, vm_scale_set_name, custom_headers:custom_headers).value!
nil
end | ruby | def cancel(resource_group_name, vm_scale_set_name, custom_headers:nil)
response = cancel_async(resource_group_name, vm_scale_set_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"cancel",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"cancel_async",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"nil",
... | Cancels the current virtual machine scale set rolling upgrade.
@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. | [
"Cancels",
"the",
"current",
"virtual",
"machine",
"scale",
"set",
"rolling",
"upgrade",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2018-04-01/generated/azure_mgmt_compute/virtual_machine_scale_set_rolling_upgrades.rb#L32-L35 | train | Cancels a virtual machine scale set. | [
30522,
13366,
17542,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
4094,
1035,
2275,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
17542,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/versions.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Versions.import_with_http_info | def import_with_http_info(app_id, luis_app, version_id:nil, custom_headers:nil)
import_async(app_id, luis_app, version_id:version_id, custom_headers:custom_headers).value!
end | ruby | def import_with_http_info(app_id, luis_app, version_id:nil, custom_headers:nil)
import_async(app_id, luis_app, version_id:version_id, custom_headers:custom_headers).value!
end | [
"def",
"import_with_http_info",
"(",
"app_id",
",",
"luis_app",
",",
"version_id",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"import_async",
"(",
"app_id",
",",
"luis_app",
",",
"version_id",
":version_id",
",",
"custom_headers",
":custom_headers",
")",
... | Imports a new version into a LUIS application.
@param app_id The application ID.
@param luis_app [LuisApp] A LUIS application structure.
@param version_id [String] The new versionId to import. If not specified, the
versionId will be read from the imported object.
@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. | [
"Imports",
"a",
"new",
"version",
"into",
"a",
"LUIS",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/versions.rb#L662-L664 | train | Import a luis specification into a LUIS specification. | [
30522,
13366,
12324,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
6446,
1035,
10439,
1010,
2544,
1035,
8909,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
12324,
1035,
2004,
6038,
2278,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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.delete_image_store_upload_session_with_http_info | def delete_image_store_upload_session_with_http_info(session_id, timeout:60, custom_headers:nil)
delete_image_store_upload_session_async(session_id, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def delete_image_store_upload_session_with_http_info(session_id, timeout:60, custom_headers:nil)
delete_image_store_upload_session_async(session_id, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"delete_image_store_upload_session_with_http_info",
"(",
"session_id",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"delete_image_store_upload_session_async",
"(",
"session_id",
",",
"timeout",
":",
"timeout",
",",
"custom_headers",
":custom_h... | Cancels an image store upload session.
The DELETE request will cause the existing upload session to expire and
remove any previously uploaded file chunks.
@param session_id A GUID generated by the user for a file uploading. It
identifies an image store upload session which keeps track of all file chunks
until it is committed.
@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. | [
"Cancels",
"an",
"image",
"store",
"upload",
"session",
"."
] | 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#L19754-L19756 | train | Deletes an image store upload session. | [
30522,
13366,
3972,
12870,
30524,
2004,
6038,
2278,
1006,
5219,
1035,
8909,
1010,
2051,
5833,
1024,
2051,
5833,
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,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/drawing/graphic_frame.rb | Axlsx.GraphicFrame.to_xml_string | def to_xml_string(str = '')
# macro attribute should be optional!
str << '<xdr:graphicFrame>'
str << '<xdr:nvGraphicFramePr>'
str << ('<xdr:cNvPr id="' << @anchor.drawing.index.to_s << '" name="' << 'item_' << @anchor.drawing.index.to_s << '"/>')
str << '<xdr:cNvGraphicFramePr/>'
str << '</xdr:nvGraphicFramePr>'
str << '<xdr:xfrm>'
str << '<a:off x="0" y="0"/>'
str << '<a:ext cx="0" cy="0"/>'
str << '</xdr:xfrm>'
str << '<a:graphic>'
str << ('<a:graphicData uri="' << XML_NS_C << '">')
str << ('<c:chart xmlns:c="' << XML_NS_C << '" xmlns:r="' << XML_NS_R << '" r:id="' << rId << '"/>')
str << '</a:graphicData>'
str << '</a:graphic>'
str << '</xdr:graphicFrame>'
end | ruby | def to_xml_string(str = '')
# macro attribute should be optional!
str << '<xdr:graphicFrame>'
str << '<xdr:nvGraphicFramePr>'
str << ('<xdr:cNvPr id="' << @anchor.drawing.index.to_s << '" name="' << 'item_' << @anchor.drawing.index.to_s << '"/>')
str << '<xdr:cNvGraphicFramePr/>'
str << '</xdr:nvGraphicFramePr>'
str << '<xdr:xfrm>'
str << '<a:off x="0" y="0"/>'
str << '<a:ext cx="0" cy="0"/>'
str << '</xdr:xfrm>'
str << '<a:graphic>'
str << ('<a:graphicData uri="' << XML_NS_C << '">')
str << ('<c:chart xmlns:c="' << XML_NS_C << '" xmlns:r="' << XML_NS_R << '" r:id="' << rId << '"/>')
str << '</a:graphicData>'
str << '</a:graphic>'
str << '</xdr:graphicFrame>'
end | [
"def",
"to_xml_string",
"(",
"str",
"=",
"''",
")",
"# macro attribute should be optional!",
"str",
"<<",
"'<xdr:graphicFrame>'",
"str",
"<<",
"'<xdr:nvGraphicFramePr>'",
"str",
"<<",
"(",
"'<xdr:cNvPr id=\"'",
"<<",
"@anchor",
".",
"drawing",
".",
"index",
".",
"to... | Serializes the object
@param [String] str
@return [String] | [
"Serializes",
"the",
"object"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/drawing/graphic_frame.rb#L34-L51 | train | Returns the XML string for this chart. | [
30522,
13366,
2000,
1035,
20950,
1035,
5164,
1006,
2358,
2099,
1027,
1005,
1005,
1007,
1001,
26632,
17961,
2323,
2022,
11887,
999,
2358,
2099,
1026,
1026,
1005,
1026,
1060,
13626,
1024,
8425,
15643,
1028,
1005,
2358,
2099,
1026,
1026,
1005,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb | Azure::KeyVault::V2016_10_01.KeyVaultClient.get_key_versions_as_lazy | def get_key_versions_as_lazy(vault_base_url, key_name, maxresults:nil, custom_headers:nil)
first_page = get_key_versions_as_lazy_as_lazy(vault_base_url, key_name, maxresults:maxresults, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def get_key_versions_as_lazy(vault_base_url, key_name, maxresults:nil, custom_headers:nil)
first_page = get_key_versions_as_lazy_as_lazy(vault_base_url, key_name, maxresults:maxresults, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"get_key_versions_as_lazy",
"(",
"vault_base_url",
",",
"key_name",
",",
"maxresults",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"get_key_versions_as_lazy_as_lazy",
"(",
"vault_base_url",
",",
"key_name",
",",
"maxresults",
":",
"... | Retrieves a list of individual key versions with the same key name.
The full key identifier, attributes, and tags are provided in the response.
This operation requires the keys/list permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param key_name [String] The name of the key.
@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 [KeyListResult] operation results. | [
"Retrieves",
"a",
"list",
"of",
"individual",
"key",
"versions",
"with",
"the",
"same",
"key",
"name",
"."
] | 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#L9467-L9470 | train | Gets the versions of the specified key. | [
30522,
13366,
2131,
1035,
3145,
1035,
4617,
1035,
2004,
1035,
13971,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
3145,
1035,
2171,
1010,
4098,
6072,
11314,
2015,
1024,
9152,
2140,
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... |
square/connect-ruby-sdk | lib/square_connect/api/v1_employees_api.rb | SquareConnect.V1EmployeesApi.create_timecard | def create_timecard(body, opts = {})
data, _status_code, _headers = create_timecard_with_http_info(body, opts)
return data
end | ruby | def create_timecard(body, opts = {})
data, _status_code, _headers = create_timecard_with_http_info(body, opts)
return data
end | [
"def",
"create_timecard",
"(",
"body",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"create_timecard_with_http_info",
"(",
"body",
",",
"opts",
")",
"return",
"data",
"end"
] | CreateTimecard
Creates a timecard for an employee and clocks them in with an `API_CREATE` event and a `clockin_time` set to the current time unless the request provides a different value. To import timecards from another system (rather than clocking someone in). Specify the `clockin_time` and* `clockout_time` in the request. Timecards correspond to exactly one shift for a given employee, bounded by the `clockin_time` and `clockout_time` fields. An employee is considered clocked in if they have a timecard that doesn't have a `clockout_time` set. An employee that is currently clocked in cannot be clocked in a second time.
@param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
@param [Hash] opts the optional parameters
@return [V1Timecard] | [
"CreateTimecard",
"Creates",
"a",
"timecard",
"for",
"an",
"employee",
"and",
"clocks",
"them",
"in",
"with",
"an",
"API_CREATE",
"event",
"and",
"a",
"clockin_time",
"set",
"to",
"the",
"current",
"time",
"unless",
"the",
"request",
"provides",
"a",
"differen... | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/v1_employees_api.rb#L135-L138 | train | Creates a timecard | [
30522,
13366,
3443,
1035,
2051,
11522,
1006,
2303,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
30524,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2303,
1010,
23569,
2015,
1007,
2709,
2951,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.get_partition_backup_list | def get_partition_backup_list(partition_id, timeout:60, latest:false, start_date_time_filter:nil, end_date_time_filter:nil, custom_headers:nil)
response = get_partition_backup_list_async(partition_id, timeout:timeout, latest:latest, start_date_time_filter:start_date_time_filter, end_date_time_filter:end_date_time_filter, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_partition_backup_list(partition_id, timeout:60, latest:false, start_date_time_filter:nil, end_date_time_filter:nil, custom_headers:nil)
response = get_partition_backup_list_async(partition_id, timeout:timeout, latest:latest, start_date_time_filter:start_date_time_filter, end_date_time_filter:end_date_time_filter, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_partition_backup_list",
"(",
"partition_id",
",",
"timeout",
":",
"60",
",",
"latest",
":",
"false",
",",
"start_date_time_filter",
":",
"nil",
",",
"end_date_time_filter",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_par... | Gets the list of backups available for the specified partition.
Returns a list of backups available for the specified partition. The server
enumerates all the backups available in the backup store configured in the
backup policy. It also allows filtering of the result based on start and end
datetime or just fetching the latest available backup for the partition.
@param partition_id The identity of the partition.
@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 latest [Boolean] Specifies whether to get only the most recent backup
available for a partition for the specified time range.
@param start_date_time_filter [DateTime] Specify the start date time from
which to enumerate backups, in datetime format. The date time must be
specified in ISO8601 format. This is an optional parameter. If not specified,
all backups from the beginning are enumerated.
@param end_date_time_filter [DateTime] Specify the end date time till which
to enumerate backups, in datetime format. The date time must be specified in
ISO8601 format. This is an optional parameter. If not specified, enumeration
is done till the most recent backup.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [PagedBackupInfoList] operation results. | [
"Gets",
"the",
"list",
"of",
"backups",
"available",
"for",
"the",
"specified",
"partition",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L25085-L25088 | train | Gets the backup list of the specified partition. | [
30522,
13366,
2131,
1035,
13571,
1035,
10200,
1035,
2862,
1006,
13571,
1035,
8909,
1010,
2051,
5833,
1024,
3438,
1010,
6745,
1024,
6270,
1010,
2707,
1035,
3058,
1035,
2051,
1035,
11307,
1024,
9152,
2140,
1010,
2203,
1035,
3058,
1035,
2051,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ruby-git/ruby-git | lib/git/lib.rb | Git.Lib.commit_data | def commit_data(sha)
sha = sha.to_s
cdata = command_lines('cat-file', ['commit', sha])
process_commit_data(cdata, sha, 0)
end | ruby | def commit_data(sha)
sha = sha.to_s
cdata = command_lines('cat-file', ['commit', sha])
process_commit_data(cdata, sha, 0)
end | [
"def",
"commit_data",
"(",
"sha",
")",
"sha",
"=",
"sha",
".",
"to_s",
"cdata",
"=",
"command_lines",
"(",
"'cat-file'",
",",
"[",
"'commit'",
",",
"sha",
"]",
")",
"process_commit_data",
"(",
"cdata",
",",
"sha",
",",
"0",
")",
"end"
] | returns useful array of raw commit object data | [
"returns",
"useful",
"array",
"of",
"raw",
"commit",
"object",
"data"
] | 9bd4407c56068e1604f14a1b6c0c5a84868e6378 | https://github.com/ruby-git/ruby-git/blob/9bd4407c56068e1604f14a1b6c0c5a84868e6378/lib/git/lib.rb#L175-L179 | train | Commit the data for a given commit | [
30522,
13366,
10797,
1035,
2951,
1006,
21146,
1007,
21146,
1027,
21146,
1012,
2000,
1035,
1055,
3729,
6790,
1027,
3094,
1035,
3210,
1006,
1005,
4937,
1011,
5371,
1005,
1010,
1031,
1005,
10797,
1005,
1010,
21146,
1033,
1007,
2832,
1035,
1079... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-rds/lib/aws-sdk-rds/db_instance.rb | Aws::RDS.DBInstance.pending_maintenance_actions | def pending_maintenance_actions(options = {})
batches = Enumerator.new do |y|
batch = []
options = Aws::Util.deep_merge(options, filters: [{
name: "db-instance-id",
values: [@id]
}])
resp = @client.describe_pending_maintenance_actions(options)
resp.data.pending_maintenance_actions_0.pending_maintenance_action_details.each do |p|
batch << PendingMaintenanceAction.new(
target_arn: resp.data.pending_maintenance_actions[0].resource_identifier,
name: p.action,
data: p,
client: @client
)
end
y.yield(batch)
end
PendingMaintenanceAction::Collection.new(batches)
end | ruby | def pending_maintenance_actions(options = {})
batches = Enumerator.new do |y|
batch = []
options = Aws::Util.deep_merge(options, filters: [{
name: "db-instance-id",
values: [@id]
}])
resp = @client.describe_pending_maintenance_actions(options)
resp.data.pending_maintenance_actions_0.pending_maintenance_action_details.each do |p|
batch << PendingMaintenanceAction.new(
target_arn: resp.data.pending_maintenance_actions[0].resource_identifier,
name: p.action,
data: p,
client: @client
)
end
y.yield(batch)
end
PendingMaintenanceAction::Collection.new(batches)
end | [
"def",
"pending_maintenance_actions",
"(",
"options",
"=",
"{",
"}",
")",
"batches",
"=",
"Enumerator",
".",
"new",
"do",
"|",
"y",
"|",
"batch",
"=",
"[",
"]",
"options",
"=",
"Aws",
"::",
"Util",
".",
"deep_merge",
"(",
"options",
",",
"filters",
":"... | @example Request syntax with placeholder values
pending_maintenance_actions = db_instance.pending_maintenance_actions({
resource_identifier: "String",
filters: [
{
name: "String", # required
values: ["String"], # required
},
],
marker: "String",
max_records: 1,
})
@param [Hash] options ({})
@option options [String] :resource_identifier
The ARN of a resource to return pending maintenance actions for.
@option options [Array<Types::Filter>] :filters
A filter that specifies one or more resources to return pending
maintenance actions for.
Supported filters:
* `db-cluster-id` - Accepts DB cluster identifiers and DB cluster
Amazon Resource Names (ARNs). The results list will only include
pending maintenance actions for the DB clusters identified by these
ARNs.
* `db-instance-id` - Accepts DB instance identifiers and DB instance
ARNs. The results list will only include pending maintenance actions
for the DB instances identified by these ARNs.
@option options [String] :marker
An optional pagination token provided by a previous
`DescribePendingMaintenanceActions` request. If this parameter is
specified, the response includes only records beyond the marker, up to
a number of records specified by `MaxRecords`.
@option options [Integer] :max_records
The maximum number of records to include in the response. If more
records exist than the specified `MaxRecords` value, a pagination
token called a marker is included in the response so that the
remaining results can be retrieved.
Default: 100
Constraints: Minimum 20, maximum 100.
@return [PendingMaintenanceAction::Collection] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-rds/lib/aws-sdk-rds/db_instance.rb#L3026-L3045 | train | Returns a collection of pending maintenance actions | [
30522,
13366,
14223,
1035,
6032,
1035,
4506,
1006,
7047,
1027,
1063,
1065,
1007,
14108,
2229,
1027,
4372,
17897,
16259,
1012,
2047,
2079,
1064,
1061,
1064,
14108,
1027,
1031,
1033,
7047,
1027,
22091,
2015,
1024,
1024,
21183,
4014,
1012,
278... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/cells/decidim/activity_cell.rb | Decidim.ActivityCell.title | def title
resource_title = resource.try(:resource_title) || resource.try(:title)
return if resource_title.blank?
if resource_title.is_a?(String)
resource_title
elsif resource_title.is_a?(Hash)
translated_attribute(resource_title)
end
end | ruby | def title
resource_title = resource.try(:resource_title) || resource.try(:title)
return if resource_title.blank?
if resource_title.is_a?(String)
resource_title
elsif resource_title.is_a?(Hash)
translated_attribute(resource_title)
end
end | [
"def",
"title",
"resource_title",
"=",
"resource",
".",
"try",
"(",
":resource_title",
")",
"||",
"resource",
".",
"try",
"(",
":title",
")",
"return",
"if",
"resource_title",
".",
"blank?",
"if",
"resource_title",
".",
"is_a?",
"(",
"String",
")",
"resource... | The title to show at the card.
The card will also be displayed OK if there's no title. | [
"The",
"title",
"to",
"show",
"at",
"the",
"card",
"."
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/app/cells/decidim/activity_cell.rb#L34-L43 | train | Returns the title of the resource. | [
30522,
13366,
2516,
7692,
1035,
2516,
1027,
7692,
1012,
3046,
1006,
1024,
7692,
1035,
2516,
1007,
1064,
1064,
7692,
1012,
3046,
1006,
1024,
2516,
1007,
2709,
2065,
7692,
1035,
2516,
1012,
8744,
1029,
2065,
7692,
1035,
2516,
1012,
2003,
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... |
rmagick/rmagick | lib/rmagick_internal.rb | Magick.ImageList.[] | def [](*args)
a = @images[*args]
if a.respond_to?(:each)
ilist = self.class.new
a.each { |image| ilist << image }
a = ilist
end
a
end | ruby | def [](*args)
a = @images[*args]
if a.respond_to?(:each)
ilist = self.class.new
a.each { |image| ilist << image }
a = ilist
end
a
end | [
"def",
"[]",
"(",
"*",
"args",
")",
"a",
"=",
"@images",
"[",
"args",
"]",
"if",
"a",
".",
"respond_to?",
"(",
":each",
")",
"ilist",
"=",
"self",
".",
"class",
".",
"new",
"a",
".",
"each",
"{",
"|",
"image",
"|",
"ilist",
"<<",
"image",
"}",
... | Compare ImageLists
Compare each image in turn until the result of a comparison
is not 0. If all comparisons return 0, then
return if A.scene != B.scene
return A.length <=> B.length | [
"Compare",
"ImageLists",
"Compare",
"each",
"image",
"in",
"turn",
"until",
"the",
"result",
"of",
"a",
"comparison",
"is",
"not",
"0",
".",
"If",
"all",
"comparisons",
"return",
"0",
"then",
"return",
"if",
"A",
".",
"scene",
"!",
"=",
"B",
".",
"scen... | ef6688ed9d76bf123c2ea1a483eff8635051adb7 | https://github.com/rmagick/rmagick/blob/ef6688ed9d76bf123c2ea1a483eff8635051adb7/lib/rmagick_internal.rb#L1346-L1354 | train | Returns an array of the images that match the given args. | [
30522,
13366,
1031,
1033,
1006,
1008,
12098,
5620,
1007,
1037,
1027,
1030,
4871,
1031,
1008,
12098,
5620,
1033,
2065,
1037,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
2169,
1007,
6335,
2923,
1027,
2969,
1012,
2465,
1012,
2047,
1037,
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... |
rollbar/rollbar-gem | lib/rollbar/notifier.rb | Rollbar.Notifier.report_internal_error | def report_internal_error(exception)
log_error '[Rollbar] Reporting internal error encountered while sending data to Rollbar.'
configuration.execute_hook(:on_report_internal_error, exception)
begin
item = build_item('error', nil, exception, { :internal => true }, nil)
rescue StandardError => e
send_failsafe('build_item in exception_data', e)
log_error "[Rollbar] Exception: #{exception}"
return
end
begin
process_item(item)
rescue StandardError => e
send_failsafe('error in process_item', e)
log_error "[Rollbar] Item: #{item}"
return
end
begin
log_instance_link(item['data'])
rescue StandardError => e
send_failsafe('error logging instance link', e)
log_error "[Rollbar] Item: #{item}"
return
end
end | ruby | def report_internal_error(exception)
log_error '[Rollbar] Reporting internal error encountered while sending data to Rollbar.'
configuration.execute_hook(:on_report_internal_error, exception)
begin
item = build_item('error', nil, exception, { :internal => true }, nil)
rescue StandardError => e
send_failsafe('build_item in exception_data', e)
log_error "[Rollbar] Exception: #{exception}"
return
end
begin
process_item(item)
rescue StandardError => e
send_failsafe('error in process_item', e)
log_error "[Rollbar] Item: #{item}"
return
end
begin
log_instance_link(item['data'])
rescue StandardError => e
send_failsafe('error logging instance link', e)
log_error "[Rollbar] Item: #{item}"
return
end
end | [
"def",
"report_internal_error",
"(",
"exception",
")",
"log_error",
"'[Rollbar] Reporting internal error encountered while sending data to Rollbar.'",
"configuration",
".",
"execute_hook",
"(",
":on_report_internal_error",
",",
"exception",
")",
"begin",
"item",
"=",
"build_item"... | Reports an internal error in the Rollbar library. This will be reported within the configured
Rollbar project. We'll first attempt to provide a report including the exception traceback.
If that fails, we'll fall back to a more static failsafe response. | [
"Reports",
"an",
"internal",
"error",
"in",
"the",
"Rollbar",
"library",
".",
"This",
"will",
"be",
"reported",
"within",
"the",
"configured",
"Rollbar",
"project",
".",
"We",
"ll",
"first",
"attempt",
"to",
"provide",
"a",
"report",
"including",
"the",
"exc... | 83ef1acca2b0b1d1b74ff8ef29435ca82e8ca1d6 | https://github.com/rollbar/rollbar-gem/blob/83ef1acca2b0b1d1b74ff8ef29435ca82e8ca1d6/lib/rollbar/notifier.rb#L444-L472 | train | Report an internal error | [
30522,
13366,
3189,
1035,
4722,
1035,
7561,
1006,
6453,
1007,
8833,
1035,
7561,
1005,
1031,
4897,
8237,
1033,
7316,
4722,
7561,
8567,
2096,
6016,
2951,
2000,
4897,
8237,
1012,
1005,
9563,
1012,
15389,
1035,
8103,
1006,
1024,
2006,
1035,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
appium/ruby_lib | lib/appium_lib/android/common/helper.rb | Appium.Android.get_android_inspect | def get_android_inspect(class_name = false)
source = get_source
doctype_string = '<!doctyp'
source_header = source[0..doctype_string.length].downcase
source_is_html = source_header.start_with?(doctype_string, '<html')
parser = if source_is_html # parse html from webview
@android_html_parser ||= Nokogiri::HTML::SAX::Parser.new(Appium::Common::HTMLElements.new)
else
@android_native_parser ||= Nokogiri::XML::SAX::Parser.new(AndroidElements.new)
end
parser.document.reset # ensure document is reset before parsing
parser.document.filter = class_name
parser.parse source
result = parser.document.result
parser.document.reset # clean up any created objects after parsing
result
end | ruby | def get_android_inspect(class_name = false)
source = get_source
doctype_string = '<!doctyp'
source_header = source[0..doctype_string.length].downcase
source_is_html = source_header.start_with?(doctype_string, '<html')
parser = if source_is_html # parse html from webview
@android_html_parser ||= Nokogiri::HTML::SAX::Parser.new(Appium::Common::HTMLElements.new)
else
@android_native_parser ||= Nokogiri::XML::SAX::Parser.new(AndroidElements.new)
end
parser.document.reset # ensure document is reset before parsing
parser.document.filter = class_name
parser.parse source
result = parser.document.result
parser.document.reset # clean up any created objects after parsing
result
end | [
"def",
"get_android_inspect",
"(",
"class_name",
"=",
"false",
")",
"source",
"=",
"get_source",
"doctype_string",
"=",
"'<!doctyp'",
"source_header",
"=",
"source",
"[",
"0",
"..",
"doctype_string",
".",
"length",
"]",
".",
"downcase",
"source_is_html",
"=",
"s... | class AndroidElements
Android only.
Returns a string containing interesting elements.
The text, content description, and id are returned.
@param class_name [String] the class name to filter on.
if false (default) then all classes will be inspected
@return [String] | [
"class",
"AndroidElements",
"Android",
"only",
".",
"Returns",
"a",
"string",
"containing",
"interesting",
"elements",
".",
"The",
"text",
"content",
"description",
"and",
"id",
"are",
"returned",
"."
] | 1f5898400dd1928bfe42ddd5f842d1f8738f2f76 | https://github.com/appium/ruby_lib/blob/1f5898400dd1928bfe42ddd5f842d1f8738f2f76/lib/appium_lib/android/common/helper.rb#L95-L113 | train | Get the Android inspect | [
30522,
13366,
2131,
1035,
11924,
1035,
22459,
1006,
2465,
1035,
2171,
1027,
6270,
1007,
3120,
1027,
2131,
1035,
3120,
9986,
13874,
1035,
5164,
1027,
1005,
1026,
999,
9986,
3723,
2361,
1005,
3120,
1035,
20346,
1027,
3120,
1031,
1014,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_reservations/lib/2018-06-01-preview/generated/azure_mgmt_reservations/reservations_management_client.rb | Azure::Reservations::Mgmt::V2018_06_01_preview.ReservationsManagementClient.get_applied_reservation_list | def get_applied_reservation_list(subscription_id, custom_headers:nil)
response = get_applied_reservation_list_async(subscription_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_applied_reservation_list(subscription_id, custom_headers:nil)
response = get_applied_reservation_list_async(subscription_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_applied_reservation_list",
"(",
"subscription_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_applied_reservation_list_async",
"(",
"subscription_id",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"... | Get list of applicable `Reservation`s.
Get applicable `Reservation`s that are applied to this subscription.
@param subscription_id [String] Id of the subscription
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [AppliedReservations] operation results. | [
"Get",
"list",
"of",
"applicable",
"Reservation",
"s",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_reservations/lib/2018-06-01-preview/generated/azure_mgmt_reservations/reservations_management_client.rb#L255-L258 | train | Gets the list of applied reservation entities. | [
30522,
13366,
2131,
1035,
4162,
1035,
11079,
1035,
2862,
1006,
15002,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
4162,
1035,
11079,
1035,
2862,
1035,
2004,
6038,
2278,
1006,
15002,
1035,
8909,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.