repo stringclasses 235 values | path stringlengths 11 168 | func_name stringlengths 12 143 | original_string stringlengths 83 6.91k | language stringclasses 1 value | code stringlengths 83 6.91k | code_tokens listlengths 15 1.01k | docstring stringlengths 5 25.7k | docstring_tokens listlengths 1 427 | sha stringclasses 235 values | url stringlengths 99 268 | partition stringclasses 1 value | summary stringlengths 7 202 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-ruby | management/azure_mgmt_recovery_services_site_recovery/lib/2016-08-10/generated/azure_mgmt_recovery_services_site_recovery/recovery_points.rb | Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10.RecoveryPoints.list_by_replication_protected_items_next | def list_by_replication_protected_items_next(next_page_link, custom_headers:nil)
response = list_by_replication_protected_items_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_replication_protected_items_next(next_page_link, custom_headers:nil)
response = list_by_replication_protected_items_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_replication_protected_items_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_replication_protected_items_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response"... | Get recovery points for a replication protected item.
Lists the available recovery points for a replication protected item.
@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 [RecoveryPointCollection] operation results. | [
"Get",
"recovery",
"points",
"for",
"a",
"replication",
"protected",
"item",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_recovery_services_site_recovery/lib/2016-08-10/generated/azure_mgmt_recovery_services_site_recovery/recovery_points.rb#L254-L257 | train | Gets the list of all protected items in a service group. | [
30522,
13366,
2862,
1035,
2011,
1035,
21647,
1035,
5123,
1035,
5167,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
21647,
1035,
5123,
1035,
5167,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/managers.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.Managers.update_extended_info_with_http_info | def update_extended_info_with_http_info(parameters, resource_group_name, manager_name, if_match, custom_headers:nil)
update_extended_info_async(parameters, resource_group_name, manager_name, if_match, custom_headers:custom_headers).value!
end | ruby | def update_extended_info_with_http_info(parameters, resource_group_name, manager_name, if_match, custom_headers:nil)
update_extended_info_async(parameters, resource_group_name, manager_name, if_match, custom_headers:custom_headers).value!
end | [
"def",
"update_extended_info_with_http_info",
"(",
"parameters",
",",
"resource_group_name",
",",
"manager_name",
",",
"if_match",
",",
"custom_headers",
":",
"nil",
")",
"update_extended_info_async",
"(",
"parameters",
",",
"resource_group_name",
",",
"manager_name",
","... | Updates the extended info of the manager.
@param parameters [ManagerExtendedInfo] The manager extended information.
@param resource_group_name [String] The resource group name
@param manager_name [String] The manager name
@param if_match [String] Pass the ETag of ExtendedInfo fetched from GET call
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Updates",
"the",
"extended",
"info",
"of",
"the",
"manager",
"."
] | 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/managers.rb#L1096-L1098 | train | Updates the extended information of the specified resource group. | [
30522,
13366,
10651,
1035,
3668,
1035,
18558,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
11709,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
2065,
1035,
2674,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
10651... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
etewiah/property_web_builder | app/controllers/pwb/import/translations_controller.rb | Pwb.Import::TranslationsController.multiple | def multiple
I18n::Backend::ActiveRecord::Translation.import(params[:file])
return render json: { "success": true }, status: :ok, head: :no_content
# redirect_to root_url, notice: "I18n::Backend::ActiveRecord::Translations imported."
end | ruby | def multiple
I18n::Backend::ActiveRecord::Translation.import(params[:file])
return render json: { "success": true }, status: :ok, head: :no_content
# redirect_to root_url, notice: "I18n::Backend::ActiveRecord::Translations imported."
end | [
"def",
"multiple",
"I18n",
"::",
"Backend",
"::",
"ActiveRecord",
"::",
"Translation",
".",
"import",
"(",
"params",
"[",
":file",
"]",
")",
"return",
"render",
"json",
":",
"{",
"\"success\"",
":",
"true",
"}",
",",
"status",
":",
":ok",
",",
"head",
... | http://localhost:3000/import/translations/multiple | [
"http",
":",
"//",
"localhost",
":",
"3000",
"/",
"import",
"/",
"translations",
"/",
"multiple"
] | fba4e6d4ffa7bc1f4d3b50dfa5a6a9fbfee23f21 | https://github.com/etewiah/property_web_builder/blob/fba4e6d4ffa7bc1f4d3b50dfa5a6a9fbfee23f21/app/controllers/pwb/import/translations_controller.rb#L5-L11 | train | Import the translations | [
30522,
13366,
3674,
1045,
15136,
2078,
1024,
1024,
2067,
10497,
1024,
1024,
3161,
2890,
27108,
2094,
1024,
1024,
5449,
1012,
12324,
1006,
11498,
5244,
1031,
1024,
5371,
1033,
1007,
2709,
17552,
1046,
3385,
1024,
1063,
1000,
3112,
1000,
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... |
twitter/secure_headers | lib/secure_headers/view_helper.rb | SecureHeaders.ViewHelpers.nonced_javascript_include_tag | def nonced_javascript_include_tag(*args, &block)
opts = extract_options(args).merge(nonce: _content_security_policy_nonce(:script))
javascript_include_tag(*args, opts, &block)
end | ruby | def nonced_javascript_include_tag(*args, &block)
opts = extract_options(args).merge(nonce: _content_security_policy_nonce(:script))
javascript_include_tag(*args, opts, &block)
end | [
"def",
"nonced_javascript_include_tag",
"(",
"*",
"args",
",",
"&",
"block",
")",
"opts",
"=",
"extract_options",
"(",
"args",
")",
".",
"merge",
"(",
"nonce",
":",
"_content_security_policy_nonce",
"(",
":script",
")",
")",
"javascript_include_tag",
"(",
"args"... | Public: create a script src tag using the content security policy nonce.
Instructs secure_headers to append a nonce to script-src directive.
Returns an html-safe script tag with the nonce attribute. | [
"Public",
":",
"create",
"a",
"script",
"src",
"tag",
"using",
"the",
"content",
"security",
"policy",
"nonce",
".",
"Instructs",
"secure_headers",
"to",
"append",
"a",
"nonce",
"to",
"script",
"-",
"src",
"directive",
"."
] | 543e6712aadae08f1653ed973e6b6204f7eac26a | https://github.com/twitter/secure_headers/blob/543e6712aadae08f1653ed973e6b6204f7eac26a/lib/secure_headers/view_helper.rb#L39-L43 | train | Returns the nonced javascript include tag for the given arguments. | [
30522,
13366,
2512,
11788,
1035,
9262,
22483,
1035,
2421,
1035,
6415,
1006,
1008,
12098,
5620,
1010,
1004,
3796,
1007,
23569,
2015,
1027,
14817,
1035,
7047,
1006,
12098,
5620,
1007,
1012,
13590,
1006,
2512,
3401,
1024,
1035,
4180,
1035,
303... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_datalake_store/lib/2016-11-01/generated/azure_mgmt_datalake_store/trusted_id_providers.rb | Azure::DataLakeStore::Mgmt::V2016_11_01.TrustedIdProviders.get_with_http_info | def get_with_http_info(resource_group_name, account_name, trusted_id_provider_name, custom_headers:nil)
get_async(resource_group_name, account_name, trusted_id_provider_name, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, account_name, trusted_id_provider_name, custom_headers:nil)
get_async(resource_group_name, account_name, trusted_id_provider_name, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"account_name",
",",
"trusted_id_provider_name",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"trusted_id_provider_name",
",",
"custom_headers",
":c... | Gets the specified Data Lake Store trusted identity provider.
@param resource_group_name [String] The name of the Azure resource group.
@param account_name [String] The name of the Data Lake Store account.
@param trusted_id_provider_name [String] The name of the trusted identity
provider to retrieve.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"specified",
"Data",
"Lake",
"Store",
"trusted",
"identity",
"provider",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_datalake_store/lib/2016-11-01/generated/azure_mgmt_datalake_store/trusted_id_providers.rb#L267-L269 | train | Gets the specified trusted id specification. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
9480,
1035,
8909,
1035,
10802,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ruby-git/ruby-git | lib/git/base.rb | Git.Base.commit_all | def commit_all(message, opts = {})
opts = {:add_all => true}.merge(opts)
self.lib.commit(message, opts)
end | ruby | def commit_all(message, opts = {})
opts = {:add_all => true}.merge(opts)
self.lib.commit(message, opts)
end | [
"def",
"commit_all",
"(",
"message",
",",
"opts",
"=",
"{",
"}",
")",
"opts",
"=",
"{",
":add_all",
"=>",
"true",
"}",
".",
"merge",
"(",
"opts",
")",
"self",
".",
"lib",
".",
"commit",
"(",
"message",
",",
"opts",
")",
"end"
] | commits all pending changes in the index file to the git repository,
but automatically adds all modified files without having to explicitly
calling @git.add() on them. | [
"commits",
"all",
"pending",
"changes",
"in",
"the",
"index",
"file",
"to",
"the",
"git",
"repository",
"but",
"automatically",
"adds",
"all",
"modified",
"files",
"without",
"having",
"to",
"explicitly",
"calling"
] | 9bd4407c56068e1604f14a1b6c0c5a84868e6378 | https://github.com/ruby-git/ruby-git/blob/9bd4407c56068e1604f14a1b6c0c5a84868e6378/lib/git/base.rb#L299-L302 | train | Commit all changes to the database | [
30522,
13366,
10797,
1035,
2035,
1006,
4471,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
23569,
2015,
1027,
1063,
1024,
5587,
1035,
2035,
1027,
1028,
2995,
1065,
1012,
13590,
1006,
23569,
2015,
1007,
2969,
1012,
5622,
2497,
1012,
10797,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/sprockets | lib/sprockets/uri_utils.rb | Sprockets.URIUtils.parse_uri_query_params | def parse_uri_query_params(query)
query.to_s.split('&'.freeze).reduce({}) do |h, p|
k, v = p.split('='.freeze, 2)
v = URI::Generic::DEFAULT_PARSER.unescape(v) if v
h[k.to_sym] = v || true
h
end
end | ruby | def parse_uri_query_params(query)
query.to_s.split('&'.freeze).reduce({}) do |h, p|
k, v = p.split('='.freeze, 2)
v = URI::Generic::DEFAULT_PARSER.unescape(v) if v
h[k.to_sym] = v || true
h
end
end | [
"def",
"parse_uri_query_params",
"(",
"query",
")",
"query",
".",
"to_s",
".",
"split",
"(",
"'&'",
".",
"freeze",
")",
".",
"reduce",
"(",
"{",
"}",
")",
"do",
"|",
"h",
",",
"p",
"|",
"k",
",",
"v",
"=",
"p",
".",
"split",
"(",
"'='",
".",
... | Internal: Parse query string into hash of params
query - String query string
Return Hash of params. | [
"Internal",
":",
"Parse",
"query",
"string",
"into",
"hash",
"of",
"params"
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/uri_utils.rb#L182-L189 | train | Parse URI query params | [
30522,
13366,
11968,
3366,
1035,
24471,
2072,
1035,
23032,
1035,
11498,
5244,
1006,
23032,
1007,
23032,
1012,
2000,
1035,
1055,
1012,
3975,
1006,
1005,
1004,
1005,
1012,
13184,
1007,
1012,
5547,
1006,
1063,
1065,
1007,
2079,
1064,
1044,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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.restart_node | def restart_node(node_name, restart_node_description, timeout:60, custom_headers:nil)
response = restart_node_async(node_name, restart_node_description, timeout:timeout, custom_headers:custom_headers).value!
nil
end | ruby | def restart_node(node_name, restart_node_description, timeout:60, custom_headers:nil)
response = restart_node_async(node_name, restart_node_description, timeout:timeout, custom_headers:custom_headers).value!
nil
end | [
"def",
"restart_node",
"(",
"node_name",
",",
"restart_node_description",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"restart_node_async",
"(",
"node_name",
",",
"restart_node_description",
",",
"timeout",
":",
"timeout",
"... | Restarts a Service Fabric cluster node.
Restarts a Service Fabric cluster node that is already started.
@param node_name [String] The name of the node.
@param restart_node_description [RestartNodeDescription] The instance of the
node to be restarted and a flag indicating the need to take dump of the
fabric process.
@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. | [
"Restarts",
"a",
"Service",
"Fabric",
"cluster",
"node",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L4531-L4534 | train | Restarts a node. | [
30522,
13366,
23818,
1035,
13045,
1006,
13045,
1035,
2171,
1010,
23818,
1035,
13045,
1035,
6412,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
23818,
1035,
13045,
1035,
2004,
6038,
2278,
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... |
cypriss/mutations | lib/mutations/model_filter.rb | Mutations.ModelFilter.initialize_constants! | def initialize_constants!
@initialize_constants ||= begin
class_const = options[:class] || @name.to_s.camelize
class_const = class_const.constantize if class_const.is_a?(String)
options[:class] = class_const
if options[:builder]
options[:builder] = options[:builder].constantize if options[:builder].is_a?(String)
end
true
end
unless Mutations.cache_constants?
options[:class] = options[:class].to_s.constantize if options[:class]
options[:builder] = options[:builder].to_s.constantize if options[:builder]
end
end | ruby | def initialize_constants!
@initialize_constants ||= begin
class_const = options[:class] || @name.to_s.camelize
class_const = class_const.constantize if class_const.is_a?(String)
options[:class] = class_const
if options[:builder]
options[:builder] = options[:builder].constantize if options[:builder].is_a?(String)
end
true
end
unless Mutations.cache_constants?
options[:class] = options[:class].to_s.constantize if options[:class]
options[:builder] = options[:builder].to_s.constantize if options[:builder]
end
end | [
"def",
"initialize_constants!",
"@initialize_constants",
"||=",
"begin",
"class_const",
"=",
"options",
"[",
":class",
"]",
"||",
"@name",
".",
"to_s",
".",
"camelize",
"class_const",
"=",
"class_const",
".",
"constantize",
"if",
"class_const",
".",
"is_a?",
"(",
... | Initialize the model class and builder | [
"Initialize",
"the",
"model",
"class",
"and",
"builder"
] | c9948325648d0ea85420963829d1a4d6b4f17bd9 | https://github.com/cypriss/mutations/blob/c9948325648d0ea85420963829d1a4d6b4f17bd9/lib/mutations/model_filter.rb#L16-L33 | train | Initialize the constants for the object. | [
30522,
13366,
3988,
4697,
1035,
5377,
2015,
999,
1030,
3988,
4697,
1035,
5377,
2015,
1064,
1064,
1027,
4088,
2465,
1035,
9530,
3367,
1027,
7047,
1031,
1024,
2465,
1033,
1064,
1064,
1030,
2171,
1012,
2000,
1035,
1055,
1012,
19130,
4697,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machines.rb | Azure::Compute::Mgmt::V2016_04_30_preview.VirtualMachines.begin_redeploy | def begin_redeploy(resource_group_name, vm_name, custom_headers:nil)
response = begin_redeploy_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_redeploy(resource_group_name, vm_name, custom_headers:nil)
response = begin_redeploy_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_redeploy",
"(",
"resource_group_name",
",",
"vm_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_redeploy_async",
"(",
"resource_group_name",
",",
"vm_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
... | The operation to redeploy a virtual machine.
@param resource_group_name [String] The name of the resource group.
@param vm_name [String] The name of the virtual machine.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OperationStatusResponse] operation results. | [
"The",
"operation",
"to",
"redeploy",
"a",
"virtual",
"machine",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machines.rb#L1778-L1781 | train | Redeploy a virtual machine. | [
30522,
13366,
4088,
1035,
2417,
13699,
4135,
2100,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
2417,
13699,
4135,
2100,
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... |
ruby2d/ruby2d | lib/ruby2d/color.rb | Ruby2D.Color.hex_to_f | def hex_to_f(h)
h = (h[1..-1]).chars.each_slice(2).map(&:join)
a = []
h.each do |el|
a.push(el.to_i(16))
end
a.push(255)
return to_f(a)
end | ruby | def hex_to_f(h)
h = (h[1..-1]).chars.each_slice(2).map(&:join)
a = []
h.each do |el|
a.push(el.to_i(16))
end
a.push(255)
return to_f(a)
end | [
"def",
"hex_to_f",
"(",
"h",
")",
"h",
"=",
"(",
"h",
"[",
"1",
"..",
"-",
"1",
"]",
")",
".",
"chars",
".",
"each_slice",
"(",
"2",
")",
".",
"map",
"(",
":join",
")",
"a",
"=",
"[",
"]",
"h",
".",
"each",
"do",
"|",
"el",
"|",
"a",
".... | Convert from hex value (e.g. #FFF000) to Float (0.0..1.0) | [
"Convert",
"from",
"hex",
"value",
"(",
"e",
".",
"g",
".",
"#FFF000",
")",
"to",
"Float",
"(",
"0",
".",
"0",
"..",
"1",
".",
"0",
")"
] | 43ce9805a7ae8b82b7ab8c50bf6d4c845d395dc4 | https://github.com/ruby2d/ruby2d/blob/43ce9805a7ae8b82b7ab8c50bf6d4c845d395dc4/lib/ruby2d/color.rb#L120-L130 | train | Convert hex string to float | [
30522,
13366,
2002,
2595,
1035,
2000,
1035,
1042,
1006,
1044,
1007,
1044,
1027,
1006,
1044,
1031,
1015,
1012,
1012,
1011,
1015,
1033,
1007,
1012,
25869,
2015,
1012,
2169,
1035,
14704,
1006,
1016,
1007,
1012,
4949,
1006,
1004,
1024,
3693,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/environments.rb | Azure::Labservices::Mgmt::V2018_10_15.Environments.claim_with_http_info | def claim_with_http_info(resource_group_name, lab_account_name, lab_name, environment_setting_name, environment_name, custom_headers:nil)
claim_async(resource_group_name, lab_account_name, lab_name, environment_setting_name, environment_name, custom_headers:custom_headers).value!
end | ruby | def claim_with_http_info(resource_group_name, lab_account_name, lab_name, environment_setting_name, environment_name, custom_headers:nil)
claim_async(resource_group_name, lab_account_name, lab_name, environment_setting_name, environment_name, custom_headers:custom_headers).value!
end | [
"def",
"claim_with_http_info",
"(",
"resource_group_name",
",",
"lab_account_name",
",",
"lab_name",
",",
"environment_setting_name",
",",
"environment_name",
",",
"custom_headers",
":",
"nil",
")",
"claim_async",
"(",
"resource_group_name",
",",
"lab_account_name",
",",
... | Claims the environment and assigns it to the user
@param resource_group_name [String] The name of the resource group.
@param lab_account_name [String] The name of the lab Account.
@param lab_name [String] The name of the lab.
@param environment_setting_name [String] The name of the environment Setting.
@param environment_name [String] The name of the environment.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Claims",
"the",
"environment",
"and",
"assigns",
"it",
"to",
"the",
"user"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/environments.rb#L569-L571 | train | Claim a given environment. | [
30522,
13366,
4366,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
6845,
1035,
4070,
1035,
2171,
1010,
6845,
1035,
2171,
1010,
4044,
1035,
4292,
1035,
2171,
1010,
4044,
1035,
2171,
1010,
7661,
1035,
20346,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
oauth-xx/oauth2 | lib/oauth2/mac_token.rb | OAuth2.MACToken.header | def header(verb, url)
timestamp = Time.now.utc.to_i
nonce = Digest::MD5.hexdigest([timestamp, SecureRandom.hex].join(':'))
uri = URI.parse(url)
raise(ArgumentError, "could not parse \"#{url}\" into URI") unless uri.is_a?(URI::HTTP)
mac = signature(timestamp, nonce, verb, uri)
"MAC id=\"#{token}\", ts=\"#{timestamp}\", nonce=\"#{nonce}\", mac=\"#{mac}\""
end | ruby | def header(verb, url)
timestamp = Time.now.utc.to_i
nonce = Digest::MD5.hexdigest([timestamp, SecureRandom.hex].join(':'))
uri = URI.parse(url)
raise(ArgumentError, "could not parse \"#{url}\" into URI") unless uri.is_a?(URI::HTTP)
mac = signature(timestamp, nonce, verb, uri)
"MAC id=\"#{token}\", ts=\"#{timestamp}\", nonce=\"#{nonce}\", mac=\"#{mac}\""
end | [
"def",
"header",
"(",
"verb",
",",
"url",
")",
"timestamp",
"=",
"Time",
".",
"now",
".",
"utc",
".",
"to_i",
"nonce",
"=",
"Digest",
"::",
"MD5",
".",
"hexdigest",
"(",
"[",
"timestamp",
",",
"SecureRandom",
".",
"hex",
"]",
".",
"join",
"(",
"':'... | Generate the MAC header
@param [Symbol] verb the HTTP request method
@param [String] url the HTTP URL path of the request | [
"Generate",
"the",
"MAC",
"header"
] | f08ff9da169136ab133aa2faab0d74a4407deffb | https://github.com/oauth-xx/oauth2/blob/f08ff9da169136ab133aa2faab0d74a4407deffb/lib/oauth2/mac_token.rb#L61-L72 | train | Returns the header for the given verb and url | [
30522,
13366,
20346,
1006,
12034,
1010,
24471,
2140,
1007,
2335,
15464,
2361,
1027,
2051,
1012,
2085,
1012,
11396,
1012,
2000,
1035,
1045,
2512,
3401,
1027,
17886,
1024,
1024,
9108,
2629,
1012,
2002,
2595,
4305,
8449,
2102,
1006,
1031,
2335... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.create_custom_prebuilt_entity_role_with_http_info | def create_custom_prebuilt_entity_role_with_http_info(app_id, version_id, entity_id, entity_role_create_object, custom_headers:nil)
create_custom_prebuilt_entity_role_async(app_id, version_id, entity_id, entity_role_create_object, custom_headers:custom_headers).value!
end | ruby | def create_custom_prebuilt_entity_role_with_http_info(app_id, version_id, entity_id, entity_role_create_object, custom_headers:nil)
create_custom_prebuilt_entity_role_async(app_id, version_id, entity_id, entity_role_create_object, custom_headers:custom_headers).value!
end | [
"def",
"create_custom_prebuilt_entity_role_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"entity_role_create_object",
",",
"custom_headers",
":",
"nil",
")",
"create_custom_prebuilt_entity_role_async",
"(",
"app_id",
",",
"version_id",
",",
"enti... | Create a role for a prebuilt entity in a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param entity_id The entity model ID.
@param entity_role_create_object [EntityRoleCreateObject] An entity role
object containing the name of role.
@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. | [
"Create",
"a",
"role",
"for",
"a",
"prebuilt",
"entity",
"in",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L7850-L7852 | train | Creates an entity role for a given prebuilt entity. | [
30522,
13366,
3443,
1035,
7661,
1035,
3653,
8569,
4014,
2102,
1035,
9178,
1035,
2535,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
9178,
1035,
8909,
1010,
9178,
1035,
2535,
1035,
3443,
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... |
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... |
mikel/mail | lib/mail/network/retriever_methods/pop3.rb | Mail.POP3.start | def start(config = Configuration.instance, &block)
raise ArgumentError.new("Mail::Retrievable#pop3_start takes a block") unless block_given?
pop3 = Net::POP3.new(settings[:address], settings[:port], false)
pop3.enable_ssl(OpenSSL::SSL::VERIFY_NONE) if settings[:enable_ssl]
pop3.read_timeout = settings[:read_timeout] if settings[:read_timeout]
pop3.start(settings[:user_name], settings[:password])
yield pop3
ensure
if defined?(pop3) && pop3 && pop3.started?
pop3.finish
end
end | ruby | def start(config = Configuration.instance, &block)
raise ArgumentError.new("Mail::Retrievable#pop3_start takes a block") unless block_given?
pop3 = Net::POP3.new(settings[:address], settings[:port], false)
pop3.enable_ssl(OpenSSL::SSL::VERIFY_NONE) if settings[:enable_ssl]
pop3.read_timeout = settings[:read_timeout] if settings[:read_timeout]
pop3.start(settings[:user_name], settings[:password])
yield pop3
ensure
if defined?(pop3) && pop3 && pop3.started?
pop3.finish
end
end | [
"def",
"start",
"(",
"config",
"=",
"Configuration",
".",
"instance",
",",
"&",
"block",
")",
"raise",
"ArgumentError",
".",
"new",
"(",
"\"Mail::Retrievable#pop3_start takes a block\"",
")",
"unless",
"block_given?",
"pop3",
"=",
"Net",
"::",
"POP3",
".",
"new"... | Start a POP3 session and ensure that it will be closed in any case. Any messages
marked for deletion via #find_and_delete or with the :delete_after_find option
will be deleted when the session is closed. | [
"Start",
"a",
"POP3",
"session",
"and",
"ensure",
"that",
"it",
"will",
"be",
"closed",
"in",
"any",
"case",
".",
"Any",
"messages",
"marked",
"for",
"deletion",
"via",
"#find_and_delete",
"or",
"with",
"the",
":",
"delete_after_find",
"option",
"will",
"be"... | fb53fb369eb2bf0494ac70675970c90cdcc3f495 | https://github.com/mikel/mail/blob/fb53fb369eb2bf0494ac70675970c90cdcc3f495/lib/mail/network/retriever_methods/pop3.rb#L127-L140 | train | Start a pop3 connection | [
30522,
13366,
2707,
1006,
9530,
8873,
2290,
1027,
9563,
1012,
6013,
1010,
1004,
3796,
1007,
5333,
6685,
2121,
29165,
1012,
2047,
1006,
1000,
5653,
1024,
1024,
2128,
18886,
13331,
3468,
1001,
3769,
2509,
1035,
2707,
3138,
1037,
3796,
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... |
square/connect-ruby-sdk | lib/square_connect/api/v1_items_api.rb | SquareConnect.V1ItemsApi.create_page | def create_page(location_id, body, opts = {})
data, _status_code, _headers = create_page_with_http_info(location_id, body, opts)
return data
end | ruby | def create_page(location_id, body, opts = {})
data, _status_code, _headers = create_page_with_http_info(location_id, body, opts)
return data
end | [
"def",
"create_page",
"(",
"location_id",
",",
"body",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"create_page_with_http_info",
"(",
"location_id",
",",
"body",
",",
"opts",
")",
"return",
"data",
"end"
] | CreatePage
Creates a Favorites page in Square Register.
@param location_id The ID of the location to create an item for.
@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 [V1Page] | [
"CreatePage",
"Creates",
"a",
"Favorites",
"page",
"in",
"Square",
"Register",
"."
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/v1_items_api.rb#L573-L576 | train | Creates a page of data | [
30522,
13366,
3443,
1035,
3931,
1006,
3295,
1035,
8909,
1010,
2303,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
3443,
1035,
3931,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_container_registry/lib/2018-02-01-preview/generated/azure_mgmt_container_registry/build_tasks.rb | Azure::ContainerRegistry::Mgmt::V2018_02_01_preview.BuildTasks.begin_delete | def begin_delete(resource_group_name, registry_name, build_task_name, custom_headers:nil)
response = begin_delete_async(resource_group_name, registry_name, build_task_name, custom_headers:custom_headers).value!
nil
end | ruby | def begin_delete(resource_group_name, registry_name, build_task_name, custom_headers:nil)
response = begin_delete_async(resource_group_name, registry_name, build_task_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_delete",
"(",
"resource_group_name",
",",
"registry_name",
",",
"build_task_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_delete_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"build_task_name",
",",
"custom_headers... | Deletes a specified build task.
@param resource_group_name [String] The name of the resource group to which
the container registry belongs.
@param registry_name [String] The name of the container registry.
@param build_task_name [String] The name of the container registry build
task.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Deletes",
"a",
"specified",
"build",
"task",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_registry/lib/2018-02-01-preview/generated/azure_mgmt_container_registry/build_tasks.rb#L639-L642 | train | Deletes a build task. | [
30522,
13366,
4088,
1035,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
3857,
1035,
4708,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
3972,
12870,
1035,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-iam/lib/aws-sdk-iam/role.rb | Aws::IAM.Role.attach_policy | def attach_policy(options = {})
options = options.merge(role_name: @name)
resp = @client.attach_role_policy(options)
resp.data
end | ruby | def attach_policy(options = {})
options = options.merge(role_name: @name)
resp = @client.attach_role_policy(options)
resp.data
end | [
"def",
"attach_policy",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"role_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"attach_role_policy",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @!group Actions
@example Request syntax with placeholder values
role.attach_policy({
policy_arn: "arnType", # required
})
@param [Hash] options ({})
@option options [required, String] :policy_arn
The Amazon Resource Name (ARN) of the IAM policy you want to attach.
For more information about ARNs, see [Amazon Resource Names (ARNs) and
AWS Service Namespaces][1] in the *AWS General Reference*.
[1]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
@return [EmptyStructure] | [
"@!group",
"Actions",
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-iam/lib/aws-sdk-iam/role.rb#L275-L279 | train | Attach policy to a role | [
30522,
13366,
22476,
1035,
3343,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
2535,
1035,
2171,
1024,
1030,
2171,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
22476,
1035,
2535,
1035,
3343,
1006,
7047,
1007,
24501,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | actionview/lib/action_view/template/resolver.rb | ActionView.PathResolver.extract_handler_and_format_and_variant | def extract_handler_and_format_and_variant(path)
pieces = File.basename(path).split(".")
pieces.shift
extension = pieces.pop
handler = Template.handler_for_extension(extension)
format, variant = pieces.last.split(EXTENSIONS[:variants], 2) if pieces.last
format = if format
Template::Types[format]&.ref
else
if handler.respond_to?(:default_format) # default_format can return nil
handler.default_format
else
nil
end
end
# Template::Types[format] and handler.default_format can return nil
[handler, format, variant]
end | ruby | def extract_handler_and_format_and_variant(path)
pieces = File.basename(path).split(".")
pieces.shift
extension = pieces.pop
handler = Template.handler_for_extension(extension)
format, variant = pieces.last.split(EXTENSIONS[:variants], 2) if pieces.last
format = if format
Template::Types[format]&.ref
else
if handler.respond_to?(:default_format) # default_format can return nil
handler.default_format
else
nil
end
end
# Template::Types[format] and handler.default_format can return nil
[handler, format, variant]
end | [
"def",
"extract_handler_and_format_and_variant",
"(",
"path",
")",
"pieces",
"=",
"File",
".",
"basename",
"(",
"path",
")",
".",
"split",
"(",
"\".\"",
")",
"pieces",
".",
"shift",
"extension",
"=",
"pieces",
".",
"pop",
"handler",
"=",
"Template",
".",
"... | Extract handler, formats and variant from path. If a format cannot be found neither
from the path, or the handler, we should return the array of formats given
to the resolver. | [
"Extract",
"handler",
"formats",
"and",
"variant",
"from",
"path",
".",
"If",
"a",
"format",
"cannot",
"be",
"found",
"neither",
"from",
"the",
"path",
"or",
"the",
"handler",
"we",
"should",
"return",
"the",
"array",
"of",
"formats",
"given",
"to",
"the",... | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/actionview/lib/action_view/template/resolver.rb#L275-L295 | train | Extract handler and format and variant from a path | [
30522,
13366,
14817,
1035,
28213,
1035,
1998,
1035,
4289,
1035,
1998,
1035,
8349,
1006,
4130,
1007,
4109,
1027,
5371,
1012,
2918,
18442,
1006,
4130,
1007,
1012,
3975,
1006,
1000,
1012,
1000,
1007,
4109,
1012,
5670,
5331,
1027,
4109,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
piotrmurach/github | lib/github_api/normalizer.rb | Github.Normalizer.normalize! | def normalize!(params)
case params
when Hash
params.keys.each do |k|
params[k.to_s] = params.delete(k)
normalize!(params[k.to_s])
end
when Array
params.map! do |el|
normalize!(el)
end
end
params
end | ruby | def normalize!(params)
case params
when Hash
params.keys.each do |k|
params[k.to_s] = params.delete(k)
normalize!(params[k.to_s])
end
when Array
params.map! do |el|
normalize!(el)
end
end
params
end | [
"def",
"normalize!",
"(",
"params",
")",
"case",
"params",
"when",
"Hash",
"params",
".",
"keys",
".",
"each",
"do",
"|",
"k",
"|",
"params",
"[",
"k",
".",
"to_s",
"]",
"=",
"params",
".",
"delete",
"(",
"k",
")",
"normalize!",
"(",
"params",
"[",... | Turns any keys from nested hashes including nested arrays into strings | [
"Turns",
"any",
"keys",
"from",
"nested",
"hashes",
"including",
"nested",
"arrays",
"into",
"strings"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/normalizer.rb#L8-L21 | train | Normalize the params | [
30522,
13366,
3671,
4697,
999,
1006,
11498,
5244,
1007,
2553,
11498,
5244,
2043,
23325,
11498,
5244,
1012,
6309,
1012,
2169,
2079,
1064,
1047,
1064,
11498,
5244,
1031,
1047,
1012,
2000,
1035,
1055,
1033,
1027,
11498,
5244,
1012,
3972,
12870... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/managed_backup_short_term_retention_policies.rb | Azure::SQL::Mgmt::V2017_03_01_preview.ManagedBackupShortTermRetentionPolicies.list_by_database | def list_by_database(resource_group_name, managed_instance_name, database_name, custom_headers:nil)
first_page = list_by_database_as_lazy(resource_group_name, managed_instance_name, database_name, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_by_database(resource_group_name, managed_instance_name, database_name, custom_headers:nil)
first_page = list_by_database_as_lazy(resource_group_name, managed_instance_name, database_name, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_by_database",
"(",
"resource_group_name",
",",
"managed_instance_name",
",",
"database_name",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_by_database_as_lazy",
"(",
"resource_group_name",
",",
"managed_instance_name",
",",
"database_name",
... | Gets a managed database's short term retention policy list.
@param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param managed_instance_name [String] The name of the managed instance.
@param database_name [String] The name of the database.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<ManagedBackupShortTermRetentionPolicy>] operation results. | [
"Gets",
"a",
"managed",
"database",
"s",
"short",
"term",
"retention",
"policy",
"list",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/managed_backup_short_term_retention_policies.rb#L247-L250 | train | Gets all the managed instance s managed databases. | [
30522,
13366,
2862,
1035,
2011,
1035,
7809,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3266,
1035,
6013,
1035,
2171,
1010,
30524,
1024,
7661,
1035,
20346,
2015,
1007,
2034,
1035,
3931,
1012,
2131,
1035,
2035,
1035,
5167,
2203,
102,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activerecord/lib/active_record/transactions.rb | ActiveRecord.Transactions.committed! | def committed!(should_run_callbacks: true) #:nodoc:
if should_run_callbacks && trigger_transactional_callbacks?
@_committed_already_called = true
_run_commit_without_transaction_enrollment_callbacks
_run_commit_callbacks
end
ensure
@_committed_already_called = false
force_clear_transaction_record_state
end | ruby | def committed!(should_run_callbacks: true) #:nodoc:
if should_run_callbacks && trigger_transactional_callbacks?
@_committed_already_called = true
_run_commit_without_transaction_enrollment_callbacks
_run_commit_callbacks
end
ensure
@_committed_already_called = false
force_clear_transaction_record_state
end | [
"def",
"committed!",
"(",
"should_run_callbacks",
":",
"true",
")",
"#:nodoc:",
"if",
"should_run_callbacks",
"&&",
"trigger_transactional_callbacks?",
"@_committed_already_called",
"=",
"true",
"_run_commit_without_transaction_enrollment_callbacks",
"_run_commit_callbacks",
"end",... | Call the #after_commit callbacks.
Ensure that it is not called if the object was never persisted (failed create),
but call it after the commit of a destroyed object. | [
"Call",
"the",
"#after_commit",
"callbacks",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activerecord/lib/active_record/transactions.rb#L335-L344 | train | Called when the record has been committed. | [
30522,
13366,
5462,
999,
1006,
2323,
1035,
2448,
1035,
2655,
12221,
1024,
2995,
1007,
1001,
1024,
7293,
10085,
1024,
2065,
2323,
1035,
2448,
1035,
2655,
12221,
1004,
1004,
9495,
1035,
12598,
2389,
1035,
2655,
12221,
1029,
1030,
1035,
5462,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
phusion/passenger | src/ruby_supportlib/phusion_passenger/utils.rb | PhusionPassenger.Utils.global_backtrace_report | def global_backtrace_report
if Kernel.respond_to?(:caller_for_all_threads)
all_thread_stacks = caller_for_all_threads
elsif Thread.respond_to?(:list) && Thread.public_method_defined?(:backtrace)
all_thread_stacks = {}
Thread.list.each do |thread|
all_thread_stacks[thread] = thread.backtrace
end
end
output = "========== Process #{Process.pid}: backtrace dump ==========\n"
if all_thread_stacks
all_thread_stacks.each_pair do |thread, stack|
if thread_name = thread[:name]
thread_name = "(#{thread_name})"
end
stack ||= ["(empty)"]
output << ("-" * 60) << "\n"
output << "# Thread: #{thread.inspect}#{thread_name}, "
if thread == Thread.main
output << "[main thread], "
end
if thread == Thread.current
output << "[current thread], "
end
output << "alive = #{thread.alive?}\n"
output << ("-" * 60) << "\n"
output << " " << stack.join("\n ")
output << "\n\n"
end
else
output << ("-" * 60) << "\n"
output << "# Current thread: #{Thread.current.inspect}\n"
output << ("-" * 60) << "\n"
output << " " << caller.join("\n ")
end
return output
end | ruby | def global_backtrace_report
if Kernel.respond_to?(:caller_for_all_threads)
all_thread_stacks = caller_for_all_threads
elsif Thread.respond_to?(:list) && Thread.public_method_defined?(:backtrace)
all_thread_stacks = {}
Thread.list.each do |thread|
all_thread_stacks[thread] = thread.backtrace
end
end
output = "========== Process #{Process.pid}: backtrace dump ==========\n"
if all_thread_stacks
all_thread_stacks.each_pair do |thread, stack|
if thread_name = thread[:name]
thread_name = "(#{thread_name})"
end
stack ||= ["(empty)"]
output << ("-" * 60) << "\n"
output << "# Thread: #{thread.inspect}#{thread_name}, "
if thread == Thread.main
output << "[main thread], "
end
if thread == Thread.current
output << "[current thread], "
end
output << "alive = #{thread.alive?}\n"
output << ("-" * 60) << "\n"
output << " " << stack.join("\n ")
output << "\n\n"
end
else
output << ("-" * 60) << "\n"
output << "# Current thread: #{Thread.current.inspect}\n"
output << ("-" * 60) << "\n"
output << " " << caller.join("\n ")
end
return output
end | [
"def",
"global_backtrace_report",
"if",
"Kernel",
".",
"respond_to?",
"(",
":caller_for_all_threads",
")",
"all_thread_stacks",
"=",
"caller_for_all_threads",
"elsif",
"Thread",
".",
"respond_to?",
"(",
":list",
")",
"&&",
"Thread",
".",
"public_method_defined?",
"(",
... | Returns a string which reports the backtraces for all threads,
or if that's not supported the backtrace for the current thread. | [
"Returns",
"a",
"string",
"which",
"reports",
"the",
"backtraces",
"for",
"all",
"threads",
"or",
"if",
"that",
"s",
"not",
"supported",
"the",
"backtrace",
"for",
"the",
"current",
"thread",
"."
] | 970964b53e0ba86959acdf40f06c99b0c4a128ca | https://github.com/phusion/passenger/blob/970964b53e0ba86959acdf40f06c99b0c4a128ca/src/ruby_supportlib/phusion_passenger/utils.rb#L201-L238 | train | Returns a string containing the backtrace dump for the current thread. | [
30522,
13366,
3795,
1035,
2067,
6494,
3401,
1035,
3189,
2065,
16293,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
20587,
30524,
1035,
4225,
1029,
1006,
1024,
2067,
6494,
3401,
1007,
2035,
1035,
11689,
1035,
20829,
1027,
1063,
1065,
11689,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.get_replica_health_using_policy_with_http_info | def get_replica_health_using_policy_with_http_info(partition_id, replica_id, events_health_state_filter:0, application_health_policy:nil, timeout:60, custom_headers:nil)
get_replica_health_using_policy_async(partition_id, replica_id, events_health_state_filter:events_health_state_filter, application_health_policy:application_health_policy, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def get_replica_health_using_policy_with_http_info(partition_id, replica_id, events_health_state_filter:0, application_health_policy:nil, timeout:60, custom_headers:nil)
get_replica_health_using_policy_async(partition_id, replica_id, events_health_state_filter:events_health_state_filter, application_health_policy:application_health_policy, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"get_replica_health_using_policy_with_http_info",
"(",
"partition_id",
",",
"replica_id",
",",
"events_health_state_filter",
":",
"0",
",",
"application_health_policy",
":",
"nil",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"get_replica_he... | Gets the health of a Service Fabric stateful service replica or stateless
service instance using the specified policy.
Gets the health of a Service Fabric stateful service replica or stateless
service instance.
Use EventsHealthStateFilter to filter the collection of health events
reported on the cluster based on the health state.
Use ApplicationHealthPolicy to optionally override the health policies used
to evaluate the health. This API only uses 'ConsiderWarningAsError' field of
the ApplicationHealthPolicy. The rest of the fields are ignored while
evaluating the health of the replica.
@param partition_id The identity of the partition.
@param replica_id [String] The identifier of the replica.
@param events_health_state_filter [Integer] Allows filtering the collection
of HealthEvent objects returned based on health state.
The possible values for this parameter include integer value of one of the
following health states.
Only events that match the filter are returned. All events are used to
evaluate the aggregated health state.
If not specified, all entries are returned. The state values are flag based
enumeration, so the value could be a combination of these value obtained
using bitwise 'OR' operator. For example, If the provided value is 6 then all
of the events with HealthState value of OK (2) and Warning (4) are returned.
- Default - Default value. Matches any HealthState. The value is zero.
- None - Filter that doesn't match any HealthState value. Used in order to
return no results on a given collection of states. The value is 1.
- Ok - Filter that matches input with HealthState value Ok. The value is 2.
- Warning - Filter that matches input with HealthState value Warning. The
value is 4.
- Error - Filter that matches input with HealthState value Error. The value
is 8.
- All - Filter that matches input with any HealthState value. The value is
65535.
@param application_health_policy [ApplicationHealthPolicy] Describes the
health policies used to evaluate the health of an application or one of its
children.
If not present, the health evaluation uses the health policy from application
manifest or the default health policy.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"health",
"of",
"a",
"Service",
"Fabric",
"stateful",
"service",
"replica",
"or",
"stateless",
"service",
"instance",
"using",
"the",
"specified",
"policy",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L14960-L14962 | train | Gets the health of the replica using the specified policy. | [
30522,
13366,
2131,
1035,
15059,
1035,
2740,
1035,
2478,
1035,
3343,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
13571,
1035,
8909,
1010,
15059,
1035,
8909,
1010,
2824,
1035,
2740,
1035,
2110,
1035,
11307,
1024,
1014,
1010,
4646,
1035,
2740,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hashicorp/vault-ruby | lib/vault/persistent.rb | Vault.PersistentHTTP.request_failed | def request_failed exception, req, connection # :nodoc:
due_to = "(due to #{exception.message} - #{exception.class})"
message = "too many connection resets #{due_to} #{error_message connection}"
finish connection
raise Error, message, exception.backtrace
end | ruby | def request_failed exception, req, connection # :nodoc:
due_to = "(due to #{exception.message} - #{exception.class})"
message = "too many connection resets #{due_to} #{error_message connection}"
finish connection
raise Error, message, exception.backtrace
end | [
"def",
"request_failed",
"exception",
",",
"req",
",",
"connection",
"# :nodoc:",
"due_to",
"=",
"\"(due to #{exception.message} - #{exception.class})\"",
"message",
"=",
"\"too many connection resets #{due_to} #{error_message connection}\"",
"finish",
"connection",
"raise",
"Error... | Raises an Error for +exception+ which resulted from attempting the request
+req+ on the +connection+.
Finishes the +connection+. | [
"Raises",
"an",
"Error",
"for",
"+",
"exception",
"+",
"which",
"resulted",
"from",
"attempting",
"the",
"request",
"+",
"req",
"+",
"on",
"the",
"+",
"connection",
"+",
"."
] | 02f0532a802ba1a2a0d8703a4585dab76eb9d864 | https://github.com/hashicorp/vault-ruby/blob/02f0532a802ba1a2a0d8703a4585dab76eb9d864/lib/vault/persistent.rb#L992-L999 | train | Raises an exception if the connection has been reset | [
30522,
13366,
5227,
1035,
3478,
6453,
1010,
2128,
4160,
1010,
4434,
1001,
1024,
7293,
10085,
1024,
2349,
1035,
2000,
1027,
1000,
1006,
2349,
2000,
1001,
1063,
6453,
1012,
4471,
1065,
1011,
1001,
1063,
6453,
1012,
2465,
1065,
1007,
1000,
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_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machines.rb | Azure::Compute::Mgmt::V2016_04_30_preview.VirtualMachines.capture | def capture(resource_group_name, vm_name, parameters, custom_headers:nil)
response = capture_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def capture(resource_group_name, vm_name, parameters, custom_headers:nil)
response = capture_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"capture",
"(",
"resource_group_name",
",",
"vm_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"capture_async",
"(",
"resource_group_name",
",",
"vm_name",
",",
"parameters",
",",
"custom_headers",
":custom_headers",
")",
... | Captures the VM by copying virtual hard disks of the VM and outputs a
template that can be used to create similar VMs.
@param resource_group_name [String] The name of the resource group.
@param vm_name [String] The name of the virtual machine.
@param parameters [VirtualMachineCaptureParameters] Parameters supplied to
the Capture Virtual Machine operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [VirtualMachineCaptureResult] operation results. | [
"Captures",
"the",
"VM",
"by",
"copying",
"virtual",
"hard",
"disks",
"of",
"the",
"VM",
"and",
"outputs",
"a",
"template",
"that",
"can",
"be",
"used",
"to",
"create",
"similar",
"VMs",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machines.rb#L135-L138 | train | Capture virtual machine image. | [
30522,
13366,
5425,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
5425,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-ec2/lib/aws-sdk-ec2/network_interface.rb | Aws::EC2.NetworkInterface.delete | def delete(options = {})
options = options.merge(network_interface_id: @id)
resp = @client.delete_network_interface(options)
resp.data
end | ruby | def delete(options = {})
options = options.merge(network_interface_id: @id)
resp = @client.delete_network_interface(options)
resp.data
end | [
"def",
"delete",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"network_interface_id",
":",
"@id",
")",
"resp",
"=",
"@client",
".",
"delete_network_interface",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
network_interface.delete({
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 [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/network_interface.rb#L378-L382 | train | Delete a network interface | [
30522,
13366,
3972,
12870,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
2897,
1035,
8278,
1035,
8909,
1024,
1030,
8909,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
3972,
12870,
1035,
2897,
1035,
8278,
1006,
7047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/thrift | lib/rb/lib/thrift/transport/base_transport.rb | Thrift.BaseTransport.read_into_buffer | def read_into_buffer(buffer, size)
tmp = read_all(size)
i = 0
tmp.each_byte do |byte|
Bytes.set_string_byte(buffer, i, byte)
i += 1
end
i
end | ruby | def read_into_buffer(buffer, size)
tmp = read_all(size)
i = 0
tmp.each_byte do |byte|
Bytes.set_string_byte(buffer, i, byte)
i += 1
end
i
end | [
"def",
"read_into_buffer",
"(",
"buffer",
",",
"size",
")",
"tmp",
"=",
"read_all",
"(",
"size",
")",
"i",
"=",
"0",
"tmp",
".",
"each_byte",
"do",
"|",
"byte",
"|",
"Bytes",
".",
"set_string_byte",
"(",
"buffer",
",",
"i",
",",
"byte",
")",
"i",
"... | Reads size bytes and copies them into buffer[0..size]. | [
"Reads",
"size",
"bytes",
"and",
"copies",
"them",
"into",
"buffer",
"[",
"0",
"..",
"size",
"]",
"."
] | 27d8387c49a49fcf193893f834e9766ae0b051c1 | https://github.com/apache/thrift/blob/27d8387c49a49fcf193893f834e9766ae0b051c1/lib/rb/lib/thrift/transport/base_transport.rb#L72-L80 | train | Read the data into the buffer. | [
30522,
13366,
3191,
1035,
2046,
1035,
17698,
1006,
17698,
1010,
2946,
1007,
1056,
8737,
1027,
3191,
1035,
2035,
1006,
2946,
1007,
1045,
1027,
1014,
1056,
8737,
1012,
2169,
1035,
24880,
2079,
1064,
24880,
1064,
27507,
1012,
2275,
1035,
5164,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.delete_closed_list | def delete_closed_list(app_id, version_id, cl_entity_id, custom_headers:nil)
response = delete_closed_list_async(app_id, version_id, cl_entity_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def delete_closed_list(app_id, version_id, cl_entity_id, custom_headers:nil)
response = delete_closed_list_async(app_id, version_id, cl_entity_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"delete_closed_list",
"(",
"app_id",
",",
"version_id",
",",
"cl_entity_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_closed_list_async",
"(",
"app_id",
",",
"version_id",
",",
"cl_entity_id",
",",
"custom_headers",
":custom_headers",
... | Deletes a list entity model from a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param cl_entity_id The list entity model ID.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OperationStatus] operation results. | [
"Deletes",
"a",
"list",
"entity",
"model",
"from",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L3348-L3351 | train | Deletes a list entity from the application version of the application. | [
30522,
13366,
3972,
12870,
1035,
2701,
1035,
2862,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
18856,
1035,
9178,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
1035,
2701,
30524,
1885... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/base.rb | Git.Base.push | def push(remote = 'origin', branch = 'master', opts = {})
# Small hack to keep backwards compatibility with the 'push(remote, branch, tags)' method signature.
opts = {:tags => opts} if [true, false].include?(opts)
self.lib.push(remote, branch, opts)
end | ruby | def push(remote = 'origin', branch = 'master', opts = {})
# Small hack to keep backwards compatibility with the 'push(remote, branch, tags)' method signature.
opts = {:tags => opts} if [true, false].include?(opts)
self.lib.push(remote, branch, opts)
end | [
"def",
"push",
"(",
"remote",
"=",
"'origin'",
",",
"branch",
"=",
"'master'",
",",
"opts",
"=",
"{",
"}",
")",
"# Small hack to keep backwards compatibility with the 'push(remote, branch, tags)' method signature.",
"opts",
"=",
"{",
":tags",
"=>",
"opts",
"}",
"if",
... | pushes changes to a remote repository - easiest if this is a cloned repository,
otherwise you may have to run something like this first to setup the push parameters:
@git.config('remote.remote-name.push', 'refs/heads/master:refs/heads/master') | [
"pushes",
"changes",
"to",
"a",
"remote",
"repository",
"-",
"easiest",
"if",
"this",
"is",
"a",
"cloned",
"repository",
"otherwise",
"you",
"may",
"have",
"to",
"run",
"something",
"like",
"this",
"first",
"to",
"setup",
"the",
"push",
"parameters",
":"
] | 9bd4407c56068e1604f14a1b6c0c5a84868e6378 | https://github.com/ruby-git/ruby-git/blob/9bd4407c56068e1604f14a1b6c0c5a84868e6378/lib/git/base.rb#L325-L330 | train | Pushes to the remote repository. | [
30522,
13366,
5245,
1006,
6556,
1027,
1005,
4761,
1005,
1010,
3589,
1027,
1005,
3040,
1005,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
1001,
2235,
20578,
2000,
2562,
11043,
21778,
2007,
1996,
1005,
5245,
1006,
6556,
1010,
3589,
1010,
22073,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/thrift | lib/rb/lib/thrift/transport/buffered_transport.rb | Thrift.BufferedTransport.read_into_buffer | def read_into_buffer(buffer, size)
i = 0
while i < size
# If the read buffer is exhausted, try to read up to DEFAULT_BUFFER more bytes into it.
if @index >= @rbuf.size
@rbuf = @transport.read(DEFAULT_BUFFER)
@index = 0
end
# The read buffer has some data now, so copy bytes over to the output buffer.
byte = Bytes.get_string_byte(@rbuf, @index)
Bytes.set_string_byte(buffer, i, byte)
@index += 1
i += 1
end
i
end | ruby | def read_into_buffer(buffer, size)
i = 0
while i < size
# If the read buffer is exhausted, try to read up to DEFAULT_BUFFER more bytes into it.
if @index >= @rbuf.size
@rbuf = @transport.read(DEFAULT_BUFFER)
@index = 0
end
# The read buffer has some data now, so copy bytes over to the output buffer.
byte = Bytes.get_string_byte(@rbuf, @index)
Bytes.set_string_byte(buffer, i, byte)
@index += 1
i += 1
end
i
end | [
"def",
"read_into_buffer",
"(",
"buffer",
",",
"size",
")",
"i",
"=",
"0",
"while",
"i",
"<",
"size",
"# If the read buffer is exhausted, try to read up to DEFAULT_BUFFER more bytes into it.",
"if",
"@index",
">=",
"@rbuf",
".",
"size",
"@rbuf",
"=",
"@transport",
"."... | Reads a number of bytes from the transport into the buffer passed.
buffer - The String (byte buffer) to write data to; this is assumed to have a BINARY encoding.
size - The number of bytes to read from the transport and write to the buffer.
Returns the number of bytes read. | [
"Reads",
"a",
"number",
"of",
"bytes",
"from",
"the",
"transport",
"into",
"the",
"buffer",
"passed",
"."
] | 27d8387c49a49fcf193893f834e9766ae0b051c1 | https://github.com/apache/thrift/blob/27d8387c49a49fcf193893f834e9766ae0b051c1/lib/rb/lib/thrift/transport/buffered_transport.rb#L77-L93 | train | Read the data into the given buffer. | [
30522,
13366,
3191,
1035,
2046,
1035,
17698,
1006,
17698,
1010,
2946,
1007,
1045,
1027,
1014,
2096,
1045,
1026,
2946,
1001,
2065,
1996,
3191,
17698,
2003,
9069,
1010,
3046,
2000,
3191,
2039,
2000,
12398,
1035,
17698,
2062,
27507,
2046,
2009... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
uken/fluent-plugin-elasticsearch | lib/fluent/plugin/out_elasticsearch.rb | Fluent::Plugin.ElasticsearchOutput.append_record_to_messages | def append_record_to_messages(op, meta, header, record, msgs)
case op
when UPDATE_OP, UPSERT_OP
if meta.has_key?(ID_FIELD)
header[UPDATE_OP] = meta
msgs << @dump_proc.call(header) << BODY_DELIMITER
msgs << @dump_proc.call(update_body(record, op)) << BODY_DELIMITER
return true
end
when CREATE_OP
if meta.has_key?(ID_FIELD)
header[CREATE_OP] = meta
msgs << @dump_proc.call(header) << BODY_DELIMITER
msgs << @dump_proc.call(record) << BODY_DELIMITER
return true
end
when INDEX_OP
header[INDEX_OP] = meta
msgs << @dump_proc.call(header) << BODY_DELIMITER
msgs << @dump_proc.call(record) << BODY_DELIMITER
return true
end
return false
end | ruby | def append_record_to_messages(op, meta, header, record, msgs)
case op
when UPDATE_OP, UPSERT_OP
if meta.has_key?(ID_FIELD)
header[UPDATE_OP] = meta
msgs << @dump_proc.call(header) << BODY_DELIMITER
msgs << @dump_proc.call(update_body(record, op)) << BODY_DELIMITER
return true
end
when CREATE_OP
if meta.has_key?(ID_FIELD)
header[CREATE_OP] = meta
msgs << @dump_proc.call(header) << BODY_DELIMITER
msgs << @dump_proc.call(record) << BODY_DELIMITER
return true
end
when INDEX_OP
header[INDEX_OP] = meta
msgs << @dump_proc.call(header) << BODY_DELIMITER
msgs << @dump_proc.call(record) << BODY_DELIMITER
return true
end
return false
end | [
"def",
"append_record_to_messages",
"(",
"op",
",",
"meta",
",",
"header",
",",
"record",
",",
"msgs",
")",
"case",
"op",
"when",
"UPDATE_OP",
",",
"UPSERT_OP",
"if",
"meta",
".",
"has_key?",
"(",
"ID_FIELD",
")",
"header",
"[",
"UPDATE_OP",
"]",
"=",
"m... | append_record_to_messages adds a record to the bulk message
payload to be submitted to Elasticsearch. Records that do
not include '_id' field are skipped when 'write_operation'
is configured for 'create' or 'update'
returns 'true' if record was appended to the bulk message
and 'false' otherwise | [
"append_record_to_messages",
"adds",
"a",
"record",
"to",
"the",
"bulk",
"message",
"payload",
"to",
"be",
"submitted",
"to",
"Elasticsearch",
".",
"Records",
"that",
"do",
"not",
"include",
"_id",
"field",
"are",
"skipped",
"when",
"write_operation",
"is",
"con... | 9f9e51ddd012acb36c7f9d7a16e00970004098bc | https://github.com/uken/fluent-plugin-elasticsearch/blob/9f9e51ddd012acb36c7f9d7a16e00970004098bc/lib/fluent/plugin/out_elasticsearch.rb#L492-L515 | train | Append the record to the messages | [
30522,
13366,
10439,
10497,
1035,
2501,
1035,
2000,
1035,
7696,
1006,
6728,
1010,
18804,
1010,
20346,
1010,
2501,
1010,
5796,
5620,
1007,
2553,
6728,
2043,
10651,
1035,
6728,
1010,
11139,
8743,
1035,
6728,
2065,
18804,
1012,
2038,
1035,
314... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.list_entity_suggestions | def list_entity_suggestions(app_id, version_id, entity_id, take:100, custom_headers:nil)
response = list_entity_suggestions_async(app_id, version_id, entity_id, take:take, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_entity_suggestions(app_id, version_id, entity_id, take:100, custom_headers:nil)
response = list_entity_suggestions_async(app_id, version_id, entity_id, take:take, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_entity_suggestions",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"take",
":",
"100",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_entity_suggestions_async",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"tak... | Get suggested example utterances that would improve the accuracy of the
entity model in a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param entity_id The target entity extractor model to enhance.
@param take [Integer] The number of entries to return. Maximum page size is
500. Default is 100.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array] operation results. | [
"Get",
"suggested",
"example",
"utterances",
"that",
"would",
"improve",
"the",
"accuracy",
"of",
"the",
"entity",
"model",
"in",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L3977-L3980 | train | Gets a list of entity suggestions for a version of the application. | [
30522,
13366,
2862,
1035,
9178,
1035,
15690,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
9178,
1035,
8909,
1010,
2202,
1024,
2531,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
9178,
1035,
15690,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_authorization/lib/2018-09-01-preview/generated/azure_mgmt_authorization/role_assignments.rb | Azure::Authorization::Mgmt::V2018_09_01_preview.RoleAssignments.list_for_resource_group | def list_for_resource_group(resource_group_name, filter:nil, custom_headers:nil)
first_page = list_for_resource_group_as_lazy(resource_group_name, filter:filter, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_for_resource_group(resource_group_name, filter:nil, custom_headers:nil)
first_page = list_for_resource_group_as_lazy(resource_group_name, filter:filter, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_for_resource_group",
"(",
"resource_group_name",
",",
"filter",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_for_resource_group_as_lazy",
"(",
"resource_group_name",
",",
"filter",
":",
"filter",
",",
"custom_headers",
":cu... | Gets role assignments for a resource group.
@param resource_group_name [String] The name of the resource group.
@param filter [String] The filter to apply on the operation. Use
$filter=atScope() to return all role assignments at or above the scope. Use
$filter=principalId eq {id} to return all role assignments at, above or below
the scope for the specified principal.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<RoleAssignment>] operation results. | [
"Gets",
"role",
"assignments",
"for",
"a",
"resource",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_authorization/lib/2018-09-01-preview/generated/azure_mgmt_authorization/role_assignments.rb#L163-L166 | train | Gets all the segmentation products under a resource group. | [
30522,
13366,
2862,
1035,
2005,
1035,
7692,
1035,
2177,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
11307,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2862,
1035,
2005,
1035,
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... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_customvisiontraining/lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb | Azure::CognitiveServices::Customvisiontraining::V3_0.CustomvisiontrainingClient.get_tagged_images | def get_tagged_images(project_id, iteration_id:nil, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil)
response = get_tagged_images_async(project_id, iteration_id:iteration_id, tag_ids:tag_ids, order_by:order_by, take:take, skip:skip, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_tagged_images(project_id, iteration_id:nil, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil)
response = get_tagged_images_async(project_id, iteration_id:iteration_id, tag_ids:tag_ids, order_by:order_by, take:take, skip:skip, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_tagged_images",
"(",
"project_id",
",",
"iteration_id",
":",
"nil",
",",
"tag_ids",
":",
"nil",
",",
"order_by",
":",
"nil",
",",
"take",
":",
"50",
",",
"skip",
":",
"0",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_tagged_i... | Get tagged images for a given project iteration.
This API supports batching and range selection. By default it will only
return first 50 images matching images.
Use the {take} and {skip} parameters to control how many images to return in
a given batch.
The filtering is on an and/or relationship. For example, if the provided tag
ids are for the "Dog" and
"Cat" tags, then only images tagged with Dog and/or Cat will be returned
@param project_id The project id.
@param iteration_id The iteration id. Defaults to workspace.
@param tag_ids A list of tags ids to filter the images. Defaults to all
tagged images when null. Limited to 20.
@param order_by [Enum] The ordering. Defaults to newest. Possible values
include: 'Newest', 'Oldest'
@param take [Integer] Maximum number of images to return. Defaults to 50,
limited to 256.
@param skip [Integer] Number of images to skip before beginning the image
batch. Defaults to 0.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array] operation results. | [
"Get",
"tagged",
"images",
"for",
"a",
"given",
"project",
"iteration",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_customvisiontraining/lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb#L956-L959 | train | Gets the images tagged in a project. | [
30522,
13366,
2131,
1035,
26610,
1035,
4871,
1006,
2622,
1035,
8909,
30524,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
26610,
1035,
4871,
1035,
2004,
6038,
2278,
1006,
2622,
1035,
8909,
1010,
27758,
1035,
8909,
1024,
27758,
1035,
8909,
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... |
decidim/decidim | decidim-core/app/helpers/decidim/icon_helper.rb | Decidim.IconHelper.manifest_icon | def manifest_icon(manifest, options = {})
if manifest.icon
external_icon manifest.icon, options
else
icon "question-mark", options
end
end | ruby | def manifest_icon(manifest, options = {})
if manifest.icon
external_icon manifest.icon, options
else
icon "question-mark", options
end
end | [
"def",
"manifest_icon",
"(",
"manifest",
",",
"options",
"=",
"{",
"}",
")",
"if",
"manifest",
".",
"icon",
"external_icon",
"manifest",
".",
"icon",
",",
"options",
"else",
"icon",
"\"question-mark\"",
",",
"options",
"end",
"end"
] | Public: Returns an icon given an instance of a Manifest. It defaults to
a question mark when no icon is found.
manifest - The manifest to generate the icon for.
options - a Hash with options
Returns an HTML tag with the icon. | [
"Public",
":",
"Returns",
"an",
"icon",
"given",
"an",
"instance",
"of",
"a",
"Manifest",
".",
"It",
"defaults",
"to",
"a",
"question",
"mark",
"when",
"no",
"icon",
"is",
"found",
"."
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/app/helpers/decidim/icon_helper.rb#L26-L32 | train | Returns the icon for the given manifest | [
30522,
13366,
19676,
1035,
12696,
1006,
19676,
1010,
7047,
1027,
1063,
1065,
1007,
2065,
19676,
1012,
12696,
6327,
1035,
12696,
19676,
1012,
12696,
1010,
7047,
2842,
12696,
1000,
3160,
1011,
2928,
1000,
1010,
7047,
2203,
2203,
102,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-iam/lib/aws-sdk-iam/user.rb | Aws::IAM.User.attach_policy | def attach_policy(options = {})
options = options.merge(user_name: @name)
resp = @client.attach_user_policy(options)
resp.data
end | ruby | def attach_policy(options = {})
options = options.merge(user_name: @name)
resp = @client.attach_user_policy(options)
resp.data
end | [
"def",
"attach_policy",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"user_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"attach_user_policy",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
user.attach_policy({
policy_arn: "arnType", # required
})
@param [Hash] options ({})
@option options [required, String] :policy_arn
The Amazon Resource Name (ARN) of the IAM policy you want to attach.
For more information about ARNs, see [Amazon Resource Names (ARNs) and
AWS Service Namespaces][1] in the *AWS General Reference*.
[1]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
@return [EmptyStructure] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-iam/lib/aws-sdk-iam/user.rb#L338-L342 | train | Attach policy to a user | [
30522,
13366,
22476,
1035,
3343,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
5310,
1035,
2171,
1024,
1030,
2171,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
22476,
1035,
5310,
1035,
3343,
1006,
7047,
1007,
24501,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/logger.rb | Discordrb.Logger.mode= | def mode=(value)
case value
when :debug
@enabled_modes = %i[debug good info warn error out in ratelimit]
when :verbose
@enabled_modes = %i[good info warn error out in ratelimit]
when :normal
@enabled_modes = %i[info warn error ratelimit]
when :quiet
@enabled_modes = %i[warn error]
when :silent
@enabled_modes = %i[]
end
end | ruby | def mode=(value)
case value
when :debug
@enabled_modes = %i[debug good info warn error out in ratelimit]
when :verbose
@enabled_modes = %i[good info warn error out in ratelimit]
when :normal
@enabled_modes = %i[info warn error ratelimit]
when :quiet
@enabled_modes = %i[warn error]
when :silent
@enabled_modes = %i[]
end
end | [
"def",
"mode",
"=",
"(",
"value",
")",
"case",
"value",
"when",
":debug",
"@enabled_modes",
"=",
"%i[",
"debug",
"good",
"info",
"warn",
"error",
"out",
"in",
"ratelimit",
"]",
"when",
":verbose",
"@enabled_modes",
"=",
"%i[",
"good",
"info",
"warn",
"erro... | Sets the logging mode
Possible modes are:
* :debug logs everything
* :verbose logs everything except for debug messages
* :normal logs useful information, warnings and errors
* :quiet only logs warnings and errors
* :silent logs nothing
@param value [Symbol] What logging mode to use | [
"Sets",
"the",
"logging",
"mode",
"Possible",
"modes",
"are",
":",
"*",
":",
"debug",
"logs",
"everything",
"*",
":",
"verbose",
"logs",
"everything",
"except",
"for",
"debug",
"messages",
"*",
":",
"normal",
"logs",
"useful",
"information",
"warnings",
"and... | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/logger.rb#L66-L79 | train | Set the mode of the object. | [
30522,
13366,
5549,
1027,
1006,
3643,
1007,
2553,
3643,
2043,
1024,
2139,
8569,
2290,
1030,
9124,
1035,
11583,
1027,
1003,
1045,
1031,
2139,
8569,
2290,
2204,
18558,
11582,
7561,
2041,
1999,
3446,
17960,
4183,
1033,
2043,
1024,
12034,
9232,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
slim-template/slim | lib/slim/parser.rb | Slim.Parser.syntax_error! | def syntax_error!(message)
raise SyntaxError.new(message, options[:file], @orig_line, @lineno,
@orig_line && @line ? @orig_line.size - @line.size : 0)
rescue SyntaxError => ex
# HACK: Manipulate stacktrace for Rails and other frameworks
# to find the right file.
ex.backtrace.unshift "#{options[:file]}:#{@lineno}"
raise
end | ruby | def syntax_error!(message)
raise SyntaxError.new(message, options[:file], @orig_line, @lineno,
@orig_line && @line ? @orig_line.size - @line.size : 0)
rescue SyntaxError => ex
# HACK: Manipulate stacktrace for Rails and other frameworks
# to find the right file.
ex.backtrace.unshift "#{options[:file]}:#{@lineno}"
raise
end | [
"def",
"syntax_error!",
"(",
"message",
")",
"raise",
"SyntaxError",
".",
"new",
"(",
"message",
",",
"options",
"[",
":file",
"]",
",",
"@orig_line",
",",
"@lineno",
",",
"@orig_line",
"&&",
"@line",
"?",
"@orig_line",
".",
"size",
"-",
"@line",
".",
"s... | Helper for raising exceptions | [
"Helper",
"for",
"raising",
"exceptions"
] | ae8e7338fcfb67256d2f6b50c64fc317210e31a2 | https://github.com/slim-template/slim/blob/ae8e7338fcfb67256d2f6b50c64fc317210e31a2/lib/slim/parser.rb#L523-L531 | train | Raise a syntax error | [
30522,
13366,
20231,
1035,
7561,
999,
1006,
4471,
1007,
5333,
20231,
2121,
29165,
1012,
2047,
1006,
4471,
1010,
7047,
1031,
1024,
5371,
1033,
1010,
1030,
2030,
8004,
1035,
2240,
1010,
1030,
17517,
2080,
1010,
1030,
2030,
8004,
1035,
2240,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/logging.rb | Puppet::Util.Logging.log_exception | def log_exception(exception, message = :default, options = {})
trace = Puppet[:trace] || options[:trace]
level = options[:level] || :err
if message == :default && exception.is_a?(Puppet::ParseErrorWithIssue)
# Retain all detailed info and keep plain message and stacktrace separate
backtrace = []
build_exception_trace(backtrace, exception, trace)
Puppet::Util::Log.create({
:level => level,
:source => log_source,
:message => exception.basic_message,
:issue_code => exception.issue_code,
:backtrace => backtrace.empty? ? nil : backtrace,
:file => exception.file,
:line => exception.line,
:pos => exception.pos,
:environment => exception.environment,
:node => exception.node
}.merge(log_metadata))
else
send_log(level, format_exception(exception, message, trace))
end
end | ruby | def log_exception(exception, message = :default, options = {})
trace = Puppet[:trace] || options[:trace]
level = options[:level] || :err
if message == :default && exception.is_a?(Puppet::ParseErrorWithIssue)
# Retain all detailed info and keep plain message and stacktrace separate
backtrace = []
build_exception_trace(backtrace, exception, trace)
Puppet::Util::Log.create({
:level => level,
:source => log_source,
:message => exception.basic_message,
:issue_code => exception.issue_code,
:backtrace => backtrace.empty? ? nil : backtrace,
:file => exception.file,
:line => exception.line,
:pos => exception.pos,
:environment => exception.environment,
:node => exception.node
}.merge(log_metadata))
else
send_log(level, format_exception(exception, message, trace))
end
end | [
"def",
"log_exception",
"(",
"exception",
",",
"message",
"=",
":default",
",",
"options",
"=",
"{",
"}",
")",
"trace",
"=",
"Puppet",
"[",
":trace",
"]",
"||",
"options",
"[",
":trace",
"]",
"level",
"=",
"options",
"[",
":level",
"]",
"||",
":err",
... | Log an exception via Puppet.err. Will also log the backtrace if Puppet[:trace] is set.
Parameters:
[exception] an Exception to log
[message] an optional String overriding the message to be logged; by default, we log Exception.message.
If you pass a String here, your string will be logged instead. You may also pass nil if you don't
wish to log a message at all; in this case it is likely that you are only calling this method in order
to take advantage of the backtrace logging. | [
"Log",
"an",
"exception",
"via",
"Puppet",
".",
"err",
".",
"Will",
"also",
"log",
"the",
"backtrace",
"if",
"Puppet",
"[",
":",
"trace",
"]",
"is",
"set",
".",
"Parameters",
":",
"[",
"exception",
"]",
"an",
"Exception",
"to",
"log",
"[",
"message",
... | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/util/logging.rb#L50-L72 | train | Log an exception | [
30522,
13366,
8833,
1035,
6453,
1006,
6453,
1010,
4471,
1027,
1024,
12398,
1010,
7047,
1027,
1063,
1065,
1007,
7637,
1027,
13997,
1031,
1024,
7637,
1033,
1064,
1064,
7047,
1031,
1024,
7637,
1033,
2504,
1027,
7047,
1031,
1024,
2504,
1033,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jeremytregunna/ruby-trello | lib/trello/client.rb | Trello.Client.find | def find(path, id, params = {})
response = get("/#{path.to_s.pluralize}/#{id}", params)
trello_class = class_from_path(path)
trello_class.parse response do |data|
data.client = self
end
end | ruby | def find(path, id, params = {})
response = get("/#{path.to_s.pluralize}/#{id}", params)
trello_class = class_from_path(path)
trello_class.parse response do |data|
data.client = self
end
end | [
"def",
"find",
"(",
"path",
",",
"id",
",",
"params",
"=",
"{",
"}",
")",
"response",
"=",
"get",
"(",
"\"/#{path.to_s.pluralize}/#{id}\"",
",",
"params",
")",
"trello_class",
"=",
"class_from_path",
"(",
"path",
")",
"trello_class",
".",
"parse",
"response"... | Finds given resource by id
Examples:
client.find(:board, "board1234")
client.find(:member, "user1234") | [
"Finds",
"given",
"resource",
"by",
"id"
] | ad79c9d8152ad5395b3b61c43170908f1912bfb2 | https://github.com/jeremytregunna/ruby-trello/blob/ad79c9d8152ad5395b3b61c43170908f1912bfb2/lib/trello/client.rb#L43-L49 | train | Find a single resource by its ID | [
30522,
13366,
2424,
1006,
4130,
1010,
8909,
1010,
11498,
5244,
1027,
1063,
1065,
1007,
3433,
1027,
2131,
1006,
1000,
1013,
1001,
1063,
4130,
1012,
2000,
1035,
1055,
1012,
13994,
4697,
1065,
1013,
1001,
1063,
8909,
1065,
1000,
1010,
11498,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jnunemaker/httparty | lib/httparty.rb | HTTParty.ClassMethods.head | def head(path, options = {}, &block)
ensure_method_maintained_across_redirects options
perform_request Net::HTTP::Head, path, options, &block
end | ruby | def head(path, options = {}, &block)
ensure_method_maintained_across_redirects options
perform_request Net::HTTP::Head, path, options, &block
end | [
"def",
"head",
"(",
"path",
",",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"ensure_method_maintained_across_redirects",
"options",
"perform_request",
"Net",
"::",
"HTTP",
"::",
"Head",
",",
"path",
",",
"options",
",",
"block",
"end"
] | Perform a HEAD request to a path | [
"Perform",
"a",
"HEAD",
"request",
"to",
"a",
"path"
] | b4099defba01231d2faaaa2660476f867e096bfb | https://github.com/jnunemaker/httparty/blob/b4099defba01231d2faaaa2660476f867e096bfb/lib/httparty.rb#L552-L555 | train | Perform a HEAD request | [
30522,
13366,
2132,
1006,
4130,
1010,
7047,
1027,
1063,
1065,
1010,
1004,
3796,
1007,
5676,
1035,
4118,
1035,
5224,
1035,
2408,
1035,
2417,
7442,
16649,
7047,
4685,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adimichele/hubspot-ruby | lib/hubspot/contact_list.rb | Hubspot.ContactList.add | def add(contacts)
contact_ids = [contacts].flatten.uniq.compact.map(&:id)
response = Hubspot::Connection.post_json(ADD_CONTACT_PATH, params: { list_id: @id }, body: { vids: contact_ids })
response['updated'].sort == contact_ids.sort
end | ruby | def add(contacts)
contact_ids = [contacts].flatten.uniq.compact.map(&:id)
response = Hubspot::Connection.post_json(ADD_CONTACT_PATH, params: { list_id: @id }, body: { vids: contact_ids })
response['updated'].sort == contact_ids.sort
end | [
"def",
"add",
"(",
"contacts",
")",
"contact_ids",
"=",
"[",
"contacts",
"]",
".",
"flatten",
".",
"uniq",
".",
"compact",
".",
"map",
"(",
":id",
")",
"response",
"=",
"Hubspot",
"::",
"Connection",
".",
"post_json",
"(",
"ADD_CONTACT_PATH",
",",
"param... | {http://developers.hubspot.com/docs/methods/lists/add_contact_to_list} | [
"{",
"http",
":",
"//",
"developers",
".",
"hubspot",
".",
"com",
"/",
"docs",
"/",
"methods",
"/",
"lists",
"/",
"add_contact_to_list",
"}"
] | 8eb0a64dd0c14c79e631e81bfdc169583e775a46 | https://github.com/adimichele/hubspot-ruby/blob/8eb0a64dd0c14c79e631e81bfdc169583e775a46/lib/hubspot/contact_list.rb#L102-L106 | train | Add a list of contacts to the list | [
30522,
13366,
5587,
1006,
10402,
1007,
3967,
1035,
8909,
2015,
1027,
1031,
10402,
1033,
1012,
4257,
6528,
1012,
4895,
18515,
1012,
9233,
1012,
4949,
1006,
1004,
1024,
8909,
1007,
3433,
1027,
9594,
13102,
4140,
1024,
1024,
4434,
1012,
2695,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cheezy/page-object | lib/page-object/accessors.rb | PageObject.Accessors.cell | def cell(name, identifier={:index => 0}, &block)
standard_methods(name, identifier, 'cell_for', &block)
define_method("#{name}") do
return platform.cell_text_for identifier.clone unless block_given?
self.send("#{name}_element").text
end
end | ruby | def cell(name, identifier={:index => 0}, &block)
standard_methods(name, identifier, 'cell_for', &block)
define_method("#{name}") do
return platform.cell_text_for identifier.clone unless block_given?
self.send("#{name}_element").text
end
end | [
"def",
"cell",
"(",
"name",
",",
"identifier",
"=",
"{",
":index",
"=>",
"0",
"}",
",",
"&",
"block",
")",
"standard_methods",
"(",
"name",
",",
"identifier",
",",
"'cell_for'",
",",
"block",
")",
"define_method",
"(",
"\"#{name}\"",
")",
"do",
"return",... | adds three methods - one to retrieve the text from a table cell,
another to return the table cell element, and another to check the cell's
existence.
@example
cell(:total, :id => 'total_cell')
# will generate 'total', 'total_element', and 'total?' methods
@param [Symbol] the name used for the generated methods
@param [Hash] identifier how we find a cell.
@param optional block to be invoked when element method is called | [
"adds",
"three",
"methods",
"-",
"one",
"to",
"retrieve",
"the",
"text",
"from",
"a",
"table",
"cell",
"another",
"to",
"return",
"the",
"table",
"cell",
"element",
"and",
"another",
"to",
"check",
"the",
"cell",
"s",
"existence",
"."
] | 850d775bf63768fbb1551a34480195785fe8e193 | https://github.com/cheezy/page-object/blob/850d775bf63768fbb1551a34480195785fe8e193/lib/page-object/accessors.rb#L514-L520 | train | Creates a cell for the given name. | [
30522,
13366,
3526,
1006,
2171,
1010,
8909,
4765,
18095,
1027,
1063,
1024,
5950,
1027,
1028,
1014,
1065,
1010,
1004,
3796,
1007,
3115,
1035,
4725,
1006,
2171,
1010,
8909,
4765,
18095,
1010,
1005,
3526,
1035,
2005,
1005,
1010,
1004,
3796,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
projectcypress/health-data-standards | lib/hqmf-parser/2.0/population_criteria.rb | HQMF2.PopulationCriteria.handle_observation_criteria | def handle_observation_criteria
exp = @entry.at_xpath('./cda:measureObservationDefinition/cda:value/cda:expression/@value',
HQMF2::Document::NAMESPACES)
# Measure Observations criteria rely on computed expressions. If it doesn't have one,
# then it is likely formatted improperly.
fail 'Measure Observations criteria is missing computed expression(s) ' if exp.nil?
parts = exp.to_s.split('-')
dc = parse_parts_to_dc(parts)
@doc.add_data_criteria(dc)
# Update reference_ids with any newly referenced data criteria
dc.children_criteria.each { |cc| @doc.add_reference_id(cc) } unless dc.children_criteria.nil?
dc
end | ruby | def handle_observation_criteria
exp = @entry.at_xpath('./cda:measureObservationDefinition/cda:value/cda:expression/@value',
HQMF2::Document::NAMESPACES)
# Measure Observations criteria rely on computed expressions. If it doesn't have one,
# then it is likely formatted improperly.
fail 'Measure Observations criteria is missing computed expression(s) ' if exp.nil?
parts = exp.to_s.split('-')
dc = parse_parts_to_dc(parts)
@doc.add_data_criteria(dc)
# Update reference_ids with any newly referenced data criteria
dc.children_criteria.each { |cc| @doc.add_reference_id(cc) } unless dc.children_criteria.nil?
dc
end | [
"def",
"handle_observation_criteria",
"exp",
"=",
"@entry",
".",
"at_xpath",
"(",
"'./cda:measureObservationDefinition/cda:value/cda:expression/@value'",
",",
"HQMF2",
"::",
"Document",
"::",
"NAMESPACES",
")",
"# Measure Observations criteria rely on computed expressions. If it does... | extracts out any measure observation definitons, creating from them the proper criteria to generate a precondition | [
"extracts",
"out",
"any",
"measure",
"observation",
"definitons",
"creating",
"from",
"them",
"the",
"proper",
"criteria",
"to",
"generate",
"a",
"precondition"
] | 252d4f0927c513eacde6b9ea41b76faa1423c34b | https://github.com/projectcypress/health-data-standards/blob/252d4f0927c513eacde6b9ea41b76faa1423c34b/lib/hqmf-parser/2.0/population_criteria.rb#L69-L81 | train | Handle Measure Observations criteria | [
30522,
13366,
5047,
1035,
8089,
1035,
9181,
4654,
2361,
1027,
1030,
4443,
1012,
2012,
1035,
26726,
8988,
1006,
1005,
1012,
1013,
3729,
2050,
1024,
5468,
16429,
8043,
21596,
3207,
16294,
22753,
1013,
3729,
2050,
1024,
3643,
1013,
3729,
2050,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_event_hub/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/namespaces.rb | Azure::EventHub::Mgmt::V2018_01_01_preview.Namespaces.get_ip_filter_rule | def get_ip_filter_rule(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers:nil)
response = get_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_ip_filter_rule(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers:nil)
response = get_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_ip_filter_rule",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"ip_filter_rule_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_ip_filter_rule_async",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"ip_filter_rule_name",
... | Gets an IpFilterRule for a Namespace by rule name.
@param resource_group_name [String] Name of the resource group within the
Azure subscription.
@param namespace_name [String] The Namespace name
@param ip_filter_rule_name [String] The IP Filter Rule name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [IpFilterRule] operation results. | [
"Gets",
"an",
"IpFilterRule",
"for",
"a",
"Namespace",
"by",
"rule",
"name",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_event_hub/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/namespaces.rb#L844-L847 | train | Gets the specified ip filter rule. | [
30522,
13366,
2131,
1035,
12997,
1035,
11307,
1035,
3627,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3415,
15327,
1035,
2171,
1010,
12997,
1035,
11307,
1035,
3627,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-ec2/lib/aws-sdk-ec2/volume.rb | Aws::EC2.Volume.delete | def delete(options = {})
options = options.merge(volume_id: @id)
resp = @client.delete_volume(options)
resp.data
end | ruby | def delete(options = {})
options = options.merge(volume_id: @id)
resp = @client.delete_volume(options)
resp.data
end | [
"def",
"delete",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"volume_id",
":",
"@id",
")",
"resp",
"=",
"@client",
".",
"delete_volume",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
volume.delete({
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 [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/volume.rb#L367-L371 | train | Delete a volume | [
30522,
13366,
3972,
12870,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
3872,
1035,
8909,
1024,
1030,
8909,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
3972,
12870,
1035,
3872,
1006,
7047,
1007,
24501,
2361,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mongodb/mongo-ruby-driver | lib/mongo/uri.rb | Mongo.URI.auth_mech_props | def auth_mech_props(value)
properties = hash_extractor('authMechanismProperties', value)
if properties[:canonicalize_host_name]
properties.merge!(canonicalize_host_name:
%w(true TRUE).include?(properties[:canonicalize_host_name]))
end
properties
end | ruby | def auth_mech_props(value)
properties = hash_extractor('authMechanismProperties', value)
if properties[:canonicalize_host_name]
properties.merge!(canonicalize_host_name:
%w(true TRUE).include?(properties[:canonicalize_host_name]))
end
properties
end | [
"def",
"auth_mech_props",
"(",
"value",
")",
"properties",
"=",
"hash_extractor",
"(",
"'authMechanismProperties'",
",",
"value",
")",
"if",
"properties",
"[",
":canonicalize_host_name",
"]",
"properties",
".",
"merge!",
"(",
"canonicalize_host_name",
":",
"%w(",
"t... | Auth mechanism properties extractor.
@param value [ String ] The auth mechanism properties string.
@return [ Hash ] The auth mechanism properties hash. | [
"Auth",
"mechanism",
"properties",
"extractor",
"."
] | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/uri.rb#L666-L673 | train | Extract the properties of the authentication mechanism. | [
30522,
13366,
8740,
2705,
1035,
2033,
2818,
1035,
24387,
1006,
3643,
1007,
5144,
1027,
23325,
1035,
14817,
2953,
1006,
1005,
8740,
2705,
4168,
14856,
2964,
21572,
4842,
7368,
1005,
1010,
3643,
1007,
2065,
5144,
1031,
1024,
18562,
30524,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
watir/watir | lib/watir/elements/select.rb | Watir.Select.include? | def include?(str_or_rx)
option(text: str_or_rx).exist? || option(label: str_or_rx).exist?
end | ruby | def include?(str_or_rx)
option(text: str_or_rx).exist? || option(label: str_or_rx).exist?
end | [
"def",
"include?",
"(",
"str_or_rx",
")",
"option",
"(",
"text",
":",
"str_or_rx",
")",
".",
"exist?",
"||",
"option",
"(",
"label",
":",
"str_or_rx",
")",
".",
"exist?",
"end"
] | Returns true if the select list has one or more options where text or label matches the given value.
@param [String, Regexp] str_or_rx
@return [Boolean] | [
"Returns",
"true",
"if",
"the",
"select",
"list",
"has",
"one",
"or",
"more",
"options",
"where",
"text",
"or",
"label",
"matches",
"the",
"given",
"value",
"."
] | 2d8db09811c6221ae401b85b2f61f5fa66e463a3 | https://github.com/watir/watir/blob/2d8db09811c6221ae401b85b2f61f5fa66e463a3/lib/watir/elements/select.rb#L20-L22 | train | Returns true if the option with the given text or label exists in the current object. | [
30522,
13366,
2421,
1029,
1006,
2358,
2099,
1035,
2030,
1035,
1054,
2595,
1007,
5724,
1006,
3793,
1024,
2358,
2099,
1035,
2030,
1035,
1054,
2595,
1007,
1012,
4839,
1029,
1064,
1064,
5724,
1006,
3830,
1024,
2358,
2099,
1035,
2030,
1035,
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_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb | Azure::SQL::Mgmt::V2017_03_01_preview.LongTermRetentionBackups.begin_delete_with_http_info | def begin_delete_with_http_info(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:nil)
begin_delete_async(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:custom_headers).value!
end | ruby | def begin_delete_with_http_info(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:nil)
begin_delete_async(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:custom_headers).value!
end | [
"def",
"begin_delete_with_http_info",
"(",
"location_name",
",",
"long_term_retention_server_name",
",",
"long_term_retention_database_name",
",",
"backup_name",
",",
"custom_headers",
":",
"nil",
")",
"begin_delete_async",
"(",
"location_name",
",",
"long_term_retention_server... | Deletes a long term retention backup.
@param location_name [String] The location of the database
@param long_term_retention_server_name [String] The name of the server
@param long_term_retention_database_name [String] The name of the database
@param backup_name [String] The backup name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Deletes",
"a",
"long",
"term",
"retention",
"backup",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb#L518-L520 | train | Deletes a long term retention policy. | [
30522,
13366,
4088,
1035,
3972,
12870,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
3295,
1035,
2171,
1010,
2146,
1035,
2744,
1035,
20125,
1035,
8241,
1035,
2171,
1010,
2146,
1035,
2744,
1035,
20125,
1035,
7809,
1035,
2171,
1010,
10200,
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_reservations/lib/2017-11-01/generated/azure_mgmt_reservations/reservation.rb | Azure::Reservations::Mgmt::V2017_11_01.Reservation.begin_split | def begin_split(reservation_order_id, body, custom_headers:nil)
response = begin_split_async(reservation_order_id, body, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_split(reservation_order_id, body, custom_headers:nil)
response = begin_split_async(reservation_order_id, body, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_split",
"(",
"reservation_order_id",
",",
"body",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_split_async",
"(",
"reservation_order_id",
",",
"body",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"... | Split the `Reservation`.
Split a `Reservation` into two `Reservation`s with specified quantity
distribution.
@param reservation_order_id [String] Order Id of the reservation
@param body [SplitRequest] Information needed to Split a reservation item
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array] operation results. | [
"Split",
"the",
"Reservation",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_reservations/lib/2017-11-01/generated/azure_mgmt_reservations/reservation.rb#L515-L518 | train | Splits the given reservation order by the number of words in the body. | [
30522,
13366,
4088,
1035,
3975,
1006,
11079,
1035,
2344,
1035,
8909,
1010,
2303,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
3975,
1035,
2004,
6038,
2278,
1006,
11079,
1035,
2344,
1035,
8909,
1010,
2303,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cheezy/page-object | lib/page-object/accessors.rb | PageObject.Accessors.span | def span(name, identifier={:index => 0}, &block)
standard_methods(name, identifier, 'span_for', &block)
define_method(name) do
return platform.span_text_for identifier.clone unless block_given?
self.send("#{name}_element").text
end
end | ruby | def span(name, identifier={:index => 0}, &block)
standard_methods(name, identifier, 'span_for', &block)
define_method(name) do
return platform.span_text_for identifier.clone unless block_given?
self.send("#{name}_element").text
end
end | [
"def",
"span",
"(",
"name",
",",
"identifier",
"=",
"{",
":index",
"=>",
"0",
"}",
",",
"&",
"block",
")",
"standard_methods",
"(",
"name",
",",
"identifier",
",",
"'span_for'",
",",
"block",
")",
"define_method",
"(",
"name",
")",
"do",
"return",
"pla... | adds three methods - one to retrieve the text from a span,
another to return the span element, and another to check the span's existence.
@example
span(:alert, :id => 'alert')
# will generate 'alert', 'alert_element', and 'alert?' methods
@param [Symbol] the name used for the generated methods
@param [Hash] identifier how we find a span.
@param optional block to be invoked when element method is called | [
"adds",
"three",
"methods",
"-",
"one",
"to",
"retrieve",
"the",
"text",
"from",
"a",
"span",
"another",
"to",
"return",
"the",
"span",
"element",
"and",
"another",
"to",
"check",
"the",
"span",
"s",
"existence",
"."
] | 850d775bf63768fbb1551a34480195785fe8e193 | https://github.com/cheezy/page-object/blob/850d775bf63768fbb1551a34480195785fe8e193/lib/page-object/accessors.rb#L472-L478 | train | Creates a span method. | [
30522,
13366,
8487,
1006,
2171,
1010,
8909,
4765,
18095,
1027,
1063,
1024,
5950,
1027,
1028,
1014,
1065,
1010,
1004,
3796,
1007,
3115,
1035,
4725,
1006,
2171,
1010,
8909,
4765,
18095,
1010,
1005,
8487,
1035,
2005,
1005,
1010,
1004,
3796,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.backup_key | def backup_key(vault_base_url, key_name, custom_headers:nil)
response = backup_key_async(vault_base_url, key_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def backup_key(vault_base_url, key_name, custom_headers:nil)
response = backup_key_async(vault_base_url, key_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"backup_key",
"(",
"vault_base_url",
",",
"key_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"backup_key_async",
"(",
"vault_base_url",
",",
"key_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",... | Requests that a backup of the specified key be downloaded to the client.
The Key Backup operation exports a key from Azure Key Vault in a protected
form. Note that this operation does NOT return key material in a form that
can be used outside the Azure Key Vault system, the returned key material is
either protected to a Azure Key Vault HSM or to Azure Key Vault itself. The
intent of this operation is to allow a client to GENERATE a key in one Azure
Key Vault instance, BACKUP the key, and then RESTORE it into another Azure
Key Vault instance. The BACKUP operation may be used to export, in protected
form, any key type from Azure Key Vault. Individual versions of a key cannot
be backed up. BACKUP / RESTORE can be performed within geographical
boundaries only; meaning that a BACKUP from one geographical area cannot be
restored to another geographical area. For example, a backup from the US
geographical area cannot be restored in an EU geographical area. This
operation requires the key/backup 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 custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [BackupKeyResult] operation results. | [
"Requests",
"that",
"a",
"backup",
"of",
"the",
"specified",
"key",
"be",
"downloaded",
"to",
"the",
"client",
"."
] | 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#L1046-L1049 | train | Backup a key. | [
30522,
13366,
10200,
1035,
3145,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
3145,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
10200,
1035,
3145,
1035,
2004,
6038,
2278,
1006,
11632,
1035,
2918,
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_contentmoderator/lib/1.0/generated/azure_cognitiveservices_contentmoderator/list_management_term.rb | Azure::CognitiveServices::ContentModerator::V1_0.ListManagementTerm.delete_term_with_http_info | def delete_term_with_http_info(list_id, term, language, custom_headers:nil)
delete_term_async(list_id, term, language, custom_headers:custom_headers).value!
end | ruby | def delete_term_with_http_info(list_id, term, language, custom_headers:nil)
delete_term_async(list_id, term, language, custom_headers:custom_headers).value!
end | [
"def",
"delete_term_with_http_info",
"(",
"list_id",
",",
"term",
",",
"language",
",",
"custom_headers",
":",
"nil",
")",
"delete_term_async",
"(",
"list_id",
",",
"term",
",",
"language",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"end"
] | Deletes a term from the list with list Id equal to the list Id passed.
@param list_id [String] List Id of the image list.
@param term [String] Term to be deleted
@param language [String] Language of the terms.
@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",
"term",
"from",
"the",
"list",
"with",
"list",
"Id",
"equal",
"to",
"the",
"list",
"Id",
"passed",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_contentmoderator/lib/1.0/generated/azure_cognitiveservices_contentmoderator/list_management_term.rb#L147-L149 | train | Deletes a list term. | [
30522,
13366,
3972,
12870,
1035,
2744,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2862,
1035,
8909,
1010,
2744,
1010,
2653,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3972,
12870,
1035,
2744,
1035,
2004,
6038,
2278,
1006,
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... |
randym/axlsx | lib/axlsx/drawing/vml_drawing.rb | Axlsx.VmlDrawing.to_xml_string | def to_xml_string(str = '')
str << <<BAD_PROGRAMMER
<xml xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel">
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="#{@comments.worksheet.index+1}"/>
</o:shapelayout>
<v:shapetype id="_x0000_t202" coordsize="21600,21600" o:spt="202"
path="m0,0l0,21600,21600,21600,21600,0xe">
<v:stroke joinstyle="miter"/>
<v:path gradientshapeok="t" o:connecttype="rect"/>
</v:shapetype>
BAD_PROGRAMMER
@comments.each { |comment| comment.vml_shape.to_xml_string str }
str << "</xml>"
end | ruby | def to_xml_string(str = '')
str << <<BAD_PROGRAMMER
<xml xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel">
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="#{@comments.worksheet.index+1}"/>
</o:shapelayout>
<v:shapetype id="_x0000_t202" coordsize="21600,21600" o:spt="202"
path="m0,0l0,21600,21600,21600,21600,0xe">
<v:stroke joinstyle="miter"/>
<v:path gradientshapeok="t" o:connecttype="rect"/>
</v:shapetype>
BAD_PROGRAMMER
@comments.each { |comment| comment.vml_shape.to_xml_string str }
str << "</xml>"
end | [
"def",
"to_xml_string",
"(",
"str",
"=",
"''",
")",
"str",
"<<",
"<<BAD_PROGRAMMER",
"#{",
"@comments",
".",
"worksheet",
".",
"index",
"+",
"1",
"}",
"BAD_PROGRAMMER",
"@comments",
".",
"each",
"{",
"|",
"comment",
"|",
"comment",
".",
"vml_shape",
".",
... | serialize the vml_drawing to xml.
@param [String] str
@return [String] | [
"serialize",
"the",
"vml_drawing",
"to",
"xml",
"."
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/drawing/vml_drawing.rb#L22-L39 | train | Convert the cell to XML | [
30522,
13366,
2000,
1035,
20950,
1035,
5164,
1006,
2358,
2099,
1027,
1005,
1005,
1007,
2358,
2099,
1026,
1026,
1026,
1026,
2919,
1035,
20273,
1026,
20950,
20950,
3619,
1024,
1058,
1027,
1000,
24471,
2078,
1024,
8040,
28433,
2015,
1011,
7513... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/racc | lib/racc/state.rb | Racc.State.srules | def srules
@srules ||= begin
closure.each_with_object(Hash.new { |h,k| h[k] = [] }) do |ptr, table|
next if ptr.reduce? || ptr.symbol.nonterminal?
table[ptr.symbol] << ptr
end
end
end | ruby | def srules
@srules ||= begin
closure.each_with_object(Hash.new { |h,k| h[k] = [] }) do |ptr, table|
next if ptr.reduce? || ptr.symbol.nonterminal?
table[ptr.symbol] << ptr
end
end
end | [
"def",
"srules",
"@srules",
"||=",
"begin",
"closure",
".",
"each_with_object",
"(",
"Hash",
".",
"new",
"{",
"|",
"h",
",",
"k",
"|",
"h",
"[",
"k",
"]",
"=",
"[",
"]",
"}",
")",
"do",
"|",
"ptr",
",",
"table",
"|",
"next",
"if",
"ptr",
".",
... | {Sym -> LocationPointers within rules which direct us to shift that Sym} | [
"{",
"Sym",
"-",
">",
"LocationPointers",
"within",
"rules",
"which",
"direct",
"us",
"to",
"shift",
"that",
"Sym",
"}"
] | d3244edfa11dd6e86e43f570c6444d41c7e3552a | https://github.com/ruby/racc/blob/d3244edfa11dd6e86e43f570c6444d41c7e3552a/lib/racc/state.rb#L547-L554 | train | Returns the array of the srules that are used to generate the result. | [
30522,
13366,
5034,
16308,
1030,
5034,
16308,
1064,
1064,
1027,
4088,
8503,
1012,
2169,
1035,
2007,
1035,
4874,
1006,
23325,
1012,
2047,
1063,
1064,
1044,
1010,
1047,
1064,
1044,
1031,
1047,
1033,
1027,
1031,
1033,
1065,
1007,
2079,
1064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_recovery_services_site_recovery/lib/2016-08-10/generated/azure_mgmt_recovery_services_site_recovery/recovery_points.rb | Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10.RecoveryPoints.list_by_replication_protected_items | def list_by_replication_protected_items(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:nil)
first_page = list_by_replication_protected_items_as_lazy(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_by_replication_protected_items(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:nil)
first_page = list_by_replication_protected_items_as_lazy(fabric_name, protection_container_name, replicated_protected_item_name, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_by_replication_protected_items",
"(",
"fabric_name",
",",
"protection_container_name",
",",
"replicated_protected_item_name",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_by_replication_protected_items_as_lazy",
"(",
"fabric_name",
",",
"protect... | Get recovery points for a replication protected item.
Lists the available recovery points for a replication protected item.
@param fabric_name [String] The fabric name.
@param protection_container_name [String] The protection container name.
@param replicated_protected_item_name [String] The replication protected
item's name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<RecoveryPoint>] operation results. | [
"Get",
"recovery",
"points",
"for",
"a",
"replication",
"protected",
"item",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_recovery_services_site_recovery/lib/2016-08-10/generated/azure_mgmt_recovery_services_site_recovery/recovery_points.rb#L149-L152 | train | Gets all the items in the specified protection container. | [
30522,
13366,
2862,
1035,
2011,
1035,
21647,
1035,
5123,
1035,
5167,
1006,
8313,
1035,
2171,
1010,
3860,
1035,
11661,
1035,
2171,
1010,
28024,
2094,
1035,
5123,
1035,
8875,
1035,
2171,
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... |
mongodb/mongo-ruby-driver | lib/mongo/session.rb | Mongo.Session.start_transaction | def start_transaction(options = nil)
if options
Lint.validate_read_concern_option(options[:read_concern])
end
check_if_ended!
if within_states?(STARTING_TRANSACTION_STATE, TRANSACTION_IN_PROGRESS_STATE)
raise Mongo::Error::InvalidTransactionOperation.new(
Mongo::Error::InvalidTransactionOperation::TRANSACTION_ALREADY_IN_PROGRESS)
end
next_txn_num
@txn_options = options || @options[:default_transaction_options] || {}
if txn_write_concern && WriteConcern.send(:unacknowledged?, txn_write_concern)
raise Mongo::Error::InvalidTransactionOperation.new(
Mongo::Error::InvalidTransactionOperation::UNACKNOWLEDGED_WRITE_CONCERN)
end
@state = STARTING_TRANSACTION_STATE
@already_committed = false
end | ruby | def start_transaction(options = nil)
if options
Lint.validate_read_concern_option(options[:read_concern])
end
check_if_ended!
if within_states?(STARTING_TRANSACTION_STATE, TRANSACTION_IN_PROGRESS_STATE)
raise Mongo::Error::InvalidTransactionOperation.new(
Mongo::Error::InvalidTransactionOperation::TRANSACTION_ALREADY_IN_PROGRESS)
end
next_txn_num
@txn_options = options || @options[:default_transaction_options] || {}
if txn_write_concern && WriteConcern.send(:unacknowledged?, txn_write_concern)
raise Mongo::Error::InvalidTransactionOperation.new(
Mongo::Error::InvalidTransactionOperation::UNACKNOWLEDGED_WRITE_CONCERN)
end
@state = STARTING_TRANSACTION_STATE
@already_committed = false
end | [
"def",
"start_transaction",
"(",
"options",
"=",
"nil",
")",
"if",
"options",
"Lint",
".",
"validate_read_concern_option",
"(",
"options",
"[",
":read_concern",
"]",
")",
"end",
"check_if_ended!",
"if",
"within_states?",
"(",
"STARTING_TRANSACTION_STATE",
",",
"TRAN... | Places subsequent operations in this session into a new transaction.
Note that the transaction will not be started on the server until an
operation is performed after start_transaction is called.
@example Start a new transaction
session.start_transaction(options)
@param [ Hash ] options The options for the transaction being started.
@option options [ Hash ] read_concern The read concern options hash,
with the following optional keys:
- *:level* -- the read preference level as a symbol; valid values
are *:local*, *:majority*, and *:snapshot*
@option options [ Hash ] :write_concern The write concern options. Can be :w =>
Integer|String, :fsync => Boolean, :j => Boolean.
@option options [ Hash ] :read The read preference options. The hash may have the following
items:
- *:mode* -- read preference specified as a symbol; the only valid value is
*:primary*.
@raise [ Error::InvalidTransactionOperation ] If a transaction is already in
progress or if the write concern is unacknowledged.
@since 2.6.0 | [
"Places",
"subsequent",
"operations",
"in",
"this",
"session",
"into",
"a",
"new",
"transaction",
"."
] | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/session.rb#L580-L602 | train | Start a new transaction | [
30522,
13366,
2707,
1035,
12598,
1006,
7047,
1027,
9152,
2140,
1007,
2065,
7047,
11409,
2102,
1012,
9398,
3686,
1035,
3191,
1035,
5142,
1035,
5724,
1006,
7047,
1031,
1024,
3191,
1035,
5142,
1033,
1007,
2203,
4638,
1035,
2065,
1035,
3092,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
petergoldstein/dalli | lib/dalli/client.rb | Dalli.Client.perform | def perform(*all_args)
return yield if block_given?
op, key, *args = *all_args
key = key.to_s
key = validate_key(key)
begin
server = ring.server_for_key(key)
ret = server.request(op, key, *args)
ret
rescue NetworkError => e
Dalli.logger.debug { e.inspect }
Dalli.logger.debug { "retrying request with new server" }
retry
end
end | ruby | def perform(*all_args)
return yield if block_given?
op, key, *args = *all_args
key = key.to_s
key = validate_key(key)
begin
server = ring.server_for_key(key)
ret = server.request(op, key, *args)
ret
rescue NetworkError => e
Dalli.logger.debug { e.inspect }
Dalli.logger.debug { "retrying request with new server" }
retry
end
end | [
"def",
"perform",
"(",
"*",
"all_args",
")",
"return",
"yield",
"if",
"block_given?",
"op",
",",
"key",
",",
"*",
"args",
"=",
"all_args",
"key",
"=",
"key",
".",
"to_s",
"key",
"=",
"validate_key",
"(",
"key",
")",
"begin",
"server",
"=",
"ring",
".... | Chokepoint method for instrumentation | [
"Chokepoint",
"method",
"for",
"instrumentation"
] | 5755dbfd06e333a8239f976d4b10492b4555b726 | https://github.com/petergoldstein/dalli/blob/5755dbfd06e333a8239f976d4b10492b4555b726/lib/dalli/client.rb#L360-L375 | train | Perform a request to the server. | [
30522,
13366,
4685,
1006,
1008,
2035,
1035,
12098,
5620,
1007,
2709,
10750,
2065,
3796,
1035,
2445,
1029,
6728,
1010,
3145,
1010,
1008,
12098,
5620,
1027,
1008,
2035,
1035,
12098,
5620,
3145,
1027,
3145,
1012,
2000,
1035,
1055,
3145,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mongodb/mongo-ruby-driver | lib/mongo/server.rb | Mongo.Server.start_monitoring | def start_monitoring
publish_sdam_event(
Monitoring::SERVER_OPENING,
Monitoring::Event::ServerOpening.new(address, cluster.topology)
)
if options[:monitoring_io] != false
monitor.run!
ObjectSpace.define_finalizer(self, self.class.finalize(monitor))
end
end | ruby | def start_monitoring
publish_sdam_event(
Monitoring::SERVER_OPENING,
Monitoring::Event::ServerOpening.new(address, cluster.topology)
)
if options[:monitoring_io] != false
monitor.run!
ObjectSpace.define_finalizer(self, self.class.finalize(monitor))
end
end | [
"def",
"start_monitoring",
"publish_sdam_event",
"(",
"Monitoring",
"::",
"SERVER_OPENING",
",",
"Monitoring",
"::",
"Event",
"::",
"ServerOpening",
".",
"new",
"(",
"address",
",",
"cluster",
".",
"topology",
")",
")",
"if",
"options",
"[",
":monitoring_io",
"]... | Start monitoring the server.
Used internally by the driver to add a server to a cluster
while delaying monitoring until the server is in the cluster.
@api private | [
"Start",
"monitoring",
"the",
"server",
"."
] | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/server.rb#L225-L234 | train | Start monitoring | [
30522,
13366,
2707,
1035,
8822,
10172,
1035,
17371,
3286,
1035,
2724,
1006,
8822,
1024,
1024,
8241,
1035,
3098,
1010,
8822,
1024,
1024,
2724,
1024,
1024,
8241,
26915,
2075,
1012,
2047,
1006,
4769,
1010,
9324,
1012,
19587,
1007,
1007,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_mixedreality/lib/2019-02-28-preview/generated/azure_mgmt_mixedreality/spatial_anchors_accounts.rb | Azure::MixedReality::Mgmt::V2019_02_28_preview.SpatialAnchorsAccounts.regenerate_keys | def regenerate_keys(resource_group_name, spatial_anchors_account_name, spatial_anchors_account_key_regenerate, custom_headers:nil)
response = regenerate_keys_async(resource_group_name, spatial_anchors_account_name, spatial_anchors_account_key_regenerate, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def regenerate_keys(resource_group_name, spatial_anchors_account_name, spatial_anchors_account_key_regenerate, custom_headers:nil)
response = regenerate_keys_async(resource_group_name, spatial_anchors_account_name, spatial_anchors_account_key_regenerate, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"regenerate_keys",
"(",
"resource_group_name",
",",
"spatial_anchors_account_name",
",",
"spatial_anchors_account_key_regenerate",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"regenerate_keys_async",
"(",
"resource_group_name",
",",
"spatial_anchors_account_... | Regenerate 1 Key of a Spatial Anchors Account
@param resource_group_name [String] Name of an Azure resource group.
@param spatial_anchors_account_name [String] Name of an Mixed Reality Spatial
Anchors Account.
@param spatial_anchors_account_key_regenerate
[SpatialAnchorsAccountKeyRegenerateRequest] Specifying which key to be
regenerated.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [SpatialAnchorsAccountKeys] operation results. | [
"Regenerate",
"1",
"Key",
"of",
"a",
"Spatial",
"Anchors",
"Account"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_mixedreality/lib/2019-02-28-preview/generated/azure_mgmt_mixedreality/spatial_anchors_accounts.rb#L745-L748 | train | Regenerate the key for the specified spatial anchors account. | [
30522,
13366,
19723,
24454,
3686,
1035,
6309,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
13589,
1035,
24674,
1035,
4070,
1035,
2171,
1010,
13589,
1035,
24674,
1035,
4070,
1035,
3145,
1035,
19723,
24454,
3686,
1010,
7661,
1035,
20346,
2015,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/diagnostics.rb | Azure::Web::Mgmt::V2018_02_01.Diagnostics.list_site_detector_responses | def list_site_detector_responses(resource_group_name, site_name, custom_headers:nil)
first_page = list_site_detector_responses_as_lazy(resource_group_name, site_name, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_site_detector_responses(resource_group_name, site_name, custom_headers:nil)
first_page = list_site_detector_responses_as_lazy(resource_group_name, site_name, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_site_detector_responses",
"(",
"resource_group_name",
",",
"site_name",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_site_detector_responses_as_lazy",
"(",
"resource_group_name",
",",
"site_name",
",",
"custom_headers",
":custom_headers",
")... | List Site Detector Responses
List Site Detector Responses
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param site_name [String] Site Name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<DetectorResponse>] operation results. | [
"List",
"Site",
"Detector",
"Responses"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/diagnostics.rb#L259-L262 | train | Gets all the detector responses for a site. | [
30522,
13366,
2862,
1035,
2609,
1035,
19034,
1035,
10960,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2609,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2862,
1035,
2609,
1035,
19034,
1035,
10960,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_graph_rbac/lib/1.6/generated/azure_graph_rbac/service_principals.rb | Azure::GraphRbac::V1_6.ServicePrincipals.list_password_credentials | def list_password_credentials(object_id, custom_headers:nil)
response = list_password_credentials_async(object_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_password_credentials(object_id, custom_headers:nil)
response = list_password_credentials_async(object_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_password_credentials",
"(",
"object_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_password_credentials_async",
"(",
"object_id",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"respon... | Gets the passwordCredentials associated with a service principal.
@param object_id [String] The object ID of the service principal.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [PasswordCredentialListResult] operation results. | [
"Gets",
"the",
"passwordCredentials",
"associated",
"with",
"a",
"service",
"principal",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_graph_rbac/lib/1.6/generated/azure_graph_rbac/service_principals.rb#L668-L671 | train | Gets the password credentials for the specified object. | [
30522,
13366,
2862,
1035,
20786,
1035,
22496,
1006,
4874,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
20786,
1035,
22496,
1035,
2004,
6038,
2278,
1006,
4874,
1035,
8909,
1010,
7661,
1035,
20346... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sporkmonger/addressable | lib/addressable/uri.rb | Addressable.URI.to_s | def to_s
if self.scheme == nil && self.path != nil && !self.path.empty? &&
self.path =~ NORMPATH
raise InvalidURIError,
"Cannot assemble URI string with ambiguous path: '#{self.path}'"
end
@uri_string ||= begin
uri_string = String.new
uri_string << "#{self.scheme}:" if self.scheme != nil
uri_string << "//#{self.authority}" if self.authority != nil
uri_string << self.path.to_s
uri_string << "?#{self.query}" if self.query != nil
uri_string << "##{self.fragment}" if self.fragment != nil
uri_string.force_encoding(Encoding::UTF_8)
uri_string
end
end | ruby | def to_s
if self.scheme == nil && self.path != nil && !self.path.empty? &&
self.path =~ NORMPATH
raise InvalidURIError,
"Cannot assemble URI string with ambiguous path: '#{self.path}'"
end
@uri_string ||= begin
uri_string = String.new
uri_string << "#{self.scheme}:" if self.scheme != nil
uri_string << "//#{self.authority}" if self.authority != nil
uri_string << self.path.to_s
uri_string << "?#{self.query}" if self.query != nil
uri_string << "##{self.fragment}" if self.fragment != nil
uri_string.force_encoding(Encoding::UTF_8)
uri_string
end
end | [
"def",
"to_s",
"if",
"self",
".",
"scheme",
"==",
"nil",
"&&",
"self",
".",
"path",
"!=",
"nil",
"&&",
"!",
"self",
".",
"path",
".",
"empty?",
"&&",
"self",
".",
"path",
"=~",
"NORMPATH",
"raise",
"InvalidURIError",
",",
"\"Cannot assemble URI string with... | Converts the URI to a <code>String</code>.
@return [String] The URI's <code>String</code> representation. | [
"Converts",
"the",
"URI",
"to",
"a",
"<code",
">",
"String<",
"/",
"code",
">",
"."
] | 5894c95a7768435cb46d1355954611dbd194832e | https://github.com/sporkmonger/addressable/blob/5894c95a7768435cb46d1355954611dbd194832e/lib/addressable/uri.rb#L2315-L2331 | train | Returns a new URI object with the given URI. | [
30522,
13366,
2000,
1035,
1055,
2065,
2969,
1012,
5679,
1027,
1027,
9152,
2140,
1004,
1004,
2969,
1012,
4130,
999,
1027,
9152,
2140,
1004,
1004,
999,
2969,
1012,
4130,
1012,
4064,
1029,
1004,
1004,
2969,
1012,
4130,
1027,
1066,
13373,
150... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
piotrmurach/github | lib/github_api/client/pull_requests/reviews.rb | Github.Client::PullRequests::Reviews.dismiss | def dismiss(*args)
arguments(args, required: [:user, :repo, :number, :id])
params = arguments.params
params["accept"] ||= PREVIEW_MEDIA
put_request("/repos/#{arguments.user}/#{arguments.repo}/pulls/#{arguments.number}/reviews/#{arguments.id}/dismissals", params)
end | ruby | def dismiss(*args)
arguments(args, required: [:user, :repo, :number, :id])
params = arguments.params
params["accept"] ||= PREVIEW_MEDIA
put_request("/repos/#{arguments.user}/#{arguments.repo}/pulls/#{arguments.number}/reviews/#{arguments.id}/dismissals", params)
end | [
"def",
"dismiss",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":number",
",",
":id",
"]",
")",
"params",
"=",
"arguments",
".",
"params",
"params",
"[",
"\"accept\"",
"]",
"||=",
"PREVIEW_MEDI... | @option params [String] :message
Optional string - Reason for dismissal
@example
github = Github.new oauth_token: '...'
github.pull_requests.reviews.dismiss 'user-name', 'repo-name', 'number', 'review-id'
message: "I can't get to this right now."
@api public | [
"@option",
"params",
"[",
"String",
"]",
":",
"message",
"Optional",
"string",
"-",
"Reason",
"for",
"dismissal"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/pull_requests/reviews.rb#L130-L137 | train | Dismiss a review | [
30522,
13366,
19776,
1006,
1008,
12098,
5620,
1007,
9918,
1006,
12098,
5620,
1010,
3223,
1024,
1031,
1024,
5310,
1010,
1024,
16360,
2080,
1010,
1024,
2193,
1010,
1024,
8909,
1033,
1007,
11498,
5244,
1027,
9918,
1012,
11498,
5244,
11498,
524... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
libgit2/rugged | lib/rugged/submodule_collection.rb | Rugged.SubmoduleCollection.clone_submodule | def clone_submodule(repo, fetch_options)
# the remote was just added by setup_add, no need to check presence
repo.remotes['origin'].fetch(fetch_options)
repo.branches.create('master','origin/master')
repo.branches['master'].upstream = repo.branches['origin/master']
repo.checkout_head(strategy: :force)
end | ruby | def clone_submodule(repo, fetch_options)
# the remote was just added by setup_add, no need to check presence
repo.remotes['origin'].fetch(fetch_options)
repo.branches.create('master','origin/master')
repo.branches['master'].upstream = repo.branches['origin/master']
repo.checkout_head(strategy: :force)
end | [
"def",
"clone_submodule",
"(",
"repo",
",",
"fetch_options",
")",
"# the remote was just added by setup_add, no need to check presence",
"repo",
".",
"remotes",
"[",
"'origin'",
"]",
".",
"fetch",
"(",
"fetch_options",
")",
"repo",
".",
"branches",
".",
"create",
"(",... | currently libgit2's `git_submodule_add_setup` initializes a repo
with a workdir for the submodule. libgit2's `git_clone` however
requires the target for the clone to be an empty dir.
This provides a ghetto clone implementation that:
1. fetches the remote
2. sets up a master branch to be tracking origin/master
3. checkouts the submodule | [
"currently",
"libgit2",
"s",
"git_submodule_add_setup",
"initializes",
"a",
"repo",
"with",
"a",
"workdir",
"for",
"the",
"submodule",
".",
"libgit2",
"s",
"git_clone",
"however",
"requires",
"the",
"target",
"for",
"the",
"clone",
"to",
"be",
"an",
"empty",
"... | 33873e5df2bd38501814182ff79609ed4bd88012 | https://github.com/libgit2/rugged/blob/33873e5df2bd38501814182ff79609ed4bd88012/lib/rugged/submodule_collection.rb#L43-L51 | train | Clone the submodule | [
30522,
13366,
17598,
1035,
4942,
5302,
8566,
2571,
1006,
16360,
2080,
1010,
18584,
1035,
7047,
1007,
1001,
1996,
6556,
2001,
2074,
2794,
2011,
16437,
1035,
5587,
1010,
2053,
2342,
2000,
4638,
3739,
16360,
2080,
1012,
6556,
2015,
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_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb | Azure::Web::Mgmt::V2018_02_01.AppServiceEnvironments.begin_resume | def begin_resume(resource_group_name, name, custom_headers:nil)
first_page = begin_resume_as_lazy(resource_group_name, name, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def begin_resume(resource_group_name, name, custom_headers:nil)
first_page = begin_resume_as_lazy(resource_group_name, name, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"begin_resume",
"(",
"resource_group_name",
",",
"name",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"begin_resume_as_lazy",
"(",
"resource_group_name",
",",
"name",
",",
"custom_headers",
":custom_headers",
")",
"first_page",
".",
"get_all_items... | Resume an App Service Environment.
Resume 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 [Array<Site>] operation results. | [
"Resume",
"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#L4635-L4638 | train | Resumes a virtual machine from a resource group. | [
30522,
13366,
4088,
1035,
13746,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
4088,
1035,
13746,
1035,
2004,
1035,
13971,
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_sql/lib/2017-10-01-preview/generated/azure_mgmt_sql/managed_database_vulnerability_assessment_scans.rb | Azure::SQL::Mgmt::V2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentScans.initiate_scan_async | def initiate_scan_async(resource_group_name, managed_instance_name, database_name, scan_id, custom_headers:nil)
# Send request
promise = begin_initiate_scan_async(resource_group_name, managed_instance_name, database_name, scan_id, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | ruby | def initiate_scan_async(resource_group_name, managed_instance_name, database_name, scan_id, custom_headers:nil)
# Send request
promise = begin_initiate_scan_async(resource_group_name, managed_instance_name, database_name, scan_id, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | [
"def",
"initiate_scan_async",
"(",
"resource_group_name",
",",
"managed_instance_name",
",",
"database_name",
",",
"scan_id",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_initiate_scan_async",
"(",
"resource_group_name",
",",
"managed_i... | @param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param managed_instance_name [String] The name of the managed instance.
@param database_name [String] The name of the database.
@param scan_id [String] The vulnerability assessment scan Id of the scan to
retrieve.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@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/2017-10-01-preview/generated/azure_mgmt_sql/managed_database_vulnerability_assessment_scans.rb#L272-L286 | train | Initializes a scan of a managed database. | [
30522,
13366,
17820,
1035,
13594,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3266,
1035,
6013,
1035,
2171,
1010,
7809,
1035,
2171,
1010,
13594,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ffaker/ffaker | lib/ffaker/identification_kr.rb | FFaker.IdentificationKr.rrn | def rrn
birth = fetch_sample([*Date.new(1970, 1, 1)..Date.new(1999, 12, 31)]).strftime('%y%d%m')
sex = fetch_sample([1, 2])
loc = FFaker.numerify("#{fetch_sample([*'00'..'95'])}###")
a, b, c, d, e, f, g, h, i, j, k, l = "#{birth}#{sex}#{loc}".split(//).map(&:to_i)
checksum = (11 - (2 * a + 3 * b + 4 * c + 5 * d + 6 * e + 7 * f + 8 * g + 9 * h + 2 * i + 3 * j + 4 * k + 5 * l) % 11) % 10
"#{birth}-#{sex}#{loc}#{checksum}"
end | ruby | def rrn
birth = fetch_sample([*Date.new(1970, 1, 1)..Date.new(1999, 12, 31)]).strftime('%y%d%m')
sex = fetch_sample([1, 2])
loc = FFaker.numerify("#{fetch_sample([*'00'..'95'])}###")
a, b, c, d, e, f, g, h, i, j, k, l = "#{birth}#{sex}#{loc}".split(//).map(&:to_i)
checksum = (11 - (2 * a + 3 * b + 4 * c + 5 * d + 6 * e + 7 * f + 8 * g + 9 * h + 2 * i + 3 * j + 4 * k + 5 * l) % 11) % 10
"#{birth}-#{sex}#{loc}#{checksum}"
end | [
"def",
"rrn",
"birth",
"=",
"fetch_sample",
"(",
"[",
"Date",
".",
"new",
"(",
"1970",
",",
"1",
",",
"1",
")",
"..",
"Date",
".",
"new",
"(",
"1999",
",",
"12",
",",
"31",
")",
"]",
")",
".",
"strftime",
"(",
"'%y%d%m'",
")",
"sex",
"=",
"fe... | Resident Registration Number
http://ko.wikipedia.org/wiki/%EC%A3%BC%EB%AF%BC%EB%93%B1%EB%A1%9D%EB%B2%88%ED%98%B8 | [
"Resident",
"Registration",
"Number",
"http",
":",
"//",
"ko",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"%EC%A3%BC%EB%AF%BC%EB%93%B1%EB%A1%9D%EB%B2%88%ED%98%B8"
] | 9570ac54874fec66a99b9c86401fb878f1e3e951 | https://github.com/ffaker/ffaker/blob/9570ac54874fec66a99b9c86401fb878f1e3e951/lib/ffaker/identification_kr.rb#L10-L17 | train | Returns the unique identifier for the record | [
30522,
13366,
25269,
2078,
4182,
1027,
18584,
1035,
7099,
1006,
1031,
1008,
3058,
1012,
2047,
1006,
3359,
1010,
1015,
1010,
1015,
1007,
1012,
1012,
3058,
1012,
2047,
1006,
2639,
1010,
2260,
1010,
2861,
1007,
1033,
1007,
1012,
2358,
12881,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cheezy/page-object | lib/page-object/accessors.rb | PageObject.Accessors.radio_button | def radio_button(name, identifier={:index => 0}, &block)
standard_methods(name, identifier, 'radio_button_for', &block)
define_method("select_#{name}") do
return platform.select_radio(identifier.clone) unless block_given?
self.send("#{name}_element").select
end
define_method("#{name}_selected?") do
return platform.radio_selected?(identifier.clone) unless block_given?
self.send("#{name}_element").selected?
end
end | ruby | def radio_button(name, identifier={:index => 0}, &block)
standard_methods(name, identifier, 'radio_button_for', &block)
define_method("select_#{name}") do
return platform.select_radio(identifier.clone) unless block_given?
self.send("#{name}_element").select
end
define_method("#{name}_selected?") do
return platform.radio_selected?(identifier.clone) unless block_given?
self.send("#{name}_element").selected?
end
end | [
"def",
"radio_button",
"(",
"name",
",",
"identifier",
"=",
"{",
":index",
"=>",
"0",
"}",
",",
"&",
"block",
")",
"standard_methods",
"(",
"name",
",",
"identifier",
",",
"'radio_button_for'",
",",
"block",
")",
"define_method",
"(",
"\"select_#{name}\"",
"... | adds four methods - one to select, another to return if a radio button
is selected, another method to return a PageObject::Elements::RadioButton
object representing the radio button element, and another to check
the radio button's existence.
@example
radio_button(:north, :id => "north")
# will generate 'select_north', 'north_selected?',
# 'north_element', and 'north?' methods
@param [Symbol] the name used for the generated methods
@param [Hash] identifier how we find a radio button.
@param optional block to be invoked when element method is called | [
"adds",
"four",
"methods",
"-",
"one",
"to",
"select",
"another",
"to",
"return",
"if",
"a",
"radio",
"button",
"is",
"selected",
"another",
"method",
"to",
"return",
"a",
"PageObject",
"::",
"Elements",
"::",
"RadioButton",
"object",
"representing",
"the",
... | 850d775bf63768fbb1551a34480195785fe8e193 | https://github.com/cheezy/page-object/blob/850d775bf63768fbb1551a34480195785fe8e193/lib/page-object/accessors.rb#L357-L367 | train | Creates a radio button | [
30522,
13366,
2557,
1035,
6462,
1006,
2171,
1010,
8909,
4765,
18095,
1027,
1063,
1024,
5950,
1027,
1028,
1014,
1065,
1010,
1004,
3796,
1007,
3115,
1035,
4725,
1006,
2171,
1010,
8909,
4765,
18095,
1010,
1005,
2557,
1035,
6462,
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... |
ruby/psych | lib/psych/scalar_scanner.rb | Psych.ScalarScanner.tokenize | def tokenize string
return nil if string.empty?
return string if @string_cache.key?(string)
return @symbol_cache[string] if @symbol_cache.key?(string)
case string
# Check for a String type, being careful not to get caught by hash keys, hex values, and
# special floats (e.g., -.inf).
when /^[^\d\.:-]?[A-Za-z_\s!@#\$%\^&\*\(\)\{\}\<\>\|\/\\~;=]+/, /\n/
if string.length > 5
@string_cache[string] = true
return string
end
case string
when /^[^ytonf~]/i
@string_cache[string] = true
string
when '~', /^null$/i
nil
when /^(yes|true|on)$/i
true
when /^(no|false|off)$/i
false
else
@string_cache[string] = true
string
end
when TIME
begin
parse_time string
rescue ArgumentError
string
end
when /^\d{4}-(?:1[012]|0\d|\d)-(?:[12]\d|3[01]|0\d|\d)$/
require 'date'
begin
class_loader.date.strptime(string, '%Y-%m-%d')
rescue ArgumentError
string
end
when /^\.inf$/i
Float::INFINITY
when /^-\.inf$/i
-Float::INFINITY
when /^\.nan$/i
Float::NAN
when /^:./
if string =~ /^:(["'])(.*)\1/
@symbol_cache[string] = class_loader.symbolize($2.sub(/^:/, ''))
else
@symbol_cache[string] = class_loader.symbolize(string.sub(/^:/, ''))
end
when /^[-+]?[0-9][0-9_]*(:[0-5]?[0-9]){1,2}$/
i = 0
string.split(':').each_with_index do |n,e|
i += (n.to_i * 60 ** (e - 2).abs)
end
i
when /^[-+]?[0-9][0-9_]*(:[0-5]?[0-9]){1,2}\.[0-9_]*$/
i = 0
string.split(':').each_with_index do |n,e|
i += (n.to_f * 60 ** (e - 2).abs)
end
i
when FLOAT
if string =~ /\A[-+]?\.\Z/
@string_cache[string] = true
string
else
Float(string.gsub(/[,_]|\.([Ee]|$)/, '\1'))
end
else
int = parse_int string.gsub(/[,_]/, '')
return int if int
@string_cache[string] = true
string
end
end | ruby | def tokenize string
return nil if string.empty?
return string if @string_cache.key?(string)
return @symbol_cache[string] if @symbol_cache.key?(string)
case string
# Check for a String type, being careful not to get caught by hash keys, hex values, and
# special floats (e.g., -.inf).
when /^[^\d\.:-]?[A-Za-z_\s!@#\$%\^&\*\(\)\{\}\<\>\|\/\\~;=]+/, /\n/
if string.length > 5
@string_cache[string] = true
return string
end
case string
when /^[^ytonf~]/i
@string_cache[string] = true
string
when '~', /^null$/i
nil
when /^(yes|true|on)$/i
true
when /^(no|false|off)$/i
false
else
@string_cache[string] = true
string
end
when TIME
begin
parse_time string
rescue ArgumentError
string
end
when /^\d{4}-(?:1[012]|0\d|\d)-(?:[12]\d|3[01]|0\d|\d)$/
require 'date'
begin
class_loader.date.strptime(string, '%Y-%m-%d')
rescue ArgumentError
string
end
when /^\.inf$/i
Float::INFINITY
when /^-\.inf$/i
-Float::INFINITY
when /^\.nan$/i
Float::NAN
when /^:./
if string =~ /^:(["'])(.*)\1/
@symbol_cache[string] = class_loader.symbolize($2.sub(/^:/, ''))
else
@symbol_cache[string] = class_loader.symbolize(string.sub(/^:/, ''))
end
when /^[-+]?[0-9][0-9_]*(:[0-5]?[0-9]){1,2}$/
i = 0
string.split(':').each_with_index do |n,e|
i += (n.to_i * 60 ** (e - 2).abs)
end
i
when /^[-+]?[0-9][0-9_]*(:[0-5]?[0-9]){1,2}\.[0-9_]*$/
i = 0
string.split(':').each_with_index do |n,e|
i += (n.to_f * 60 ** (e - 2).abs)
end
i
when FLOAT
if string =~ /\A[-+]?\.\Z/
@string_cache[string] = true
string
else
Float(string.gsub(/[,_]|\.([Ee]|$)/, '\1'))
end
else
int = parse_int string.gsub(/[,_]/, '')
return int if int
@string_cache[string] = true
string
end
end | [
"def",
"tokenize",
"string",
"return",
"nil",
"if",
"string",
".",
"empty?",
"return",
"string",
"if",
"@string_cache",
".",
"key?",
"(",
"string",
")",
"return",
"@symbol_cache",
"[",
"string",
"]",
"if",
"@symbol_cache",
".",
"key?",
"(",
"string",
")",
... | Create a new scanner
Tokenize +string+ returning the Ruby object | [
"Create",
"a",
"new",
"scanner",
"Tokenize",
"+",
"string",
"+",
"returning",
"the",
"Ruby",
"object"
] | f3a37e6bc1c2a98bfc9fafc389ea05622c744af9 | https://github.com/ruby/psych/blob/f3a37e6bc1c2a98bfc9fafc389ea05622c744af9/lib/psych/scalar_scanner.rb#L32-L111 | train | Parse a string into a Hash. | [
30522,
13366,
19204,
4697,
5164,
2709,
9152,
2140,
2065,
5164,
1012,
4064,
1029,
2709,
5164,
2065,
1030,
5164,
1035,
17053,
1012,
3145,
1029,
1006,
5164,
1007,
2709,
1030,
6454,
1035,
17053,
1031,
5164,
1033,
2065,
1030,
6454,
1035,
17053,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/fields.rb | Mongoid.Fields.apply_default | def apply_default(name)
unless attributes.key?(name)
if field = fields[name]
default = field.eval_default(self)
unless default.nil? || field.lazy?
attribute_will_change!(name)
attributes[name] = default
end
end
end
end | ruby | def apply_default(name)
unless attributes.key?(name)
if field = fields[name]
default = field.eval_default(self)
unless default.nil? || field.lazy?
attribute_will_change!(name)
attributes[name] = default
end
end
end
end | [
"def",
"apply_default",
"(",
"name",
")",
"unless",
"attributes",
".",
"key?",
"(",
"name",
")",
"if",
"field",
"=",
"fields",
"[",
"name",
"]",
"default",
"=",
"field",
".",
"eval_default",
"(",
"self",
")",
"unless",
"default",
".",
"nil?",
"||",
"fi... | Applies a single default value for the given name.
@example Apply a single default.
model.apply_default("name")
@param [ String ] name The name of the field.
@since 2.4.0 | [
"Applies",
"a",
"single",
"default",
"value",
"for",
"the",
"given",
"name",
"."
] | 56976e32610f4c2450882b0bfe14da099f0703f4 | https://github.com/mongodb/mongoid/blob/56976e32610f4c2450882b0bfe14da099f0703f4/lib/mongoid/fields.rb#L101-L111 | train | Apply default value to the object | [
30522,
13366,
6611,
1035,
12398,
1006,
2171,
1007,
4983,
12332,
1012,
3145,
1029,
1006,
2171,
1007,
2065,
2492,
1027,
4249,
1031,
2171,
1033,
12398,
1027,
2492,
1012,
9345,
2140,
1035,
12398,
1006,
2969,
1007,
4983,
12398,
1012,
9152,
2140,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rmagick/rmagick | lib/rmagick_internal.rb | Magick.ImageList.is_an_image_array | def is_an_image_array(ary)
Kernel.raise ArgumentError, "Magick::ImageList or array of Magick::Images required (#{ary.class} given)" unless ary.respond_to? :each
ary.each { |obj| is_an_image obj }
true
end | ruby | def is_an_image_array(ary)
Kernel.raise ArgumentError, "Magick::ImageList or array of Magick::Images required (#{ary.class} given)" unless ary.respond_to? :each
ary.each { |obj| is_an_image obj }
true
end | [
"def",
"is_an_image_array",
"(",
"ary",
")",
"Kernel",
".",
"raise",
"ArgumentError",
",",
"\"Magick::ImageList or array of Magick::Images required (#{ary.class} given)\"",
"unless",
"ary",
".",
"respond_to?",
":each",
"ary",
".",
"each",
"{",
"|",
"obj",
"|",
"is_an_im... | Ensure array is always an array of Magick::Image objects | [
"Ensure",
"array",
"is",
"always",
"an",
"array",
"of",
"Magick",
"::",
"Image",
"objects"
] | ef6688ed9d76bf123c2ea1a483eff8635051adb7 | https://github.com/rmagick/rmagick/blob/ef6688ed9d76bf123c2ea1a483eff8635051adb7/lib/rmagick_internal.rb#L1240-L1244 | train | Returns true if the array is an image array | [
30522,
13366,
2003,
1035,
2019,
1035,
3746,
1035,
9140,
1006,
12098,
2100,
1007,
16293,
1012,
5333,
6685,
2121,
29165,
1010,
1000,
3894,
2243,
1024,
1024,
3746,
9863,
2030,
9140,
1997,
3894,
2243,
1024,
1024,
4871,
3223,
1006,
1001,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/users.rb | Azure::Labservices::Mgmt::V2018_10_15.Users.create_or_update | def create_or_update(resource_group_name, lab_account_name, lab_name, user_name, user, custom_headers:nil)
response = create_or_update_async(resource_group_name, lab_account_name, lab_name, user_name, user, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_or_update(resource_group_name, lab_account_name, lab_name, user_name, user, custom_headers:nil)
response = create_or_update_async(resource_group_name, lab_account_name, lab_name, user_name, user, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_or_update",
"(",
"resource_group_name",
",",
"lab_account_name",
",",
"lab_name",
",",
"user_name",
",",
"user",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_or_update_async",
"(",
"resource_group_name",
",",
"lab_account_name",
",",... | Create or replace an existing User.
@param resource_group_name [String] The name of the resource group.
@param lab_account_name [String] The name of the lab Account.
@param lab_name [String] The name of the lab.
@param user_name [String] The name of the user.
@param user [User] The User registered to a lab
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [User] operation results. | [
"Create",
"or",
"replace",
"an",
"existing",
"User",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/users.rb#L260-L263 | train | Creates or updates a user in a lab. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
6845,
1035,
4070,
1035,
2171,
1010,
6845,
1035,
2171,
1010,
5310,
1035,
2171,
1010,
5310,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | frameit/lib/frameit/screenshot.rb | Frameit.Screenshot.device_name | def device_name
# rubocop:disable Require/MissingRequireStatement
sizes = Deliver::AppScreenshot::ScreenSize
case @screen_size
when sizes::IOS_65
return 'iPhone XS Max'
when sizes::IOS_61
return 'iPhone XR'
when sizes::IOS_58
return Frameit.config[:use_legacy_iphonex] ? 'iPhone X' : 'iPhone XS'
when sizes::IOS_55
return Frameit.config[:use_legacy_iphone6s] ? 'iPhone 6s Plus' : 'iPhone 7 Plus'
when sizes::IOS_47
return Frameit.config[:use_legacy_iphone6s] ? 'iPhone 6s' : 'iPhone 7'
when sizes::IOS_40
return Frameit.config[:use_legacy_iphone5s] ? 'iPhone 5s' : 'iPhone SE'
when sizes::IOS_35
return 'iPhone 4'
when sizes::IOS_IPAD
return 'iPad Air 2'
when sizes::IOS_IPAD_PRO
return 'iPad Pro'
when sizes::MAC
return 'MacBook'
else
UI.error("Unknown device type for size #{@screen_size} for path '#{path}'")
end
# rubocop:enable Require/MissingRequireStatement
end | ruby | def device_name
# rubocop:disable Require/MissingRequireStatement
sizes = Deliver::AppScreenshot::ScreenSize
case @screen_size
when sizes::IOS_65
return 'iPhone XS Max'
when sizes::IOS_61
return 'iPhone XR'
when sizes::IOS_58
return Frameit.config[:use_legacy_iphonex] ? 'iPhone X' : 'iPhone XS'
when sizes::IOS_55
return Frameit.config[:use_legacy_iphone6s] ? 'iPhone 6s Plus' : 'iPhone 7 Plus'
when sizes::IOS_47
return Frameit.config[:use_legacy_iphone6s] ? 'iPhone 6s' : 'iPhone 7'
when sizes::IOS_40
return Frameit.config[:use_legacy_iphone5s] ? 'iPhone 5s' : 'iPhone SE'
when sizes::IOS_35
return 'iPhone 4'
when sizes::IOS_IPAD
return 'iPad Air 2'
when sizes::IOS_IPAD_PRO
return 'iPad Pro'
when sizes::MAC
return 'MacBook'
else
UI.error("Unknown device type for size #{@screen_size} for path '#{path}'")
end
# rubocop:enable Require/MissingRequireStatement
end | [
"def",
"device_name",
"# rubocop:disable Require/MissingRequireStatement",
"sizes",
"=",
"Deliver",
"::",
"AppScreenshot",
"::",
"ScreenSize",
"case",
"@screen_size",
"when",
"sizes",
"::",
"IOS_65",
"return",
"'iPhone XS Max'",
"when",
"sizes",
"::",
"IOS_61",
"return",
... | the color to use for the frame (from Frameit::Color)
path: Path to screenshot
color: Color to use for the frame
Device name for a given screen size. Used to use the correct template | [
"the",
"color",
"to",
"use",
"for",
"the",
"frame",
"(",
"from",
"Frameit",
"::",
"Color",
")",
"path",
":",
"Path",
"to",
"screenshot",
"color",
":",
"Color",
"to",
"use",
"for",
"the",
"frame",
"Device",
"name",
"for",
"a",
"given",
"screen",
"size",... | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/frameit/lib/frameit/screenshot.rb#L28-L56 | train | Returns the device name for the current screen size. | [
30522,
13366,
5080,
1035,
2171,
1001,
14548,
24163,
2361,
1024,
4487,
19150,
5478,
1013,
4394,
2890,
15549,
28533,
3686,
3672,
10826,
1027,
8116,
1024,
1024,
18726,
24410,
19040,
1024,
1024,
12117,
4697,
2553,
1030,
3898,
1035,
2946,
2043,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/log_analytics.rb | Azure::Compute::Mgmt::V2018_04_01.LogAnalytics.export_throttled_requests | def export_throttled_requests(parameters, location, custom_headers:nil)
response = export_throttled_requests_async(parameters, location, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def export_throttled_requests(parameters, location, custom_headers:nil)
response = export_throttled_requests_async(parameters, location, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"export_throttled_requests",
"(",
"parameters",
",",
"location",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"export_throttled_requests_async",
"(",
"parameters",
",",
"location",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"respo... | Export logs that show total throttled Api requests for this subscription in
the given time window.
@param parameters [ThrottledRequestsInput] Parameters supplied to the
LogAnalytics getThrottledRequests Api.
@param location [String] The location upon which virtual-machine-sizes is
queried.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [LogAnalyticsOperationResult] operation results. | [
"Export",
"logs",
"that",
"show",
"total",
"throttled",
"Api",
"requests",
"for",
"this",
"subscription",
"in",
"the",
"given",
"time",
"window",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2018-04-01/generated/azure_mgmt_compute/log_analytics.rb#L84-L87 | train | Export the throttling requests for the specified subscription. | [
30522,
13366,
9167,
1035,
24420,
2094,
1035,
11186,
1006,
11709,
1010,
3295,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
9167,
1035,
24420,
2094,
1035,
11186,
1035,
2004,
6038,
2278,
1006,
11709,
1010,
3295,
1010,
766... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/client.rb | Mongo.Client.list_mongo_databases | def list_mongo_databases(filter = {}, opts = {})
database_names(filter, opts).collect do |name|
Database.new(self, name, options)
end
end | ruby | def list_mongo_databases(filter = {}, opts = {})
database_names(filter, opts).collect do |name|
Database.new(self, name, options)
end
end | [
"def",
"list_mongo_databases",
"(",
"filter",
"=",
"{",
"}",
",",
"opts",
"=",
"{",
"}",
")",
"database_names",
"(",
"filter",
",",
"opts",
")",
".",
"collect",
"do",
"|",
"name",
"|",
"Database",
".",
"new",
"(",
"self",
",",
"name",
",",
"options",... | Returns a list of Mongo::Database objects.
@example Get a list of Mongo::Database objects.
client.list_mongo_databases
@param [ Hash ] filter The filter criteria for getting a list of databases.
@param [ Hash ] opts The command options.
@return [ Array<Mongo::Database> ] The list of database objects.
@since 2.5.0 | [
"Returns",
"a",
"list",
"of",
"Mongo",
"::",
"Database",
"objects",
"."
] | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/client.rb#L629-L633 | train | Returns a list of all the databases in the database system. | [
30522,
13366,
2862,
1035,
12256,
3995,
1035,
17881,
1006,
11307,
1027,
1063,
1065,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
7809,
1035,
3415,
1006,
11307,
1010,
23569,
2015,
1007,
1012,
8145,
2079,
1064,
2171,
1064,
7809,
1012,
2047,
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.get_partition_event_list | def get_partition_event_list(partition_id, 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_partition_event_list_async(partition_id, 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_partition_event_list(partition_id, 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_partition_event_list_async(partition_id, 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_partition_event_list",
"(",
"partition_id",
",",
"start_time_utc",
",",
"end_time_utc",
",",
"timeout",
":",
"60",
",",
"events_types_filter",
":",
"nil",
",",
"exclude_analysis_events",
":",
"nil",
",",
"skip_correlation_lookup",
":",
"nil",
",",
"custo... | Gets a Partition-related events.
The response is list of PartitionEvent objects.
@param partition_id The identity of the partition.
@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",
"a",
"Partition",
"-",
"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#L28532-L28535 | train | Gets the list of events for the specified partition. | [
30522,
13366,
2131,
1035,
13571,
1035,
2724,
1035,
2862,
1006,
13571,
1035,
8909,
1010,
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,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_sets.rb | Azure::Compute::Mgmt::V2018_04_01.VirtualMachineScaleSets.begin_update_with_http_info | def begin_update_with_http_info(resource_group_name, vm_scale_set_name, parameters, custom_headers:nil)
begin_update_async(resource_group_name, vm_scale_set_name, parameters, custom_headers:custom_headers).value!
end | ruby | def begin_update_with_http_info(resource_group_name, vm_scale_set_name, parameters, custom_headers:nil)
begin_update_async(resource_group_name, vm_scale_set_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_update_with_http_info",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_update_async",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"parameters",
",",
"custom_headers",
":c... | Update a VM scale set.
@param resource_group_name [String] The name of the resource group.
@param vm_scale_set_name [String] The name of the VM scale set to create or
update.
@param parameters [VirtualMachineScaleSetUpdate] The scale set 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. | [
"Update",
"a",
"VM",
"scale",
"set",
"."
] | 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_sets.rb#L1383-L1385 | train | Updates a virtual machine scale set. | [
30522,
13366,
4088,
1035,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
4094,
1035,
2275,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
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... |
mongodb/mongoid | lib/mongoid/attributes.rb | Mongoid.Attributes.typed_value_for | def typed_value_for(key, value)
fields.key?(key) ? fields[key].mongoize(value) : value.mongoize
end | ruby | def typed_value_for(key, value)
fields.key?(key) ? fields[key].mongoize(value) : value.mongoize
end | [
"def",
"typed_value_for",
"(",
"key",
",",
"value",
")",
"fields",
".",
"key?",
"(",
"key",
")",
"?",
"fields",
"[",
"key",
"]",
".",
"mongoize",
"(",
"value",
")",
":",
"value",
".",
"mongoize",
"end"
] | Return the typecasted value for a field.
@example Get the value typecasted.
person.typed_value_for(:title, :sir)
@param [ String, Symbol ] key The field name.
@param [ Object ] value The uncast value.
@return [ Object ] The cast value.
@since 1.0.0 | [
"Return",
"the",
"typecasted",
"value",
"for",
"a",
"field",
"."
] | 56976e32610f4c2450882b0bfe14da099f0703f4 | https://github.com/mongodb/mongoid/blob/56976e32610f4c2450882b0bfe14da099f0703f4/lib/mongoid/attributes.rb#L287-L289 | train | Returns the value for the given key. | [
30522,
13366,
21189,
1035,
3643,
1035,
2005,
1006,
3145,
1010,
3643,
1007,
4249,
1012,
3145,
1029,
1006,
3145,
1007,
1029,
4249,
1031,
3145,
1033,
1012,
12256,
3995,
4697,
1006,
3643,
1007,
1024,
3643,
1012,
12256,
3995,
4697,
2203,
102,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.start_partition_restart_with_http_info | def start_partition_restart_with_http_info(service_id, partition_id, operation_id, restart_partition_mode, timeout:60, custom_headers:nil)
start_partition_restart_async(service_id, partition_id, operation_id, restart_partition_mode, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def start_partition_restart_with_http_info(service_id, partition_id, operation_id, restart_partition_mode, timeout:60, custom_headers:nil)
start_partition_restart_async(service_id, partition_id, operation_id, restart_partition_mode, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"start_partition_restart_with_http_info",
"(",
"service_id",
",",
"partition_id",
",",
"operation_id",
",",
"restart_partition_mode",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"start_partition_restart_async",
"(",
"service_id",
",",
"part... | This API will restart some or all replicas or instances of the specified
partition.
This API is useful for testing failover.
If used to target a stateless service partition, RestartPartitionMode must be
AllReplicasOrInstances.
Call the GetPartitionRestartProgress API using the same OperationId to get
the progress.
@param service_id [String] The identity of the service. This is typically the
full name of the service without the 'fabric:' URI scheme.
Starting from version 6.0, hierarchical names are delimited with the "~"
character.
For example, if the service name is "fabric:/myapp/app1/svc1", the service
identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
versions.
@param partition_id The identity of the partition.
@param operation_id A GUID that identifies a call of this API. This is
passed into the corresponding GetProgress API
@param restart_partition_mode [RestartPartitionMode] Describe which
partitions to restart. Possible values include: 'Invalid',
'AllReplicasOrInstances', 'OnlyActiveSecondaries'
@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. | [
"This",
"API",
"will",
"restart",
"some",
"or",
"all",
"replicas",
"or",
"instances",
"of",
"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#L21357-L21359 | train | Restarts the specified partition. | [
30522,
13366,
2707,
1035,
13571,
1035,
23818,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2326,
1035,
8909,
1010,
13571,
1035,
8909,
1010,
3169,
1035,
8909,
1010,
23818,
1035,
13571,
1035,
5549,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
github/linguist | samples/Ruby/sinatra.rb | Sinatra.Helpers.send_file | def send_file(path, opts={})
if opts[:type] or not response['Content-Type']
content_type opts[:type] || File.extname(path), :default => 'application/octet-stream'
end
if opts[:disposition] == 'attachment' || opts[:filename]
attachment opts[:filename] || path
elsif opts[:disposition] == 'inline'
response['Content-Disposition'] = 'inline'
end
last_modified opts[:last_modified] if opts[:last_modified]
file = Rack::File.new nil
file.path = path
result = file.serving env
result[1].each { |k,v| headers[k] ||= v }
headers['Content-Length'] = result[1]['Content-Length']
halt opts[:status] || result[0], result[2]
rescue Errno::ENOENT
not_found
end | ruby | def send_file(path, opts={})
if opts[:type] or not response['Content-Type']
content_type opts[:type] || File.extname(path), :default => 'application/octet-stream'
end
if opts[:disposition] == 'attachment' || opts[:filename]
attachment opts[:filename] || path
elsif opts[:disposition] == 'inline'
response['Content-Disposition'] = 'inline'
end
last_modified opts[:last_modified] if opts[:last_modified]
file = Rack::File.new nil
file.path = path
result = file.serving env
result[1].each { |k,v| headers[k] ||= v }
headers['Content-Length'] = result[1]['Content-Length']
halt opts[:status] || result[0], result[2]
rescue Errno::ENOENT
not_found
end | [
"def",
"send_file",
"(",
"path",
",",
"opts",
"=",
"{",
"}",
")",
"if",
"opts",
"[",
":type",
"]",
"or",
"not",
"response",
"[",
"'Content-Type'",
"]",
"content_type",
"opts",
"[",
":type",
"]",
"||",
"File",
".",
"extname",
"(",
"path",
")",
",",
... | Use the contents of the file at +path+ as the response body. | [
"Use",
"the",
"contents",
"of",
"the",
"file",
"at",
"+",
"path",
"+",
"as",
"the",
"response",
"body",
"."
] | 9116c90fcbb82ac03b4b33c58cfbde1fcf745e99 | https://github.com/github/linguist/blob/9116c90fcbb82ac03b4b33c58cfbde1fcf745e99/samples/Ruby/sinatra.rb#L266-L287 | train | Send a file to the client | [
30522,
13366,
4604,
1035,
5371,
1006,
4130,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2065,
23569,
2015,
1031,
1024,
2828,
1033,
2030,
2025,
3433,
1031,
1005,
4180,
1011,
2828,
1005,
1033,
4180,
1035,
2828,
23569,
2015,
1031,
1024,
2828,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/2017-03-01/generated/azure_mgmt_api_management/diagnostic.rb | Azure::ApiManagement::Mgmt::V2017_03_01.Diagnostic.head_with_http_info | def head_with_http_info(resource_group_name, service_name, diagnostic_id, custom_headers:nil)
head_async(resource_group_name, service_name, diagnostic_id, custom_headers:custom_headers).value!
end | ruby | def head_with_http_info(resource_group_name, service_name, diagnostic_id, custom_headers:nil)
head_async(resource_group_name, service_name, diagnostic_id, custom_headers:custom_headers).value!
end | [
"def",
"head_with_http_info",
"(",
"resource_group_name",
",",
"service_name",
",",
"diagnostic_id",
",",
"custom_headers",
":",
"nil",
")",
"head_async",
"(",
"resource_group_name",
",",
"service_name",
",",
"diagnostic_id",
",",
"custom_headers",
":custom_headers",
")... | Gets the entity state (Etag) version of the Diagnostic 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 diagnostic_id [String] Diagnostic identifier. Must be unique in the
current API Management service instance.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"entity",
"state",
"(",
"Etag",
")",
"version",
"of",
"the",
"Diagnostic",
"specified",
"by",
"its",
"identifier",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2017-03-01/generated/azure_mgmt_api_management/diagnostic.rb#L169-L171 | train | Gets the diagnostic specification. | [
30522,
13366,
2132,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
16474,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2132,
1035,
2004,
6038,
2278,
1006,
7692,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
savonrb/savon | lib/savon/options.rb | Savon.GlobalOptions.log_level | def log_level(level)
levels = { :debug => 0, :info => 1, :warn => 2, :error => 3, :fatal => 4 }
unless levels.include? level
raise ArgumentError, "Invalid log level: #{level.inspect}\n" \
"Expected one of: #{levels.keys.inspect}"
end
@options[:logger].level = levels[level]
end | ruby | def log_level(level)
levels = { :debug => 0, :info => 1, :warn => 2, :error => 3, :fatal => 4 }
unless levels.include? level
raise ArgumentError, "Invalid log level: #{level.inspect}\n" \
"Expected one of: #{levels.keys.inspect}"
end
@options[:logger].level = levels[level]
end | [
"def",
"log_level",
"(",
"level",
")",
"levels",
"=",
"{",
":debug",
"=>",
"0",
",",
":info",
"=>",
"1",
",",
":warn",
"=>",
"2",
",",
":error",
"=>",
"3",
",",
":fatal",
"=>",
"4",
"}",
"unless",
"levels",
".",
"include?",
"level",
"raise",
"Argum... | Changes the Logger's log level. | [
"Changes",
"the",
"Logger",
"s",
"log",
"level",
"."
] | 0fa08fc30ecce2cd1109474bfcc14abf13a0c297 | https://github.com/savonrb/savon/blob/0fa08fc30ecce2cd1109474bfcc14abf13a0c297/lib/savon/options.rb#L206-L215 | train | Sets the log level for this logger. | [
30522,
13366,
8833,
1035,
2504,
1006,
2504,
1007,
3798,
1027,
1063,
1024,
2139,
8569,
2290,
1027,
1028,
1014,
1010,
1024,
18558,
1027,
1028,
1015,
1010,
1024,
11582,
1027,
1028,
1016,
1010,
1024,
7561,
1027,
1028,
1017,
1010,
1024,
10611,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
grpc/grpc | src/ruby/lib/grpc/generic/active_call.rb | GRPC.ActiveCall.send_status | def send_status(code = OK, details = '', assert_finished = false,
metadata: {})
send_initial_metadata
ops = {
SEND_STATUS_FROM_SERVER => Struct::Status.new(code, details, metadata)
}
ops[RECV_CLOSE_ON_SERVER] = nil if assert_finished
@call.run_batch(ops)
set_output_stream_done
nil
end | ruby | def send_status(code = OK, details = '', assert_finished = false,
metadata: {})
send_initial_metadata
ops = {
SEND_STATUS_FROM_SERVER => Struct::Status.new(code, details, metadata)
}
ops[RECV_CLOSE_ON_SERVER] = nil if assert_finished
@call.run_batch(ops)
set_output_stream_done
nil
end | [
"def",
"send_status",
"(",
"code",
"=",
"OK",
",",
"details",
"=",
"''",
",",
"assert_finished",
"=",
"false",
",",
"metadata",
":",
"{",
"}",
")",
"send_initial_metadata",
"ops",
"=",
"{",
"SEND_STATUS_FROM_SERVER",
"=>",
"Struct",
"::",
"Status",
".",
"n... | send_status sends a status to the remote endpoint.
@param code [int] the status code to send
@param details [String] details
@param assert_finished [true, false] when true(default), waits for
FINISHED.
@param metadata [Hash] metadata to send to the server. If a value is a
list, mulitple metadata for its key are sent | [
"send_status",
"sends",
"a",
"status",
"to",
"the",
"remote",
"endpoint",
"."
] | f3937f0e55227a4ef3a23f895d3b204a947610f8 | https://github.com/grpc/grpc/blob/f3937f0e55227a4ef3a23f895d3b204a947610f8/src/ruby/lib/grpc/generic/active_call.rb#L206-L217 | train | Send a status message to the server | [
30522,
13366,
4604,
1035,
3570,
1006,
3642,
1027,
7929,
1010,
4751,
1027,
1005,
1005,
1010,
20865,
1035,
2736,
1027,
6270,
1010,
27425,
1024,
1063,
30524,
2358,
6820,
6593,
1024,
1024,
3570,
1012,
2047,
1006,
3642,
1010,
4751,
1010,
27425,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_batch/lib/2017-09-01/generated/azure_mgmt_batch/pool_operations.rb | Azure::Batch::Mgmt::V2017_09_01.PoolOperations.disable_auto_scale_with_http_info | def disable_auto_scale_with_http_info(resource_group_name, account_name, pool_name, custom_headers:nil)
disable_auto_scale_async(resource_group_name, account_name, pool_name, custom_headers:custom_headers).value!
end | ruby | def disable_auto_scale_with_http_info(resource_group_name, account_name, pool_name, custom_headers:nil)
disable_auto_scale_async(resource_group_name, account_name, pool_name, custom_headers:custom_headers).value!
end | [
"def",
"disable_auto_scale_with_http_info",
"(",
"resource_group_name",
",",
"account_name",
",",
"pool_name",
",",
"custom_headers",
":",
"nil",
")",
"disable_auto_scale_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"pool_name",
",",
"custom_headers",
":c... | Disables automatic scaling for a pool.
@param resource_group_name [String] The name of the resource group that
contains the Batch account.
@param account_name [String] The name of the Batch account.
@param pool_name [String] The pool name. This must be unique within the
account.
@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. | [
"Disables",
"automatic",
"scaling",
"for",
"a",
"pool",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_batch/lib/2017-09-01/generated/azure_mgmt_batch/pool_operations.rb#L557-L559 | train | Disables auto scale of the specified pool. | [
30522,
13366,
4487,
19150,
1035,
8285,
1035,
4094,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
4770,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4487,
19150,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
david942j/one_gadget | lib/one_gadget/helper.rb | OneGadget.Helper.comments_of_file | def comments_of_file(file)
File.readlines(file).map { |s| s[2..-1].rstrip if s.start_with?('# ') }.compact
end | ruby | def comments_of_file(file)
File.readlines(file).map { |s| s[2..-1].rstrip if s.start_with?('# ') }.compact
end | [
"def",
"comments_of_file",
"(",
"file",
")",
"File",
".",
"readlines",
"(",
"file",
")",
".",
"map",
"{",
"|",
"s",
"|",
"s",
"[",
"2",
"..",
"-",
"1",
"]",
".",
"rstrip",
"if",
"s",
".",
"start_with?",
"(",
"'# '",
")",
"}",
".",
"compact",
"e... | Fetch lines start with '#'.
@param [String] file
Filename.
@return [Array<String>]
Lines of comments. | [
"Fetch",
"lines",
"start",
"with",
"#",
"."
] | ff6ef04541e83441bfe3c2664a6febd1640f4263 | https://github.com/david942j/one_gadget/blob/ff6ef04541e83441bfe3c2664a6febd1640f4263/lib/one_gadget/helper.rb#L37-L39 | train | Returns the comments of the file | [
30522,
13366,
7928,
1035,
1997,
1035,
5371,
1006,
5371,
1007,
5371,
1012,
3191,
12735,
1006,
5371,
1007,
1012,
4949,
1063,
1064,
1055,
1064,
1055,
1031,
1016,
1012,
1012,
1011,
1015,
1033,
1012,
12667,
24901,
2065,
1055,
1012,
2707,
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/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.get_intent_with_http_info | def get_intent_with_http_info(app_id, version_id, intent_id, custom_headers:nil)
get_intent_async(app_id, version_id, intent_id, custom_headers:custom_headers).value!
end | ruby | def get_intent_with_http_info(app_id, version_id, intent_id, custom_headers:nil)
get_intent_async(app_id, version_id, intent_id, custom_headers:custom_headers).value!
end | [
"def",
"get_intent_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"intent_id",
",",
"custom_headers",
":",
"nil",
")",
"get_intent_async",
"(",
"app_id",
",",
"version_id",
",",
"intent_id",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"e... | Gets information about the intent model in a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param intent_id The intent classifier ID.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"information",
"about",
"the",
"intent",
"model",
"in",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L1839-L1841 | train | Gets the intent for the application version. | [
30522,
13366,
2131,
1035,
7848,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
7848,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
7848,
1035,
2004,
6038,
2278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | 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.create_service_from_template | def create_service_from_template(application_id, service_from_template_description, timeout:60, custom_headers:nil)
response = create_service_from_template_async(application_id, service_from_template_description, timeout:timeout, custom_headers:custom_headers).value!
nil
end | ruby | def create_service_from_template(application_id, service_from_template_description, timeout:60, custom_headers:nil)
response = create_service_from_template_async(application_id, service_from_template_description, timeout:timeout, custom_headers:custom_headers).value!
nil
end | [
"def",
"create_service_from_template",
"(",
"application_id",
",",
"service_from_template_description",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_service_from_template_async",
"(",
"application_id",
",",
"service_from_templa... | Creates a Service Fabric service from the service template.
Creates a Service Fabric service from the service template defined in the
application manifest. A service template contains the properties that will be
same for the service instance of the same type. The API allows overriding the
properties that are usually different for different services of the same
service type.
@param application_id [String] The identity of the application. This is
typically the full name of the application without the 'fabric:' URI scheme.
Starting from version 6.0, hierarchical names are delimited with the "~"
character.
For example, if the application name is "fabric:/myapp/app1", the application
identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
@param service_from_template_description [ServiceFromTemplateDescription]
Describes the service that needs to be created from the template defined in
the application manifest.
@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. | [
"Creates",
"a",
"Service",
"Fabric",
"service",
"from",
"the",
"service",
"template",
"."
] | 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#L10260-L10263 | train | Creates a service from a template. | [
30522,
13366,
3443,
1035,
2326,
1035,
2013,
1035,
23561,
1006,
4646,
1035,
8909,
1010,
2326,
1035,
2013,
1035,
23561,
1035,
6412,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3443,
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/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.get_custom_entity_role | def get_custom_entity_role(app_id, version_id, entity_id, role_id, custom_headers:nil)
response = get_custom_entity_role_async(app_id, version_id, entity_id, role_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_custom_entity_role(app_id, version_id, entity_id, role_id, custom_headers:nil)
response = get_custom_entity_role_async(app_id, version_id, entity_id, role_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_custom_entity_role",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"role_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_custom_entity_role_async",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"role_id",
",",
... | Get one role for a given prebuilt entity in a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param entity_id entity ID.
@param role_id entity role ID.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [EntityRole] operation results. | [
"Get",
"one",
"role",
"for",
"a",
"given",
"prebuilt",
"entity",
"in",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L10967-L10970 | train | Gets the role for an entity in a version of the application. | [
30522,
13366,
2131,
1035,
7661,
1035,
9178,
1035,
2535,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
9178,
1035,
8909,
1010,
2535,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
7661,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
deivid-rodriguez/byebug | lib/byebug/history.rb | Byebug.History.restore | def restore
return unless File.exist?(Setting[:histfile])
File.readlines(Setting[:histfile]).reverse_each { |l| push(l.chomp) }
end | ruby | def restore
return unless File.exist?(Setting[:histfile])
File.readlines(Setting[:histfile]).reverse_each { |l| push(l.chomp) }
end | [
"def",
"restore",
"return",
"unless",
"File",
".",
"exist?",
"(",
"Setting",
"[",
":histfile",
"]",
")",
"File",
".",
"readlines",
"(",
"Setting",
"[",
":histfile",
"]",
")",
".",
"reverse_each",
"{",
"|",
"l",
"|",
"push",
"(",
"l",
".",
"chomp",
")... | Restores history from disk. | [
"Restores",
"history",
"from",
"disk",
"."
] | bf41a63858a648baa7fb621600d6451786d1572a | https://github.com/deivid-rodriguez/byebug/blob/bf41a63858a648baa7fb621600d6451786d1572a/lib/byebug/history.rb#L36-L40 | train | Restore the
file | [
30522,
13366,
9239,
2709,
4983,
5371,
1012,
4839,
1029,
1006,
4292,
1031,
1024,
2010,
24475,
9463,
1033,
1007,
5371,
1012,
3191,
12735,
1006,
4292,
1031,
1024,
2010,
24475,
9463,
1033,
1007,
1012,
7901,
1035,
2169,
1063,
1064,
1048,
1064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.get_replica_info_list | def get_replica_info_list(partition_id, continuation_token:nil, timeout:60, custom_headers:nil)
response = get_replica_info_list_async(partition_id, continuation_token:continuation_token, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_replica_info_list(partition_id, continuation_token:nil, timeout:60, custom_headers:nil)
response = get_replica_info_list_async(partition_id, continuation_token:continuation_token, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_replica_info_list",
"(",
"partition_id",
",",
"continuation_token",
":",
"nil",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_replica_info_list_async",
"(",
"partition_id",
",",
"continuation_token",
":continuatio... | Gets the information about replicas of a Service Fabric service partition.
The GetReplicas endpoint returns information about the replicas of the
specified partition. The response includes the id, role, status, health, node
name, uptime, and other details about the replica.
@param partition_id The identity of the partition.
@param continuation_token [String] The continuation token parameter is used
to obtain next set of results. A continuation token with a non empty value is
included in the response of the API when the results from the system do not
fit in a single response. When this value is passed to the next API call, the
API returns next set of results. If there are no further results then the
continuation token does not contain a value. The value of this parameter
should not be URL encoded.
@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 [PagedReplicaInfoList] operation results. | [
"Gets",
"the",
"information",
"about",
"replicas",
"of",
"a",
"Service",
"Fabric",
"service",
"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#L14447-L14450 | train | Gets the replica info list for a partition. | [
30522,
13366,
2131,
1035,
15059,
1035,
18558,
1035,
2862,
1006,
13571,
1035,
8909,
1010,
13633,
1035,
19204,
1024,
9152,
2140,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
1505... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/sprockets | lib/sprockets/utils.rb | Sprockets.Utils.dfs | def dfs(initial)
nodes, seen = Set.new, Set.new
stack = Array(initial).reverse
while node = stack.pop
if seen.include?(node)
nodes.add(node)
else
seen.add(node)
stack.push(node)
stack.concat(Array(yield node).reverse)
end
end
nodes
end | ruby | def dfs(initial)
nodes, seen = Set.new, Set.new
stack = Array(initial).reverse
while node = stack.pop
if seen.include?(node)
nodes.add(node)
else
seen.add(node)
stack.push(node)
stack.concat(Array(yield node).reverse)
end
end
nodes
end | [
"def",
"dfs",
"(",
"initial",
")",
"nodes",
",",
"seen",
"=",
"Set",
".",
"new",
",",
"Set",
".",
"new",
"stack",
"=",
"Array",
"(",
"initial",
")",
".",
"reverse",
"while",
"node",
"=",
"stack",
".",
"pop",
"if",
"seen",
".",
"include?",
"(",
"n... | Internal: Post-order Depth-First search algorithm.
Used for resolving asset dependencies.
initial - Initial Array of nodes to traverse.
block -
node - Current node to get children of
Returns a Set of nodes. | [
"Internal",
":",
"Post",
"-",
"order",
"Depth",
"-",
"First",
"search",
"algorithm",
"."
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/utils.rb#L157-L172 | train | Return a new set of nodes with the same name as the given initial. | [
30522,
13366,
1040,
10343,
1006,
3988,
1007,
14164,
1010,
2464,
1027,
2275,
1012,
2047,
1010,
2275,
1012,
2047,
9991,
1027,
9140,
1006,
3988,
1007,
1012,
7901,
2096,
13045,
1027,
9991,
1012,
3769,
2065,
2464,
1012,
2421,
1029,
1006,
13045,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
norman/friendly_id | lib/friendly_id/slugged.rb | FriendlyId.Slugged.normalize_friendly_id | def normalize_friendly_id(value)
value = value.to_s.parameterize
value = value[0...friendly_id_config.slug_limit] if friendly_id_config.slug_limit
value
end | ruby | def normalize_friendly_id(value)
value = value.to_s.parameterize
value = value[0...friendly_id_config.slug_limit] if friendly_id_config.slug_limit
value
end | [
"def",
"normalize_friendly_id",
"(",
"value",
")",
"value",
"=",
"value",
".",
"to_s",
".",
"parameterize",
"value",
"=",
"value",
"[",
"0",
"...",
"friendly_id_config",
".",
"slug_limit",
"]",
"if",
"friendly_id_config",
".",
"slug_limit",
"value",
"end"
] | Process the given value to make it suitable for use as a slug.
This method is not intended to be invoked directly; FriendlyId uses it
internally to process strings into slugs.
However, if FriendlyId's default slug generation doesn't suit your needs,
you can override this method in your model class to control exactly how
slugs are generated.
### Example
class Person < ActiveRecord::Base
extend FriendlyId
friendly_id :name_and_location
def name_and_location
"#{name} from #{location}"
end
# Use default slug, but upper case and with underscores
def normalize_friendly_id(string)
super.upcase.gsub("-", "_")
end
end
bob = Person.create! :name => "Bob Smith", :location => "New York City"
bob.friendly_id #=> "BOB_SMITH_FROM_NEW_YORK_CITY"
### More Resources
You might want to look into Babosa[https://github.com/norman/babosa],
which is the slugging library used by FriendlyId prior to version 4, which
offers some specialized functionality missing from Active Support.
@param [#to_s] value The value used as the basis of the slug.
@return The candidate slug text, without a sequence. | [
"Process",
"the",
"given",
"value",
"to",
"make",
"it",
"suitable",
"for",
"use",
"as",
"a",
"slug",
"."
] | 67422c04e1bfed4207b2a04826bc67ec0e231ce7 | https://github.com/norman/friendly_id/blob/67422c04e1bfed4207b2a04826bc67ec0e231ce7/lib/friendly_id/slugged.rb#L290-L294 | train | Normalize the value to a string. | [
30522,
13366,
3671,
4697,
1035,
5379,
1035,
8909,
1006,
3643,
1007,
3643,
1027,
3643,
1012,
2000,
1035,
1055,
1012,
16381,
4697,
3643,
1027,
3643,
1031,
1014,
1012,
1012,
1012,
5379,
1035,
8909,
1035,
9530,
8873,
2290,
1012,
23667,
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_resources/lib/2016-02-01/generated/azure_mgmt_resources/resources.rb | Azure::Resources::Mgmt::V2016_02_01.Resources.begin_update_with_http_info | def begin_update_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:nil)
begin_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:custom_headers).value!
end | ruby | def begin_update_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:nil)
begin_update_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_update_with_http_info",
"(",
"resource_group_name",
",",
"resource_provider_namespace",
",",
"parent_resource_path",
",",
"resource_type",
",",
"resource_name",
",",
"api_version",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_update_async"... | Updates a resource.
@param resource_group_name [String] The name of the resource group for the
resource. The name is case insensitive.
@param resource_provider_namespace [String] The namespace of the resource
provider.
@param parent_resource_path [String] The parent resource identity.
@param resource_type [String] The resource type of the resource to update.
@param resource_name [String] The name of the resource to update.
@param api_version [String] The API version to use for the operation.
@param parameters [GenericResource] Parameters for updating the resource.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Updates",
"a",
"resource",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_resources/lib/2016-02-01/generated/azure_mgmt_resources/resources.rb#L805-L807 | train | Updates a resource in the specified resource group. | [
30522,
13366,
4088,
1035,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7692,
1035,
10802,
1035,
3415,
15327,
1010,
6687,
1035,
7692,
1035,
4130,
1010,
7692,
1035,
2828,
1010,
7692,
1035,
2171,
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... |
fastlane/fastlane | frameit/lib/frameit/editor.rb | Frameit.Editor.generate_background | def generate_background
background = MiniMagick::Image.open(fetch_config['background'])
if background.height != screenshot.size[1]
background.resize("#{screenshot.size[0]}x#{screenshot.size[1]}^") # `^` says it should fill area
background.merge!(["-gravity", "center", "-crop", "#{screenshot.size[0]}x#{screenshot.size[1]}+0+0"]) # crop from center
end
background
end | ruby | def generate_background
background = MiniMagick::Image.open(fetch_config['background'])
if background.height != screenshot.size[1]
background.resize("#{screenshot.size[0]}x#{screenshot.size[1]}^") # `^` says it should fill area
background.merge!(["-gravity", "center", "-crop", "#{screenshot.size[0]}x#{screenshot.size[1]}+0+0"]) # crop from center
end
background
end | [
"def",
"generate_background",
"background",
"=",
"MiniMagick",
"::",
"Image",
".",
"open",
"(",
"fetch_config",
"[",
"'background'",
"]",
")",
"if",
"background",
".",
"height",
"!=",
"screenshot",
".",
"size",
"[",
"1",
"]",
"background",
".",
"resize",
"("... | Returns a correctly sized background image | [
"Returns",
"a",
"correctly",
"sized",
"background",
"image"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/frameit/lib/frameit/editor.rb#L251-L259 | train | Generate the background image for the image | [
30522,
13366,
9699,
1035,
4281,
4281,
1027,
7163,
2863,
12863,
2243,
1024,
1024,
3746,
1012,
2330,
1006,
18584,
1035,
9530,
8873,
2290,
1031,
1005,
4281,
1005,
1033,
1007,
2065,
4281,
1012,
4578,
999,
1027,
12117,
12326,
1012,
2946,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_customvisiontraining/lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb | Azure::CognitiveServices::Customvisiontraining::V3_0.CustomvisiontrainingClient.get_tagged_image_count | def get_tagged_image_count(project_id, iteration_id:nil, tag_ids:nil, custom_headers:nil)
response = get_tagged_image_count_async(project_id, iteration_id:iteration_id, tag_ids:tag_ids, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_tagged_image_count(project_id, iteration_id:nil, tag_ids:nil, custom_headers:nil)
response = get_tagged_image_count_async(project_id, iteration_id:iteration_id, tag_ids:tag_ids, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_tagged_image_count",
"(",
"project_id",
",",
"iteration_id",
":",
"nil",
",",
"tag_ids",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_tagged_image_count_async",
"(",
"project_id",
",",
"iteration_id",
":iteration_id",
",",
... | Gets the number of images tagged with the provided {tagIds}.
The filtering is on an and/or relationship. For example, if the provided tag
ids are for the "Dog" and
"Cat" tags, then only images tagged with Dog and/or Cat will be returned
@param project_id The project id.
@param iteration_id The iteration id. Defaults to workspace.
@param tag_ids A list of tags ids to filter the images to count. Defaults to
all tags when null.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Number] operation results. | [
"Gets",
"the",
"number",
"of",
"images",
"tagged",
"with",
"the",
"provided",
"{",
"tagIds",
"}",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_customvisiontraining/lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb#L319-L322 | train | Gets the number of images tagged by a given project iteration. | [
30522,
13366,
2131,
1035,
26610,
1035,
3746,
1035,
4175,
1006,
2622,
1035,
8909,
1010,
27758,
1035,
8909,
1024,
9152,
2140,
1010,
6415,
1035,
8909,
2015,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
bblimke/webmock | lib/webmock/request_pattern.rb | WebMock.BodyPattern.matching_body_hashes? | def matching_body_hashes?(query_parameters, pattern, content_type)
return false unless query_parameters.is_a?(Hash)
return false unless query_parameters.keys.sort == pattern.keys.sort
query_parameters.each do |key, actual|
expected = pattern[key]
if actual.is_a?(Hash) && expected.is_a?(Hash)
return false unless matching_body_hashes?(actual, expected, content_type)
else
expected = WebMock::Util::ValuesStringifier.stringify_values(expected) if url_encoded_body?(content_type)
return false unless expected === actual
end
end
true
end | ruby | def matching_body_hashes?(query_parameters, pattern, content_type)
return false unless query_parameters.is_a?(Hash)
return false unless query_parameters.keys.sort == pattern.keys.sort
query_parameters.each do |key, actual|
expected = pattern[key]
if actual.is_a?(Hash) && expected.is_a?(Hash)
return false unless matching_body_hashes?(actual, expected, content_type)
else
expected = WebMock::Util::ValuesStringifier.stringify_values(expected) if url_encoded_body?(content_type)
return false unless expected === actual
end
end
true
end | [
"def",
"matching_body_hashes?",
"(",
"query_parameters",
",",
"pattern",
",",
"content_type",
")",
"return",
"false",
"unless",
"query_parameters",
".",
"is_a?",
"(",
"Hash",
")",
"return",
"false",
"unless",
"query_parameters",
".",
"keys",
".",
"sort",
"==",
"... | Compare two hashes for equality
For two hashes to match they must have the same length and all
values must match when compared using `#===`.
The following hashes are examples of matches:
{a: /\d+/} and {a: '123'}
{a: '123'} and {a: '123'}
{a: {b: /\d+/}} and {a: {b: '123'}}
{a: {b: 'wow'}} and {a: {b: 'wow'}}
@param [Hash] query_parameters typically the result of parsing
JSON, XML or URL encoded parameters.
@param [Hash] pattern which contains keys with a string, hash or
regular expression value to use for comparison.
@return [Boolean] true if the paramaters match the comparison
hash, false if not. | [
"Compare",
"two",
"hashes",
"for",
"equality"
] | c0bcc09af372286cd110ec4159112ce583007951 | https://github.com/bblimke/webmock/blob/c0bcc09af372286cd110ec4159112ce583007951/lib/webmock/request_pattern.rb#L310-L324 | train | Returns true if the query parameters match the pattern. | [
30522,
13366,
9844,
1035,
2303,
1035,
23325,
2229,
1029,
1006,
23032,
1035,
11709,
1010,
5418,
1010,
4180,
1035,
2828,
1007,
2709,
6270,
4983,
23032,
1035,
11709,
1012,
2003,
1035,
1037,
1029,
1006,
23325,
1007,
2709,
6270,
4983,
23032,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/haml-lint | lib/haml_lint/linter.rb | HamlLint.Linter.inline_content_is_string? | def inline_content_is_string?(node)
tag_with_inline_content = tag_with_inline_text(node)
inline_content = inline_node_content(node)
index = tag_with_inline_content.rindex(inline_content) - 1
%w[' "].include?(tag_with_inline_content[index])
end | ruby | def inline_content_is_string?(node)
tag_with_inline_content = tag_with_inline_text(node)
inline_content = inline_node_content(node)
index = tag_with_inline_content.rindex(inline_content) - 1
%w[' "].include?(tag_with_inline_content[index])
end | [
"def",
"inline_content_is_string?",
"(",
"node",
")",
"tag_with_inline_content",
"=",
"tag_with_inline_text",
"(",
"node",
")",
"inline_content",
"=",
"inline_node_content",
"(",
"node",
")",
"index",
"=",
"tag_with_inline_content",
".",
"rindex",
"(",
"inline_content",... | Returns whether the inline content for a node is a string.
For example, the following node has a literal string:
%tag= "A literal #{string}"
whereas this one does not:
%tag A literal #{string}
@param node [HamlLint::Tree::Node]
@return [true,false] | [
"Returns",
"whether",
"the",
"inline",
"content",
"for",
"a",
"node",
"is",
"a",
"string",
"."
] | 024c773667e54cf88db938c2b368977005d70ee8 | https://github.com/sds/haml-lint/blob/024c773667e54cf88db938c2b368977005d70ee8/lib/haml_lint/linter.rb#L118-L125 | train | Returns true if the inline content of the node is a string. | [
30522,
13366,
23881,
1035,
4180,
1035,
2003,
1035,
5164,
1029,
1006,
13045,
1007,
6415,
1035,
2007,
1035,
23881,
1035,
4180,
1027,
6415,
1035,
2007,
1035,
23881,
1035,
3793,
1006,
13045,
1007,
23881,
1035,
4180,
1027,
23881,
1035,
13045,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.