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_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/devices.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.Devices.begin_scan_for_updates_with_http_info | def begin_scan_for_updates_with_http_info(device_name, resource_group_name, manager_name, custom_headers:nil)
begin_scan_for_updates_async(device_name, resource_group_name, manager_name, custom_headers:custom_headers).value!
end | ruby | def begin_scan_for_updates_with_http_info(device_name, resource_group_name, manager_name, custom_headers:nil)
begin_scan_for_updates_async(device_name, resource_group_name, manager_name, custom_headers:custom_headers).value!
end | [
"def",
"begin_scan_for_updates_with_http_info",
"(",
"device_name",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"begin_scan_for_updates_async",
"(",
"device_name",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_hea... | Scans for updates on the device.
@param device_name [String] The device name
@param resource_group_name [String] The resource group name
@param manager_name [String] The manager name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Scans",
"for",
"updates",
"on",
"the",
"device",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/devices.rb#L1592-L1594 | train | Gets the list of documents that are currently being updated. | [
30522,
13366,
4088,
1035,
13594,
1035,
2005,
1035,
14409,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
5080,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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.update_secret_with_http_info | def update_secret_with_http_info(vault_base_url, secret_name, secret_version, content_type:nil, secret_attributes:nil, tags:nil, custom_headers:nil)
update_secret_async(vault_base_url, secret_name, secret_version, content_type:content_type, secret_attributes:secret_attributes, tags:tags, custom_headers:custom_headers).value!
end | ruby | def update_secret_with_http_info(vault_base_url, secret_name, secret_version, content_type:nil, secret_attributes:nil, tags:nil, custom_headers:nil)
update_secret_async(vault_base_url, secret_name, secret_version, content_type:content_type, secret_attributes:secret_attributes, tags:tags, custom_headers:custom_headers).value!
end | [
"def",
"update_secret_with_http_info",
"(",
"vault_base_url",
",",
"secret_name",
",",
"secret_version",
",",
"content_type",
":",
"nil",
",",
"secret_attributes",
":",
"nil",
",",
"tags",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"update_secret_async",
... | Updates the attributes associated with a specified secret in a given key
vault.
The UPDATE operation changes specified attributes of an existing stored
secret. Attributes that are not specified in the request are left unchanged.
The value of a secret itself cannot be changed. This operation requires the
secrets/set permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param secret_name [String] The name of the secret.
@param secret_version [String] The version of the secret.
@param content_type [String] Type of the secret value such as a password.
@param secret_attributes [SecretAttributes] The secret management attributes.
@param tags [Hash{String => String}] Application specific metadata in the
form of key-value pairs.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Updates",
"the",
"attributes",
"associated",
"with",
"a",
"specified",
"secret",
"in",
"a",
"given",
"key",
"vault",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb#L2939-L2941 | train | Updates a secret. | [
30522,
13366,
10651,
1035,
3595,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
3595,
1035,
2171,
1010,
3595,
1035,
2544,
1010,
4180,
1035,
2828,
1024,
9152,
2140,
1010,
3595,
1035,
12332,
1024,
9152,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-iam/lib/aws-sdk-iam/policy.rb | Aws::IAM.Policy.detach_group | def detach_group(options = {})
options = options.merge(policy_arn: @arn)
resp = @client.detach_group_policy(options)
resp.data
end | ruby | def detach_group(options = {})
options = options.merge(policy_arn: @arn)
resp = @client.detach_group_policy(options)
resp.data
end | [
"def",
"detach_group",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"policy_arn",
":",
"@arn",
")",
"resp",
"=",
"@client",
".",
"detach_group_policy",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
policy.detach_group({
group_name: "groupNameType", # required
})
@param [Hash] options ({})
@option options [required, String] :group_name
The name (friendly name, not ARN) of the IAM group to detach the
policy from.
This parameter allows (through its [regex pattern][1]) a string of
characters consisting of upper and lowercase alphanumeric characters
with no spaces. You can also include any of the following characters:
\_+=,.@-
[1]: http://wikipedia.org/wiki/regex
@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/policy.rb#L423-L427 | train | Detaches the policy from the group | [
30522,
13366,
20010,
6776,
1035,
2177,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
3343,
1035,
12098,
2078,
1024,
1030,
12098,
2078,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
20010,
6776,
1035,
2177,
1035,
3343... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/network_watchers.rb | Azure::Network::Mgmt::V2018_08_01.NetworkWatchers.get_next_hop_async | def get_next_hop_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
# Send request
promise = begin_get_next_hop_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Network::Mgmt::V2018_08_01::Models::NextHopResult.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | ruby | def get_next_hop_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
# Send request
promise = begin_get_next_hop_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Network::Mgmt::V2018_08_01::Models::NextHopResult.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | [
"def",
"get_next_hop_async",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_get_next_hop_async",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"pa... | @param resource_group_name [String] The name of the resource group.
@param network_watcher_name [String] The name of the network watcher.
@param parameters [NextHopParameters] Parameters that define the source and
destination endpoint.
@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",
".",
"@param",
"network_watcher_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"network",
"watcher",
".",
"@param",
"parameters",
"[",
"NextHopParameter... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/network_watchers.rb#L729-L745 | train | Gets the next hop for a specified resource group. | [
30522,
13366,
2131,
1035,
2279,
1035,
6154,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2897,
1035,
3422,
2121,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/hybrid_runbook_worker_group_operations.rb | Azure::Automation::Mgmt::V2015_10_31.HybridRunbookWorkerGroupOperations.delete | def delete(resource_group_name, automation_account_name, hybrid_runbook_worker_group_name, custom_headers:nil)
response = delete_async(resource_group_name, automation_account_name, hybrid_runbook_worker_group_name, custom_headers:custom_headers).value!
nil
end | ruby | def delete(resource_group_name, automation_account_name, hybrid_runbook_worker_group_name, custom_headers:nil)
response = delete_async(resource_group_name, automation_account_name, hybrid_runbook_worker_group_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"delete",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"hybrid_runbook_worker_group_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_async",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"hybrid_runbook_wo... | Delete a hybrid runbook worker group.
@param resource_group_name [String] Name of an Azure Resource group.
@param automation_account_name [String] The name of the automation account.
@param hybrid_runbook_worker_group_name [String] The hybrid runbook worker
group name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Delete",
"a",
"hybrid",
"runbook",
"worker",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/hybrid_runbook_worker_group_operations.rb#L35-L38 | train | Deletes a hybrid runbook worker group. | [
30522,
13366,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
19309,
1035,
4070,
1035,
2171,
1010,
8893,
1035,
2448,
8654,
1035,
7309,
1035,
2177,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/models/order_fulfillment_pickup_details.rb | SquareConnect.OrderFulfillmentPickupDetails.cancel_reason= | def cancel_reason=(cancel_reason)
if !cancel_reason.nil? && cancel_reason.to_s.length > 100
fail ArgumentError, "invalid value for 'cancel_reason', the character length must be smaller than or equal to 100."
end
@cancel_reason = cancel_reason
end | ruby | def cancel_reason=(cancel_reason)
if !cancel_reason.nil? && cancel_reason.to_s.length > 100
fail ArgumentError, "invalid value for 'cancel_reason', the character length must be smaller than or equal to 100."
end
@cancel_reason = cancel_reason
end | [
"def",
"cancel_reason",
"=",
"(",
"cancel_reason",
")",
"if",
"!",
"cancel_reason",
".",
"nil?",
"&&",
"cancel_reason",
".",
"to_s",
".",
"length",
">",
"100",
"fail",
"ArgumentError",
",",
"\"invalid value for 'cancel_reason', the character length must be smaller than or... | Custom attribute writer method with validation
@param [Object] cancel_reason Value to be assigned | [
"Custom",
"attribute",
"writer",
"method",
"with",
"validation"
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/models/order_fulfillment_pickup_details.rb#L251-L258 | train | Set the cancel reason for this session. | [
30522,
13366,
17542,
1035,
3114,
1027,
1006,
17542,
1035,
3114,
1007,
2065,
999,
17542,
1035,
3114,
1012,
9152,
2140,
1029,
1004,
1004,
17542,
1035,
3114,
1012,
2000,
1035,
1055,
1012,
3091,
1028,
2531,
8246,
6685,
2121,
29165,
1010,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_scheduler/lib/2016-03-01/generated/azure_mgmt_scheduler/jobs.rb | Azure::Scheduler::Mgmt::V2016_03_01.Jobs.create_or_update | def create_or_update(resource_group_name, job_collection_name, job_name, job, custom_headers:nil)
response = create_or_update_async(resource_group_name, job_collection_name, job_name, job, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_or_update(resource_group_name, job_collection_name, job_name, job, custom_headers:nil)
response = create_or_update_async(resource_group_name, job_collection_name, job_name, job, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_or_update",
"(",
"resource_group_name",
",",
"job_collection_name",
",",
"job_name",
",",
"job",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_or_update_async",
"(",
"resource_group_name",
",",
"job_collection_name",
",",
"job_name",
... | Provisions a new job or updates an existing job.
@param resource_group_name [String] The resource group name.
@param job_collection_name [String] The job collection name.
@param job_name [String] The job name.
@param job [JobDefinition] The job definition.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [JobDefinition] operation results. | [
"Provisions",
"a",
"new",
"job",
"or",
"updates",
"an",
"existing",
"job",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_scheduler/lib/2016-03-01/generated/azure_mgmt_scheduler/jobs.rb#L132-L135 | train | Creates or updates a job in the specified job collection. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3105,
1035,
3074,
1035,
2171,
1010,
3105,
1035,
2171,
1010,
3105,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3443,
1035,
2030,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
randym/axlsx | lib/axlsx/stylesheet/gradient_fill.rb | Axlsx.GradientFill.validate_format_percentage | def validate_format_percentage(name, value)
DataTypeValidator.validate name, Float, value, lambda { |arg| arg >= 0.0 && arg <= 1.0}
end | ruby | def validate_format_percentage(name, value)
DataTypeValidator.validate name, Float, value, lambda { |arg| arg >= 0.0 && arg <= 1.0}
end | [
"def",
"validate_format_percentage",
"(",
"name",
",",
"value",
")",
"DataTypeValidator",
".",
"validate",
"name",
",",
"Float",
",",
"value",
",",
"lambda",
"{",
"|",
"arg",
"|",
"arg",
">=",
"0.0",
"&&",
"arg",
"<=",
"1.0",
"}",
"end"
] | validates that the value provided is between 0.0 and 1.0 | [
"validates",
"that",
"the",
"value",
"provided",
"is",
"between",
"0",
".",
"0",
"and",
"1",
".",
"0"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/stylesheet/gradient_fill.rb#L88-L90 | train | Validate the format percentage value | [
30522,
13366,
9398,
3686,
1035,
4289,
1035,
7017,
1006,
2171,
1010,
3643,
1007,
2951,
13874,
10175,
8524,
4263,
1012,
9398,
3686,
2171,
1010,
14257,
1010,
3643,
1010,
23375,
1063,
1064,
12098,
2290,
1064,
12098,
2290,
1028,
1027,
1014,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
etewiah/property_web_builder | app/controllers/pwb/search_controller.rb | Pwb.SearchController.rent | def rent
@page = Pwb::Page.find_by_slug "rent"
@page_title = @current_agency.company_name
# @content_to_show = []
if @page.present?
@page_title = @page.page_title + ' - ' + @current_agency.company_name
# TODO: - allow addition of custom content
# @page.ordered_visible_page_contents.each do |page_content|
# @content_to_show.push page_content.content.raw
# end
end
# @page_title = I18n.t("searchForProperties")
# in erb template for this action, I have js that will render search_results template
# for properties - like search_ajax action does
@operation_type = "for_rent"
# above used to decide if link to result should be to buy or rent path
@properties = Prop.visible.for_rent.limit 45
# .order('price_rental_monthly_current_cents ASC').limit 35
@prices_from_collection = @current_website.rent_price_options_from
@prices_till_collection = @current_website.rent_price_options_till
# @prices_collection = %W(#{''}
# 150 250 500 1,000 1,500 2,000 2,500 3,000 4,000 5,000 10,000)
set_common_search_inputs
set_select_picker_texts
apply_search_filter filtering_params(params)
set_map_markers
@search_defaults = params[:search].present? ? params[:search] : {}
js 'Main/Search#sort' # trigger client-side paloma script
render "/pwb/search/rent"
end | ruby | def rent
@page = Pwb::Page.find_by_slug "rent"
@page_title = @current_agency.company_name
# @content_to_show = []
if @page.present?
@page_title = @page.page_title + ' - ' + @current_agency.company_name
# TODO: - allow addition of custom content
# @page.ordered_visible_page_contents.each do |page_content|
# @content_to_show.push page_content.content.raw
# end
end
# @page_title = I18n.t("searchForProperties")
# in erb template for this action, I have js that will render search_results template
# for properties - like search_ajax action does
@operation_type = "for_rent"
# above used to decide if link to result should be to buy or rent path
@properties = Prop.visible.for_rent.limit 45
# .order('price_rental_monthly_current_cents ASC').limit 35
@prices_from_collection = @current_website.rent_price_options_from
@prices_till_collection = @current_website.rent_price_options_till
# @prices_collection = %W(#{''}
# 150 250 500 1,000 1,500 2,000 2,500 3,000 4,000 5,000 10,000)
set_common_search_inputs
set_select_picker_texts
apply_search_filter filtering_params(params)
set_map_markers
@search_defaults = params[:search].present? ? params[:search] : {}
js 'Main/Search#sort' # trigger client-side paloma script
render "/pwb/search/rent"
end | [
"def",
"rent",
"@page",
"=",
"Pwb",
"::",
"Page",
".",
"find_by_slug",
"\"rent\"",
"@page_title",
"=",
"@current_agency",
".",
"company_name",
"# @content_to_show = []",
"if",
"@page",
".",
"present?",
"@page_title",
"=",
"@page",
".",
"page_title",
"+",
"' - '",
... | TODO: - avoid duplication b/n rent and buy | [
"TODO",
":",
"-",
"avoid",
"duplication",
"b",
"/",
"n",
"rent",
"and",
"buy"
] | fba4e6d4ffa7bc1f4d3b50dfa5a6a9fbfee23f21 | https://github.com/etewiah/property_web_builder/blob/fba4e6d4ffa7bc1f4d3b50dfa5a6a9fbfee23f21/app/controllers/pwb/search_controller.rb#L78-L111 | train | Returns the result of the search | [
30522,
13366,
9278,
1030,
3931,
1027,
1052,
2860,
2497,
1024,
1024,
3931,
1012,
2424,
1035,
2011,
1035,
23667,
1000,
9278,
1000,
1030,
3931,
1035,
2516,
1027,
1030,
2783,
1035,
4034,
1012,
2194,
1035,
2171,
1001,
1030,
4180,
1035,
2000,
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... |
colszowka/simplecov | lib/simplecov/configuration.rb | SimpleCov.Configuration.parse_filter | def parse_filter(filter_argument = nil, &filter_proc)
filter = filter_argument || filter_proc
if filter
SimpleCov::Filter.build_filter(filter)
else
raise ArgumentError, "Please specify either a filter or a block to filter with"
end
end | ruby | def parse_filter(filter_argument = nil, &filter_proc)
filter = filter_argument || filter_proc
if filter
SimpleCov::Filter.build_filter(filter)
else
raise ArgumentError, "Please specify either a filter or a block to filter with"
end
end | [
"def",
"parse_filter",
"(",
"filter_argument",
"=",
"nil",
",",
"&",
"filter_proc",
")",
"filter",
"=",
"filter_argument",
"||",
"filter_proc",
"if",
"filter",
"SimpleCov",
"::",
"Filter",
".",
"build_filter",
"(",
"filter",
")",
"else",
"raise",
"ArgumentError"... | The actual filter processor. Not meant for direct use | [
"The",
"actual",
"filter",
"processor",
".",
"Not",
"meant",
"for",
"direct",
"use"
] | 8f6978a2513f10c4dd8d7dd7eed666fe3f2b55c2 | https://github.com/colszowka/simplecov/blob/8f6978a2513f10c4dd8d7dd7eed666fe3f2b55c2/lib/simplecov/configuration.rb#L295-L303 | train | Parse a filter | [
30522,
13366,
11968,
3366,
1035,
11307,
1006,
11307,
1035,
6685,
1027,
9152,
2140,
1010,
1004,
11307,
1035,
4013,
2278,
1007,
11307,
1027,
11307,
1035,
6685,
1064,
1064,
11307,
1035,
4013,
2278,
2065,
11307,
3722,
3597,
2615,
1024,
1024,
11... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hanami/hanami | lib/hanami/app.rb | Hanami.App.middleware | def middleware(configuration, environment)
builder.use Hanami::CommonLogger, Hanami.logger unless Hanami.logger.nil?
builder.use Rack::ContentLength
configuration.middleware.each do |m, args, blk|
builder.use(m, *args, &blk)
end
if configuration.early_hints
require 'hanami/early_hints'
builder.use Hanami::EarlyHints
end
if middleware = environment.static_assets_middleware # rubocop:disable Lint/AssignmentInCondition
builder.use middleware
end
builder.use Rack::MethodOverride
end | ruby | def middleware(configuration, environment)
builder.use Hanami::CommonLogger, Hanami.logger unless Hanami.logger.nil?
builder.use Rack::ContentLength
configuration.middleware.each do |m, args, blk|
builder.use(m, *args, &blk)
end
if configuration.early_hints
require 'hanami/early_hints'
builder.use Hanami::EarlyHints
end
if middleware = environment.static_assets_middleware # rubocop:disable Lint/AssignmentInCondition
builder.use middleware
end
builder.use Rack::MethodOverride
end | [
"def",
"middleware",
"(",
"configuration",
",",
"environment",
")",
"builder",
".",
"use",
"Hanami",
"::",
"CommonLogger",
",",
"Hanami",
".",
"logger",
"unless",
"Hanami",
".",
"logger",
".",
"nil?",
"builder",
".",
"use",
"Rack",
"::",
"ContentLength",
"co... | @since 0.9.0
@api private
rubocop:disable Metrics/AbcSize
rubocop:disable Metrics/MethodLength | [
"@since",
"0",
".",
"9",
".",
"0",
"@api",
"private"
] | 8c6e5147e92ef869b25379448572da3698eacfdc | https://github.com/hanami/hanami/blob/8c6e5147e92ef869b25379448572da3698eacfdc/lib/hanami/app.rb#L74-L92 | train | Create a new middleware instance. | [
30522,
13366,
2690,
8059,
1006,
9563,
1010,
4044,
1007,
12508,
1012,
2224,
26048,
4328,
1024,
1024,
2691,
21197,
4590,
1010,
26048,
4328,
1012,
8833,
4590,
4983,
26048,
4328,
1012,
8833,
4590,
1012,
9152,
2140,
1029,
12508,
1012,
2224,
1451... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/sprockets | lib/sprockets/directive_processor.rb | Sprockets.DirectiveProcessor.compile_header_pattern | def compile_header_pattern(comments)
re = comments.map { |c|
case c
when String
"(?:#{Regexp.escape(c)}.*\\n?)+"
when Array
"(?:#{Regexp.escape(c[0])}(?m:.*?)#{Regexp.escape(c[1])})"
else
raise TypeError, "unknown comment type: #{c.class}"
end
}.join("|")
Regexp.compile("\\A(?:(?m:\\s*)(?:#{re}))+")
end | ruby | def compile_header_pattern(comments)
re = comments.map { |c|
case c
when String
"(?:#{Regexp.escape(c)}.*\\n?)+"
when Array
"(?:#{Regexp.escape(c[0])}(?m:.*?)#{Regexp.escape(c[1])})"
else
raise TypeError, "unknown comment type: #{c.class}"
end
}.join("|")
Regexp.compile("\\A(?:(?m:\\s*)(?:#{re}))+")
end | [
"def",
"compile_header_pattern",
"(",
"comments",
")",
"re",
"=",
"comments",
".",
"map",
"{",
"|",
"c",
"|",
"case",
"c",
"when",
"String",
"\"(?:#{Regexp.escape(c)}.*\\\\n?)+\"",
"when",
"Array",
"\"(?:#{Regexp.escape(c[0])}(?m:.*?)#{Regexp.escape(c[1])})\"",
"else",
... | Directives will only be picked up if they are in the header
of the source file. C style (/* */), JavaScript (//), and
Ruby (#) comments are supported.
Directives in comments after the first non-whitespace line
of code will not be processed. | [
"Directives",
"will",
"only",
"be",
"picked",
"up",
"if",
"they",
"are",
"in",
"the",
"header",
"of",
"the",
"source",
"file",
".",
"C",
"style",
"(",
"/",
"*",
"*",
"/",
")",
"JavaScript",
"(",
"//",
")",
"and",
"Ruby",
"(",
"#",
")",
"comments",
... | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/directive_processor.rb#L104-L116 | train | compile header pattern | [
30522,
13366,
4012,
22090,
1035,
20346,
1035,
5418,
1006,
7928,
1007,
2128,
1027,
7928,
1012,
4949,
1063,
1064,
1039,
1064,
2553,
1039,
2043,
5164,
1000,
1006,
1029,
1024,
1001,
1063,
19723,
10288,
2361,
1012,
4019,
1006,
1039,
1007,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
zendesk/ruby-kafka | lib/kafka/client.rb | Kafka.Client.deliver_message | def deliver_message(value, key: nil, headers: {}, topic:, partition: nil, partition_key: nil, retries: 1)
create_time = Time.now
message = PendingMessage.new(
value: value,
key: key,
headers: headers,
topic: topic,
partition: partition,
partition_key: partition_key,
create_time: create_time
)
if partition.nil?
partition_count = @cluster.partitions_for(topic).count
partition = Partitioner.partition_for_key(partition_count, message)
end
buffer = MessageBuffer.new
buffer.write(
value: message.value,
key: message.key,
headers: message.headers,
topic: message.topic,
partition: partition,
create_time: message.create_time,
)
@cluster.add_target_topics([topic])
compressor = Compressor.new(
instrumenter: @instrumenter,
)
transaction_manager = TransactionManager.new(
cluster: @cluster,
logger: @logger,
idempotent: false,
transactional: false
)
operation = ProduceOperation.new(
cluster: @cluster,
transaction_manager: transaction_manager,
buffer: buffer,
required_acks: 1,
ack_timeout: 10,
compressor: compressor,
logger: @logger,
instrumenter: @instrumenter,
)
attempt = 1
begin
operation.execute
unless buffer.empty?
raise DeliveryFailed.new(nil, [message])
end
rescue Kafka::Error => e
@cluster.mark_as_stale!
if attempt >= (retries + 1)
raise
else
attempt += 1
@logger.warn "Error while delivering message, #{e.class}: #{e.message}; retrying after 1s..."
sleep 1
retry
end
end
end | ruby | def deliver_message(value, key: nil, headers: {}, topic:, partition: nil, partition_key: nil, retries: 1)
create_time = Time.now
message = PendingMessage.new(
value: value,
key: key,
headers: headers,
topic: topic,
partition: partition,
partition_key: partition_key,
create_time: create_time
)
if partition.nil?
partition_count = @cluster.partitions_for(topic).count
partition = Partitioner.partition_for_key(partition_count, message)
end
buffer = MessageBuffer.new
buffer.write(
value: message.value,
key: message.key,
headers: message.headers,
topic: message.topic,
partition: partition,
create_time: message.create_time,
)
@cluster.add_target_topics([topic])
compressor = Compressor.new(
instrumenter: @instrumenter,
)
transaction_manager = TransactionManager.new(
cluster: @cluster,
logger: @logger,
idempotent: false,
transactional: false
)
operation = ProduceOperation.new(
cluster: @cluster,
transaction_manager: transaction_manager,
buffer: buffer,
required_acks: 1,
ack_timeout: 10,
compressor: compressor,
logger: @logger,
instrumenter: @instrumenter,
)
attempt = 1
begin
operation.execute
unless buffer.empty?
raise DeliveryFailed.new(nil, [message])
end
rescue Kafka::Error => e
@cluster.mark_as_stale!
if attempt >= (retries + 1)
raise
else
attempt += 1
@logger.warn "Error while delivering message, #{e.class}: #{e.message}; retrying after 1s..."
sleep 1
retry
end
end
end | [
"def",
"deliver_message",
"(",
"value",
",",
"key",
":",
"nil",
",",
"headers",
":",
"{",
"}",
",",
"topic",
":",
",",
"partition",
":",
"nil",
",",
"partition_key",
":",
"nil",
",",
"retries",
":",
"1",
")",
"create_time",
"=",
"Time",
".",
"now",
... | Initializes a new Kafka client.
@param seed_brokers [Array<String>, String] the list of brokers used to initialize
the client. Either an Array of connections, or a comma separated string of connections.
A connection can either be a string of "host:port" or a full URI with a scheme.
If there's a scheme it's ignored and only host/port are used.
@param client_id [String] the identifier for this application.
@param logger [Logger] the logger that should be used by the client.
@param connect_timeout [Integer, nil] the timeout setting for connecting
to brokers. See {BrokerPool#initialize}.
@param socket_timeout [Integer, nil] the timeout setting for socket
connections. See {BrokerPool#initialize}.
@param ssl_ca_cert [String, Array<String>, nil] a PEM encoded CA cert, or an Array of
PEM encoded CA certs, to use with an SSL connection.
@param ssl_ca_cert_file_path [String, nil] a path on the filesystem to a PEM encoded CA cert
to use with an SSL connection.
@param ssl_client_cert [String, nil] a PEM encoded client cert to use with an
SSL connection. Must be used in combination with ssl_client_cert_key.
@param ssl_client_cert_key [String, nil] a PEM encoded client cert key to use with an
SSL connection. Must be used in combination with ssl_client_cert.
@param ssl_client_cert_key_password [String, nil] the password required to read the
ssl_client_cert_key. Must be used in combination with ssl_client_cert_key.
@param sasl_gssapi_principal [String, nil] a KRB5 principal
@param sasl_gssapi_keytab [String, nil] a KRB5 keytab filepath
@param sasl_scram_username [String, nil] SCRAM username
@param sasl_scram_password [String, nil] SCRAM password
@param sasl_scram_mechanism [String, nil] Scram mechanism, either "sha256" or "sha512"
@param sasl_over_ssl [Boolean] whether to enforce SSL with SASL
@param sasl_oauth_token_provider [Object, nil] OAuthBearer Token Provider instance that
implements method token. See {Sasl::OAuth#initialize}
@return [Client]
Delivers a single message to the Kafka cluster.
**Note:** Only use this API for low-throughput scenarios. If you want to deliver
many messages at a high rate, or if you want to configure the way messages are
sent, use the {#producer} or {#async_producer} APIs instead.
@param value [String, nil] the message value.
@param key [String, nil] the message key.
@param headers [Hash<String, String>] the headers for the message.
@param topic [String] the topic that the message should be written to.
@param partition [Integer, nil] the partition that the message should be written
to, or `nil` if either `partition_key` is passed or the partition should be
chosen at random.
@param partition_key [String] a value used to deterministically choose a
partition to write to.
@param retries [Integer] the number of times to retry the delivery before giving
up.
@return [nil] | [
"Initializes",
"a",
"new",
"Kafka",
"client",
"."
] | 2a73471b6a607a52dc85c79301ba522acb4566b5 | https://github.com/zendesk/ruby-kafka/blob/2a73471b6a607a52dc85c79301ba522acb4566b5/lib/kafka/client.rb#L137-L212 | train | Deliver a message to a topic. | [
30522,
13366,
8116,
1035,
4471,
1006,
3643,
1010,
3145,
1024,
9152,
2140,
1010,
20346,
2015,
1024,
1063,
1065,
1010,
8476,
1024,
1010,
13571,
1024,
9152,
2140,
1010,
13571,
1035,
3145,
1024,
9152,
2140,
1010,
2128,
21011,
1024,
1015,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activerecord/lib/active_record/database_configurations.rb | ActiveRecord.DatabaseConfigurations.default_hash | def default_hash(env = ActiveRecord::ConnectionHandling::DEFAULT_ENV.call.to_s)
default = find_db_config(env)
default.config if default
end | ruby | def default_hash(env = ActiveRecord::ConnectionHandling::DEFAULT_ENV.call.to_s)
default = find_db_config(env)
default.config if default
end | [
"def",
"default_hash",
"(",
"env",
"=",
"ActiveRecord",
"::",
"ConnectionHandling",
"::",
"DEFAULT_ENV",
".",
"call",
".",
"to_s",
")",
"default",
"=",
"find_db_config",
"(",
"env",
")",
"default",
".",
"config",
"if",
"default",
"end"
] | Returns the config hash that corresponds with the environment
If the application has multiple databases +default_hash+ will
return the first config hash for the environment.
{ database: "my_db", adapter: "mysql2" } | [
"Returns",
"the",
"config",
"hash",
"that",
"corresponds",
"with",
"the",
"environment"
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activerecord/lib/active_record/database_configurations.rb#L60-L63 | train | Returns the default hash for the database | [
30522,
13366,
12398,
1035,
23325,
1006,
4372,
2615,
1027,
3161,
2890,
27108,
2094,
1024,
1024,
4434,
11774,
2989,
1024,
1024,
12398,
1035,
4372,
2615,
1012,
2655,
1012,
2000,
1035,
1055,
1007,
12398,
1027,
2424,
1035,
16962,
1035,
9530,
887... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | spaceship/lib/spaceship/du/utilities.rb | Spaceship.Utilities.grab_video_preview | def grab_video_preview(video_path, timestamp, dimensions)
width, height = dimensions
require 'tempfile'
tmp = Tempfile.new(['video_preview', ".jpg"])
file = tmp.path
command = "ffmpeg -y -i \"#{video_path}\" -s #{width}x#{height} -ss \"#{timestamp}\" -vframes 1 \"#{file}\" 2>&1 >/dev/null"
# puts "COMMAND: #{command}"
`#{command}`
raise "Failed to grab screenshot at #{timestamp} from #{video_path} (using #{command})" unless $CHILD_STATUS.to_i == 0
tmp
end | ruby | def grab_video_preview(video_path, timestamp, dimensions)
width, height = dimensions
require 'tempfile'
tmp = Tempfile.new(['video_preview', ".jpg"])
file = tmp.path
command = "ffmpeg -y -i \"#{video_path}\" -s #{width}x#{height} -ss \"#{timestamp}\" -vframes 1 \"#{file}\" 2>&1 >/dev/null"
# puts "COMMAND: #{command}"
`#{command}`
raise "Failed to grab screenshot at #{timestamp} from #{video_path} (using #{command})" unless $CHILD_STATUS.to_i == 0
tmp
end | [
"def",
"grab_video_preview",
"(",
"video_path",
",",
"timestamp",
",",
"dimensions",
")",
"width",
",",
"height",
"=",
"dimensions",
"require",
"'tempfile'",
"tmp",
"=",
"Tempfile",
".",
"new",
"(",
"[",
"'video_preview'",
",",
"\".jpg\"",
"]",
")",
"file",
... | Grabs a screenshot from the specified video at the specified timestamp using `ffmpeg`
@param video_path (String) the path to the video file
@param timestamp (String) the `ffmpeg` timestamp format (e.g. 00.00)
@param dimensions (Array) the dimension of the screenshot to generate
@return the TempFile containing the generated screenshot | [
"Grabs",
"a",
"screenshot",
"from",
"the",
"specified",
"video",
"at",
"the",
"specified",
"timestamp",
"using",
"ffmpeg"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/spaceship/lib/spaceship/du/utilities.rb#L44-L54 | train | Grab a video preview | [
30522,
13366,
6723,
1035,
2678,
1035,
19236,
1006,
2678,
1035,
4130,
1010,
2335,
15464,
2361,
1010,
9646,
1007,
9381,
1010,
4578,
1027,
9646,
5478,
1005,
8915,
8737,
8873,
2571,
1005,
1056,
8737,
1027,
8915,
8737,
8873,
2571,
1012,
2047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
appium/ruby_lib | lib/appium_lib/ios/common/helper.rb | Appium.Ios._all_pred | def _all_pred(opts)
predicate = opts[:predicate]
raise 'predicate must be provided' unless predicate
visible = opts.fetch :visible, true
%($.mainApp().getAllWithPredicate("#{predicate}", #{visible});)
end | ruby | def _all_pred(opts)
predicate = opts[:predicate]
raise 'predicate must be provided' unless predicate
visible = opts.fetch :visible, true
%($.mainApp().getAllWithPredicate("#{predicate}", #{visible});)
end | [
"def",
"_all_pred",
"(",
"opts",
")",
"predicate",
"=",
"opts",
"[",
":predicate",
"]",
"raise",
"'predicate must be provided'",
"unless",
"predicate",
"visible",
"=",
"opts",
".",
"fetch",
":visible",
",",
"true",
"%($.mainApp().getAllWithPredicate(\"#{predicate}\", #{... | predicate - the predicate to evaluate on the main app
visible - if true, only visible elements are returned. default true | [
"predicate",
"-",
"the",
"predicate",
"to",
"evaluate",
"on",
"the",
"main",
"app"
] | 1f5898400dd1928bfe42ddd5f842d1f8738f2f76 | https://github.com/appium/ruby_lib/blob/1f5898400dd1928bfe42ddd5f842d1f8738f2f76/lib/appium_lib/ios/common/helper.rb#L376-L382 | train | Returns all the terms that match the predicate | [
30522,
13366,
1035,
2035,
1035,
3653,
2094,
1006,
23569,
2015,
1007,
3653,
16467,
1027,
23569,
2015,
1031,
1024,
3653,
16467,
1033,
5333,
1005,
3653,
16467,
2442,
2022,
3024,
1005,
4983,
3653,
16467,
5710,
1027,
23569,
2015,
1012,
18584,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
meew0/discordrb | lib/discordrb/data/server.rb | Discordrb.Server.move | def move(user, channel)
API::Server.update_member(@bot.token, @id, user.resolve_id, channel_id: channel.resolve_id)
end | ruby | def move(user, channel)
API::Server.update_member(@bot.token, @id, user.resolve_id, channel_id: channel.resolve_id)
end | [
"def",
"move",
"(",
"user",
",",
"channel",
")",
"API",
"::",
"Server",
".",
"update_member",
"(",
"@bot",
".",
"token",
",",
"@id",
",",
"user",
".",
"resolve_id",
",",
"channel_id",
":",
"channel",
".",
"resolve_id",
")",
"end"
] | Forcibly moves a user into a different voice channel. Only works if the bot has the permission needed.
@param user [User, #resolve_id] The user to move.
@param channel [Channel, #resolve_id] The voice channel to move into. | [
"Forcibly",
"moves",
"a",
"user",
"into",
"a",
"different",
"voice",
"channel",
".",
"Only",
"works",
"if",
"the",
"bot",
"has",
"the",
"permission",
"needed",
"."
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/data/server.rb#L573-L575 | train | Move the server to another channel | [
30522,
13366,
2693,
1006,
5310,
1010,
3149,
1007,
17928,
1024,
1024,
8241,
1012,
10651,
1035,
2266,
1006,
1030,
28516,
1012,
19204,
1010,
1030,
8909,
1010,
5310,
1012,
10663,
1035,
8909,
1010,
3149,
1035,
8909,
1024,
3149,
1012,
10663,
1035... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-rds/lib/aws-sdk-rds/resource.rb | Aws::RDS.Resource.create_db_instance | def create_db_instance(options = {})
resp = @client.create_db_instance(options)
DBInstance.new(
id: resp.data.db_instance.db_instance_identifier,
data: resp.data.db_instance,
client: @client
)
end | ruby | def create_db_instance(options = {})
resp = @client.create_db_instance(options)
DBInstance.new(
id: resp.data.db_instance.db_instance_identifier,
data: resp.data.db_instance,
client: @client
)
end | [
"def",
"create_db_instance",
"(",
"options",
"=",
"{",
"}",
")",
"resp",
"=",
"@client",
".",
"create_db_instance",
"(",
"options",
")",
"DBInstance",
".",
"new",
"(",
"id",
":",
"resp",
".",
"data",
".",
"db_instance",
".",
"db_instance_identifier",
",",
... | @example Request syntax with placeholder values
dbinstance = rds.create_db_instance({
db_name: "String",
db_instance_identifier: "String", # required
allocated_storage: 1,
db_instance_class: "String", # required
engine: "String", # required
master_username: "String",
master_user_password: "String",
db_security_groups: ["String"],
vpc_security_group_ids: ["String"],
availability_zone: "String",
db_subnet_group_name: "String",
preferred_maintenance_window: "String",
db_parameter_group_name: "String",
backup_retention_period: 1,
preferred_backup_window: "String",
port: 1,
multi_az: false,
engine_version: "String",
auto_minor_version_upgrade: false,
license_model: "String",
iops: 1,
option_group_name: "String",
character_set_name: "String",
publicly_accessible: false,
tags: [
{
key: "String",
value: "String",
},
],
db_cluster_identifier: "String",
storage_type: "String",
tde_credential_arn: "String",
tde_credential_password: "String",
storage_encrypted: false,
kms_key_id: "String",
domain: "String",
copy_tags_to_snapshot: false,
monitoring_interval: 1,
monitoring_role_arn: "String",
domain_iam_role_name: "String",
promotion_tier: 1,
timezone: "String",
enable_iam_database_authentication: false,
enable_performance_insights: false,
performance_insights_kms_key_id: "String",
performance_insights_retention_period: 1,
enable_cloudwatch_logs_exports: ["String"],
processor_features: [
{
name: "String",
value: "String",
},
],
deletion_protection: false,
})
@param [Hash] options ({})
@option options [String] :db_name
The meaning of this parameter differs according to the database engine
you use.
Type: String
**MySQL**
The name of the database to create when the DB instance is created. If
this parameter is not specified, no database is created in the DB
instance.
Constraints:
* Must contain 1 to 64 letters or numbers.
* Can't be a word reserved by the specified database engine
**MariaDB**
The name of the database to create when the DB instance is created. If
this parameter is not specified, no database is created in the DB
instance.
Constraints:
* Must contain 1 to 64 letters or numbers.
* Can't be a word reserved by the specified database engine
**PostgreSQL**
The name of the database to create when the DB instance is created. If
this parameter is not specified, the default "postgres" database is
created in the DB instance.
Constraints:
* Must contain 1 to 63 letters, numbers, or underscores.
* Must begin with a letter or an underscore. Subsequent characters can
be letters, underscores, or digits (0-9).
* Can't be a word reserved by the specified database engine
**Oracle**
The Oracle System ID (SID) of the created DB instance. If you specify
`null`, the default value `ORCL` is used. You can't specify the
string NULL, or any other reserved word, for `DBName`.
Default: `ORCL`
Constraints:
* Can't be longer than 8 characters
^
**SQL Server**
Not applicable. Must be null.
**Amazon Aurora**
The name of the database to create when the primary instance of the DB
cluster is created. If this parameter is not specified, no database is
created in the DB instance.
Constraints:
* Must contain 1 to 64 letters or numbers.
* Can't be a word reserved by the specified database engine
@option options [required, String] :db_instance_identifier
The DB instance identifier. This parameter is stored as a lowercase
string.
Constraints:
* Must contain from 1 to 63 letters, numbers, or hyphens.
* First character must be a letter.
* Can't end with a hyphen or contain two consecutive hyphens.
Example: `mydbinstance`
@option options [Integer] :allocated_storage
The amount of storage (in gibibytes) to allocate for the DB instance.
Type: Integer
**Amazon Aurora**
Not applicable. Aurora cluster volumes automatically grow as the
amount of data in your database increases, though you are only charged
for the space that you use in an Aurora cluster volume.
**MySQL**
Constraints to the amount of storage for each storage type are the
following:
* General Purpose (SSD) storage (gp2): Must be an integer from 20 to
32768.
* Provisioned IOPS storage (io1): Must be an integer from 100 to
32768.
* Magnetic storage (standard): Must be an integer from 5 to 3072.
**MariaDB**
Constraints to the amount of storage for each storage type are the
following:
* General Purpose (SSD) storage (gp2): Must be an integer from 20 to
32768.
* Provisioned IOPS storage (io1): Must be an integer from 100 to
32768.
* Magnetic storage (standard): Must be an integer from 5 to 3072.
**PostgreSQL**
Constraints to the amount of storage for each storage type are the
following:
* General Purpose (SSD) storage (gp2): Must be an integer from 20 to
32768.
* Provisioned IOPS storage (io1): Must be an integer from 100 to
32768.
* Magnetic storage (standard): Must be an integer from 5 to 3072.
**Oracle**
Constraints to the amount of storage for each storage type are the
following:
* General Purpose (SSD) storage (gp2): Must be an integer from 20 to
32768.
* Provisioned IOPS storage (io1): Must be an integer from 100 to
32768.
* Magnetic storage (standard): Must be an integer from 10 to 3072.
**SQL Server**
Constraints to the amount of storage for each storage type are the
following:
* General Purpose (SSD) storage (gp2):
* Enterprise and Standard editions: Must be an integer from 200 to
16384.
* Web and Express editions: Must be an integer from 20 to 16384.
* Provisioned IOPS storage (io1):
* Enterprise and Standard editions: Must be an integer from 200 to
16384.
* Web and Express editions: Must be an integer from 100 to 16384.
* Magnetic storage (standard):
* Enterprise and Standard editions: Must be an integer from 200 to
1024.
* Web and Express editions: Must be an integer from 20 to 1024.
@option options [required, String] :db_instance_class
The compute and memory capacity of the DB instance, for example,
`db.m4.large`. Not all DB instance classes are available in all AWS
Regions, or for all database engines. For the full list of DB instance
classes, and availability for your engine, see [DB Instance Class][1]
in the *Amazon RDS User Guide.*
[1]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html
@option options [required, String] :engine
The name of the database engine to be used for this instance.
Not every database engine is available for every AWS Region.
Valid Values:
* `aurora` (for MySQL 5.6-compatible Aurora)
* `aurora-mysql` (for MySQL 5.7-compatible Aurora)
* `aurora-postgresql`
* `mariadb`
* `mysql`
* `oracle-ee`
* `oracle-se2`
* `oracle-se1`
* `oracle-se`
* `postgres`
* `sqlserver-ee`
* `sqlserver-se`
* `sqlserver-ex`
* `sqlserver-web`
@option options [String] :master_username
The name for the master user.
**Amazon Aurora**
Not applicable. The name for the master user is managed by the DB
cluster. For more information, see CreateDBCluster.
**MariaDB**
Constraints:
* Required for MariaDB.
* Must be 1 to 16 letters or numbers.
* Can't be a reserved word for the chosen database engine.
**Microsoft SQL Server**
Constraints:
* Required for SQL Server.
* Must be 1 to 128 letters or numbers.
* The first character must be a letter.
* Can't be a reserved word for the chosen database engine.
**MySQL**
Constraints:
* Required for MySQL.
* Must be 1 to 16 letters or numbers.
* First character must be a letter.
* Can't be a reserved word for the chosen database engine.
**Oracle**
Constraints:
* Required for Oracle.
* Must be 1 to 30 letters or numbers.
* First character must be a letter.
* Can't be a reserved word for the chosen database engine.
**PostgreSQL**
Constraints:
* Required for PostgreSQL.
* Must be 1 to 63 letters or numbers.
* First character must be a letter.
* Can't be a reserved word for the chosen database engine.
@option options [String] :master_user_password
The password for the master user. The password can include any
printable ASCII character except "/", """, or "@".
**Amazon Aurora**
Not applicable. The password for the master user is managed by the DB
cluster. For more information, see CreateDBCluster.
**MariaDB**
Constraints: Must contain from 8 to 41 characters.
**Microsoft SQL Server**
Constraints: Must contain from 8 to 128 characters.
**MySQL**
Constraints: Must contain from 8 to 41 characters.
**Oracle**
Constraints: Must contain from 8 to 30 characters.
**PostgreSQL**
Constraints: Must contain from 8 to 128 characters.
@option options [Array<String>] :db_security_groups
A list of DB security groups to associate with this DB instance.
Default: The default DB security group for the database engine.
@option options [Array<String>] :vpc_security_group_ids
A list of Amazon EC2 VPC security groups to associate with this DB
instance.
**Amazon Aurora**
Not applicable. The associated list of EC2 VPC security groups is
managed by the DB cluster. For more information, see CreateDBCluster.
Default: The default EC2 VPC security group for the DB subnet group's
VPC.
@option options [String] :availability_zone
The EC2 Availability Zone that the DB instance is created in. For
information on AWS Regions and Availability Zones, see [Regions and
Availability Zones][1].
Default: A random, system-chosen Availability Zone in the endpoint's
AWS Region.
Example: `us-east-1d`
Constraint: The AvailabilityZone parameter can't be specified if the
MultiAZ parameter is set to `true`. The specified Availability Zone
must be in the same AWS Region as the current endpoint.
[1]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html
@option options [String] :db_subnet_group_name
A DB subnet group to associate with this DB instance.
If there is no DB subnet group, then it is a non-VPC DB instance.
@option options [String] :preferred_maintenance_window
The time range each week during which system maintenance can occur, in
Universal Coordinated Time (UTC). For more information, see [Amazon
RDS Maintenance Window][1].
Format: `ddd:hh24:mi-ddd:hh24:mi`
The default is a 30-minute window selected at random from an 8-hour
block of time for each AWS Region, occurring on a random day of the
week.
Valid Days: Mon, Tue, Wed, Thu, Fri, Sat, Sun.
Constraints: Minimum 30-minute window.
[1]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Maintenance.html#Concepts.DBMaintenance
@option options [String] :db_parameter_group_name
The name of the DB parameter group to associate with this DB instance.
If this argument is omitted, the default DBParameterGroup for the
specified engine is used.
Constraints:
* Must be 1 to 255 letters, numbers, or hyphens.
* First character must be a letter
* Can't end with a hyphen or contain two consecutive hyphens
@option options [Integer] :backup_retention_period
The number of days for which automated backups are retained. Setting
this parameter to a positive number enables backups. Setting this
parameter to 0 disables automated backups.
**Amazon Aurora**
Not applicable. The retention period for automated backups is managed
by the DB cluster. For more information, see CreateDBCluster.
Default: 1
Constraints:
* Must be a value from 0 to 35
* Can't be set to 0 if the DB instance is a source to Read Replicas
@option options [String] :preferred_backup_window
The daily time range during which automated backups are created if
automated backups are enabled, using the `BackupRetentionPeriod`
parameter. For more information, see [The Backup Window][1] in the
*Amazon RDS User Guide*.
**Amazon Aurora**
Not applicable. The daily time range for creating automated backups is
managed by the DB cluster. For more information, see CreateDBCluster.
The default is a 30-minute window selected at random from an 8-hour
block of time for each AWS Region. To see the time blocks available,
see [ Adjusting the Preferred DB Instance Maintenance Window][2] in
the *Amazon RDS User Guide*.
Constraints:
* Must be in the format `hh24:mi-hh24:mi`.
* Must be in Universal Coordinated Time (UTC).
* Must not conflict with the preferred maintenance window.
* Must be at least 30 minutes.
[1]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html#USER_WorkingWithAutomatedBackups.BackupWindow
[2]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Maintenance.html#AdjustingTheMaintenanceWindow
@option options [Integer] :port
The port number on which the database accepts connections.
**MySQL**
Default: `3306`
Valid Values: `1150-65535`
Type: Integer
**MariaDB**
Default: `3306`
Valid Values: `1150-65535`
Type: Integer
**PostgreSQL**
Default: `5432`
Valid Values: `1150-65535`
Type: Integer
**Oracle**
Default: `1521`
Valid Values: `1150-65535`
**SQL Server**
Default: `1433`
Valid Values: `1150-65535` except for `1434`, `3389`, `47001`,
`49152`, and `49152` through `49156`.
**Amazon Aurora**
Default: `3306`
Valid Values: `1150-65535`
Type: Integer
@option options [Boolean] :multi_az
A value that specifies whether the DB instance is a Multi-AZ
deployment. You can't set the AvailabilityZone parameter if the
MultiAZ parameter is set to true.
@option options [String] :engine_version
The version number of the database engine to use.
For a list of valid engine versions, call DescribeDBEngineVersions.
The following are the database engines and links to information about
the major and minor versions that are available with Amazon RDS. Not
every database engine is available for every AWS Region.
**Amazon Aurora**
Not applicable. The version number of the database engine to be used
by the DB instance is managed by the DB cluster. For more information,
see CreateDBCluster.
**MariaDB**
See [MariaDB on Amazon RDS Versions][1] in the *Amazon RDS User
Guide.*
**Microsoft SQL Server**
See [Version and Feature Support on Amazon RDS][2] in the *Amazon RDS
User Guide.*
**MySQL**
See [MySQL on Amazon RDS Versions][3] in the *Amazon RDS User Guide.*
**Oracle**
See [Oracle Database Engine Release Notes][4] in the *Amazon RDS User
Guide.*
**PostgreSQL**
See [Supported PostgreSQL Database Versions][5] in the *Amazon RDS
User Guide.*
[1]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_MariaDB.html#MariaDB.Concepts.VersionMgmt
[2]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_SQLServer.html#SQLServer.Concepts.General.FeatureSupport
[3]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_MySQL.html#MySQL.Concepts.VersionMgmt
[4]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.Oracle.PatchComposition.html
[5]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_PostgreSQL.html#PostgreSQL.Concepts.General.DBVersions
@option options [Boolean] :auto_minor_version_upgrade
Indicates that minor engine upgrades are applied automatically to the
DB instance during the maintenance window.
Default: `true`
@option options [String] :license_model
License model information for this DB instance.
Valid values: `license-included` \| `bring-your-own-license` \|
`general-public-license`
@option options [Integer] :iops
The amount of Provisioned IOPS (input/output operations per second) to
be initially allocated for the DB instance. For information about
valid Iops values, see see [Amazon RDS Provisioned IOPS Storage to
Improve Performance][1] in the *Amazon RDS User Guide*.
Constraints: Must be a multiple between 1 and 50 of the storage amount
for the DB instance.
[1]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#USER_PIOPS
@option options [String] :option_group_name
Indicates that the DB instance should be associated with the specified
option group.
Permanent options, such as the TDE option for Oracle Advanced Security
TDE, can't be removed from an option group, and that option group
can't be removed from a DB instance once it is associated with a DB
instance
@option options [String] :character_set_name
For supported engines, indicates that the DB instance should be
associated with the specified CharacterSet.
**Amazon Aurora**
Not applicable. The character set is managed by the DB cluster. For
more information, see CreateDBCluster.
@option options [Boolean] :publicly_accessible
Specifies the accessibility options for the DB instance. A value of
true specifies an Internet-facing instance with a publicly resolvable
DNS name, which resolves to a public IP address. A value of false
specifies an internal instance with a DNS name that resolves to a
private IP address.
Default: The default behavior varies depending on whether
`DBSubnetGroupName` is specified.
If `DBSubnetGroupName` is not specified, and `PubliclyAccessible` is
not specified, the following applies:
* If the default VPC in the target region doesn’t have an Internet
gateway attached to it, the DB instance is private.
* If the default VPC in the target region has an Internet gateway
attached to it, the DB instance is public.
If `DBSubnetGroupName` is specified, and `PubliclyAccessible` is not
specified, the following applies:
* If the subnets are part of a VPC that doesn’t have an Internet
gateway attached to it, the DB instance is private.
* If the subnets are part of a VPC that has an Internet gateway
attached to it, the DB instance is public.
@option options [Array<Types::Tag>] :tags
A list of tags. For more information, see [Tagging Amazon RDS
Resources][1] in the *Amazon RDS User Guide.*
[1]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.html
@option options [String] :db_cluster_identifier
The identifier of the DB cluster that the instance will belong to.
For information on creating a DB cluster, see CreateDBCluster.
Type: String
@option options [String] :storage_type
Specifies the storage type to be associated with the DB instance.
Valid values: `standard | gp2 | io1`
If you specify `io1`, you must also include a value for the `Iops`
parameter.
Default: `io1` if the `Iops` parameter is specified, otherwise
`standard`
@option options [String] :tde_credential_arn
The ARN from the key store with which to associate the instance for
TDE encryption.
@option options [String] :tde_credential_password
The password for the given ARN from the key store in order to access
the device.
@option options [Boolean] :storage_encrypted
Specifies whether the DB instance is encrypted.
**Amazon Aurora**
Not applicable. The encryption for DB instances is managed by the DB
cluster. For more information, see CreateDBCluster.
Default: false
@option options [String] :kms_key_id
The AWS KMS key identifier for an encrypted DB instance.
The KMS key identifier is the Amazon Resource Name (ARN) for the KMS
encryption key. If you are creating a DB instance with the same AWS
account that owns the KMS encryption key used to encrypt the new DB
instance, then you can use the KMS key alias instead of the ARN for
the KM encryption key.
**Amazon Aurora**
Not applicable. The KMS key identifier is managed by the DB cluster.
For more information, see CreateDBCluster.
If the `StorageEncrypted` parameter is true, and you do not specify a
value for the `KmsKeyId` parameter, then Amazon RDS will use your
default encryption key. AWS KMS creates the default encryption key for
your AWS account. Your AWS account has a different default encryption
key for each AWS Region.
@option options [String] :domain
Specify the Active Directory Domain to create the instance in.
@option options [Boolean] :copy_tags_to_snapshot
True to copy all tags from the DB instance to snapshots of the DB
instance, and otherwise false. The default is false.
**Amazon Aurora**
Not applicable. Copying tags to snapshots is managed by the DB
cluster. Setting this value for an Aurora DB instance has no effect on
the DB cluster setting. For more information, see CreateDBCluster.
@option options [Integer] :monitoring_interval
The interval, in seconds, between points when Enhanced Monitoring
metrics are collected for the DB instance. To disable collecting
Enhanced Monitoring metrics, specify 0. The default is 0.
If `MonitoringRoleArn` is specified, then you must also set
`MonitoringInterval` to a value other than 0.
Valid Values: `0, 1, 5, 10, 15, 30, 60`
@option options [String] :monitoring_role_arn
The ARN for the IAM role that permits RDS to send enhanced monitoring
metrics to Amazon CloudWatch Logs. For example,
`arn:aws:iam:123456789012:role/emaccess`. For information on creating
a monitoring role, go to [Setting Up and Enabling Enhanced
Monitoring][1] in the *Amazon RDS User Guide*.
If `MonitoringInterval` is set to a value other than 0, then you must
supply a `MonitoringRoleArn` value.
[1]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Monitoring.OS.html#USER_Monitoring.OS.Enabling
@option options [String] :domain_iam_role_name
Specify the name of the IAM role to be used when making API calls to
the Directory Service.
@option options [Integer] :promotion_tier
A value that specifies the order in which an Aurora Replica is
promoted to the primary instance after a failure of the existing
primary instance. For more information, see [ Fault Tolerance for an
Aurora DB Cluster][1] in the *Amazon Aurora User Guide*.
Default: 1
Valid Values: 0 - 15
[1]: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.Managing.Backups.html#Aurora.Managing.FaultTolerance
@option options [String] :timezone
The time zone of the DB instance. The time zone parameter is currently
supported only by [Microsoft SQL Server][1].
[1]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_SQLServer.html#SQLServer.Concepts.General.TimeZone
@option options [Boolean] :enable_iam_database_authentication
True to enable mapping of AWS Identity and Access Management (IAM)
accounts to database accounts, and otherwise false.
You can enable IAM database authentication for the following database
engines:
**Amazon Aurora**
Not applicable. Mapping AWS IAM accounts to database accounts is
managed by the DB cluster. For more information, see CreateDBCluster.
**MySQL**
* For MySQL 5.6, minor version 5.6.34 or higher
* For MySQL 5.7, minor version 5.7.16 or higher
Default: `false`
@option options [Boolean] :enable_performance_insights
True to enable Performance Insights for the DB instance, and otherwise
false.
For more information, see [Using Amazon Performance Insights][1] in
the *Amazon Relational Database Service User Guide*.
[1]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.html
@option options [String] :performance_insights_kms_key_id
The AWS KMS key identifier for encryption of Performance Insights
data. The KMS key ID is the Amazon Resource Name (ARN), KMS key
identifier, or the KMS key alias for the KMS encryption key.
@option options [Integer] :performance_insights_retention_period
The amount of time, in days, to retain Performance Insights data.
Valid values are 7 or 731 (2 years).
@option options [Array<String>] :enable_cloudwatch_logs_exports
The list of log types that need to be enabled for exporting to
CloudWatch Logs. The values in the list depend on the DB engine being
used. For more information, see [Publishing Database Logs to Amazon
CloudWatch Logs ][1] in the *Amazon Relational Database Service User
Guide*.
[1]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.html#USER_LogAccess.Procedural.UploadtoCloudWatch
@option options [Array<Types::ProcessorFeature>] :processor_features
The number of CPU cores and the number of threads per core for the DB
instance class of the DB instance.
@option options [Boolean] :deletion_protection
Indicates if the DB instance should have deletion protection enabled.
The database can't be deleted when this value is set to true. The
default is false. For more information, see [ Deleting a DB
Instance][1].
[1]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_DeleteInstance.html
@return [DBInstance] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-rds/lib/aws-sdk-rds/resource.rb#L1226-L1233 | train | Create a DB Instance | [
30522,
13366,
3443,
1035,
16962,
1035,
6013,
1006,
7047,
1027,
1063,
1065,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
3443,
1035,
16962,
1035,
6013,
1006,
7047,
1007,
16962,
7076,
26897,
1012,
2047,
1006,
8909,
1024,
24501,
2361,
1012,
2951... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | actionview/lib/action_view/layouts.rb | ActionView.Layouts._layout_for_option | def _layout_for_option(name)
case name
when String then _normalize_layout(name)
when Proc then name
when true then Proc.new { |lookup_context, formats| _default_layout(lookup_context, formats, true) }
when :default then Proc.new { |lookup_context, formats| _default_layout(lookup_context, formats, false) }
when false, nil then nil
else
raise ArgumentError,
"String, Proc, :default, true, or false, expected for `layout'; you passed #{name.inspect}"
end
end | ruby | def _layout_for_option(name)
case name
when String then _normalize_layout(name)
when Proc then name
when true then Proc.new { |lookup_context, formats| _default_layout(lookup_context, formats, true) }
when :default then Proc.new { |lookup_context, formats| _default_layout(lookup_context, formats, false) }
when false, nil then nil
else
raise ArgumentError,
"String, Proc, :default, true, or false, expected for `layout'; you passed #{name.inspect}"
end
end | [
"def",
"_layout_for_option",
"(",
"name",
")",
"case",
"name",
"when",
"String",
"then",
"_normalize_layout",
"(",
"name",
")",
"when",
"Proc",
"then",
"name",
"when",
"true",
"then",
"Proc",
".",
"new",
"{",
"|",
"lookup_context",
",",
"formats",
"|",
"_d... | Determine the layout for a given name, taking into account the name type.
==== Parameters
* <tt>name</tt> - The name of the template | [
"Determine",
"the",
"layout",
"for",
"a",
"given",
"name",
"taking",
"into",
"account",
"the",
"name",
"type",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/actionview/lib/action_view/layouts.rb#L387-L398 | train | Returns the layout for the given option. | [
30522,
13366,
1035,
9621,
1035,
2005,
1035,
5724,
1006,
2171,
1007,
2553,
2171,
2043,
5164,
2059,
1035,
3671,
4697,
1035,
9621,
1006,
2171,
1007,
2043,
4013,
2278,
2059,
2171,
2043,
2995,
2059,
4013,
2278,
1012,
2047,
1063,
1064,
2298,
62... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-ec2/lib/aws-sdk-ec2/snapshot.rb | Aws::EC2.Snapshot.delete | def delete(options = {})
options = options.merge(snapshot_id: @id)
resp = @client.delete_snapshot(options)
resp.data
end | ruby | def delete(options = {})
options = options.merge(snapshot_id: @id)
resp = @client.delete_snapshot(options)
resp.data
end | [
"def",
"delete",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"snapshot_id",
":",
"@id",
")",
"resp",
"=",
"@client",
".",
"delete_snapshot",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
snapshot.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/snapshot.rb#L429-L433 | train | Delete a snapshot | [
30522,
13366,
3972,
12870,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
20057,
12326,
1035,
8909,
1024,
1030,
8909,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
3972,
12870,
1035,
20057,
12326,
1006,
7047,
1007,
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... |
hanami/hanami | lib/hanami/routes.rb | Hanami.Routes.url | def url(name, *args)
Utils::Escape::SafeString.new(@routes.url(name, *args))
end | ruby | def url(name, *args)
Utils::Escape::SafeString.new(@routes.url(name, *args))
end | [
"def",
"url",
"(",
"name",
",",
"*",
"args",
")",
"Utils",
"::",
"Escape",
"::",
"SafeString",
".",
"new",
"(",
"@routes",
".",
"url",
"(",
"name",
",",
"args",
")",
")",
"end"
] | Return an absolute path for the given route name
@param name [Symbol] the route name
@param args [Array,nil] an optional set of arguments that is passed down
to the wrapped route set.
@return [Hanami::Utils::Escape::SafeString] the corresponding absolute URL
@raise Hanami::Routing::InvalidRouteException
@since 0.1.0
@see http://rdoc.info/gems/hanami-router/Hanami/Router#url-instance_method
@example Basic example
require 'hanami'
module Web
class Application < Hanami::Application
configure do
routes do
scheme 'https'
host 'bookshelf.org'
get '/login', to: 'sessions#new', as: :login
end
end
end
end
Web.routes.url(:login)
# => 'https://bookshelf.org/login'
Web.routes.url(:login, return_to: '/dashboard')
# => 'https://bookshelf.org/login?return_to=%2Fdashboard'
@example Dynamic finders
require 'hanami'
module Web
class Application < Hanami::Application
configure do
routes do
scheme 'https'
host 'bookshelf.org'
get '/login', to: 'sessions#new', as: :login
end
end
end
end
Web.routes.login_url
# => 'https://bookshelf.org/login'
Web.routes.login_url(return_to: '/dashboard')
# => 'https://bookshelf.org/login?return_to=%2Fdashboard' | [
"Return",
"an",
"absolute",
"path",
"for",
"the",
"given",
"route",
"name"
] | 8c6e5147e92ef869b25379448572da3698eacfdc | https://github.com/hanami/hanami/blob/8c6e5147e92ef869b25379448572da3698eacfdc/lib/hanami/routes.rb#L136-L138 | train | Returns the URL for the given route name. | [
30522,
13366,
24471,
2140,
1006,
2171,
1010,
1008,
12098,
5620,
1007,
21183,
12146,
1024,
1024,
4019,
1024,
1024,
3647,
3367,
4892,
1012,
2047,
1006,
1030,
5847,
1012,
24471,
2140,
1006,
2171,
1010,
1008,
12098,
5620,
1007,
1007,
2203,
102,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
zendesk/ruby-kafka | lib/kafka/offset_manager.rb | Kafka.OffsetManager.seek_to_default | def seek_to_default(topic, partition)
# Remove any cached offset, in case things have changed broker-side.
clear_resolved_offset(topic)
offset = resolve_offset(topic, partition)
seek_to(topic, partition, offset)
end | ruby | def seek_to_default(topic, partition)
# Remove any cached offset, in case things have changed broker-side.
clear_resolved_offset(topic)
offset = resolve_offset(topic, partition)
seek_to(topic, partition, offset)
end | [
"def",
"seek_to_default",
"(",
"topic",
",",
"partition",
")",
"# Remove any cached offset, in case things have changed broker-side.",
"clear_resolved_offset",
"(",
"topic",
")",
"offset",
"=",
"resolve_offset",
"(",
"topic",
",",
"partition",
")",
"seek_to",
"(",
"topic"... | Move the consumer's position in the partition back to the configured default
offset, either the first or latest in the partition.
@param topic [String] the name of the topic.
@param partition [Integer] the partition number.
@return [nil] | [
"Move",
"the",
"consumer",
"s",
"position",
"in",
"the",
"partition",
"back",
"to",
"the",
"configured",
"default",
"offset",
"either",
"the",
"first",
"or",
"latest",
"in",
"the",
"partition",
"."
] | 2a73471b6a607a52dc85c79301ba522acb4566b5 | https://github.com/zendesk/ruby-kafka/blob/2a73471b6a607a52dc85c79301ba522acb4566b5/lib/kafka/offset_manager.rb#L68-L75 | train | Seek to the default partition. | [
30522,
13366,
6148,
1035,
2000,
1035,
12398,
1006,
8476,
1010,
13571,
1007,
1001,
6366,
2151,
17053,
2094,
16396,
1010,
1999,
2553,
2477,
2031,
2904,
20138,
1011,
2217,
1012,
3154,
1035,
10395,
1035,
16396,
1006,
8476,
1007,
16396,
1027,
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/2014-04-01/generated/azure_mgmt_sql/transparent_data_encryption_activities.rb | Azure::SQL::Mgmt::V2014_04_01.TransparentDataEncryptionActivities.list_by_configuration | def list_by_configuration(resource_group_name, server_name, database_name, custom_headers:nil)
response = list_by_configuration_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_configuration(resource_group_name, server_name, database_name, custom_headers:nil)
response = list_by_configuration_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_configuration",
"(",
"resource_group_name",
",",
"server_name",
",",
"database_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_configuration_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"database_name",
",",
"cust... | Returns a database's transparent data encryption operation result.
@param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param server_name [String] The name of the server.
@param database_name [String] The name of the database for which the
transparent data encryption applies.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [TransparentDataEncryptionActivityListResult] operation results. | [
"Returns",
"a",
"database",
"s",
"transparent",
"data",
"encryption",
"operation",
"result",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/transparent_data_encryption_activities.rb#L41-L44 | train | Gets the list of all the available database documents. | [
30522,
13366,
2862,
1035,
2011,
1035,
9563,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
7809,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
9563,
1035,
2004,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
boazsegev/combine_pdf | lib/combine_pdf/pdf_public.rb | CombinePDF.PDF.insert | def insert(location, data)
pages_to_add = nil
if data.is_a? PDF
@version = [@version, data.version].max
pages_to_add = data.pages
actual_value(@names ||= {}.dup).update data.names, &HASH_MERGE_NEW_NO_PAGE
merge_outlines((@outlines ||= {}.dup), actual_value(data.outlines), location) unless actual_value(data.outlines).empty?
if actual_value(@forms_data)
actual_value(@forms_data).update actual_value(data.forms_data), &HASH_MERGE_NEW_NO_PAGE if data.forms_data
else
@forms_data = data.forms_data
end
warn 'Form data might be lost when combining PDF forms (possible conflicts).' unless data.forms_data.nil? || data.forms_data.empty?
elsif data.is_a?(Array) && (data.select { |o| !(o.is_a?(Hash) && o[:Type] == :Page) }).empty?
pages_to_add = data
elsif data.is_a?(Hash) && data[:Type] == :Page
pages_to_add = [data]
else
warn "Shouldn't add objects to the file unless they are PDF objects or PDF pages (an Array or a single PDF page)."
return false # return false, which will also stop any chaining.
end
# pages_to_add.map! {|page| page.copy }
catalog = rebuild_catalog
pages_array = catalog[:Pages][:referenced_object][:Kids]
page_count = pages_array.length
if location < 0 && (page_count + location < 0)
location = 0
elsif location > 0 && (location > page_count)
location = page_count
end
pages_array.insert location, pages_to_add
pages_array.flatten!
self
end | ruby | def insert(location, data)
pages_to_add = nil
if data.is_a? PDF
@version = [@version, data.version].max
pages_to_add = data.pages
actual_value(@names ||= {}.dup).update data.names, &HASH_MERGE_NEW_NO_PAGE
merge_outlines((@outlines ||= {}.dup), actual_value(data.outlines), location) unless actual_value(data.outlines).empty?
if actual_value(@forms_data)
actual_value(@forms_data).update actual_value(data.forms_data), &HASH_MERGE_NEW_NO_PAGE if data.forms_data
else
@forms_data = data.forms_data
end
warn 'Form data might be lost when combining PDF forms (possible conflicts).' unless data.forms_data.nil? || data.forms_data.empty?
elsif data.is_a?(Array) && (data.select { |o| !(o.is_a?(Hash) && o[:Type] == :Page) }).empty?
pages_to_add = data
elsif data.is_a?(Hash) && data[:Type] == :Page
pages_to_add = [data]
else
warn "Shouldn't add objects to the file unless they are PDF objects or PDF pages (an Array or a single PDF page)."
return false # return false, which will also stop any chaining.
end
# pages_to_add.map! {|page| page.copy }
catalog = rebuild_catalog
pages_array = catalog[:Pages][:referenced_object][:Kids]
page_count = pages_array.length
if location < 0 && (page_count + location < 0)
location = 0
elsif location > 0 && (location > page_count)
location = page_count
end
pages_array.insert location, pages_to_add
pages_array.flatten!
self
end | [
"def",
"insert",
"(",
"location",
",",
"data",
")",
"pages_to_add",
"=",
"nil",
"if",
"data",
".",
"is_a?",
"PDF",
"@version",
"=",
"[",
"@version",
",",
"data",
".",
"version",
"]",
".",
"max",
"pages_to_add",
"=",
"data",
".",
"pages",
"actual_value",
... | add PDF pages (or PDF files) into a specific location.
returns the new pages Array! (unlike `#<<`, doesn't return self!)
location:: the location for the added page(s). Could be any number. negative numbers represent a count backwards (-1 being the end of the page array and 0 being the begining). if the location is beyond bounds, the pages will be added to the end of the PDF object (or at the begining, if the out of bounds was a negative number).
data:: a PDF page, a PDF file (CombinePDF.new "filname.pdf") or an array of pages (CombinePDF.new("filname.pdf").pages[0..3]). | [
"add",
"PDF",
"pages",
"(",
"or",
"PDF",
"files",
")",
"into",
"a",
"specific",
"location",
"."
] | 09054051019c069f551f3e60be789577c0f93900 | https://github.com/boazsegev/combine_pdf/blob/09054051019c069f551f3e60be789577c0f93900/lib/combine_pdf/pdf_public.rb#L304-L337 | train | Insert a PDF object at the given location. | [
30522,
13366,
19274,
1006,
3295,
1010,
2951,
1007,
5530,
1035,
2000,
1035,
5587,
1027,
9152,
2140,
2065,
2951,
1012,
2003,
1035,
1037,
1029,
11135,
1030,
2544,
1027,
1031,
1030,
2544,
1010,
2951,
1012,
2544,
1033,
1012,
4098,
5530,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb | Azure::Web::Mgmt::V2018_02_01.AppServiceEnvironments.list_metrics | def list_metrics(resource_group_name, name, details:nil, filter:nil, custom_headers:nil)
first_page = list_metrics_as_lazy(resource_group_name, name, details:details, filter:filter, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_metrics(resource_group_name, name, details:nil, filter:nil, custom_headers:nil)
first_page = list_metrics_as_lazy(resource_group_name, name, details:details, filter:filter, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_metrics",
"(",
"resource_group_name",
",",
"name",
",",
"details",
":",
"nil",
",",
"filter",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_metrics_as_lazy",
"(",
"resource_group_name",
",",
"name",
",",
"details",
"... | Get global metrics of an App Service Environment.
Get global metrics of an App Service Environment.
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param name [String] Name of the App Service Environment.
@param details [Boolean] Specify <code>true</code> to include instance
details. The default is <code>false</code>.
@param filter [String] Return only usages/metrics specified in the filter.
Filter conforms to odata syntax. Example: $filter=(name.value eq 'Metric1' or
name.value eq 'Metric2') and startTime eq 2014-01-01T00:00:00Z and endTime eq
2014-12-31T23:59:59Z and timeGrain eq duration'[Hour|Minute|Day]'.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<ResourceMetric>] operation results. | [
"Get",
"global",
"metrics",
"of",
"an",
"App",
"Service",
"Environment",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb#L1181-L1184 | train | Gets all metrics for a resource group. | [
30522,
13366,
2862,
1035,
12046,
2015,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
4751,
1024,
9152,
2140,
1010,
11307,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2862,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jeremytregunna/ruby-trello | lib/trello/card.rb | Trello.Card.add_label | def add_label(label)
unless label.valid?
errors.add(:label, "is not valid.")
return Trello.logger.warn "Label is not valid." unless label.valid?
end
client.post("/cards/#{id}/idLabels", {value: label.id})
end | ruby | def add_label(label)
unless label.valid?
errors.add(:label, "is not valid.")
return Trello.logger.warn "Label is not valid." unless label.valid?
end
client.post("/cards/#{id}/idLabels", {value: label.id})
end | [
"def",
"add_label",
"(",
"label",
")",
"unless",
"label",
".",
"valid?",
"errors",
".",
"add",
"(",
":label",
",",
"\"is not valid.\"",
")",
"return",
"Trello",
".",
"logger",
".",
"warn",
"\"Label is not valid.\"",
"unless",
"label",
".",
"valid?",
"end",
"... | Add a label | [
"Add",
"a",
"label"
] | ad79c9d8152ad5395b3b61c43170908f1912bfb2 | https://github.com/jeremytregunna/ruby-trello/blob/ad79c9d8152ad5395b3b61c43170908f1912bfb2/lib/trello/card.rb#L403-L409 | train | Add a label to the card | [
30522,
13366,
5587,
1035,
3830,
1006,
3830,
1007,
4983,
3830,
1012,
9398,
1029,
10697,
1012,
5587,
1006,
1024,
3830,
1010,
1000,
2003,
2025,
9398,
1012,
1000,
1007,
2709,
29461,
7174,
1012,
8833,
4590,
1012,
11582,
1000,
3830,
2003,
2025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/fileparsing.rb | Puppet::Util::FileParsing.FileRecord.join | def join(details)
joinchar = self.joiner
fields.collect { |field|
# If the field is marked absent, use the appropriate replacement
if details[field] == :absent or details[field] == [:absent] or details[field].nil?
if self.optional.include?(field)
self.absent
else
raise ArgumentError, _("Field '%{field}' is required") % { field: field }
end
else
details[field].to_s
end
}.reject { |c| c.nil?}.join(joinchar)
end | ruby | def join(details)
joinchar = self.joiner
fields.collect { |field|
# If the field is marked absent, use the appropriate replacement
if details[field] == :absent or details[field] == [:absent] or details[field].nil?
if self.optional.include?(field)
self.absent
else
raise ArgumentError, _("Field '%{field}' is required") % { field: field }
end
else
details[field].to_s
end
}.reject { |c| c.nil?}.join(joinchar)
end | [
"def",
"join",
"(",
"details",
")",
"joinchar",
"=",
"self",
".",
"joiner",
"fields",
".",
"collect",
"{",
"|",
"field",
"|",
"# If the field is marked absent, use the appropriate replacement",
"if",
"details",
"[",
"field",
"]",
"==",
":absent",
"or",
"details",
... | Convert a record into a line by joining the fields together appropriately.
This is pulled into a separate method so it can be called by the hooks. | [
"Convert",
"a",
"record",
"into",
"a",
"line",
"by",
"joining",
"the",
"fields",
"together",
"appropriately",
".",
"This",
"is",
"pulled",
"into",
"a",
"separate",
"method",
"so",
"it",
"can",
"be",
"called",
"by",
"the",
"hooks",
"."
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/util/fileparsing.rb#L102-L117 | train | Returns a string containing the fields that are required to be joined. | [
30522,
13366,
3693,
1006,
4751,
1007,
3693,
7507,
2099,
1027,
2969,
1012,
3693,
2121,
4249,
1012,
8145,
1063,
1064,
2492,
1064,
1001,
2065,
1996,
2492,
2003,
4417,
9962,
1010,
2224,
1996,
6413,
6110,
2065,
4751,
1031,
2492,
1033,
1027,
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_search/lib/2015-08-19/generated/azure_mgmt_search/services.rb | Azure::Search::Mgmt::V2015_08_19.Services.delete | def delete(resource_group_name, search_service_name, search_management_request_options:nil, custom_headers:nil)
response = delete_async(resource_group_name, search_service_name, search_management_request_options:search_management_request_options, custom_headers:custom_headers).value!
nil
end | ruby | def delete(resource_group_name, search_service_name, search_management_request_options:nil, custom_headers:nil)
response = delete_async(resource_group_name, search_service_name, search_management_request_options:search_management_request_options, custom_headers:custom_headers).value!
nil
end | [
"def",
"delete",
"(",
"resource_group_name",
",",
"search_service_name",
",",
"search_management_request_options",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_async",
"(",
"resource_group_name",
",",
"search_service_name",
",",
"search_m... | Deletes a Search service in the given resource group, along with its
associated resources.
@param resource_group_name [String] The name of the resource group within the
current subscription. You can obtain this value from the Azure Resource
Manager API or the portal.
@param search_service_name [String] The name of the Azure Search service
associated with the specified resource group.
@param search_management_request_options [SearchManagementRequestOptions]
Additional parameters for the operation
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Deletes",
"a",
"Search",
"service",
"in",
"the",
"given",
"resource",
"group",
"along",
"with",
"its",
"associated",
"resources",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_search/lib/2015-08-19/generated/azure_mgmt_search/services.rb#L345-L348 | train | Deletes a search service. | [
30522,
13366,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3945,
1035,
2326,
1035,
2171,
1010,
3945,
1035,
2968,
1035,
5227,
1035,
7047,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb | Aws::RDS.DBSnapshot.copy | def copy(options = {})
options = options.merge(source_db_snapshot_identifier: @snapshot_id)
resp = @client.copy_db_snapshot(options)
DBSnapshot.new(
instance_id: resp.data.db_snapshot.db_instance_identifier,
snapshot_id: resp.data.db_snapshot.db_snapshot_identifier,
data: resp.data.db_snapshot,
client: @client
)
end | ruby | def copy(options = {})
options = options.merge(source_db_snapshot_identifier: @snapshot_id)
resp = @client.copy_db_snapshot(options)
DBSnapshot.new(
instance_id: resp.data.db_snapshot.db_instance_identifier,
snapshot_id: resp.data.db_snapshot.db_snapshot_identifier,
data: resp.data.db_snapshot,
client: @client
)
end | [
"def",
"copy",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"source_db_snapshot_identifier",
":",
"@snapshot_id",
")",
"resp",
"=",
"@client",
".",
"copy_db_snapshot",
"(",
"options",
")",
"DBSnapshot",
".",
"new",
"(",
... | @example Request syntax with placeholder values
dbsnapshot = db_snapshot.copy({
target_db_snapshot_identifier: "String", # required
kms_key_id: "String",
tags: [
{
key: "String",
value: "String",
},
],
copy_tags: false,
pre_signed_url: "String",
option_group_name: "String",
source_region: "String",
})
@param [Hash] options ({})
@option options [required, String] :target_db_snapshot_identifier
The identifier for the copy of the snapshot.
Constraints:
* Can't be null, empty, or blank
* Must contain from 1 to 255 letters, numbers, or hyphens
* First character must be a letter
* Can't end with a hyphen or contain two consecutive hyphens
Example: `my-db-snapshot`
@option options [String] :kms_key_id
The AWS KMS key ID for an encrypted DB snapshot. The KMS key ID is the
Amazon Resource Name (ARN), KMS key identifier, or the KMS key alias
for the KMS encryption key.
If you copy an encrypted DB snapshot from your AWS account, you can
specify a value for this parameter to encrypt the copy with a new KMS
encryption key. If you don't specify a value for this parameter, then
the copy of the DB snapshot is encrypted with the same KMS key as the
source DB snapshot.
If you copy an encrypted DB snapshot that is shared from another AWS
account, then you must specify a value for this parameter.
If you specify this parameter when you copy an unencrypted snapshot,
the copy is encrypted.
If you copy an encrypted snapshot to a different AWS Region, then you
must specify a KMS key for the destination AWS Region. KMS encryption
keys are specific to the AWS Region that they are created in, and you
can't use encryption keys from one AWS Region in another AWS Region.
@option options [Array<Types::Tag>] :tags
A list of tags. For more information, see [Tagging Amazon RDS
Resources][1] in the *Amazon RDS User Guide.*
[1]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.html
@option options [Boolean] :copy_tags
True to copy all tags from the source DB snapshot to the target DB
snapshot, and otherwise false. The default is false.
@option options [String] :pre_signed_url
The URL that contains a Signature Version 4 signed request for the
`CopyDBSnapshot` API action in the source AWS Region that contains the
source DB snapshot to copy.
You must specify this parameter when you copy an encrypted DB snapshot
from another AWS Region by using the Amazon RDS API. You can specify
the `--source-region` option instead of this parameter when you copy
an encrypted DB snapshot from another AWS Region by using the AWS CLI.
The presigned URL must be a valid request for the `CopyDBSnapshot` API
action that can be executed in the source AWS Region that contains the
encrypted DB snapshot to be copied. The presigned URL request must
contain the following parameter values:
* `DestinationRegion` - The AWS Region that the encrypted DB snapshot
is copied to. This AWS Region is the same one where the
`CopyDBSnapshot` action is called that contains this presigned URL.
For example, if you copy an encrypted DB snapshot from the us-west-2
AWS Region to the us-east-1 AWS Region, then you call the
`CopyDBSnapshot` action in the us-east-1 AWS Region and provide a
presigned URL that contains a call to the `CopyDBSnapshot` action in
the us-west-2 AWS Region. For this example, the `DestinationRegion`
in the presigned URL must be set to the us-east-1 AWS Region.
* `KmsKeyId` - The AWS KMS key identifier for the key to use to
encrypt the copy of the DB snapshot in the destination AWS Region.
This is the same identifier for both the `CopyDBSnapshot` action
that is called in the destination AWS Region, and the action
contained in the presigned URL.
* `SourceDBSnapshotIdentifier` - The DB snapshot identifier for the
encrypted snapshot to be copied. This identifier must be in the
Amazon Resource Name (ARN) format for the source AWS Region. For
example, if you are copying an encrypted DB snapshot from the
us-west-2 AWS Region, then your `SourceDBSnapshotIdentifier` looks
like the following example:
`arn:aws:rds:us-west-2:123456789012:snapshot:mysql-instance1-snapshot-20161115`.
To learn how to generate a Signature Version 4 signed request, see
[Authenticating Requests: Using Query Parameters (AWS Signature
Version 4)][1] and [Signature Version 4 Signing Process][2].
[1]: https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html
[2]: https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html
@option options [String] :option_group_name
The name of an option group to associate with the copy of the
snapshot.
Specify this option if you are copying a snapshot from one AWS Region
to another, and your DB instance uses a nondefault option group. If
your source DB instance uses Transparent Data Encryption for Oracle or
Microsoft SQL Server, you must specify this option when copying across
AWS Regions. For more information, see [Option Group
Considerations][1] in the *Amazon RDS User Guide.*
[1]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_CopySnapshot.html#USER_CopySnapshot.Options
@option options [String] :destination_region
@option options [String] :source_region
The source region of the snapshot. This is only needed when the
shapshot is encrypted and in a different region.
@return [DBSnapshot] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb#L508-L517 | train | Copy the snapshot to the current DB instance | [
30522,
13366,
6100,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
3120,
1035,
16962,
1035,
20057,
12326,
1035,
8909,
4765,
18095,
1024,
1030,
20057,
12326,
1035,
8909,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
61... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/rpc_server.rb | GRPC.RpcServer.run_till_terminated_or_interrupted | def run_till_terminated_or_interrupted(signals, wait_interval = 60)
@stop_server = false
@stop_server_mu = Mutex.new
@stop_server_cv = ConditionVariable.new
@stop_server_thread = Thread.new do
loop do
break if @stop_server
@stop_server_mu.synchronize do
@stop_server_cv.wait(@stop_server_mu, wait_interval)
end
end
# stop is surrounded by mutex, should handle multiple calls to stop
# correctly
stop
end
valid_signals = Signal.list
# register signal handlers
signals.each do |sig|
# input validation
if sig.class == String
sig.upcase!
if sig.start_with?('SIG')
# cut out the SIG prefix to see if valid signal
sig = sig[3..-1]
end
end
# register signal traps for all valid signals
if valid_signals.value?(sig) || valid_signals.key?(sig)
Signal.trap(sig) do
@stop_server = true
@stop_server_cv.broadcast
end
else
fail "#{sig} not a valid signal"
end
end
run
@stop_server_thread.join
end | ruby | def run_till_terminated_or_interrupted(signals, wait_interval = 60)
@stop_server = false
@stop_server_mu = Mutex.new
@stop_server_cv = ConditionVariable.new
@stop_server_thread = Thread.new do
loop do
break if @stop_server
@stop_server_mu.synchronize do
@stop_server_cv.wait(@stop_server_mu, wait_interval)
end
end
# stop is surrounded by mutex, should handle multiple calls to stop
# correctly
stop
end
valid_signals = Signal.list
# register signal handlers
signals.each do |sig|
# input validation
if sig.class == String
sig.upcase!
if sig.start_with?('SIG')
# cut out the SIG prefix to see if valid signal
sig = sig[3..-1]
end
end
# register signal traps for all valid signals
if valid_signals.value?(sig) || valid_signals.key?(sig)
Signal.trap(sig) do
@stop_server = true
@stop_server_cv.broadcast
end
else
fail "#{sig} not a valid signal"
end
end
run
@stop_server_thread.join
end | [
"def",
"run_till_terminated_or_interrupted",
"(",
"signals",
",",
"wait_interval",
"=",
"60",
")",
"@stop_server",
"=",
"false",
"@stop_server_mu",
"=",
"Mutex",
".",
"new",
"@stop_server_cv",
"=",
"ConditionVariable",
".",
"new",
"@stop_server_thread",
"=",
"Thread",... | runs the server with signal handlers
@param signals
List of String, Integer or both representing signals that the user
would like to send to the server for graceful shutdown
@param wait_interval (optional)
Integer seconds that user would like stop_server_thread to poll
stop_server | [
"runs",
"the",
"server",
"with",
"signal",
"handlers"
] | f3937f0e55227a4ef3a23f895d3b204a947610f8 | https://github.com/grpc/grpc/blob/f3937f0e55227a4ef3a23f895d3b204a947610f8/src/ruby/lib/grpc/generic/rpc_server.rb#L371-L416 | train | run the server until the server is terminated or interrupted or interrupted | [
30522,
13366,
2448,
1035,
6229,
1035,
12527,
1035,
2030,
1035,
7153,
1006,
7755,
1010,
3524,
1035,
13483,
1027,
3438,
1007,
1030,
2644,
1035,
8241,
1027,
6270,
1030,
2644,
1035,
8241,
1035,
14163,
1027,
20101,
2595,
1012,
2047,
1030,
2644,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
puppetlabs/puppet | lib/puppet/util/rdoc/generators/puppet_generator.rb | Generators.PuppetGenerator.generate_class_list | def generate_class_list(classes, modules, from, html_file, class_dir)
if from.is_module? and !@modules.has_key?(from.name)
k = HTMLPuppetModule.new(from, html_file, class_dir, @options)
classes << k
@modules[from.name] = k
modules << @modules[from.name]
elsif from.is_module?
modules << @modules[from.name]
elsif !from.is_module?
k = HTMLPuppetClass.new(from, html_file, class_dir, @options)
classes << k
end
from.each_classmodule do |mod|
generate_class_list(classes, modules, mod, html_file, class_dir)
end
end | ruby | def generate_class_list(classes, modules, from, html_file, class_dir)
if from.is_module? and !@modules.has_key?(from.name)
k = HTMLPuppetModule.new(from, html_file, class_dir, @options)
classes << k
@modules[from.name] = k
modules << @modules[from.name]
elsif from.is_module?
modules << @modules[from.name]
elsif !from.is_module?
k = HTMLPuppetClass.new(from, html_file, class_dir, @options)
classes << k
end
from.each_classmodule do |mod|
generate_class_list(classes, modules, mod, html_file, class_dir)
end
end | [
"def",
"generate_class_list",
"(",
"classes",
",",
"modules",
",",
"from",
",",
"html_file",
",",
"class_dir",
")",
"if",
"from",
".",
"is_module?",
"and",
"!",
"@modules",
".",
"has_key?",
"(",
"from",
".",
"name",
")",
"k",
"=",
"HTMLPuppetModule",
".",
... | produce a class/module list of HTMLPuppetModule/HTMLPuppetClass
based on the code object traversal. | [
"produce",
"a",
"class",
"/",
"module",
"list",
"of",
"HTMLPuppetModule",
"/",
"HTMLPuppetClass",
"based",
"on",
"the",
"code",
"object",
"traversal",
"."
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/util/rdoc/generators/puppet_generator.rb#L177-L192 | train | Generate the class list for the given class from the given module. | [
30522,
13366,
9699,
1035,
2465,
1035,
2862,
1006,
4280,
1010,
14184,
1010,
2013,
1010,
16129,
1035,
5371,
1010,
2465,
1035,
16101,
1007,
2065,
2013,
1012,
2003,
1035,
11336,
1029,
1998,
999,
1030,
14184,
1012,
2038,
1035,
3145,
1029,
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_compute/lib/2018-04-01/generated/azure_mgmt_compute/virtual_machine_extension_images.rb | Azure::Compute::Mgmt::V2018_04_01.VirtualMachineExtensionImages.list_versions | def list_versions(location, publisher_name, type, filter:nil, top:nil, orderby:nil, custom_headers:nil)
response = list_versions_async(location, publisher_name, type, filter:filter, top:top, orderby:orderby, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_versions(location, publisher_name, type, filter:nil, top:nil, orderby:nil, custom_headers:nil)
response = list_versions_async(location, publisher_name, type, filter:filter, top:top, orderby:orderby, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_versions",
"(",
"location",
",",
"publisher_name",
",",
"type",
",",
"filter",
":",
"nil",
",",
"top",
":",
"nil",
",",
"orderby",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_versions_async",
"(",
"location",
","... | Gets a list of virtual machine extension image versions.
@param location [String] The name of a supported Azure region.
@param publisher_name [String]
@param type [String]
@param filter [String] The filter to apply on the operation.
@param top [Integer]
@param orderby [String]
@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",
"list",
"of",
"virtual",
"machine",
"extension",
"image",
"versions",
"."
] | 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_extension_images.rb#L246-L249 | train | Gets the list of versions of the specified type. | [
30522,
13366,
2862,
1035,
4617,
1006,
3295,
1010,
6674,
1035,
2171,
1010,
2828,
1010,
11307,
1024,
9152,
2140,
1010,
2327,
1024,
9152,
2140,
1010,
2344,
3762,
1024,
9152,
2140,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/load_balancer_probes.rb | Azure::Network::Mgmt::V2018_07_01.LoadBalancerProbes.get_with_http_info | def get_with_http_info(resource_group_name, load_balancer_name, probe_name, custom_headers:nil)
get_async(resource_group_name, load_balancer_name, probe_name, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, load_balancer_name, probe_name, custom_headers:nil)
get_async(resource_group_name, load_balancer_name, probe_name, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"load_balancer_name",
",",
"probe_name",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"load_balancer_name",
",",
"probe_name",
",",
"custom_headers",
":custom_headers",
... | Gets load balancer probe.
@param resource_group_name [String] The name of the resource group.
@param load_balancer_name [String] The name of the load balancer.
@param probe_name [String] The name of the probe.
@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",
"load",
"balancer",
"probe",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/load_balancer_probes.rb#L143-L145 | train | Gets the specified load balancer probe. | [
30522,
13366,
2131,
1035,
30524,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7170,
1035,
5703,
2099,
1035,
2171,
1010,
15113,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
20346,
2015,
1007,
1012,
3643,
999,
2203,
102,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-changelog-generator/github-changelog-generator | lib/github_changelog_generator/octo_fetcher.rb | GitHubChangelogGenerator.OctoFetcher.fetch_events_async | def fetch_events_async(issues)
i = 0
threads = []
issues.each_slice(MAX_THREAD_NUMBER) do |issues_slice|
issues_slice.each do |issue|
threads << Thread.new do
issue["events"] = []
iterate_pages(@client, "issue_events", issue["number"]) do |new_event|
issue["events"].concat(new_event)
end
issue["events"] = issue["events"].map { |event| stringify_keys_deep(event.to_hash) }
print_in_same_line("Fetching events for issues and PR: #{i + 1}/#{issues.count}")
i += 1
end
end
threads.each(&:join)
threads = []
end
# to clear line from prev print
print_empty_line
Helper.log.info "Fetching events for issues and PR: #{i}"
end | ruby | def fetch_events_async(issues)
i = 0
threads = []
issues.each_slice(MAX_THREAD_NUMBER) do |issues_slice|
issues_slice.each do |issue|
threads << Thread.new do
issue["events"] = []
iterate_pages(@client, "issue_events", issue["number"]) do |new_event|
issue["events"].concat(new_event)
end
issue["events"] = issue["events"].map { |event| stringify_keys_deep(event.to_hash) }
print_in_same_line("Fetching events for issues and PR: #{i + 1}/#{issues.count}")
i += 1
end
end
threads.each(&:join)
threads = []
end
# to clear line from prev print
print_empty_line
Helper.log.info "Fetching events for issues and PR: #{i}"
end | [
"def",
"fetch_events_async",
"(",
"issues",
")",
"i",
"=",
"0",
"threads",
"=",
"[",
"]",
"issues",
".",
"each_slice",
"(",
"MAX_THREAD_NUMBER",
")",
"do",
"|",
"issues_slice",
"|",
"issues_slice",
".",
"each",
"do",
"|",
"issue",
"|",
"threads",
"<<",
"... | Fetch event for all issues and add them to 'events'
@param [Array] issues
@return [Void] | [
"Fetch",
"event",
"for",
"all",
"issues",
"and",
"add",
"them",
"to",
"events"
] | f18c64b5cc0d7473b059275b88385ac11ca8b564 | https://github.com/github-changelog-generator/github-changelog-generator/blob/f18c64b5cc0d7473b059275b88385ac11ca8b564/lib/github_changelog_generator/octo_fetcher.rb#L187-L211 | train | Fetch events for issues and PR | [
30522,
13366,
18584,
1035,
2824,
1035,
2004,
6038,
2278,
1006,
3314,
1007,
1045,
1027,
1014,
16457,
1027,
1031,
1033,
3314,
1012,
2169,
1035,
14704,
1006,
4098,
1035,
11689,
1035,
2193,
1007,
2079,
1064,
3314,
1035,
14704,
1064,
3314,
1035,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/overcommit | lib/overcommit/hook_context/pre_commit.rb | Overcommit::HookContext.PreCommit.restore_working_tree | def restore_working_tree
result = Overcommit::Utils.execute(%w[git stash pop --index --quiet])
unless result.success?
raise Overcommit::Exceptions::HookCleanupFailed,
"Unable to restore working tree after #{hook_script_name} hooks run:" \
"\nSTDOUT:#{result.stdout}\nSTDERR:#{result.stderr}"
end
end | ruby | def restore_working_tree
result = Overcommit::Utils.execute(%w[git stash pop --index --quiet])
unless result.success?
raise Overcommit::Exceptions::HookCleanupFailed,
"Unable to restore working tree after #{hook_script_name} hooks run:" \
"\nSTDOUT:#{result.stdout}\nSTDERR:#{result.stderr}"
end
end | [
"def",
"restore_working_tree",
"result",
"=",
"Overcommit",
"::",
"Utils",
".",
"execute",
"(",
"%w[",
"git",
"stash",
"pop",
"--index",
"--quiet",
"]",
")",
"unless",
"result",
".",
"success?",
"raise",
"Overcommit",
"::",
"Exceptions",
"::",
"HookCleanupFailed... | Applies the stash to the working tree to restore the user's state. | [
"Applies",
"the",
"stash",
"to",
"the",
"working",
"tree",
"to",
"restore",
"the",
"user",
"s",
"state",
"."
] | 35d60adb41da942178b789560968e3ad030b0ac7 | https://github.com/sds/overcommit/blob/35d60adb41da942178b789560968e3ad030b0ac7/lib/overcommit/hook_context/pre_commit.rb#L163-L170 | train | Restore the working tree from the working tree. | [
30522,
13366,
9239,
1035,
2551,
1035,
3392,
2765,
1027,
2058,
9006,
22930,
1024,
1024,
21183,
12146,
1012,
15389,
1006,
1003,
1059,
1031,
21025,
2102,
2358,
11823,
3769,
1011,
1011,
5950,
1011,
1011,
4251,
1033,
1007,
4983,
2765,
1012,
3112... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
activeadmin/arbre | lib/arbre/element.rb | Arbre.Element.method_missing | def method_missing(name, *args, &block)
if current_arbre_element.respond_to?(name)
current_arbre_element.send name, *args, &block
elsif assigns && assigns.has_key?(name)
assigns[name]
elsif helpers.respond_to?(name)
helpers.send(name, *args, &block)
else
super
end
end | ruby | def method_missing(name, *args, &block)
if current_arbre_element.respond_to?(name)
current_arbre_element.send name, *args, &block
elsif assigns && assigns.has_key?(name)
assigns[name]
elsif helpers.respond_to?(name)
helpers.send(name, *args, &block)
else
super
end
end | [
"def",
"method_missing",
"(",
"name",
",",
"*",
"args",
",",
"&",
"block",
")",
"if",
"current_arbre_element",
".",
"respond_to?",
"(",
"name",
")",
"current_arbre_element",
".",
"send",
"name",
",",
"args",
",",
"block",
"elsif",
"assigns",
"&&",
"assigns",... | Implements the method lookup chain. When you call a method that
doesn't exist, we:
1. Try to call the method on the current DOM context
2. Return an assigned variable of the same name
3. Call the method on the helper object
4. Call super | [
"Implements",
"the",
"method",
"lookup",
"chain",
".",
"When",
"you",
"call",
"a",
"method",
"that",
"doesn",
"t",
"exist",
"we",
":"
] | 8621789d2f3fcc8b92ca11cdded6383bba6fcf55 | https://github.com/activeadmin/arbre/blob/8621789d2f3fcc8b92ca11cdded6383bba6fcf55/lib/arbre/element.rb#L175-L185 | train | This method is called by the XMLParser class. | [
30522,
13366,
4118,
1035,
4394,
1006,
2171,
1010,
1008,
12098,
5620,
1010,
1004,
3796,
1007,
2065,
2783,
1035,
12098,
13578,
1035,
5783,
1012,
6869,
1035,
2000,
1029,
1006,
2171,
1007,
2783,
1035,
12098,
13578,
1035,
5783,
1012,
4604,
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... |
sds/scss-lint | lib/scss_lint/linter/space_after_comma.rb | SCSSLint.Linter::SpaceAfterComma.find_comma_position | def find_comma_position(arg) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
offset = 0
pos = arg.source_range.end_pos
if character_at(pos, offset) != ','
loop do
offset += 1
break if (right_char = character_at(pos, offset)) == ','
offset = -offset
break if (left_char = character_at(pos, offset)) == ','
offset = -offset
next unless right_char.nil? && left_char.nil?
offset = 0
pos = Sass::Source::Position.new(pos.line + 1, 1)
break if character_at(pos, offset) == ','
end
end
Sass::Source::Position.new(pos.line, pos.offset + offset)
end | ruby | def find_comma_position(arg) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
offset = 0
pos = arg.source_range.end_pos
if character_at(pos, offset) != ','
loop do
offset += 1
break if (right_char = character_at(pos, offset)) == ','
offset = -offset
break if (left_char = character_at(pos, offset)) == ','
offset = -offset
next unless right_char.nil? && left_char.nil?
offset = 0
pos = Sass::Source::Position.new(pos.line + 1, 1)
break if character_at(pos, offset) == ','
end
end
Sass::Source::Position.new(pos.line, pos.offset + offset)
end | [
"def",
"find_comma_position",
"(",
"arg",
")",
"# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity",
"offset",
"=",
"0",
"pos",
"=",
"arg",
".",
"source_range",
".",
"end_pos",
"if",
"character_at",
"(",
"pos",
",",
"offset",
")",
"!=",
"','",
"loop",
... | Find the comma following this argument.
The Sass parser is unpredictable in where it marks the end of the
source range. Thus we need to start at the indicated range, and check
left and right of that range, gradually moving further outward until
we find the comma. | [
"Find",
"the",
"comma",
"following",
"this",
"argument",
"."
] | e99afe4ede041a431a06e585c12ce82f6ad50116 | https://github.com/sds/scss-lint/blob/e99afe4ede041a431a06e585c12ce82f6ad50116/lib/scss_lint/linter/space_after_comma.rb#L103-L123 | train | Find the first comma character in the argument | [
30522,
13366,
2424,
1035,
4012,
2863,
30524,
1024,
4487,
19150,
12046,
2015,
1013,
5925,
5332,
4371,
1010,
12046,
2015,
1013,
22330,
20464,
9626,
4588,
9006,
19386,
3012,
16396,
1027,
1014,
13433,
2015,
1027,
12098,
2290,
1012,
3120,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
appium/ruby_lib | lib/appium_lib/ios/common/helper.rb | Appium.Ios.page | def page(opts = {})
class_name = opts.is_a?(Hash) ? opts.fetch(:class, nil) : opts
source = get_source
# current_context may be nil which breaks start_with
if current_context && current_context.start_with?('WEBVIEW')
parser = @android_html_parser ||= Nokogiri::HTML::SAX::Parser.new(Appium::Common::HTMLElements.new)
parser.document.reset
parser.document.filter = class_name
parser.parse source
result = parser.document.result
puts result
result
else
parser = Nokogiri::XML::SAX::Parser.new(UITestElementsPrinter.new)
if class_name
parser.document.filter = class_name.is_a?(Symbol) ? class_name.to_s : class_name
end
parser.parse source
nil
end
end | ruby | def page(opts = {})
class_name = opts.is_a?(Hash) ? opts.fetch(:class, nil) : opts
source = get_source
# current_context may be nil which breaks start_with
if current_context && current_context.start_with?('WEBVIEW')
parser = @android_html_parser ||= Nokogiri::HTML::SAX::Parser.new(Appium::Common::HTMLElements.new)
parser.document.reset
parser.document.filter = class_name
parser.parse source
result = parser.document.result
puts result
result
else
parser = Nokogiri::XML::SAX::Parser.new(UITestElementsPrinter.new)
if class_name
parser.document.filter = class_name.is_a?(Symbol) ? class_name.to_s : class_name
end
parser.parse source
nil
end
end | [
"def",
"page",
"(",
"opts",
"=",
"{",
"}",
")",
"class_name",
"=",
"opts",
".",
"is_a?",
"(",
"Hash",
")",
"?",
"opts",
".",
"fetch",
"(",
":class",
",",
"nil",
")",
":",
"opts",
"source",
"=",
"get_source",
"# current_context may be nil which breaks start... | Prints a string of interesting elements to the console.
@example
```ruby
page class: :UIAButton # filter on buttons
page class: :UIAButton, window: 1
```
@option visible [Symbol] visible value to filter on
@option class [Symbol] class name to filter on
@return [void] | [
"Prints",
"a",
"string",
"of",
"interesting",
"elements",
"to",
"the",
"console",
"."
] | 1f5898400dd1928bfe42ddd5f842d1f8738f2f76 | https://github.com/appium/ruby_lib/blob/1f5898400dd1928bfe42ddd5f842d1f8738f2f76/lib/appium_lib/ios/common/helper.rb#L73-L95 | train | Returns the page object for the current context. | [
30522,
13366,
3931,
1006,
23569,
2015,
1027,
1063,
1065,
1007,
2465,
1035,
2171,
1027,
23569,
2015,
1012,
2003,
1035,
1037,
1029,
1006,
23325,
1007,
1029,
23569,
2015,
1012,
18584,
1006,
1024,
2465,
1010,
9152,
2140,
1007,
1024,
23569,
2015... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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_application_type_info_list_with_http_info | def get_application_type_info_list_with_http_info(application_type_definition_kind_filter:0, exclude_application_parameters:false, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
get_application_type_info_list_async(application_type_definition_kind_filter:application_type_definition_kind_filter, exclude_application_parameters:exclude_application_parameters, continuation_token:continuation_token, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def get_application_type_info_list_with_http_info(application_type_definition_kind_filter:0, exclude_application_parameters:false, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
get_application_type_info_list_async(application_type_definition_kind_filter:application_type_definition_kind_filter, exclude_application_parameters:exclude_application_parameters, continuation_token:continuation_token, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"get_application_type_info_list_with_http_info",
"(",
"application_type_definition_kind_filter",
":",
"0",
",",
"exclude_application_parameters",
":",
"false",
",",
"continuation_token",
":",
"nil",
",",
"max_results",
":",
"0",
",",
"timeout",
":",
"60",
",",
"c... | Gets the list of application types in the Service Fabric cluster.
Returns the information about the application types that are provisioned or
in the process of being provisioned in the Service Fabric cluster. Each
version of an application type is returned as one application type. The
response includes the name, version, status and other details about the
application type. This is a paged query, meaning that if not all of the
application types fit in a page, one page of results is returned as well as a
continuation token which can be used to get the next page. For example, if
there are 10 application types but a page only fits the first 3 application
types, or if max results is set to 3, then 3 is returned. To access the rest
of the results, retrieve subsequent pages by using the returned continuation
token in the next query. An empty continuation token is returned if there are
no subsequent pages.
@param application_type_definition_kind_filter [Integer] Used to filter on
ApplicationTypeDefinitionKind which is the mechanism used to define a Service
Fabric application type.
- Default - Default value, which performs the same function as selecting
"All". The value is 0.
- All - Filter that matches input with any ApplicationTypeDefinitionKind
value. The value is 65535.
- ServiceFabricApplicationPackage - Filter that matches input with
ApplicationTypeDefinitionKind value ServiceFabricApplicationPackage. The
value is 1.
- Compose - Filter that matches input with ApplicationTypeDefinitionKind
value Compose. The value is 2.
@param exclude_application_parameters [Boolean] The flag that specifies
whether application parameters will be excluded from the result.
@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 max_results [Integer] The maximum number of results to be returned as
part of the paged queries. This parameter defines the upper bound on the
number of results returned. The results returned can be less than the
specified maximum results if they do not fit in the message as per the max
message size restrictions defined in the configuration. If this parameter is
zero or not specified, the paged queries includes as many results as possible
that fit in the return message.
@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",
"list",
"of",
"application",
"types",
"in",
"the",
"Service",
"Fabric",
"cluster",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L4738-L4740 | train | Gets the list of all the applications of the specified type. | [
30522,
13366,
2131,
1035,
4646,
1035,
2828,
1035,
18558,
1035,
2862,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
4646,
1035,
2828,
1035,
6210,
1035,
2785,
1035,
11307,
1024,
1014,
1010,
23329,
1035,
4646,
1035,
11709,
1024,
6270,
1010,
13633... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.resume_service_backup | def resume_service_backup(service_id, timeout:60, custom_headers:nil)
response = resume_service_backup_async(service_id, timeout:timeout, custom_headers:custom_headers).value!
nil
end | ruby | def resume_service_backup(service_id, timeout:60, custom_headers:nil)
response = resume_service_backup_async(service_id, timeout:timeout, custom_headers:custom_headers).value!
nil
end | [
"def",
"resume_service_backup",
"(",
"service_id",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"resume_service_backup_async",
"(",
"service_id",
",",
"timeout",
":",
"timeout",
",",
"custom_headers",
":custom_headers",
")",
... | Resumes periodic backup of a Service Fabric service which was previously
suspended.
The previously suspended Service Fabric service resumes taking periodic
backup as per the backup policy currently configured for the same.
@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 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. | [
"Resumes",
"periodic",
"backup",
"of",
"a",
"Service",
"Fabric",
"service",
"which",
"was",
"previously",
"suspended",
"."
] | 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#L24610-L24613 | train | Resumes a service backup of a service. | [
30522,
13366,
13746,
1035,
2326,
1035,
10200,
1006,
2326,
1035,
8909,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
13746,
1035,
2326,
1035,
10200,
1035,
2004,
6038,
2278,
1006,
2326,
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_recovery_services_site_recovery/lib/2018-01-10/generated/azure_mgmt_recovery_services_site_recovery/replication_recovery_plans.rb | Azure::RecoveryServicesSiteRecovery::Mgmt::V2018_01_10.ReplicationRecoveryPlans.failover_commit_async | def failover_commit_async(recovery_plan_name, custom_headers:nil)
# Send request
promise = begin_failover_commit_async(recovery_plan_name, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2018_01_10::Models::RecoveryPlan.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | ruby | def failover_commit_async(recovery_plan_name, custom_headers:nil)
# Send request
promise = begin_failover_commit_async(recovery_plan_name, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2018_01_10::Models::RecoveryPlan.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | [
"def",
"failover_commit_async",
"(",
"recovery_plan_name",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_failover_commit_async",
"(",
"recovery_plan_name",
",",
"custom_headers",
":custom_headers",
")",
"promise",
"=",
"promise",
".",
... | @param recovery_plan_name [String] Recovery plan name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"recovery_plan_name",
"[",
"String",
"]",
"Recovery",
"plan",
"name",
".",
"@param",
"custom_headers",
"[",
"Hash",
"{",
"String",
"=",
">",
"String",
"}",
"]",
"A",
"hash",
"of",
"custom",
"headers",
"that",
"will",
"be",
"added",
"to",
"the",
... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_recovery_services_site_recovery/lib/2018-01-10/generated/azure_mgmt_recovery_services_site_recovery/replication_recovery_plans.rb#L362-L378 | train | Gets the current state of a recovery plan failover commit. | [
30522,
13366,
8246,
7840,
1035,
10797,
1035,
2004,
6038,
2278,
1006,
7233,
1035,
2933,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,
4088,
1035,
30524,
7233,
1035,
2933,
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... |
mongodb/mongo-ruby-driver | lib/mongo/client.rb | Mongo.Client.list_databases | def list_databases(filter = {}, name_only = false, opts = {})
cmd = { listDatabases: 1 }
cmd[:nameOnly] = !!name_only
cmd[:filter] = filter unless filter.empty?
use(Database::ADMIN).command(cmd, opts).first[Database::DATABASES]
end | ruby | def list_databases(filter = {}, name_only = false, opts = {})
cmd = { listDatabases: 1 }
cmd[:nameOnly] = !!name_only
cmd[:filter] = filter unless filter.empty?
use(Database::ADMIN).command(cmd, opts).first[Database::DATABASES]
end | [
"def",
"list_databases",
"(",
"filter",
"=",
"{",
"}",
",",
"name_only",
"=",
"false",
",",
"opts",
"=",
"{",
"}",
")",
"cmd",
"=",
"{",
"listDatabases",
":",
"1",
"}",
"cmd",
"[",
":nameOnly",
"]",
"=",
"!",
"!",
"name_only",
"cmd",
"[",
":filter"... | Get info for each database.
@example Get the info for each database.
client.list_databases
@param [ Hash ] filter The filter criteria for getting a list of databases.
@param [ true, false ] name_only Whether to only return each database name without full metadata.
@param [ Hash ] opts The command options.
@return [ Array<Hash> ] The info for each database.
@since 2.0.5 | [
"Get",
"info",
"for",
"each",
"database",
"."
] | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/client.rb#L611-L616 | train | List all databases | [
30522,
13366,
2862,
1035,
17881,
1006,
11307,
1027,
1063,
1065,
1010,
2171,
1035,
2069,
1027,
6270,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
4642,
2094,
1027,
1063,
2862,
2850,
2696,
15058,
2015,
1024,
1015,
1065,
4642,
2094,
1031,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/replication_links.rb | Azure::SQL::Mgmt::V2014_04_01.ReplicationLinks.begin_failover | def begin_failover(resource_group_name, server_name, database_name, link_id, custom_headers:nil)
response = begin_failover_async(resource_group_name, server_name, database_name, link_id, custom_headers:custom_headers).value!
nil
end | ruby | def begin_failover(resource_group_name, server_name, database_name, link_id, custom_headers:nil)
response = begin_failover_async(resource_group_name, server_name, database_name, link_id, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_failover",
"(",
"resource_group_name",
",",
"server_name",
",",
"database_name",
",",
"link_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_failover_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"database_name",
",",
... | Sets which replica database is primary by failing over from the current
primary replica database.
@param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param server_name [String] The name of the server.
@param database_name [String] The name of the database that has the
replication link to be failed over.
@param link_id [String] The ID of the replication link to be failed over.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Sets",
"which",
"replica",
"database",
"is",
"primary",
"by",
"failing",
"over",
"from",
"the",
"current",
"primary",
"replica",
"database",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/replication_links.rb#L446-L449 | train | Gets the index of the elastic network link that is failing over. | [
30522,
13366,
4088,
1035,
8246,
7840,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
7809,
1035,
2171,
1010,
4957,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
8246,
7840,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
decidim/decidim | decidim-core/lib/decidim/content_block_registry.rb | Decidim.ContentBlockRegistry.register | def register(scope, name)
scope = scope.to_s
block_exists = content_blocks[scope].any? { |content_block| content_block.name == name }
if block_exists
raise(
ContentBlockAlreadyRegistered,
"There's a content block already registered with the name `:#{name}` for the scope `:#{scope}, must be unique"
)
end
content_block = ContentBlockManifest.new(name: name)
yield(content_block)
content_block.validate!
content_blocks[scope].push(content_block)
end | ruby | def register(scope, name)
scope = scope.to_s
block_exists = content_blocks[scope].any? { |content_block| content_block.name == name }
if block_exists
raise(
ContentBlockAlreadyRegistered,
"There's a content block already registered with the name `:#{name}` for the scope `:#{scope}, must be unique"
)
end
content_block = ContentBlockManifest.new(name: name)
yield(content_block)
content_block.validate!
content_blocks[scope].push(content_block)
end | [
"def",
"register",
"(",
"scope",
",",
"name",
")",
"scope",
"=",
"scope",
".",
"to_s",
"block_exists",
"=",
"content_blocks",
"[",
"scope",
"]",
".",
"any?",
"{",
"|",
"content_block",
"|",
"content_block",
".",
"name",
"==",
"name",
"}",
"if",
"block_ex... | Public: Registers a content block for the home page.
scope - a symbol or string representing the scope of the content block.
Will be persisted as a string.
name - a symbol representing the name of the content block
&block - The content block definition.
Returns nothing. Raises an error if there's already a content block
registered with that name. | [
"Public",
":",
"Registers",
"a",
"content",
"block",
"for",
"the",
"home",
"page",
"."
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/lib/decidim/content_block_registry.rb#L52-L69 | train | Register a content block with the given scope. | [
30522,
13366,
4236,
1006,
9531,
1010,
2171,
1007,
9531,
1027,
9531,
1012,
2000,
1035,
1055,
3796,
1035,
6526,
1027,
4180,
1035,
5991,
1031,
9531,
1033,
1012,
2151,
1029,
1063,
1064,
30524,
1065,
1036,
2005,
1996,
9531,
1036,
1024,
1001,
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_sql/lib/2014-04-01/generated/azure_mgmt_sql/firewall_rules.rb | Azure::SQL::Mgmt::V2014_04_01.FirewallRules.delete_with_http_info | def delete_with_http_info(resource_group_name, server_name, firewall_rule_name, custom_headers:nil)
delete_async(resource_group_name, server_name, firewall_rule_name, custom_headers:custom_headers).value!
end | ruby | def delete_with_http_info(resource_group_name, server_name, firewall_rule_name, custom_headers:nil)
delete_async(resource_group_name, server_name, firewall_rule_name, custom_headers:custom_headers).value!
end | [
"def",
"delete_with_http_info",
"(",
"resource_group_name",
",",
"server_name",
",",
"firewall_rule_name",
",",
"custom_headers",
":",
"nil",
")",
"delete_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"firewall_rule_name",
",",
"custom_headers",
":custom_he... | Deletes a firewall rule.
@param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param server_name [String] The name of the server.
@param firewall_rule_name [String] The name of the firewall rule.
@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",
"firewall",
"rule",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/firewall_rules.rb#L183-L185 | train | Deletes the specified firewall rule from the specified server. | [
30522,
13366,
3972,
12870,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
2543,
9628,
1035,
3627,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3972,
12870,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/api_release.rb | Azure::ApiManagement::Mgmt::V2018_01_01.ApiRelease.create_with_http_info | def create_with_http_info(resource_group_name, service_name, api_id, release_id, parameters, custom_headers:nil)
create_async(resource_group_name, service_name, api_id, release_id, parameters, custom_headers:custom_headers).value!
end | ruby | def create_with_http_info(resource_group_name, service_name, api_id, release_id, parameters, custom_headers:nil)
create_async(resource_group_name, service_name, api_id, release_id, parameters, custom_headers:custom_headers).value!
end | [
"def",
"create_with_http_info",
"(",
"resource_group_name",
",",
"service_name",
",",
"api_id",
",",
"release_id",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"create_async",
"(",
"resource_group_name",
",",
"service_name",
",",
"api_id",
",",
"releas... | Creates a new Release for the API.
@param resource_group_name [String] The name of the resource group.
@param service_name [String] The name of the API Management service.
@param api_id [String] API identifier. Must be unique in the current API
Management service instance.
@param release_id [String] Release identifier within an API. Must be unique
in the current API Management service instance.
@param parameters [ApiReleaseContract] Create parameters.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Creates",
"a",
"new",
"Release",
"for",
"the",
"API",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/api_release.rb#L418-L420 | train | Creates a new chunk of a chunk of a chunk of the image. | [
30522,
13366,
3443,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
17928,
1035,
8909,
1010,
2713,
1035,
8909,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3443,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_cdn/lib/2017-04-02/generated/azure_mgmt_cdn/endpoints.rb | Azure::CDN::Mgmt::V2017_04_02.Endpoints.load_content | def load_content(resource_group_name, profile_name, endpoint_name, content_file_paths, custom_headers:nil)
response = load_content_async(resource_group_name, profile_name, endpoint_name, content_file_paths, custom_headers:custom_headers).value!
nil
end | ruby | def load_content(resource_group_name, profile_name, endpoint_name, content_file_paths, custom_headers:nil)
response = load_content_async(resource_group_name, profile_name, endpoint_name, content_file_paths, custom_headers:custom_headers).value!
nil
end | [
"def",
"load_content",
"(",
"resource_group_name",
",",
"profile_name",
",",
"endpoint_name",
",",
"content_file_paths",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"load_content_async",
"(",
"resource_group_name",
",",
"profile_name",
",",
"endpoint_name",... | Pre-loads a content to CDN. Available for Verizon Profiles.
@param resource_group_name [String] Name of the Resource group within the
Azure subscription.
@param profile_name [String] Name of the CDN profile which is unique within
the resource group.
@param endpoint_name [String] Name of the endpoint under the profile which is
unique globally.
@param content_file_paths [LoadParameters] The path to the content to be
loaded. Path should be a full URL, e.g. ‘/pictures/city.png' which loads a
single file
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Pre",
"-",
"loads",
"a",
"content",
"to",
"CDN",
".",
"Available",
"for",
"Verizon",
"Profiles",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_cdn/lib/2017-04-02/generated/azure_mgmt_cdn/endpoints.rb#L565-L568 | train | Loads the content of the specified endpoint. | [
30522,
13366,
7170,
1035,
4180,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
6337,
1035,
2171,
1010,
2203,
8400,
1035,
2171,
1010,
4180,
1035,
5371,
1035,
10425,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
7170,
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... |
watir/watir | lib/watir/elements/select.rb | Watir.Select.select! | def select!(*str_or_rx)
results = str_or_rx.flatten.map { |v| select_by!(v, :single) }
results.first
end | ruby | def select!(*str_or_rx)
results = str_or_rx.flatten.map { |v| select_by!(v, :single) }
results.first
end | [
"def",
"select!",
"(",
"*",
"str_or_rx",
")",
"results",
"=",
"str_or_rx",
".",
"flatten",
".",
"map",
"{",
"|",
"v",
"|",
"select_by!",
"(",
"v",
",",
":single",
")",
"}",
"results",
".",
"first",
"end"
] | Uses JavaScript to select the option whose text matches the given string.
@param [String, Regexp] str_or_rx
@raise [Watir::Exception::NoValueFoundException] if the value does not exist. | [
"Uses",
"JavaScript",
"to",
"select",
"the",
"option",
"whose",
"text",
"matches",
"the",
"given",
"string",
"."
] | 2d8db09811c6221ae401b85b2f61f5fa66e463a3 | https://github.com/watir/watir/blob/2d8db09811c6221ae401b85b2f61f5fa66e463a3/lib/watir/elements/select.rb#L57-L60 | train | Select the first element of the list | [
30522,
13366,
7276,
999,
1006,
1008,
2358,
2099,
1035,
2030,
1035,
1054,
2595,
1007,
3463,
1027,
2358,
2099,
1035,
2030,
1035,
1054,
2595,
1012,
4257,
6528,
1012,
4949,
1063,
1064,
1058,
1064,
7276,
1035,
2011,
999,
1006,
1058,
1010,
1024... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_advisor/lib/2017-03-31/generated/azure_mgmt_advisor/suppressions.rb | Azure::Advisor::Mgmt::V2017_03_31.Suppressions.create_with_http_info | def create_with_http_info(resource_uri, recommendation_id, name, suppression_contract, custom_headers:nil)
create_async(resource_uri, recommendation_id, name, suppression_contract, custom_headers:custom_headers).value!
end | ruby | def create_with_http_info(resource_uri, recommendation_id, name, suppression_contract, custom_headers:nil)
create_async(resource_uri, recommendation_id, name, suppression_contract, custom_headers:custom_headers).value!
end | [
"def",
"create_with_http_info",
"(",
"resource_uri",
",",
"recommendation_id",
",",
"name",
",",
"suppression_contract",
",",
"custom_headers",
":",
"nil",
")",
"create_async",
"(",
"resource_uri",
",",
"recommendation_id",
",",
"name",
",",
"suppression_contract",
",... | Enables the snoozed or dismissed attribute of a recommendation. The snoozed
or dismissed attribute is referred to as a suppression. Use this API to
create or update the snoozed or dismissed status of a recommendation.
@param resource_uri [String] The fully qualified Azure Resource Manager
identifier of the resource to which the recommendation applies.
@param recommendation_id [String] The recommendation ID.
@param name [String] The name of the suppression.
@param suppression_contract [SuppressionContract] The snoozed or dismissed
attribute; for example, the snooze duration.
@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. | [
"Enables",
"the",
"snoozed",
"or",
"dismissed",
"attribute",
"of",
"a",
"recommendation",
".",
"The",
"snoozed",
"or",
"dismissed",
"attribute",
"is",
"referred",
"to",
"as",
"a",
"suppression",
".",
"Use",
"this",
"API",
"to",
"create",
"or",
"update",
"the... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_advisor/lib/2017-03-31/generated/azure_mgmt_advisor/suppressions.rb#L159-L161 | train | Creates a new Central Season. | [
30522,
13366,
3443,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
24471,
30524,
2171,
1010,
16341,
1035,
3206,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
20346,
2015,
1007,
1012,
3643,
999,
2203,
102,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/users/followers.rb | Github.Client::Users::Followers.following? | def following?(*args)
arguments(args, required: [:username])
params = arguments.params
if target_user = params.delete('target_user')
get_request("/users/#{arguments.username}/following/#{target_user}", params)
else
get_request("/user/following/#{arguments.username}", params)
end
true
rescue Github::Error::NotFound
false
end | ruby | def following?(*args)
arguments(args, required: [:username])
params = arguments.params
if target_user = params.delete('target_user')
get_request("/users/#{arguments.username}/following/#{target_user}", params)
else
get_request("/user/following/#{arguments.username}", params)
end
true
rescue Github::Error::NotFound
false
end | [
"def",
"following?",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":username",
"]",
")",
"params",
"=",
"arguments",
".",
"params",
"if",
"target_user",
"=",
"params",
".",
"delete",
"(",
"'target_user'",
")",
"get_request",
... | Check if you are following a user
@example
github = Github.new oauth_token: '...'
github.users.followers.following? 'user-name'
github.users.followers.following? username: 'user-name'
Check if one user follows another
@example
github = Github.new oauth_token: '...'
github.users.followers.following? username: 'user-name',
target_user: 'target-user-name'
@api public | [
"Check",
"if",
"you",
"are",
"following",
"a",
"user"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/users/followers.rb#L77-L88 | train | Get the following of a user | [
30522,
13366,
2206,
1029,
1006,
1008,
12098,
5620,
1007,
9918,
1006,
12098,
5620,
1010,
3223,
1024,
1031,
1024,
5310,
18442,
1033,
1007,
11498,
5244,
1027,
9918,
1012,
11498,
5244,
2065,
4539,
1035,
5310,
1027,
11498,
5244,
1012,
3972,
1287... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/2018-05-01/generated/azure_mgmt_resources/deployment_operations.rb | Azure::Resources::Mgmt::V2018_05_01.DeploymentOperations.list_at_subscription_scope_as_lazy | def list_at_subscription_scope_as_lazy(deployment_name, top:nil, custom_headers:nil)
response = list_at_subscription_scope_async(deployment_name, top:top, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_at_subscription_scope_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_at_subscription_scope_as_lazy(deployment_name, top:nil, custom_headers:nil)
response = list_at_subscription_scope_async(deployment_name, top:top, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_at_subscription_scope_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_at_subscription_scope_as_lazy",
"(",
"deployment_name",
",",
"top",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_at_subscription_scope_async",
"(",
"deployment_name",
",",
"top",
":",
"top",
",",
"custom_headers",
":custom_he... | Gets all deployments operations for a deployment.
@param deployment_name [String] The name of the deployment with the operation
to get.
@param top [Integer] The number of results to return.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [DeploymentOperationsListResult] which provide lazy access to pages
of the response. | [
"Gets",
"all",
"deployments",
"operations",
"for",
"a",
"deployment",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_resources/lib/2018-05-01/generated/azure_mgmt_resources/deployment_operations.rb#L616-L625 | train | Gets the list of all the managed managed | [
30522,
13366,
2862,
1035,
2012,
1035,
15002,
1035,
9531,
1035,
2004,
1035,
13971,
1006,
10813,
1035,
2171,
1010,
2327,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2012,
1035,
15002,
1035,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
meew0/discordrb | lib/discordrb/webhooks/embeds.rb | Discordrb::Webhooks.Embed.colour= | def colour=(value)
if value.nil?
@colour = nil
elsif value.is_a? Integer
raise ArgumentError, 'Embed colour must be 24-bit!' if value >= 16_777_216
@colour = value
elsif value.is_a? String
self.colour = value.delete('#').to_i(16)
elsif value.is_a? Array
raise ArgumentError, 'Colour tuple must have three values!' if value.length != 3
self.colour = value[0] << 16 | value[1] << 8 | value[2]
else
self.colour = value.to_i
end
end | ruby | def colour=(value)
if value.nil?
@colour = nil
elsif value.is_a? Integer
raise ArgumentError, 'Embed colour must be 24-bit!' if value >= 16_777_216
@colour = value
elsif value.is_a? String
self.colour = value.delete('#').to_i(16)
elsif value.is_a? Array
raise ArgumentError, 'Colour tuple must have three values!' if value.length != 3
self.colour = value[0] << 16 | value[1] << 8 | value[2]
else
self.colour = value.to_i
end
end | [
"def",
"colour",
"=",
"(",
"value",
")",
"if",
"value",
".",
"nil?",
"@colour",
"=",
"nil",
"elsif",
"value",
".",
"is_a?",
"Integer",
"raise",
"ArgumentError",
",",
"'Embed colour must be 24-bit!'",
"if",
"value",
">=",
"16_777_216",
"@colour",
"=",
"value",
... | Sets the colour of the bar to the side of the embed to something new.
@param value [Integer, String, {Integer, Integer, Integer}, #to_i, nil] The colour in decimal, hexadecimal, R/G/B decimal, or nil to clear the embeds colour
form. | [
"Sets",
"the",
"colour",
"of",
"the",
"bar",
"to",
"the",
"side",
"of",
"the",
"embed",
"to",
"something",
"new",
"."
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/webhooks/embeds.rb#L42-L58 | train | Set the colour of the embed. | [
30522,
13366,
6120,
1027,
1006,
3643,
1007,
2065,
3643,
1012,
9152,
30524,
9152,
2140,
3449,
5332,
2546,
3643,
1012,
2003,
1035,
1037,
1029,
16109,
5333,
6685,
2121,
29165,
1010,
1005,
7861,
8270,
6120,
2442,
2022,
2484,
1011,
2978,
999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.cas | def cas(key, ttl=nil, options=nil, &block)
cas_core(key, false, ttl, options, &block)
end | ruby | def cas(key, ttl=nil, options=nil, &block)
cas_core(key, false, ttl, options, &block)
end | [
"def",
"cas",
"(",
"key",
",",
"ttl",
"=",
"nil",
",",
"options",
"=",
"nil",
",",
"&",
"block",
")",
"cas_core",
"(",
"key",
",",
"false",
",",
"ttl",
",",
"options",
",",
"block",
")",
"end"
] | compare and swap values using optimistic locking.
Fetch the existing value for key.
If it exists, yield the value to the block.
Add the block's return value as the new value for the key.
Add will fail if someone else changed the value.
Returns:
- nil if the key did not exist.
- false if the value was changed by someone else.
- true if the value was successfully updated. | [
"compare",
"and",
"swap",
"values",
"using",
"optimistic",
"locking",
".",
"Fetch",
"the",
"existing",
"value",
"for",
"key",
".",
"If",
"it",
"exists",
"yield",
"the",
"value",
"to",
"the",
"block",
".",
"Add",
"the",
"block",
"s",
"return",
"value",
"a... | 5755dbfd06e333a8239f976d4b10492b4555b726 | https://github.com/petergoldstein/dalli/blob/5755dbfd06e333a8239f976d4b10492b4555b726/lib/dalli/client.rb#L114-L116 | train | CAS the value at the given key. | [
30522,
13366,
25222,
1006,
3145,
1010,
23746,
2140,
1027,
9152,
2140,
1010,
7047,
1027,
9152,
2140,
1010,
1004,
3796,
1007,
25222,
1035,
4563,
1006,
3145,
1010,
6270,
1010,
23746,
2140,
1010,
7047,
1010,
1004,
3796,
1007,
2203,
102,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
chef/chef | chef-config/lib/chef-config/workstation_config_loader.rb | ChefConfig.WorkstationConfigLoader.apply_defaults | def apply_defaults
# If we don't have a better guess use the username.
Config[:node_name] ||= Etc.getlogin
# If we don't have a key (path or inline) check user.pem and $node_name.pem.
unless Config.key?(:client_key) || Config.key?(:client_key_contents)
key_path = find_default_key(["#{Config[:node_name]}.pem", "user.pem"])
Config[:client_key] = key_path if key_path
end
# Similarly look for a validation key file, though this should be less
# common these days.
unless Config.key?(:validation_key) || Config.key?(:validation_key_contents)
key_path = find_default_key(["#{Config[:validation_client_name]}.pem", "validator.pem", "validation.pem"])
Config[:validation_key] = key_path if key_path
end
end | ruby | def apply_defaults
# If we don't have a better guess use the username.
Config[:node_name] ||= Etc.getlogin
# If we don't have a key (path or inline) check user.pem and $node_name.pem.
unless Config.key?(:client_key) || Config.key?(:client_key_contents)
key_path = find_default_key(["#{Config[:node_name]}.pem", "user.pem"])
Config[:client_key] = key_path if key_path
end
# Similarly look for a validation key file, though this should be less
# common these days.
unless Config.key?(:validation_key) || Config.key?(:validation_key_contents)
key_path = find_default_key(["#{Config[:validation_client_name]}.pem", "validator.pem", "validation.pem"])
Config[:validation_key] = key_path if key_path
end
end | [
"def",
"apply_defaults",
"# If we don't have a better guess use the username.",
"Config",
"[",
":node_name",
"]",
"||=",
"Etc",
".",
"getlogin",
"# If we don't have a key (path or inline) check user.pem and $node_name.pem.",
"unless",
"Config",
".",
"key?",
"(",
":client_key",
")... | Apply default configuration values for workstation-style tools.
Global defaults should go in {ChefConfig::Config} instead, this is only
for things like `knife` and `chef`.
@api private
@since 14.3
@return [void] | [
"Apply",
"default",
"configuration",
"values",
"for",
"workstation",
"-",
"style",
"tools",
"."
] | 61f69e18e69e0dca6e8cffdcd7451181d874cdb3 | https://github.com/chef/chef/blob/61f69e18e69e0dca6e8cffdcd7451181d874cdb3/chef-config/lib/chef-config/workstation_config_loader.rb#L223-L237 | train | Apply defaults to the current configuration | [
30522,
13366,
6611,
1035,
12398,
2015,
1001,
2065,
2057,
2123,
1005,
1056,
2031,
1037,
2488,
3984,
2224,
1996,
5310,
18442,
1012,
9530,
8873,
2290,
1031,
1024,
13045,
1035,
2171,
1033,
1064,
1064,
1027,
4385,
1012,
2131,
21197,
2378,
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... |
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.recover_deleted_secret | def recover_deleted_secret(vault_base_url, secret_name, custom_headers:nil)
response = recover_deleted_secret_async(vault_base_url, secret_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def recover_deleted_secret(vault_base_url, secret_name, custom_headers:nil)
response = recover_deleted_secret_async(vault_base_url, secret_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"recover_deleted_secret",
"(",
"vault_base_url",
",",
"secret_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"recover_deleted_secret_async",
"(",
"vault_base_url",
",",
"secret_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
... | Recovers the deleted secret to the latest version.
Recovers the deleted secret in the specified vault. This operation can only
be performed on a soft-delete enabled vault. This operation requires the
secrets/recover permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param secret_name [String] The name of the deleted secret.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [SecretBundle] operation results. | [
"Recovers",
"the",
"deleted",
"secret",
"to",
"the",
"latest",
"version",
"."
] | 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#L3696-L3699 | train | Recover the deleted secret. | [
30522,
13366,
8980,
1035,
17159,
1035,
3595,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
3595,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
8980,
1035,
17159,
1035,
3595,
1035,
2004,
6038,
2278,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
httprb/http | lib/http/connection.rb | HTTP.Connection.send_request | def send_request(req)
raise StateError, "Tried to send a request while one is pending already. Make sure you read off the body." if @pending_response
raise StateError, "Tried to send a request while a response is pending. Make sure you read off the body." if @pending_request
@pending_request = true
req.stream @socket
@pending_response = true
@pending_request = false
end | ruby | def send_request(req)
raise StateError, "Tried to send a request while one is pending already. Make sure you read off the body." if @pending_response
raise StateError, "Tried to send a request while a response is pending. Make sure you read off the body." if @pending_request
@pending_request = true
req.stream @socket
@pending_response = true
@pending_request = false
end | [
"def",
"send_request",
"(",
"req",
")",
"raise",
"StateError",
",",
"\"Tried to send a request while one is pending already. Make sure you read off the body.\"",
"if",
"@pending_response",
"raise",
"StateError",
",",
"\"Tried to send a request while a response is pending. Make sure you r... | Send a request to the server
@param [Request] req Request to send to the server
@return [nil] | [
"Send",
"a",
"request",
"to",
"the",
"server"
] | f37a10ea4fab3ee411907ea2e4251ddf0ca33a93 | https://github.com/httprb/http/blob/f37a10ea4fab3ee411907ea2e4251ddf0ca33a93/lib/http/connection.rb#L70-L80 | train | Send a request to the server. | [
30522,
13366,
4604,
1035,
5227,
1006,
2128,
4160,
1007,
5333,
2110,
2121,
29165,
1010,
1000,
2699,
2000,
4604,
1037,
5227,
2096,
2028,
2003,
14223,
2525,
1012,
2191,
2469,
2017,
3191,
2125,
1996,
2303,
1012,
1000,
2065,
1030,
14223,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
decidim/decidim | decidim-core/app/models/decidim/content_block.rb | Decidim.ContentBlock.images_container | def images_container
return @images_container if @images_container
manifest = self.manifest
@images_container = Class.new do
extend ::CarrierWave::Mount
include ActiveModel::Validations
cattr_accessor :manifest, :manifest_scope
attr_reader :content_block
# Needed to calculate uploads URLs
delegate :id, to: :content_block
# Needed to customize the upload URL
def self.name
to_s.camelize
end
# Needed to customize the upload URL
def self.to_s
"decidim/#{manifest.name.to_s.underscore}_#{manifest_scope.to_s.underscore}_content_block"
end
def initialize(content_block)
@content_block = content_block
end
def manifest
self.class.manifest
end
manifest.images.each do |image_config|
mount_uploader image_config[:name], image_config[:uploader].constantize
end
# This is used to access the upload file name from the container, given
# an image name.
def read_uploader(column)
content_block.images[column.to_s]
end
# This is used to set the upload file name from the container, given
# an image name.
def write_uploader(column, value)
content_block.images[column.to_s] = value
end
# When we save the content block, we force the container to save itself
# too, so images can be processed, uploaded and stored in the DB.
def save
manifest.images.each do |image_config|
send(:"write_#{image_config[:name]}_identifier")
send(:"store_#{image_config[:name]}!")
end
end
end
@images_container.manifest = manifest
@images_container.manifest_scope = scope
@images_container = @images_container.new(self)
end | ruby | def images_container
return @images_container if @images_container
manifest = self.manifest
@images_container = Class.new do
extend ::CarrierWave::Mount
include ActiveModel::Validations
cattr_accessor :manifest, :manifest_scope
attr_reader :content_block
# Needed to calculate uploads URLs
delegate :id, to: :content_block
# Needed to customize the upload URL
def self.name
to_s.camelize
end
# Needed to customize the upload URL
def self.to_s
"decidim/#{manifest.name.to_s.underscore}_#{manifest_scope.to_s.underscore}_content_block"
end
def initialize(content_block)
@content_block = content_block
end
def manifest
self.class.manifest
end
manifest.images.each do |image_config|
mount_uploader image_config[:name], image_config[:uploader].constantize
end
# This is used to access the upload file name from the container, given
# an image name.
def read_uploader(column)
content_block.images[column.to_s]
end
# This is used to set the upload file name from the container, given
# an image name.
def write_uploader(column, value)
content_block.images[column.to_s] = value
end
# When we save the content block, we force the container to save itself
# too, so images can be processed, uploaded and stored in the DB.
def save
manifest.images.each do |image_config|
send(:"write_#{image_config[:name]}_identifier")
send(:"store_#{image_config[:name]}!")
end
end
end
@images_container.manifest = manifest
@images_container.manifest_scope = scope
@images_container = @images_container.new(self)
end | [
"def",
"images_container",
"return",
"@images_container",
"if",
"@images_container",
"manifest",
"=",
"self",
".",
"manifest",
"@images_container",
"=",
"Class",
".",
"new",
"do",
"extend",
"::",
"CarrierWave",
"::",
"Mount",
"include",
"ActiveModel",
"::",
"Validat... | Public: Holds access to the images related to the content block. This
method generates a dynamic class that encapsulates the uploaders for the
content block images, and eases the access to them. It's a little bit
hacky, but it's the only way I could come up with in order to let content
block images have different uploaders.
Examples:
# This will process the image with the uploader defined at the
# manifest, upload it and save the record.
content_block.images_container.my_image = params[:my_image]
content_block.save!
# This is how you can access the image data, just like with any other
# uploader field. You can use the uploader versions too.
content_block.images_container.my_image.url
content_block.images_container.my_image.big.url
content_block.save!
# This will delete the attached image
content_block.images_container.my_image = nil
content_block.save!
Returns an object that responds to the image names defined in the content
block manifest. | [
"Public",
":",
"Holds",
"access",
"to",
"the",
"images",
"related",
"to",
"the",
"content",
"block",
".",
"This",
"method",
"generates",
"a",
"dynamic",
"class",
"that",
"encapsulates",
"the",
"uploaders",
"for",
"the",
"content",
"block",
"images",
"and",
"... | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/app/models/decidim/content_block.rb#L67-L128 | train | Creates a new images container. | [
30522,
13366,
4871,
1035,
11661,
2709,
1030,
4871,
1035,
11661,
2065,
1030,
4871,
1035,
11661,
19676,
1027,
2969,
1012,
19676,
1030,
4871,
1035,
11661,
1027,
2465,
1012,
2047,
2079,
7949,
1024,
1024,
6839,
16535,
1024,
1024,
4057,
2421,
316... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/databases.rb | Azure::SQL::Mgmt::V2014_04_01.Databases.get_by_recommended_elastic_pool_with_http_info | def get_by_recommended_elastic_pool_with_http_info(resource_group_name, server_name, recommended_elastic_pool_name, database_name, custom_headers:nil)
get_by_recommended_elastic_pool_async(resource_group_name, server_name, recommended_elastic_pool_name, database_name, custom_headers:custom_headers).value!
end | ruby | def get_by_recommended_elastic_pool_with_http_info(resource_group_name, server_name, recommended_elastic_pool_name, database_name, custom_headers:nil)
get_by_recommended_elastic_pool_async(resource_group_name, server_name, recommended_elastic_pool_name, database_name, custom_headers:custom_headers).value!
end | [
"def",
"get_by_recommended_elastic_pool_with_http_info",
"(",
"resource_group_name",
",",
"server_name",
",",
"recommended_elastic_pool_name",
",",
"database_name",
",",
"custom_headers",
":",
"nil",
")",
"get_by_recommended_elastic_pool_async",
"(",
"resource_group_name",
",",
... | Gets a database inside of a recommended elastic pool.
@param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param server_name [String] The name of the server.
@param recommended_elastic_pool_name [String] The name of the elastic pool to
be retrieved.
@param database_name [String] The name of the database to be retrieved.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"a",
"database",
"inside",
"of",
"a",
"recommended",
"elastic",
"pool",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/databases.rb#L785-L787 | train | Gets the elastic pool. | [
30522,
13366,
2131,
1035,
2011,
1035,
6749,
1035,
21274,
1035,
4770,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
6749,
1035,
21274,
1035,
4770,
1035,
2171,
1010,
7809,
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... |
randym/axlsx | lib/axlsx/workbook/worksheet/worksheet.rb | Axlsx.Worksheet.add_page_break | def add_page_break(cell)
DataTypeValidator.validate :worksheet_page_break, [String, Cell], cell
column_index, row_index = if cell.is_a?(String)
Axlsx.name_to_indices(cell)
else
cell.pos
end
if column_index > 0
col_breaks.add_break(:id => column_index)
end
row_breaks.add_break(:id => row_index)
end | ruby | def add_page_break(cell)
DataTypeValidator.validate :worksheet_page_break, [String, Cell], cell
column_index, row_index = if cell.is_a?(String)
Axlsx.name_to_indices(cell)
else
cell.pos
end
if column_index > 0
col_breaks.add_break(:id => column_index)
end
row_breaks.add_break(:id => row_index)
end | [
"def",
"add_page_break",
"(",
"cell",
")",
"DataTypeValidator",
".",
"validate",
":worksheet_page_break",
",",
"[",
"String",
",",
"Cell",
"]",
",",
"cell",
"column_index",
",",
"row_index",
"=",
"if",
"cell",
".",
"is_a?",
"(",
"String",
")",
"Axlsx",
".",
... | Adds a page break (row break) to the worksheet
@param cell A Cell object or excel style string reference indicating where the break
should be added to the sheet.
@example
ws.add_page_break("A4") | [
"Adds",
"a",
"page",
"break",
"(",
"row",
"break",
")",
"to",
"the",
"worksheet"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/worksheet/worksheet.rb#L495-L506 | train | Add a page break to the worksheet | [
30522,
13366,
5587,
1035,
3931,
1035,
3338,
1006,
3526,
1007,
2951,
13874,
10175,
8524,
4263,
1012,
9398,
3686,
1024,
2573,
21030,
2102,
1035,
3931,
1035,
3338,
1010,
1031,
5164,
1010,
3526,
1033,
1010,
3526,
5930,
1035,
5950,
1010,
5216,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_relay/lib/2016-07-01/generated/azure_mgmt_relay/hybrid_connections.rb | Azure::Relay::Mgmt::V2016_07_01.HybridConnections.delete_authorization_rule_with_http_info | def delete_authorization_rule_with_http_info(resource_group_name, namespace_name, hybrid_connection_name, authorization_rule_name, custom_headers:nil)
delete_authorization_rule_async(resource_group_name, namespace_name, hybrid_connection_name, authorization_rule_name, custom_headers:custom_headers).value!
end | ruby | def delete_authorization_rule_with_http_info(resource_group_name, namespace_name, hybrid_connection_name, authorization_rule_name, custom_headers:nil)
delete_authorization_rule_async(resource_group_name, namespace_name, hybrid_connection_name, authorization_rule_name, custom_headers:custom_headers).value!
end | [
"def",
"delete_authorization_rule_with_http_info",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"hybrid_connection_name",
",",
"authorization_rule_name",
",",
"custom_headers",
":",
"nil",
")",
"delete_authorization_rule_async",
"(",
"resource_group_name",
",",
"name... | Deletes a HybridConnection authorization rule
@param resource_group_name [String] Name of the Resource group within the
Azure subscription.
@param namespace_name [String] The Namespace Name
@param hybrid_connection_name [String] The hybrid connection name.
@param authorization_rule_name [String] The authorizationRule 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",
"HybridConnection",
"authorization",
"rule"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_relay/lib/2016-07-01/generated/azure_mgmt_relay/hybrid_connections.rb#L804-L806 | train | Deletes the authorization rule. | [
30522,
13366,
3972,
12870,
1035,
20104,
1035,
3627,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3415,
15327,
1035,
2171,
1010,
8893,
1035,
4434,
1035,
2171,
1010,
20104,
1035,
3627,
1035,
2171,
1010,
7661,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activejob/lib/active_job/core.rb | ActiveJob.Core.deserialize | def deserialize(job_data)
self.job_id = job_data["job_id"]
self.provider_job_id = job_data["provider_job_id"]
self.queue_name = job_data["queue_name"]
self.priority = job_data["priority"]
self.serialized_arguments = job_data["arguments"]
self.executions = job_data["executions"]
self.exception_executions = job_data["exception_executions"]
self.locale = job_data["locale"] || I18n.locale.to_s
self.timezone = job_data["timezone"] || Time.zone.try(:name)
self.enqueued_at = job_data["enqueued_at"]
end | ruby | def deserialize(job_data)
self.job_id = job_data["job_id"]
self.provider_job_id = job_data["provider_job_id"]
self.queue_name = job_data["queue_name"]
self.priority = job_data["priority"]
self.serialized_arguments = job_data["arguments"]
self.executions = job_data["executions"]
self.exception_executions = job_data["exception_executions"]
self.locale = job_data["locale"] || I18n.locale.to_s
self.timezone = job_data["timezone"] || Time.zone.try(:name)
self.enqueued_at = job_data["enqueued_at"]
end | [
"def",
"deserialize",
"(",
"job_data",
")",
"self",
".",
"job_id",
"=",
"job_data",
"[",
"\"job_id\"",
"]",
"self",
".",
"provider_job_id",
"=",
"job_data",
"[",
"\"provider_job_id\"",
"]",
"self",
".",
"queue_name",
"=",
"job_data",
"[",
"\"queue_name\"",
"]"... | Attaches the stored job data to the current instance. Receives a hash
returned from +serialize+
==== Examples
class DeliverWebhookJob < ActiveJob::Base
attr_writer :attempt_number
def attempt_number
@attempt_number ||= 0
end
def serialize
super.merge('attempt_number' => attempt_number + 1)
end
def deserialize(job_data)
super
self.attempt_number = job_data['attempt_number']
end
rescue_from(Timeout::Error) do |exception|
raise exception if attempt_number > 5
retry_job(wait: 10)
end
end | [
"Attaches",
"the",
"stored",
"job",
"data",
"to",
"the",
"current",
"instance",
".",
"Receives",
"a",
"hash",
"returned",
"from",
"+",
"serialize",
"+"
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activejob/lib/active_job/core.rb#L134-L145 | train | Deserialize the job data | [
30522,
13366,
4078,
11610,
3669,
4371,
1006,
3105,
1035,
2951,
1007,
2969,
1012,
3105,
1035,
8909,
1027,
3105,
1035,
2951,
1031,
1000,
3105,
1035,
8909,
1000,
1033,
2969,
1012,
10802,
1035,
3105,
1035,
8909,
1027,
3105,
1035,
2951,
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... |
jekyll/jekyll | lib/jekyll/site.rb | Jekyll.Site.in_cache_dir | def in_cache_dir(*paths)
paths.reduce(cache_dir) do |base, path|
Jekyll.sanitized_path(base, path)
end
end | ruby | def in_cache_dir(*paths)
paths.reduce(cache_dir) do |base, path|
Jekyll.sanitized_path(base, path)
end
end | [
"def",
"in_cache_dir",
"(",
"*",
"paths",
")",
"paths",
".",
"reduce",
"(",
"cache_dir",
")",
"do",
"|",
"base",
",",
"path",
"|",
"Jekyll",
".",
"sanitized_path",
"(",
"base",
",",
"path",
")",
"end",
"end"
] | Public: Prefix a given path with the cache directory.
paths - (optional) path elements to a file or directory within the
cache directory
Returns a path which is prefixed with the cache directory. | [
"Public",
":",
"Prefix",
"a",
"given",
"path",
"with",
"the",
"cache",
"directory",
"."
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/site.rb#L416-L420 | train | Returns the cache directory for the given paths. | [
30522,
13366,
1999,
1035,
17053,
1035,
16101,
1006,
1008,
10425,
1007,
10425,
1012,
5547,
1006,
17053,
1035,
16101,
1007,
2079,
1064,
2918,
1010,
4130,
1064,
15333,
4801,
3363,
1012,
2624,
25090,
5422,
1035,
4130,
1006,
2918,
1010,
4130,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/jobs.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.Jobs.cancel_async | def cancel_async(device_name, job_name, resource_group_name, manager_name, custom_headers:nil)
# Send request
promise = begin_cancel_async(device_name, job_name, resource_group_name, manager_name, 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 cancel_async(device_name, job_name, resource_group_name, manager_name, custom_headers:nil)
# Send request
promise = begin_cancel_async(device_name, job_name, resource_group_name, manager_name, 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",
"cancel_async",
"(",
"device_name",
",",
"job_name",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_cancel_async",
"(",
"device_name",
",",
"job_name",
",",
"resource_group_name"... | @param device_name [String] The device name
@param job_name [String] The jobName.
@param resource_group_name [String] The resource group name
@param manager_name [String] The manager name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"device_name",
"[",
"String",
"]",
"The",
"device",
"name",
"@param",
"job_name",
"[",
"String",
"]",
"The",
"jobName",
".",
"@param",
"resource_group_name",
"[",
"String",
"]",
"The",
"resource",
"group",
"name",
"@param",
"manager_name",
"[",
"Stri... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/jobs.rb#L257-L271 | train | Cancels a managed cluster job. | [
30522,
13366,
17542,
1035,
2004,
6038,
2278,
1006,
5080,
1035,
2171,
1010,
3105,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.delete_prebuilt_entity_role_with_http_info | def delete_prebuilt_entity_role_with_http_info(app_id, version_id, entity_id, role_id, custom_headers:nil)
delete_prebuilt_entity_role_async(app_id, version_id, entity_id, role_id, custom_headers:custom_headers).value!
end | ruby | def delete_prebuilt_entity_role_with_http_info(app_id, version_id, entity_id, role_id, custom_headers:nil)
delete_prebuilt_entity_role_async(app_id, version_id, entity_id, role_id, custom_headers:custom_headers).value!
end | [
"def",
"delete_prebuilt_entity_role_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"role_id",
",",
"custom_headers",
":",
"nil",
")",
"delete_prebuilt_entity_role_async",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"role_id",
",... | Delete a role in 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 ID.
@param role_id The entity role Id.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Delete",
"a",
"role",
"in",
"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#L9321-L9323 | train | Deletes a prebuilt entity role. | [
30522,
13366,
3972,
12870,
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,
2535,
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... |
mhenrixon/sidekiq-unique-jobs | lib/sidekiq_unique_jobs/config.rb | SidekiqUniqueJobs.Config.add_strategy | def add_strategy(name, klass)
raise ArgumentError, "strategy #{name} already defined, please use another name" if strategies.key?(name.to_sym)
new_strategies = strategies.dup.merge(name.to_sym => klass).freeze
self.strategies = new_strategies
end | ruby | def add_strategy(name, klass)
raise ArgumentError, "strategy #{name} already defined, please use another name" if strategies.key?(name.to_sym)
new_strategies = strategies.dup.merge(name.to_sym => klass).freeze
self.strategies = new_strategies
end | [
"def",
"add_strategy",
"(",
"name",
",",
"klass",
")",
"raise",
"ArgumentError",
",",
"\"strategy #{name} already defined, please use another name\"",
"if",
"strategies",
".",
"key?",
"(",
"name",
".",
"to_sym",
")",
"new_strategies",
"=",
"strategies",
".",
"dup",
... | Adds an on_conflict strategy to the configuration.
It will raise if the strategy exists already
@param [String] name the name of the custom strategy
@param [Class] klass the class describing the strategy | [
"Adds",
"an",
"on_conflict",
"strategy",
"to",
"the",
"configuration",
".",
"It",
"will",
"raise",
"if",
"the",
"strategy",
"exists",
"already"
] | 2944b97c720528f53962ccfd17d43ac939a77f46 | https://github.com/mhenrixon/sidekiq-unique-jobs/blob/2944b97c720528f53962ccfd17d43ac939a77f46/lib/sidekiq_unique_jobs/config.rb#L62-L67 | train | Add a strategy to the strategy list | [
30522,
13366,
5587,
1035,
5656,
1006,
2171,
1010,
1047,
27102,
1007,
5333,
6685,
2121,
29165,
1010,
1000,
5656,
1001,
1063,
2171,
1065,
2525,
4225,
1010,
3531,
2224,
2178,
2171,
1000,
2065,
9942,
1012,
3145,
1029,
1006,
2171,
1012,
2000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_storage/lib/2018-03-01-preview/generated/azure_mgmt_storage/storage_accounts.rb | Azure::Storage::Mgmt::V2018_03_01_preview.StorageAccounts.create_or_update_management_policies | def create_or_update_management_policies(resource_group_name, account_name, properties, custom_headers:nil)
response = create_or_update_management_policies_async(resource_group_name, account_name, properties, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_or_update_management_policies(resource_group_name, account_name, properties, custom_headers:nil)
response = create_or_update_management_policies_async(resource_group_name, account_name, properties, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_or_update_management_policies",
"(",
"resource_group_name",
",",
"account_name",
",",
"properties",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_or_update_management_policies_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"p... | Sets the data policy rules associated with the specified storage account.
@param resource_group_name [String] The name of the resource group within the
user's subscription. The name is case insensitive.
@param account_name [String] The name of the storage account within the
specified resource group. Storage account names must be between 3 and 24
characters in length and use numbers and lower-case letters only.
@param properties [ManagementPoliciesRulesSetParameter] The data policy rules
to set to a storage account.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [StorageAccountManagementPolicies] operation results. | [
"Sets",
"the",
"data",
"policy",
"rules",
"associated",
"with",
"the",
"specified",
"storage",
"account",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_storage/lib/2018-03-01-preview/generated/azure_mgmt_storage/storage_accounts.rb#L1329-L1332 | train | Creates or updates management policies. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1035,
2968,
1035,
6043,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
5144,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3443,
1035,
2030,
1035,
10651,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/haml-lint | lib/haml_lint/tree/node.rb | HamlLint::Tree.Node.each | def each
return to_enum(__callee__) unless block_given?
node = self
loop do
yield node
break unless (node = node.next_node)
end
end | ruby | def each
return to_enum(__callee__) unless block_given?
node = self
loop do
yield node
break unless (node = node.next_node)
end
end | [
"def",
"each",
"return",
"to_enum",
"(",
"__callee__",
")",
"unless",
"block_given?",
"node",
"=",
"self",
"loop",
"do",
"yield",
"node",
"break",
"unless",
"(",
"node",
"=",
"node",
".",
"next_node",
")",
"end",
"end"
] | Implements the Enumerable interface to walk through an entire tree.
@return [Enumerator, HamlLint::Tree::Node] | [
"Implements",
"the",
"Enumerable",
"interface",
"to",
"walk",
"through",
"an",
"entire",
"tree",
"."
] | 024c773667e54cf88db938c2b368977005d70ee8 | https://github.com/sds/haml-lint/blob/024c773667e54cf88db938c2b368977005d70ee8/lib/haml_lint/tree/node.rb#L51-L59 | train | Yields each node in the sequence. | [
30522,
13366,
2169,
2709,
2000,
1035,
4372,
2819,
1006,
1035,
1035,
2655,
4402,
1035,
1035,
1007,
4983,
3796,
1035,
2445,
1029,
13045,
1027,
2969,
7077,
2079,
10750,
13045,
3338,
4983,
1006,
13045,
1027,
13045,
1012,
2279,
1035,
13045,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_policy_insights/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_states.rb | Azure::PolicyInsights::Mgmt::V2018_04_04.PolicyStates.summarize_for_resource_group | def summarize_for_resource_group(subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
response = summarize_for_resource_group_async(subscription_id, resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def summarize_for_resource_group(subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
response = summarize_for_resource_group_async(subscription_id, resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"summarize_for_resource_group",
"(",
"subscription_id",
",",
"resource_group_name",
",",
"query_options",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"summarize_for_resource_group_async",
"(",
"subscription_id",
",",
"resource_group_name",
... | Summarizes policy states for the resources under the resource group.
@param subscription_id [String] Microsoft Azure subscription ID.
@param resource_group_name [String] Resource group name.
@param query_options [QueryOptions] Additional parameters for the operation
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [SummarizeResults] operation results. | [
"Summarizes",
"policy",
"states",
"for",
"the",
"resources",
"under",
"the",
"resource",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_policy_insights/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_states.rb#L648-L651 | train | Gets the number of documents in a resource group. | [
30522,
13366,
7680,
7849,
4697,
1035,
2005,
1035,
7692,
1035,
2177,
1006,
15002,
1035,
8909,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
23032,
1035,
7047,
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... |
lostisland/faraday | lib/faraday/connection.rb | Faraday.Connection.build_exclusive_url | def build_exclusive_url(url = nil, params = nil, params_encoder = nil)
url = nil if url.respond_to?(:empty?) && url.empty?
base = url_prefix
if url && base.path && base.path !~ %r{/$}
base = base.dup
base.path = base.path + '/' # ensure trailing slash
end
uri = url ? base + url : base
if params
uri.query = params.to_query(params_encoder || options.params_encoder)
end
# rubocop:disable Style/SafeNavigation
uri.query = nil if uri.query && uri.query.empty?
# rubocop:enable Style/SafeNavigation
uri
end | ruby | def build_exclusive_url(url = nil, params = nil, params_encoder = nil)
url = nil if url.respond_to?(:empty?) && url.empty?
base = url_prefix
if url && base.path && base.path !~ %r{/$}
base = base.dup
base.path = base.path + '/' # ensure trailing slash
end
uri = url ? base + url : base
if params
uri.query = params.to_query(params_encoder || options.params_encoder)
end
# rubocop:disable Style/SafeNavigation
uri.query = nil if uri.query && uri.query.empty?
# rubocop:enable Style/SafeNavigation
uri
end | [
"def",
"build_exclusive_url",
"(",
"url",
"=",
"nil",
",",
"params",
"=",
"nil",
",",
"params_encoder",
"=",
"nil",
")",
"url",
"=",
"nil",
"if",
"url",
".",
"respond_to?",
"(",
":empty?",
")",
"&&",
"url",
".",
"empty?",
"base",
"=",
"url_prefix",
"if... | Build an absolute URL based on url_prefix.
@param url [String, URI]
@param params [Faraday::Utils::ParamsHash] A Faraday::Utils::ParamsHash to
replace the query values
of the resulting url (default: nil).
@return [URI] | [
"Build",
"an",
"absolute",
"URL",
"based",
"on",
"url_prefix",
"."
] | 3abe9d1eea4bdf61cdf7b76ff9f1ae7e09482e70 | https://github.com/lostisland/faraday/blob/3abe9d1eea4bdf61cdf7b76ff9f1ae7e09482e70/lib/faraday/connection.rb#L530-L545 | train | Build an exclusive URL | [
30522,
13366,
3857,
1035,
7262,
1035,
24471,
2140,
1006,
24471,
2140,
1027,
9152,
2140,
1010,
11498,
5244,
1027,
9152,
2140,
1010,
11498,
5244,
1035,
4372,
16044,
2099,
1027,
9152,
2140,
1007,
24471,
2140,
1027,
9152,
2140,
2065,
24471,
214... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
lostisland/faraday | lib/faraday/options.rb | Faraday.Options.each | def each
return to_enum(:each) unless block_given?
members.each do |key|
yield(key.to_sym, send(key))
end
end | ruby | def each
return to_enum(:each) unless block_given?
members.each do |key|
yield(key.to_sym, send(key))
end
end | [
"def",
"each",
"return",
"to_enum",
"(",
":each",
")",
"unless",
"block_given?",
"members",
".",
"each",
"do",
"|",
"key",
"|",
"yield",
"(",
"key",
".",
"to_sym",
",",
"send",
"(",
"key",
")",
")",
"end",
"end"
] | Public | [
"Public"
] | 3abe9d1eea4bdf61cdf7b76ff9f1ae7e09482e70 | https://github.com/lostisland/faraday/blob/3abe9d1eea4bdf61cdf7b76ff9f1ae7e09482e70/lib/faraday/options.rb#L13-L19 | train | Yields the result of the block. | [
30522,
13366,
2169,
2709,
2000,
1035,
4372,
2819,
1006,
1024,
2169,
1007,
4983,
3796,
1035,
2445,
1029,
2372,
1012,
2169,
2079,
1064,
3145,
1064,
10750,
1006,
3145,
1012,
2000,
1035,
25353,
2213,
1010,
4604,
1006,
3145,
1007,
1007,
2203,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/api/v1_employees_api.rb | SquareConnect.V1EmployeesApi.create_employee_role | def create_employee_role(employee_role, opts = {})
data, _status_code, _headers = create_employee_role_with_http_info(employee_role, opts)
return data
end | ruby | def create_employee_role(employee_role, opts = {})
data, _status_code, _headers = create_employee_role_with_http_info(employee_role, opts)
return data
end | [
"def",
"create_employee_role",
"(",
"employee_role",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"create_employee_role_with_http_info",
"(",
"employee_role",
",",
"opts",
")",
"return",
"data",
"end"
] | CreateEmployeeRole
Creates an employee role you can then assign to employees. Square accounts can include any number of roles that can be assigned to employees. These roles define the actions and permissions granted to an employee with that role. For example, an employee with a \"Shift Manager\" role might be able to issue refunds in Square Point of Sale, whereas an employee with a \"Clerk\" role might not. Roles are assigned with the [V1UpdateEmployee](#endpoint-v1updateemployee) endpoint. An employee can have only one role at a time. If an employee has no role, they have none of the permissions associated with roles. All employees can accept payments with Square Point of Sale.
@param employee_role An EmployeeRole object with a name and permissions, and an optional owner flag.
@param [Hash] opts the optional parameters
@return [V1EmployeeRole] | [
"CreateEmployeeRole",
"Creates",
"an",
"employee",
"role",
"you",
"can",
"then",
"assign",
"to",
"employees",
".",
"Square",
"accounts",
"can",
"include",
"any",
"number",
"of",
"roles",
"that",
"can",
"be",
"assigned",
"to",
"employees",
".",
"These",
"roles"... | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/v1_employees_api.rb#L80-L83 | train | Creates an employee role | [
30522,
13366,
3443,
1035,
7904,
1035,
2535,
1006,
7904,
1035,
2535,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
3443,
1035,
7904,
1035,
2535,
1035,
2007,
1035,
8299,
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... |
Fullscreen/yt | lib/yt/request.rb | Yt.Request.server_errors | def server_errors
[
OpenSSL::SSL::SSLError,
Errno::ETIMEDOUT,
Errno::EHOSTUNREACH,
Errno::ENETUNREACH,
Errno::ECONNRESET,
Net::OpenTimeout,
SocketError,
Net::HTTPServerError
] + extra_server_errors
end | ruby | def server_errors
[
OpenSSL::SSL::SSLError,
Errno::ETIMEDOUT,
Errno::EHOSTUNREACH,
Errno::ENETUNREACH,
Errno::ECONNRESET,
Net::OpenTimeout,
SocketError,
Net::HTTPServerError
] + extra_server_errors
end | [
"def",
"server_errors",
"[",
"OpenSSL",
"::",
"SSL",
"::",
"SSLError",
",",
"Errno",
"::",
"ETIMEDOUT",
",",
"Errno",
"::",
"EHOSTUNREACH",
",",
"Errno",
"::",
"ENETUNREACH",
",",
"Errno",
"::",
"ECONNRESET",
",",
"Net",
"::",
"OpenTimeout",
",",
"SocketErro... | Returns the list of server errors worth retrying the request once. | [
"Returns",
"the",
"list",
"of",
"server",
"errors",
"worth",
"retrying",
"the",
"request",
"once",
"."
] | bf5c33b977cb162bb7735ad5b80d1abdb5a38215 | https://github.com/Fullscreen/yt/blob/bf5c33b977cb162bb7735ad5b80d1abdb5a38215/lib/yt/request.rb#L205-L216 | train | Returns an array of server errors | [
30522,
13366,
8241,
1035,
10697,
1031,
7480,
14540,
1024,
1024,
7020,
2140,
1024,
1024,
7020,
3917,
29165,
1010,
9413,
19139,
1024,
1024,
3802,
14428,
26797,
2102,
1010,
9413,
19139,
1024,
1024,
15501,
14122,
4609,
16416,
2818,
1010,
9413,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/nested_attributes.rb | ActiveRecord.NestedAttributes.assign_nested_attributes_for_one_to_one_association | def assign_nested_attributes_for_one_to_one_association(association_name, attributes)
options = nested_attributes_options[association_name]
if attributes.respond_to?(:permitted?)
attributes = attributes.to_h
end
attributes = attributes.with_indifferent_access
existing_record = send(association_name)
if (options[:update_only] || !attributes["id"].blank?) && existing_record &&
(options[:update_only] || existing_record.id.to_s == attributes["id"].to_s)
assign_to_or_mark_for_destruction(existing_record, attributes, options[:allow_destroy]) unless call_reject_if(association_name, attributes)
elsif attributes["id"].present?
raise_nested_attributes_record_not_found!(association_name, attributes["id"])
elsif !reject_new_record?(association_name, attributes)
assignable_attributes = attributes.except(*UNASSIGNABLE_KEYS)
if existing_record && existing_record.new_record?
existing_record.assign_attributes(assignable_attributes)
association(association_name).initialize_attributes(existing_record)
else
method = :"build_#{association_name}"
if respond_to?(method)
send(method, assignable_attributes)
else
raise ArgumentError, "Cannot build association `#{association_name}'. Are you trying to build a polymorphic one-to-one association?"
end
end
end
end | ruby | def assign_nested_attributes_for_one_to_one_association(association_name, attributes)
options = nested_attributes_options[association_name]
if attributes.respond_to?(:permitted?)
attributes = attributes.to_h
end
attributes = attributes.with_indifferent_access
existing_record = send(association_name)
if (options[:update_only] || !attributes["id"].blank?) && existing_record &&
(options[:update_only] || existing_record.id.to_s == attributes["id"].to_s)
assign_to_or_mark_for_destruction(existing_record, attributes, options[:allow_destroy]) unless call_reject_if(association_name, attributes)
elsif attributes["id"].present?
raise_nested_attributes_record_not_found!(association_name, attributes["id"])
elsif !reject_new_record?(association_name, attributes)
assignable_attributes = attributes.except(*UNASSIGNABLE_KEYS)
if existing_record && existing_record.new_record?
existing_record.assign_attributes(assignable_attributes)
association(association_name).initialize_attributes(existing_record)
else
method = :"build_#{association_name}"
if respond_to?(method)
send(method, assignable_attributes)
else
raise ArgumentError, "Cannot build association `#{association_name}'. Are you trying to build a polymorphic one-to-one association?"
end
end
end
end | [
"def",
"assign_nested_attributes_for_one_to_one_association",
"(",
"association_name",
",",
"attributes",
")",
"options",
"=",
"nested_attributes_options",
"[",
"association_name",
"]",
"if",
"attributes",
".",
"respond_to?",
"(",
":permitted?",
")",
"attributes",
"=",
"a... | Assigns the given attributes to the association.
If an associated record does not yet exist, one will be instantiated. If
an associated record already exists, the method's behavior depends on
the value of the update_only option. If update_only is +false+ and the
given attributes include an <tt>:id</tt> that matches the existing record's
id, then the existing record will be modified. If no <tt>:id</tt> is provided
it will be replaced with a new record. If update_only is +true+ the existing
record will be modified regardless of whether an <tt>:id</tt> is provided.
If the given attributes include a matching <tt>:id</tt> attribute, or
update_only is true, and a <tt>:_destroy</tt> key set to a truthy value,
then the existing record will be marked for destruction. | [
"Assigns",
"the",
"given",
"attributes",
"to",
"the",
"association",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activerecord/lib/active_record/nested_attributes.rb#L407-L437 | train | Assign nested attributes for one - to - one association | [
30522,
13366,
23911,
1035,
9089,
2098,
1035,
12332,
1035,
2005,
1035,
2028,
1035,
2000,
1035,
2028,
1035,
2523,
1006,
2523,
1035,
2171,
1010,
12332,
1007,
7047,
1027,
9089,
2098,
1035,
12332,
1035,
7047,
1031,
2523,
1035,
2171,
1033,
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... |
strongself/Generamba | lib/generamba/template/helpers/catalog_downloader.rb | Generamba.CatalogDownloader.download_catalog | def download_catalog(name, url)
catalogs_local_path = Pathname.new(ENV['HOME'])
.join(GENERAMBA_HOME_DIR)
.join(CATALOGS_DIR)
current_catalog_path = catalogs_local_path
.join(name)
if File.exists?(current_catalog_path)
g = Git.open(current_catalog_path)
g.pull
else
Git.clone(url, name, :path => catalogs_local_path)
end
return current_catalog_path
end | ruby | def download_catalog(name, url)
catalogs_local_path = Pathname.new(ENV['HOME'])
.join(GENERAMBA_HOME_DIR)
.join(CATALOGS_DIR)
current_catalog_path = catalogs_local_path
.join(name)
if File.exists?(current_catalog_path)
g = Git.open(current_catalog_path)
g.pull
else
Git.clone(url, name, :path => catalogs_local_path)
end
return current_catalog_path
end | [
"def",
"download_catalog",
"(",
"name",
",",
"url",
")",
"catalogs_local_path",
"=",
"Pathname",
".",
"new",
"(",
"ENV",
"[",
"'HOME'",
"]",
")",
".",
"join",
"(",
"GENERAMBA_HOME_DIR",
")",
".",
"join",
"(",
"CATALOGS_DIR",
")",
"current_catalog_path",
"=",... | Clones a template catalog from a remote repository
@param name [String] The name of the template catalog
@param url [String] The url of the repository
@return [Pathname] A filepath to the downloaded catalog | [
"Clones",
"a",
"template",
"catalog",
"from",
"a",
"remote",
"repository"
] | 9ef343805f3a66f58bc36e120e822d5436a4da97 | https://github.com/strongself/Generamba/blob/9ef343805f3a66f58bc36e120e822d5436a4da97/lib/generamba/template/helpers/catalog_downloader.rb#L41-L56 | train | downloads a catalog from the local repository | [
30522,
13366,
8816,
1035,
12105,
1006,
2171,
1010,
24471,
2140,
1007,
12105,
2015,
1035,
2334,
1035,
4130,
1027,
4130,
18442,
1012,
2047,
1006,
4372,
2615,
1031,
1005,
2188,
1005,
1033,
1007,
1012,
3693,
1006,
11416,
11201,
1035,
2188,
1035... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activesupport/lib/active_support/message_verifier.rb | ActiveSupport.MessageVerifier.verified | def verified(signed_message, purpose: nil, **)
if valid_message?(signed_message)
begin
data = signed_message.split("--")[0]
message = Messages::Metadata.verify(decode(data), purpose)
@serializer.load(message) if message
rescue ArgumentError => argument_error
return if argument_error.message.include?("invalid base64")
raise
end
end
end | ruby | def verified(signed_message, purpose: nil, **)
if valid_message?(signed_message)
begin
data = signed_message.split("--")[0]
message = Messages::Metadata.verify(decode(data), purpose)
@serializer.load(message) if message
rescue ArgumentError => argument_error
return if argument_error.message.include?("invalid base64")
raise
end
end
end | [
"def",
"verified",
"(",
"signed_message",
",",
"purpose",
":",
"nil",
",",
"**",
")",
"if",
"valid_message?",
"(",
"signed_message",
")",
"begin",
"data",
"=",
"signed_message",
".",
"split",
"(",
"\"--\"",
")",
"[",
"0",
"]",
"message",
"=",
"Messages",
... | Decodes the signed message using the +MessageVerifier+'s secret.
verifier = ActiveSupport::MessageVerifier.new 's3Krit'
signed_message = verifier.generate 'a private message'
verifier.verified(signed_message) # => 'a private message'
Returns +nil+ if the message was not signed with the same secret.
other_verifier = ActiveSupport::MessageVerifier.new 'd1ff3r3nt-s3Krit'
other_verifier.verified(signed_message) # => nil
Returns +nil+ if the message is not Base64-encoded.
invalid_message = "f--46a0120593880c733a53b6dad75b42ddc1c8996d"
verifier.verified(invalid_message) # => nil
Raises any error raised while decoding the signed message.
incompatible_message = "test--dad7b06c94abba8d46a15fafaef56c327665d5ff"
verifier.verified(incompatible_message) # => TypeError: incompatible marshal file format | [
"Decodes",
"the",
"signed",
"message",
"using",
"the",
"+",
"MessageVerifier",
"+",
"s",
"secret",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/message_verifier.rb#L150-L161 | train | verify the message | [
30522,
13366,
20119,
1006,
2772,
1035,
4471,
1010,
3800,
1024,
9152,
2140,
1010,
1008,
1008,
1007,
2065,
9398,
1035,
4471,
1029,
1006,
2772,
1035,
4471,
1007,
4088,
2951,
1027,
2772,
1035,
4471,
1012,
3975,
1006,
1000,
1011,
1011,
1000,
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_kusto/lib/2017-09-07-privatepreview/generated/azure_mgmt_kusto/databases.rb | Azure::Kusto::Mgmt::V2018_09_07_privatepreview.Databases.add_principals_with_http_info | def add_principals_with_http_info(resource_group_name, cluster_name, database_name, database_principals_to_add, custom_headers:nil)
add_principals_async(resource_group_name, cluster_name, database_name, database_principals_to_add, custom_headers:custom_headers).value!
end | ruby | def add_principals_with_http_info(resource_group_name, cluster_name, database_name, database_principals_to_add, custom_headers:nil)
add_principals_async(resource_group_name, cluster_name, database_name, database_principals_to_add, custom_headers:custom_headers).value!
end | [
"def",
"add_principals_with_http_info",
"(",
"resource_group_name",
",",
"cluster_name",
",",
"database_name",
",",
"database_principals_to_add",
",",
"custom_headers",
":",
"nil",
")",
"add_principals_async",
"(",
"resource_group_name",
",",
"cluster_name",
",",
"database_... | Add Database principals permissions.
@param resource_group_name [String] The name of the resource group containing
the Kusto cluster.
@param cluster_name [String] The name of the Kusto cluster.
@param database_name [String] The name of the database in the Kusto cluster.
@param database_principals_to_add [DatabasePrincipalListRequest] List of
database principals to add.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Add",
"Database",
"principals",
"permissions",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_kusto/lib/2017-09-07-privatepreview/generated/azure_mgmt_kusto/databases.rb#L603-L605 | train | Adds a collection of principals to the database. | [
30522,
13366,
5587,
1035,
27928,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
9324,
1035,
2171,
1010,
7809,
1035,
2171,
1010,
7809,
1035,
27928,
1035,
2000,
1035,
5587,
1010,
7661,
1035,
20346,
2015,
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... |
randym/axlsx | lib/axlsx/workbook/worksheet/rich_text_run.rb | Axlsx.RichTextRun.font_size | def font_size
return sz if sz
font = styles.fonts[styles.cellXfs[style].fontId] || styles.fonts[0]
(font.b || (defined?(@b) && @b)) ? (font.sz * 1.5) : font.sz
end | ruby | def font_size
return sz if sz
font = styles.fonts[styles.cellXfs[style].fontId] || styles.fonts[0]
(font.b || (defined?(@b) && @b)) ? (font.sz * 1.5) : font.sz
end | [
"def",
"font_size",
"return",
"sz",
"if",
"sz",
"font",
"=",
"styles",
".",
"fonts",
"[",
"styles",
".",
"cellXfs",
"[",
"style",
"]",
".",
"fontId",
"]",
"||",
"styles",
".",
"fonts",
"[",
"0",
"]",
"(",
"font",
".",
"b",
"||",
"(",
"defined?",
... | we scale the font size if bold style is applied to either the style font or
the cell itself. Yes, it is a bit of a hack, but it is much better than using
imagemagick and loading metrics for every character. | [
"we",
"scale",
"the",
"font",
"size",
"if",
"bold",
"style",
"is",
"applied",
"to",
"either",
"the",
"style",
"font",
"or",
"the",
"cell",
"itself",
".",
"Yes",
"it",
"is",
"a",
"bit",
"of",
"a",
"hack",
"but",
"it",
"is",
"much",
"better",
"than",
... | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/worksheet/rich_text_run.rb#L224-L228 | train | Returns the number of bytes of the font in the cell. | [
30522,
13366,
15489,
1035,
2946,
2709,
1055,
2480,
2065,
1055,
2480,
15489,
1027,
6782,
1012,
15489,
2015,
1031,
6782,
1012,
3526,
2595,
10343,
1031,
2806,
1033,
1012,
15489,
3593,
1033,
1064,
1064,
6782,
1012,
15489,
2015,
1031,
1014,
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... |
mhenrixon/sidekiq-unique-jobs | lib/sidekiq_unique_jobs/util.rb | SidekiqUniqueJobs.Util.keys | def keys(pattern = SCAN_PATTERN, count = DEFAULT_COUNT)
return redis(&:keys) if pattern.nil?
redis { |conn| conn.scan_each(match: prefix(pattern), count: count).to_a }
end | ruby | def keys(pattern = SCAN_PATTERN, count = DEFAULT_COUNT)
return redis(&:keys) if pattern.nil?
redis { |conn| conn.scan_each(match: prefix(pattern), count: count).to_a }
end | [
"def",
"keys",
"(",
"pattern",
"=",
"SCAN_PATTERN",
",",
"count",
"=",
"DEFAULT_COUNT",
")",
"return",
"redis",
"(",
":keys",
")",
"if",
"pattern",
".",
"nil?",
"redis",
"{",
"|",
"conn",
"|",
"conn",
".",
"scan_each",
"(",
"match",
":",
"prefix",
"(",... | Find unique keys in redis
@param [String] pattern a pattern to scan for in redis
@param [Integer] count the maximum number of keys to delete
@return [Array<String>] an array with active unique keys | [
"Find",
"unique",
"keys",
"in",
"redis"
] | 2944b97c720528f53962ccfd17d43ac939a77f46 | https://github.com/mhenrixon/sidekiq-unique-jobs/blob/2944b97c720528f53962ccfd17d43ac939a77f46/lib/sidekiq_unique_jobs/util.rb#L21-L25 | train | Returns an array of keys in the cache. | [
30522,
13366,
6309,
1006,
5418,
1027,
13594,
1035,
5418,
1010,
4175,
1027,
12398,
1035,
4175,
1007,
2709,
2417,
2483,
1006,
1004,
1024,
6309,
1007,
2065,
5418,
1012,
9152,
2140,
1029,
2417,
2483,
1063,
1064,
9530,
2078,
1064,
9530,
2078,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
wearefine/fae | app/helpers/fae/form_helper.rb | Fae.FormHelper.language_support | def language_support(f, attribute, options)
return if Fae.languages.blank?
attribute_array = attribute.to_s.split('_')
language_suffix = attribute_array.pop
return unless Fae.languages.has_key?(language_suffix.to_sym) || Fae.languages.has_key?(language_suffix)
label = attribute_array.push("(#{language_suffix})").join(' ').titleize
options[:label] = label unless options[:label].present?
if options[:wrapper_html].present?
options[:wrapper_html].deep_merge!({ data: { language: language_suffix } })
else
options[:wrapper_html] = { data: { language: language_suffix } }
end
end | ruby | def language_support(f, attribute, options)
return if Fae.languages.blank?
attribute_array = attribute.to_s.split('_')
language_suffix = attribute_array.pop
return unless Fae.languages.has_key?(language_suffix.to_sym) || Fae.languages.has_key?(language_suffix)
label = attribute_array.push("(#{language_suffix})").join(' ').titleize
options[:label] = label unless options[:label].present?
if options[:wrapper_html].present?
options[:wrapper_html].deep_merge!({ data: { language: language_suffix } })
else
options[:wrapper_html] = { data: { language: language_suffix } }
end
end | [
"def",
"language_support",
"(",
"f",
",",
"attribute",
",",
"options",
")",
"return",
"if",
"Fae",
".",
"languages",
".",
"blank?",
"attribute_array",
"=",
"attribute",
".",
"to_s",
".",
"split",
"(",
"'_'",
")",
"language_suffix",
"=",
"attribute_array",
".... | removes language suffix from label and adds data attr for languange nav | [
"removes",
"language",
"suffix",
"from",
"label",
"and",
"adds",
"data",
"attr",
"for",
"languange",
"nav"
] | 645d6b66945aeff54e27af6a95c4f8a1f7a67d39 | https://github.com/wearefine/fae/blob/645d6b66945aeff54e27af6a95c4f8a1f7a67d39/app/helpers/fae/form_helper.rb#L199-L214 | train | Returns the language support for the given attribute. | [
30522,
13366,
2653,
1035,
2490,
1006,
1042,
1010,
17961,
1010,
7047,
1007,
2709,
2065,
17282,
1012,
4155,
1012,
8744,
1029,
17961,
1035,
9140,
1027,
17961,
1012,
2000,
1035,
1055,
1012,
3975,
1006,
1005,
1035,
1005,
1007,
2653,
1035,
16809,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
puppetlabs/puppet | lib/puppet/type.rb | Puppet.Type.builddepends | def builddepends
# Handle the requires
self.class.relationship_params.collect do |klass|
if param = @parameters[klass.name]
param.to_edges
end
end.flatten.reject { |r| r.nil? }
end | ruby | def builddepends
# Handle the requires
self.class.relationship_params.collect do |klass|
if param = @parameters[klass.name]
param.to_edges
end
end.flatten.reject { |r| r.nil? }
end | [
"def",
"builddepends",
"# Handle the requires",
"self",
".",
"class",
".",
"relationship_params",
".",
"collect",
"do",
"|",
"klass",
"|",
"if",
"param",
"=",
"@parameters",
"[",
"klass",
".",
"name",
"]",
"param",
".",
"to_edges",
"end",
"end",
".",
"flatte... | Builds the dependencies associated with this resource.
@return [Array<Puppet::Relationship>] list of relationships to other resources | [
"Builds",
"the",
"dependencies",
"associated",
"with",
"this",
"resource",
"."
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/type.rb#L2194-L2201 | train | Build the requires
| [
30522,
13366,
3857,
3207,
11837,
5104,
1001,
5047,
1996,
5942,
2969,
1012,
2465,
1012,
3276,
1035,
11498,
5244,
1012,
8145,
2079,
1064,
1047,
27102,
1064,
2065,
11498,
2213,
1027,
1030,
11709,
1031,
1047,
27102,
1012,
2171,
1033,
11498,
221... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_hierarchical_entity_role | def create_hierarchical_entity_role(app_id, version_id, h_entity_id, entity_role_create_object, custom_headers:nil)
response = create_hierarchical_entity_role_async(app_id, version_id, h_entity_id, entity_role_create_object, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_hierarchical_entity_role(app_id, version_id, h_entity_id, entity_role_create_object, custom_headers:nil)
response = create_hierarchical_entity_role_async(app_id, version_id, h_entity_id, entity_role_create_object, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_hierarchical_entity_role",
"(",
"app_id",
",",
"version_id",
",",
"h_entity_id",
",",
"entity_role_create_object",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_hierarchical_entity_role_async",
"(",
"app_id",
",",
"version_id",
",",
"h_... | Create a role for an hierarchical entity in a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param h_entity_id The hierarchical entity extractor 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 [Uuid] operation results. | [
"Create",
"a",
"role",
"for",
"an",
"hierarchical",
"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#L7605-L7608 | train | Creates an entity role for a given Hierarchical entity. | [
30522,
13366,
3443,
1035,
25835,
1035,
9178,
1035,
2535,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
1044,
1035,
9178,
1035,
8909,
1010,
9178,
1035,
2535,
1035,
3443,
1035,
4874,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/haml-lint | lib/haml_lint/linter.rb | HamlLint.Linter.next_node | def next_node(node)
return unless node
siblings = node.parent ? node.parent.children : [node]
next_sibling = siblings[siblings.index(node) + 1] if siblings.count > 1
return next_sibling if next_sibling
next_node(node.parent)
end | ruby | def next_node(node)
return unless node
siblings = node.parent ? node.parent.children : [node]
next_sibling = siblings[siblings.index(node) + 1] if siblings.count > 1
return next_sibling if next_sibling
next_node(node.parent)
end | [
"def",
"next_node",
"(",
"node",
")",
"return",
"unless",
"node",
"siblings",
"=",
"node",
".",
"parent",
"?",
"node",
".",
"parent",
".",
"children",
":",
"[",
"node",
"]",
"next_sibling",
"=",
"siblings",
"[",
"siblings",
".",
"index",
"(",
"node",
"... | Gets the next node following this node, ascending up the ancestor chain
recursively if this node has no siblings.
@param node [HamlLint::Tree::Node]
@return [HamlLint::Tree::Node,nil] | [
"Gets",
"the",
"next",
"node",
"following",
"this",
"node",
"ascending",
"up",
"the",
"ancestor",
"chain",
"recursively",
"if",
"this",
"node",
"has",
"no",
"siblings",
"."
] | 024c773667e54cf88db938c2b368977005d70ee8 | https://github.com/sds/haml-lint/blob/024c773667e54cf88db938c2b368977005d70ee8/lib/haml_lint/linter.rb#L153-L161 | train | Returns the next node in the hierarchy. | [
30522,
13366,
2279,
1035,
13045,
1006,
13045,
1007,
2709,
4983,
13045,
9504,
1027,
13045,
1012,
6687,
1029,
13045,
1012,
6687,
1012,
2336,
1024,
1031,
13045,
1033,
2279,
1035,
22941,
1027,
9504,
1031,
9504,
1012,
5950,
1006,
13045,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/api/v1_items_api.rb | SquareConnect.V1ItemsApi.delete_discount | def delete_discount(location_id, discount_id, opts = {})
data, _status_code, _headers = delete_discount_with_http_info(location_id, discount_id, opts)
return data
end | ruby | def delete_discount(location_id, discount_id, opts = {})
data, _status_code, _headers = delete_discount_with_http_info(location_id, discount_id, opts)
return data
end | [
"def",
"delete_discount",
"(",
"location_id",
",",
"discount_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"delete_discount_with_http_info",
"(",
"location_id",
",",
"discount_id",
",",
"opts",
")",
"return",
"data",
... | DeleteDiscount
Deletes an existing discount. *Note**: DeleteDiscount returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteDiscountRequest` object as documented below.
@param location_id The ID of the item's associated location.
@param discount_id The ID of the discount to delete.
@param [Hash] opts the optional parameters
@return [V1Discount] | [
"DeleteDiscount",
"Deletes",
"an",
"existing",
"discount",
".",
"*",
"Note",
"**",
":",
"DeleteDiscount",
"returns",
"nothing",
"on",
"success",
"but",
"Connect",
"SDKs",
"map",
"the",
"empty",
"response",
"to",
"an",
"empty",
"V1DeleteDiscountRequest",
"object",
... | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/v1_items_api.rb#L754-L757 | train | Delete a discount | [
30522,
13366,
3972,
12870,
1035,
19575,
1006,
3295,
1035,
8909,
1010,
19575,
1035,
8909,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
3972,
12870,
1035,
19575,
1035,
2007,
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... |
puppetlabs/puppet | lib/puppet/pops/visitor.rb | Puppet::Pops.Visitor.visit_this_1 | def visit_this_1(receiver, thing, arg)
if method_name = @cache[thing.class]
return receiver.send(method_name, thing, arg)
end
visit_this(receiver, thing, [arg])
end | ruby | def visit_this_1(receiver, thing, arg)
if method_name = @cache[thing.class]
return receiver.send(method_name, thing, arg)
end
visit_this(receiver, thing, [arg])
end | [
"def",
"visit_this_1",
"(",
"receiver",
",",
"thing",
",",
"arg",
")",
"if",
"method_name",
"=",
"@cache",
"[",
"thing",
".",
"class",
"]",
"return",
"receiver",
".",
"send",
"(",
"method_name",
",",
"thing",
",",
"arg",
")",
"end",
"visit_this",
"(",
... | Visit an explicit receiver with 1 args
(This is ~30% faster than calling the general method) | [
"Visit",
"an",
"explicit",
"receiver",
"with",
"1",
"args",
"(",
"This",
"is",
"~30%",
"faster",
"than",
"calling",
"the",
"general",
"method",
")"
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/pops/visitor.rb#L88-L93 | train | This method is called by the visitor to visit the given thing. | [
30522,
13366,
3942,
1035,
2023,
1035,
1015,
1006,
8393,
1010,
2518,
1010,
12098,
2290,
1007,
2065,
4118,
1035,
2171,
1027,
1030,
17053,
1031,
2518,
1012,
2465,
1033,
2709,
8393,
1012,
4604,
1006,
4118,
1035,
2171,
1010,
2518,
1010,
12098,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cloudfoundry/bosh | src/bosh-director/lib/bosh/director/nats_rpc.rb | Bosh::Director.NatsRpc.send_request | def send_request(subject_name, client_id, request, options, &callback)
request_id = generate_request_id
request["reply_to"] = "#{@inbox_name}.#{client_id}.#{request_id}"
@lock.synchronize do
@requests[request_id] = [callback, options]
end
sanitized_log_message = sanitize_log_message(request)
request_body = JSON.generate(request)
@logger.debug("SENT: #{subject_name} #{sanitized_log_message}") unless options['logging'] == false
EM.schedule do
subscribe_inbox
if @handled_response
nats.publish(subject_name, request_body)
else
nats.flush do
nats.publish(subject_name, request_body)
end
end
end
request_id
end | ruby | def send_request(subject_name, client_id, request, options, &callback)
request_id = generate_request_id
request["reply_to"] = "#{@inbox_name}.#{client_id}.#{request_id}"
@lock.synchronize do
@requests[request_id] = [callback, options]
end
sanitized_log_message = sanitize_log_message(request)
request_body = JSON.generate(request)
@logger.debug("SENT: #{subject_name} #{sanitized_log_message}") unless options['logging'] == false
EM.schedule do
subscribe_inbox
if @handled_response
nats.publish(subject_name, request_body)
else
nats.flush do
nats.publish(subject_name, request_body)
end
end
end
request_id
end | [
"def",
"send_request",
"(",
"subject_name",
",",
"client_id",
",",
"request",
",",
"options",
",",
"&",
"callback",
")",
"request_id",
"=",
"generate_request_id",
"request",
"[",
"\"reply_to\"",
"]",
"=",
"\"#{@inbox_name}.#{client_id}.#{request_id}\"",
"@lock",
".",
... | Sends a request (encoded as JSON) and listens for the response | [
"Sends",
"a",
"request",
"(",
"encoded",
"as",
"JSON",
")",
"and",
"listens",
"for",
"the",
"response"
] | 2eaa7100879ddd20cd909cd698514746195e28b7 | https://github.com/cloudfoundry/bosh/blob/2eaa7100879ddd20cd909cd698514746195e28b7/src/bosh-director/lib/bosh/director/nats_rpc.rb#L40-L63 | train | Send a request to the server | [
30522,
13366,
4604,
1035,
5227,
1006,
3395,
1035,
2171,
1010,
7396,
1035,
8909,
1010,
5227,
1010,
7047,
1010,
1004,
2655,
5963,
1007,
5227,
1035,
8909,
1027,
9699,
1035,
5227,
1035,
8909,
5227,
1031,
1000,
7514,
1035,
2000,
1000,
1033,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
puppetlabs/bolt | lib/plan_executor/executor.rb | PlanExecutor.Executor.as_resultset | def as_resultset(targets)
result_array = begin
yield
rescue StandardError => e
@logger.warn(e)
# CODEREVIEW how should we fail if there's an error?
Array(Bolt::Result.from_exception(targets[0], e))
end
Bolt::ResultSet.new(result_array)
end | ruby | def as_resultset(targets)
result_array = begin
yield
rescue StandardError => e
@logger.warn(e)
# CODEREVIEW how should we fail if there's an error?
Array(Bolt::Result.from_exception(targets[0], e))
end
Bolt::ResultSet.new(result_array)
end | [
"def",
"as_resultset",
"(",
"targets",
")",
"result_array",
"=",
"begin",
"yield",
"rescue",
"StandardError",
"=>",
"e",
"@logger",
".",
"warn",
"(",
"e",
")",
"# CODEREVIEW how should we fail if there's an error?",
"Array",
"(",
"Bolt",
"::",
"Result",
".",
"from... | This handles running the job, catching errors, and turning the result
into a result set | [
"This",
"handles",
"running",
"the",
"job",
"catching",
"errors",
"and",
"turning",
"the",
"result",
"into",
"a",
"result",
"set"
] | 50689a33699939d262ea7c822a4b24fd8c4f8d8a | https://github.com/puppetlabs/bolt/blob/50689a33699939d262ea7c822a4b24fd8c4f8d8a/lib/plan_executor/executor.rb#L29-L38 | train | Returns a new result set with the results of the block. | [
30522,
13366,
2004,
1035,
3463,
3388,
1006,
7889,
1007,
2765,
1035,
9140,
1027,
4088,
10750,
5343,
3115,
2121,
29165,
1027,
1028,
1041,
1030,
8833,
4590,
1012,
11582,
1006,
1041,
1007,
1001,
3642,
2890,
8584,
2129,
2323,
2057,
8246,
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... |
fastlane/fastlane | spaceship/lib/spaceship/client.rb | Spaceship.Client.team_id= | def team_id=(team_id)
# First, we verify the team actually exists, because otherwise iTC would return the
# following confusing error message
#
# invalid content provider id
#
available_teams = teams.collect do |team|
{
team_id: (team["contentProvider"] || {})["contentProviderId"],
team_name: (team["contentProvider"] || {})["name"]
}
end
result = available_teams.find do |available_team|
team_id.to_s == available_team[:team_id].to_s
end
unless result
error_string = "Could not set team ID to '#{team_id}', only found the following available teams:\n\n#{available_teams.map { |team| "- #{team[:team_id]} (#{team[:team_name]})" }.join("\n")}\n"
raise Tunes::Error.new, error_string
end
response = request(:post) do |req|
req.url("ra/v1/session/webSession")
req.body = {
contentProviderId: team_id,
dsId: user_detail_data.ds_id # https://github.com/fastlane/fastlane/issues/6711
}.to_json
req.headers['Content-Type'] = 'application/json'
end
handle_itc_response(response.body)
@current_team_id = team_id
end | ruby | def team_id=(team_id)
# First, we verify the team actually exists, because otherwise iTC would return the
# following confusing error message
#
# invalid content provider id
#
available_teams = teams.collect do |team|
{
team_id: (team["contentProvider"] || {})["contentProviderId"],
team_name: (team["contentProvider"] || {})["name"]
}
end
result = available_teams.find do |available_team|
team_id.to_s == available_team[:team_id].to_s
end
unless result
error_string = "Could not set team ID to '#{team_id}', only found the following available teams:\n\n#{available_teams.map { |team| "- #{team[:team_id]} (#{team[:team_name]})" }.join("\n")}\n"
raise Tunes::Error.new, error_string
end
response = request(:post) do |req|
req.url("ra/v1/session/webSession")
req.body = {
contentProviderId: team_id,
dsId: user_detail_data.ds_id # https://github.com/fastlane/fastlane/issues/6711
}.to_json
req.headers['Content-Type'] = 'application/json'
end
handle_itc_response(response.body)
@current_team_id = team_id
end | [
"def",
"team_id",
"=",
"(",
"team_id",
")",
"# First, we verify the team actually exists, because otherwise iTC would return the",
"# following confusing error message",
"#",
"# invalid content provider id",
"#",
"available_teams",
"=",
"teams",
".",
"collect",
"do",
"|",
"te... | Set a new team ID which will be used from now on | [
"Set",
"a",
"new",
"team",
"ID",
"which",
"will",
"be",
"used",
"from",
"now",
"on"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/spaceship/lib/spaceship/client.rb#L137-L171 | train | Set the current team ID | [
30522,
13366,
2136,
1035,
8909,
1027,
1006,
2136,
1035,
8909,
1007,
1001,
2034,
1010,
2057,
20410,
1996,
2136,
2941,
6526,
1010,
2138,
4728,
2009,
2278,
2052,
2709,
1996,
1001,
2206,
16801,
7561,
4471,
1001,
1001,
19528,
4180,
10802,
8909,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/tag.rb | Azure::ApiManagement::Mgmt::V2018_01_01.Tag.get_by_operation_with_http_info | def get_by_operation_with_http_info(resource_group_name, service_name, api_id, operation_id, tag_id, custom_headers:nil)
get_by_operation_async(resource_group_name, service_name, api_id, operation_id, tag_id, custom_headers:custom_headers).value!
end | ruby | def get_by_operation_with_http_info(resource_group_name, service_name, api_id, operation_id, tag_id, custom_headers:nil)
get_by_operation_async(resource_group_name, service_name, api_id, operation_id, tag_id, custom_headers:custom_headers).value!
end | [
"def",
"get_by_operation_with_http_info",
"(",
"resource_group_name",
",",
"service_name",
",",
"api_id",
",",
"operation_id",
",",
"tag_id",
",",
"custom_headers",
":",
"nil",
")",
"get_by_operation_async",
"(",
"resource_group_name",
",",
"service_name",
",",
"api_id"... | Get tag associated with the Operation.
@param resource_group_name [String] The name of the resource group.
@param service_name [String] The name of the API Management service.
@param api_id [String] API revision identifier. Must be unique in the current
API Management service instance. Non-current revision has ;rev=n as a suffix
where n is the revision number.
@param operation_id [String] Operation identifier within an API. Must be
unique in the current API Management service instance.
@param tag_id [String] Tag identifier. Must be unique in the current API
Management service instance.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Get",
"tag",
"associated",
"with",
"the",
"Operation",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/tag.rb#L1630-L1632 | train | Gets the specified tag for the specified API. | [
30522,
13366,
2131,
1035,
2011,
1035,
3169,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
17928,
1035,
8909,
1010,
3169,
1035,
8909,
1010,
6415,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_storagesync/lib/2018-07-01/generated/azure_mgmt_storagesync/registered_servers.rb | Azure::StorageSync::Mgmt::V2018_07_01.RegisteredServers.begin_delete_with_http_info | def begin_delete_with_http_info(resource_group_name, storage_sync_service_name, server_id, custom_headers:nil)
begin_delete_async(resource_group_name, storage_sync_service_name, server_id, custom_headers:custom_headers).value!
end | ruby | def begin_delete_with_http_info(resource_group_name, storage_sync_service_name, server_id, custom_headers:nil)
begin_delete_async(resource_group_name, storage_sync_service_name, server_id, custom_headers:custom_headers).value!
end | [
"def",
"begin_delete_with_http_info",
"(",
"resource_group_name",
",",
"storage_sync_service_name",
",",
"server_id",
",",
"custom_headers",
":",
"nil",
")",
"begin_delete_async",
"(",
"resource_group_name",
",",
"storage_sync_service_name",
",",
"server_id",
",",
"custom_h... | Delete the given registered server.
@param resource_group_name [String] The name of the resource group. The name
is case insensitive.
@param storage_sync_service_name [String] Name of Storage Sync Service
resource.
@param server_id [String] GUID identifying the on-premises server.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Delete",
"the",
"given",
"registered",
"server",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_storagesync/lib/2018-07-01/generated/azure_mgmt_storagesync/registered_servers.rb#L527-L529 | train | Deletes a server from the specified Data Lake Store account. | [
30522,
13366,
4088,
1035,
3972,
12870,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
5527,
1035,
26351,
1035,
2326,
1035,
2171,
1010,
8241,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-rds/lib/aws-sdk-rds/resource.rb | Aws::RDS.Resource.create_db_subnet_group | def create_db_subnet_group(options = {})
resp = @client.create_db_subnet_group(options)
DBSubnetGroup.new(
name: resp.data.db_subnet_group.db_subnet_group_name,
data: resp.data.db_subnet_group,
client: @client
)
end | ruby | def create_db_subnet_group(options = {})
resp = @client.create_db_subnet_group(options)
DBSubnetGroup.new(
name: resp.data.db_subnet_group.db_subnet_group_name,
data: resp.data.db_subnet_group,
client: @client
)
end | [
"def",
"create_db_subnet_group",
"(",
"options",
"=",
"{",
"}",
")",
"resp",
"=",
"@client",
".",
"create_db_subnet_group",
"(",
"options",
")",
"DBSubnetGroup",
".",
"new",
"(",
"name",
":",
"resp",
".",
"data",
".",
"db_subnet_group",
".",
"db_subnet_group_n... | @example Request syntax with placeholder values
dbsubnetgroup = rds.create_db_subnet_group({
db_subnet_group_name: "String", # required
db_subnet_group_description: "String", # required
subnet_ids: ["String"], # required
tags: [
{
key: "String",
value: "String",
},
],
})
@param [Hash] options ({})
@option options [required, String] :db_subnet_group_name
The name for the DB subnet group. This value is stored as a lowercase
string.
Constraints: Must contain no more than 255 letters, numbers, periods,
underscores, spaces, or hyphens. Must not be default.
Example: `mySubnetgroup`
@option options [required, String] :db_subnet_group_description
The description for the DB subnet group.
@option options [required, Array<String>] :subnet_ids
The EC2 Subnet IDs for the DB subnet group.
@option options [Array<Types::Tag>] :tags
A list of tags. For more information, see [Tagging Amazon RDS
Resources][1] in the *Amazon RDS User Guide.*
[1]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.html
@return [DBSubnetGroup] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-rds/lib/aws-sdk-rds/resource.rb#L1378-L1385 | train | Creates a DB subnet group | [
30522,
13366,
3443,
1035,
16962,
1035,
4942,
7159,
1035,
2177,
1006,
7047,
1027,
1063,
1065,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
3443,
1035,
16962,
1035,
4942,
7159,
1035,
2177,
1006,
7047,
1007,
16962,
6342,
24700,
3388,
17058,
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... |
github/linguist | lib/linguist/generated.rb | Linguist.Generated.generated_apache_thrift? | def generated_apache_thrift?
return false unless APACHE_THRIFT_EXTENSIONS.include?(extname)
return lines.first(6).any? { |l| l.include?("Autogenerated by Thrift Compiler") }
end | ruby | def generated_apache_thrift?
return false unless APACHE_THRIFT_EXTENSIONS.include?(extname)
return lines.first(6).any? { |l| l.include?("Autogenerated by Thrift Compiler") }
end | [
"def",
"generated_apache_thrift?",
"return",
"false",
"unless",
"APACHE_THRIFT_EXTENSIONS",
".",
"include?",
"(",
"extname",
")",
"return",
"lines",
".",
"first",
"(",
"6",
")",
".",
"any?",
"{",
"|",
"l",
"|",
"l",
".",
"include?",
"(",
"\"Autogenerated by Th... | Internal: Is the blob generated by Apache Thrift compiler?
Returns true or false | [
"Internal",
":",
"Is",
"the",
"blob",
"generated",
"by",
"Apache",
"Thrift",
"compiler?"
] | 9116c90fcbb82ac03b4b33c58cfbde1fcf745e99 | https://github.com/github/linguist/blob/9116c90fcbb82ac03b4b33c58cfbde1fcf745e99/lib/linguist/generated.rb#L327-L330 | train | Returns true if the file is generated by apache thrift | [
30522,
13366,
7013,
1035,
15895,
1035,
16215,
16338,
1029,
2709,
6270,
4983,
15895,
1035,
16215,
16338,
1035,
14305,
1012,
2421,
1029,
1006,
4654,
2102,
18442,
1007,
2709,
3210,
1012,
2034,
1006,
1020,
1007,
1012,
2151,
1029,
1063,
1064,
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_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/device_settings.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.DeviceSettings.create_or_update_alert_settings | def create_or_update_alert_settings(device_name, parameters, resource_group_name, manager_name, custom_headers:nil)
response = create_or_update_alert_settings_async(device_name, parameters, resource_group_name, manager_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_or_update_alert_settings(device_name, parameters, resource_group_name, manager_name, custom_headers:nil)
response = create_or_update_alert_settings_async(device_name, parameters, resource_group_name, manager_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_or_update_alert_settings",
"(",
"device_name",
",",
"parameters",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_or_update_alert_settings_async",
"(",
"device_name",
",",
"parameters",
",",
... | Creates or updates the alert settings of the specified device.
@param device_name [String] The device name
@param parameters [AlertSettings] The alert settings to be added or updated.
@param resource_group_name [String] The resource group name
@param manager_name [String] The manager name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [AlertSettings] operation results. | [
"Creates",
"or",
"updates",
"the",
"alert",
"settings",
"of",
"the",
"specified",
"device",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/device_settings.rb#L134-L137 | train | Creates or updates alert settings for the device. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1035,
9499,
1035,
10906,
1006,
5080,
1035,
2171,
1010,
11709,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3443,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
awesome-print/awesome_print | lib/awesome_print/ext/active_record.rb | AwesomePrint.ActiveRecord.cast_with_active_record | def cast_with_active_record(object, type)
cast = cast_without_active_record(object, type)
return cast if !defined?(::ActiveRecord::Base)
if object.is_a?(::ActiveRecord::Base)
cast = :active_record_instance
elsif object.is_a?(::ActiveModel::Errors)
cast = :active_model_error
elsif object.is_a?(Class) && object.ancestors.include?(::ActiveRecord::Base)
cast = :active_record_class
elsif type == :activerecord_relation || object.class.ancestors.include?(::ActiveRecord::Relation)
cast = :array
end
cast
end | ruby | def cast_with_active_record(object, type)
cast = cast_without_active_record(object, type)
return cast if !defined?(::ActiveRecord::Base)
if object.is_a?(::ActiveRecord::Base)
cast = :active_record_instance
elsif object.is_a?(::ActiveModel::Errors)
cast = :active_model_error
elsif object.is_a?(Class) && object.ancestors.include?(::ActiveRecord::Base)
cast = :active_record_class
elsif type == :activerecord_relation || object.class.ancestors.include?(::ActiveRecord::Relation)
cast = :array
end
cast
end | [
"def",
"cast_with_active_record",
"(",
"object",
",",
"type",
")",
"cast",
"=",
"cast_without_active_record",
"(",
"object",
",",
"type",
")",
"return",
"cast",
"if",
"!",
"defined?",
"(",
"::",
"ActiveRecord",
"::",
"Base",
")",
"if",
"object",
".",
"is_a?"... | Add ActiveRecord class names to the dispatcher pipeline.
------------------------------------------------------------------------------ | [
"Add",
"ActiveRecord",
"class",
"names",
"to",
"the",
"dispatcher",
"pipeline",
".",
"------------------------------------------------------------------------------"
] | 4564fd74721562cbef2443f7d97109bf9192343d | https://github.com/awesome-print/awesome_print/blob/4564fd74721562cbef2443f7d97109bf9192343d/lib/awesome_print/ext/active_record.rb#L16-L30 | train | Casts an object to the given type. | [
30522,
13366,
3459,
1035,
2007,
1035,
3161,
1035,
2501,
1006,
4874,
1010,
2828,
1007,
3459,
1027,
3459,
1035,
2302,
1035,
3161,
1035,
2501,
1006,
4874,
1010,
2828,
1007,
2709,
3459,
2065,
999,
4225,
1029,
1006,
1024,
1024,
3161,
2890,
271... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_service_bus/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb | Azure::ServiceBus::Mgmt::V2018_01_01_preview.Namespaces.list_ip_filter_rules | def list_ip_filter_rules(resource_group_name, namespace_name, custom_headers:nil)
first_page = list_ip_filter_rules_as_lazy(resource_group_name, namespace_name, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_ip_filter_rules(resource_group_name, namespace_name, custom_headers:nil)
first_page = list_ip_filter_rules_as_lazy(resource_group_name, namespace_name, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_ip_filter_rules",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_ip_filter_rules_as_lazy",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"custom_headers",
":custom_headers",
")",
"... | Gets a list of IP Filter rules for a Namespace.
@param resource_group_name [String] Name of the Resource group within the
Azure subscription.
@param namespace_name [String] The namespace name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<IpFilterRule>] operation results. | [
"Gets",
"a",
"list",
"of",
"IP",
"Filter",
"rules",
"for",
"a",
"Namespace",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_service_bus/lib/2018-01-01-preview/generated/azure_mgmt_service_bus/namespaces.rb#L531-L534 | train | Gets all the IP filter rules for a namespace. | [
30522,
13366,
2862,
1035,
12997,
1035,
11307,
1035,
3513,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3415,
15327,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2862,
1035,
12997,
1035,
11307,
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_media_services/lib/2015-10-01/generated/azure_mgmt_media_services/media_service_operations.rb | Azure::MediaServices::Mgmt::V2015_10_01.MediaServiceOperations.create_with_http_info | def create_with_http_info(resource_group_name, media_service_name, parameters, custom_headers:nil)
create_async(resource_group_name, media_service_name, parameters, custom_headers:custom_headers).value!
end | ruby | def create_with_http_info(resource_group_name, media_service_name, parameters, custom_headers:nil)
create_async(resource_group_name, media_service_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"create_with_http_info",
"(",
"resource_group_name",
",",
"media_service_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"create_async",
"(",
"resource_group_name",
",",
"media_service_name",
",",
"parameters",
",",
"custom_headers",
":custom_head... | Creates a Media Service.
@param resource_group_name [String] Name of the resource group within the
Azure subscription.
@param media_service_name [String] Name of the Media Service.
@param parameters [MediaService] Media Service properties needed for
creation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Creates",
"a",
"Media",
"Service",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_media_services/lib/2015-10-01/generated/azure_mgmt_media_services/media_service_operations.rb#L345-L347 | train | Creates a new chunk of a chunk of a chunk of the media service. | [
30522,
13366,
3443,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2865,
1035,
2326,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3443,
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... |
attr-encrypted/attr_encrypted | lib/attr_encrypted.rb | AttrEncrypted.InstanceMethods.encrypted_attributes | def encrypted_attributes
@encrypted_attributes ||= begin
duplicated= {}
self.class.encrypted_attributes.map { |key, value| duplicated[key] = value.dup }
duplicated
end
end | ruby | def encrypted_attributes
@encrypted_attributes ||= begin
duplicated= {}
self.class.encrypted_attributes.map { |key, value| duplicated[key] = value.dup }
duplicated
end
end | [
"def",
"encrypted_attributes",
"@encrypted_attributes",
"||=",
"begin",
"duplicated",
"=",
"{",
"}",
"self",
".",
"class",
".",
"encrypted_attributes",
".",
"map",
"{",
"|",
"key",
",",
"value",
"|",
"duplicated",
"[",
"key",
"]",
"=",
"value",
".",
"dup",
... | Copies the class level hash of encrypted attributes with virtual attribute names as keys
and their corresponding options as values to the instance | [
"Copies",
"the",
"class",
"level",
"hash",
"of",
"encrypted",
"attributes",
"with",
"virtual",
"attribute",
"names",
"as",
"keys",
"and",
"their",
"corresponding",
"options",
"as",
"values",
"to",
"the",
"instance"
] | 11df93aef14c661dd0c03169d382a0412f93124e | https://github.com/attr-encrypted/attr_encrypted/blob/11df93aef14c661dd0c03169d382a0412f93124e/lib/attr_encrypted.rb#L358-L364 | train | Returns the array of the encrypted attributes for this object. | [
30522,
13366,
4372,
26775,
22571,
3064,
1035,
12332,
1030,
4372,
26775,
22571,
3064,
1035,
12332,
1064,
1064,
1027,
4088,
24473,
2094,
1027,
1063,
1065,
2969,
1012,
2465,
1012,
4372,
26775,
22571,
3064,
1035,
12332,
1012,
4949,
1063,
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_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/backup_schedules.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.BackupSchedules.begin_create_or_update | def begin_create_or_update(device_name, backup_policy_name, backup_schedule_name, parameters, resource_group_name, manager_name, custom_headers:nil)
response = begin_create_or_update_async(device_name, backup_policy_name, backup_schedule_name, parameters, resource_group_name, manager_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_create_or_update(device_name, backup_policy_name, backup_schedule_name, parameters, resource_group_name, manager_name, custom_headers:nil)
response = begin_create_or_update_async(device_name, backup_policy_name, backup_schedule_name, parameters, resource_group_name, manager_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_create_or_update",
"(",
"device_name",
",",
"backup_policy_name",
",",
"backup_schedule_name",
",",
"parameters",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_create_or_update_async",
"(",
... | Creates or updates the backup schedule.
@param device_name [String] The device name
@param backup_policy_name [String] The backup policy name.
@param backup_schedule_name [String] The backup schedule name.
@param parameters [BackupSchedule] The backup schedule.
@param resource_group_name [String] The resource group name
@param manager_name [String] The manager name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [BackupSchedule] operation results. | [
"Creates",
"or",
"updates",
"the",
"backup",
"schedule",
"."
] | 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/backup_schedules.rb#L343-L346 | train | Creates or updates a backup policy schedule. | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1006,
5080,
1035,
2171,
1010,
10200,
1035,
3343,
1035,
2171,
1010,
10200,
1035,
6134,
1035,
2171,
1010,
11709,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
7661,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/api/v1_transactions_api.rb | SquareConnect.V1TransactionsApi.list_bank_accounts | def list_bank_accounts(location_id, opts = {})
data, _status_code, _headers = list_bank_accounts_with_http_info(location_id, opts)
return data
end | ruby | def list_bank_accounts(location_id, opts = {})
data, _status_code, _headers = list_bank_accounts_with_http_info(location_id, opts)
return data
end | [
"def",
"list_bank_accounts",
"(",
"location_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"list_bank_accounts_with_http_info",
"(",
"location_id",
",",
"opts",
")",
"return",
"data",
"end"
] | ListBankAccounts
Provides non-confidential details for all of a location's associated bank accounts. This endpoint does not provide full bank account numbers, and there is no way to obtain a full bank account number with the Connect API.
@param location_id The ID of the location to list bank accounts for.
@param [Hash] opts the optional parameters
@return [Array<V1BankAccount>] | [
"ListBankAccounts",
"Provides",
"non",
"-",
"confidential",
"details",
"for",
"all",
"of",
"a",
"location",
"s",
"associated",
"bank",
"accounts",
".",
"This",
"endpoint",
"does",
"not",
"provide",
"full",
"bank",
"account",
"numbers",
"and",
"there",
"is",
"n... | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/v1_transactions_api.rb#L84-L87 | train | Returns a list of Bank Account objects | [
30522,
13366,
2862,
1035,
2924,
1035,
6115,
1006,
3295,
1035,
8909,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
2862,
1035,
2924,
1035,
6115,
1035,
2007,
1035,
8299,
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... |
awesome-print/awesome_print | lib/awesome_print/ext/mongo_mapper.rb | AwesomePrint.MongoMapper.awesome_mongo_mapper_association | def awesome_mongo_mapper_association(object)
return object.inspect if !defined?(::ActiveSupport::OrderedHash)
return awesome_object(object) if @options[:raw]
association = object.class.name.split('::').last.titleize.downcase.sub(/ association$/, '')
association = "embeds #{association}" if object.embeddable?
class_name = object.class_name
"#{colorize(association, :assoc)} #{colorize(class_name, :class)}"
end | ruby | def awesome_mongo_mapper_association(object)
return object.inspect if !defined?(::ActiveSupport::OrderedHash)
return awesome_object(object) if @options[:raw]
association = object.class.name.split('::').last.titleize.downcase.sub(/ association$/, '')
association = "embeds #{association}" if object.embeddable?
class_name = object.class_name
"#{colorize(association, :assoc)} #{colorize(class_name, :class)}"
end | [
"def",
"awesome_mongo_mapper_association",
"(",
"object",
")",
"return",
"object",
".",
"inspect",
"if",
"!",
"defined?",
"(",
"::",
"ActiveSupport",
"::",
"OrderedHash",
")",
"return",
"awesome_object",
"(",
"object",
")",
"if",
"@options",
"[",
":raw",
"]",
... | Format MongoMapper association object.
------------------------------------------------------------------------------ | [
"Format",
"MongoMapper",
"association",
"object",
".",
"------------------------------------------------------------------------------"
] | 4564fd74721562cbef2443f7d97109bf9192343d | https://github.com/awesome-print/awesome_print/blob/4564fd74721562cbef2443f7d97109bf9192343d/lib/awesome_print/ext/mongo_mapper.rb#L95-L104 | train | Returns a string representation of the association of the given object. | [
30522,
13366,
12476,
1035,
12256,
3995,
1035,
4949,
4842,
1035,
2523,
1006,
4874,
1007,
2709,
4874,
1012,
22459,
2065,
999,
4225,
1029,
1006,
1024,
1024,
3161,
6342,
9397,
11589,
1024,
1024,
3641,
14949,
2232,
1007,
2709,
12476,
1035,
4874,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_service_bus/lib/2015-08-01/generated/azure_mgmt_service_bus/queues.rb | Azure::ServiceBus::Mgmt::V2015_08_01.Queues.get_with_http_info | def get_with_http_info(resource_group_name, namespace_name, queue_name, custom_headers:nil)
get_async(resource_group_name, namespace_name, queue_name, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, namespace_name, queue_name, custom_headers:nil)
get_async(resource_group_name, namespace_name, queue_name, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"queue_name",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"queue_name",
",",
"custom_headers",
":custom_headers",
")",
... | Returns a description for the specified queue.
@param resource_group_name [String] Name of the Resource group within the
Azure subscription.
@param namespace_name [String] The namespace name
@param queue_name [String] The queue name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Returns",
"a",
"description",
"for",
"the",
"specified",
"queue",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_service_bus/lib/2015-08-01/generated/azure_mgmt_service_bus/queues.rb#L365-L367 | train | Gets the sequence of elements in the queue. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3415,
15327,
1035,
2171,
1010,
24240,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
2004,
6038,
2278,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.