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_search/lib/2015-08-19/generated/azure_mgmt_search/query_keys.rb | Azure::Search::Mgmt::V2015_08_19.QueryKeys.create | def create(resource_group_name, search_service_name, name, search_management_request_options:nil, custom_headers:nil)
response = create_async(resource_group_name, search_service_name, name, search_management_request_options:search_management_request_options, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create(resource_group_name, search_service_name, name, search_management_request_options:nil, custom_headers:nil)
response = create_async(resource_group_name, search_service_name, name, search_management_request_options:search_management_request_options, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create",
"(",
"resource_group_name",
",",
"search_service_name",
",",
"name",
",",
"search_management_request_options",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_async",
"(",
"resource_group_name",
",",
"search_service_name",
... | Generates a new query key for the specified Search service. You can create up
to 50 query keys per service.
@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 name [String] The name of the new query API key.
@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.
@return [QueryKey] operation results. | [
"Generates",
"a",
"new",
"query",
"key",
"for",
"the",
"specified",
"Search",
"service",
".",
"You",
"can",
"create",
"up",
"to",
"50",
"query",
"keys",
"per",
"service",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_search/lib/2015-08-19/generated/azure_mgmt_search/query_keys.rb#L41-L44 | train | Creates a new search service. | [
30522,
13366,
3443,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3945,
1035,
2326,
1035,
2171,
1010,
2171,
1010,
3945,
1035,
2968,
1035,
5227,
1035,
7047,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/hub_virtual_network_connections.rb | Azure::Network::Mgmt::V2018_07_01.HubVirtualNetworkConnections.get_with_http_info | def get_with_http_info(resource_group_name, virtual_hub_name, connection_name, custom_headers:nil)
get_async(resource_group_name, virtual_hub_name, connection_name, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, virtual_hub_name, connection_name, custom_headers:nil)
get_async(resource_group_name, virtual_hub_name, connection_name, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"virtual_hub_name",
",",
"connection_name",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"virtual_hub_name",
",",
"connection_name",
",",
"custom_headers",
":custom_head... | Retrieves the details of a HubVirtualNetworkConnection.
@param resource_group_name [String] The resource group name of the
VirtualHub.
@param virtual_hub_name [String] The name of the VirtualHub.
@param connection_name [String] The name of the vpn connection.
@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. | [
"Retrieves",
"the",
"details",
"of",
"a",
"HubVirtualNetworkConnection",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/hub_virtual_network_connections.rb#L53-L55 | train | Gets the specified virtual hub connection. | [
30522,
13366,
2131,
1035,
2007,
30524,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7484,
1035,
9594,
1035,
2171,
1010,
4434,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cloudfoundry/bosh | src/bosh-director/lib/bosh/director/nats_rpc.rb | Bosh::Director.NatsRpc.send_message | def send_message(client, payload)
message = JSON.generate(payload)
@logger.debug("SENT: #{client} #{message}")
EM.schedule do
nats.publish(client, message)
end
end | ruby | def send_message(client, payload)
message = JSON.generate(payload)
@logger.debug("SENT: #{client} #{message}")
EM.schedule do
nats.publish(client, message)
end
end | [
"def",
"send_message",
"(",
"client",
",",
"payload",
")",
"message",
"=",
"JSON",
".",
"generate",
"(",
"payload",
")",
"@logger",
".",
"debug",
"(",
"\"SENT: #{client} #{message}\"",
")",
"EM",
".",
"schedule",
"do",
"nats",
".",
"publish",
"(",
"client",
... | Publishes a payload (encoded as JSON) without expecting a response | [
"Publishes",
"a",
"payload",
"(",
"encoded",
"as",
"JSON",
")",
"without",
"expecting",
"a",
"response"
] | 2eaa7100879ddd20cd909cd698514746195e28b7 | https://github.com/cloudfoundry/bosh/blob/2eaa7100879ddd20cd909cd698514746195e28b7/src/bosh-director/lib/bosh/director/nats_rpc.rb#L30-L37 | train | Send a message to a client | [
30522,
13366,
4604,
1035,
4471,
1006,
7396,
1010,
18093,
1007,
4471,
1027,
1046,
3385,
1012,
9699,
1006,
18093,
1007,
1030,
8833,
4590,
1012,
2139,
8569,
2290,
1006,
1000,
2741,
1024,
1001,
1063,
7396,
1065,
1001,
1063,
4471,
1065,
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... |
getsentry/raven-ruby | lib/raven/integrations/rack.rb | Raven.RackInterface.read_data_from | def read_data_from(request)
if request.form_data?
request.POST
elsif request.body # JSON requests, etc
data = request.body.read(4096 * 4) # Sentry server limit
request.body.rewind
data
end
rescue IOError => ex
ex.message
end | ruby | def read_data_from(request)
if request.form_data?
request.POST
elsif request.body # JSON requests, etc
data = request.body.read(4096 * 4) # Sentry server limit
request.body.rewind
data
end
rescue IOError => ex
ex.message
end | [
"def",
"read_data_from",
"(",
"request",
")",
"if",
"request",
".",
"form_data?",
"request",
".",
"POST",
"elsif",
"request",
".",
"body",
"# JSON requests, etc",
"data",
"=",
"request",
".",
"body",
".",
"read",
"(",
"4096",
"*",
"4",
")",
"# Sentry server ... | See Sentry server default limits at
https://github.com/getsentry/sentry/blob/master/src/sentry/conf/server.py | [
"See",
"Sentry",
"server",
"default",
"limits",
"at",
"https",
":",
"//",
"github",
".",
"com",
"/",
"getsentry",
"/",
"sentry",
"/",
"blob",
"/",
"master",
"/",
"src",
"/",
"sentry",
"/",
"conf",
"/",
"server",
".",
"py"
] | 729c22f9284939695f14822683bff1a0b72502bd | https://github.com/getsentry/raven-ruby/blob/729c22f9284939695f14822683bff1a0b72502bd/lib/raven/integrations/rack.rb#L87-L97 | train | Reads the data from the request body and returns the result as a string. | [
30522,
13366,
3191,
1035,
2951,
1035,
2013,
1006,
5227,
1007,
2065,
5227,
1012,
2433,
1035,
2951,
1029,
5227,
1012,
2695,
3449,
5332,
2546,
5227,
1012,
2303,
1001,
1046,
3385,
11186,
1010,
4385,
2951,
1027,
5227,
1012,
2303,
1012,
3191,
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... |
mongodb/mongoid | lib/mongoid/atomic.rb | Mongoid.Atomic.atomic_unsets | def atomic_unsets
unsets = []
delayed_atomic_unsets.each_pair do |name, docs|
path = nil
docs.each do |doc|
path ||= doc.flag_as_destroyed
end
unsets.push(path || name)
end
unsets
end | ruby | def atomic_unsets
unsets = []
delayed_atomic_unsets.each_pair do |name, docs|
path = nil
docs.each do |doc|
path ||= doc.flag_as_destroyed
end
unsets.push(path || name)
end
unsets
end | [
"def",
"atomic_unsets",
"unsets",
"=",
"[",
"]",
"delayed_atomic_unsets",
".",
"each_pair",
"do",
"|",
"name",
",",
"docs",
"|",
"path",
"=",
"nil",
"docs",
".",
"each",
"do",
"|",
"doc",
"|",
"path",
"||=",
"doc",
".",
"flag_as_destroyed",
"end",
"unset... | Get all the attributes that need to be unset.
@example Get the unsets.
person.atomic_unsets
@return [ Array<Hash> ] The $unset operations.
@since 2.2.0 | [
"Get",
"all",
"the",
"attributes",
"that",
"need",
"to",
"be",
"unset",
"."
] | 56976e32610f4c2450882b0bfe14da099f0703f4 | https://github.com/mongodb/mongoid/blob/56976e32610f4c2450882b0bfe14da099f0703f4/lib/mongoid/atomic.rb#L249-L259 | train | Returns the set of deleted documents. | [
30522,
13366,
9593,
1035,
4895,
13462,
2015,
4895,
13462,
2015,
1027,
1031,
1033,
8394,
1035,
9593,
1035,
4895,
13462,
2015,
1012,
2169,
1035,
3940,
2079,
1064,
2171,
1010,
9986,
2015,
1064,
4130,
1027,
9152,
2140,
9986,
2015,
1012,
2169,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb | Azure::KeyVault::V2016_10_01.KeyVaultClient.get_certificate_versions_with_http_info | def get_certificate_versions_with_http_info(vault_base_url, certificate_name, maxresults:nil, custom_headers:nil)
get_certificate_versions_async(vault_base_url, certificate_name, maxresults:maxresults, custom_headers:custom_headers).value!
end | ruby | def get_certificate_versions_with_http_info(vault_base_url, certificate_name, maxresults:nil, custom_headers:nil)
get_certificate_versions_async(vault_base_url, certificate_name, maxresults:maxresults, custom_headers:custom_headers).value!
end | [
"def",
"get_certificate_versions_with_http_info",
"(",
"vault_base_url",
",",
"certificate_name",
",",
"maxresults",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"get_certificate_versions_async",
"(",
"vault_base_url",
",",
"certificate_name",
",",
"maxresults",
":... | List the versions of a certificate.
The GetCertificateVersions operation returns the versions of a certificate in
the specified key vault. This operation requires the certificates/list
permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param certificate_name [String] The name of the certificate.
@param maxresults [Integer] Maximum number of results to return in a page. If
not specified the service will return up to 25 results.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"List",
"the",
"versions",
"of",
"a",
"certificate",
"."
] | 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#L5478-L5480 | train | Gets the versions of the certificate in the specified vault. | [
30522,
13366,
2131,
1035,
8196,
1035,
4617,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
8196,
1035,
2171,
1010,
4098,
6072,
11314,
2015,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/job_executions.rb | Azure::SQL::Mgmt::V2017_03_01_preview.JobExecutions.list_by_job_as_lazy | def list_by_job_as_lazy(resource_group_name, server_name, job_agent_name, job_name, create_time_min:nil, create_time_max:nil, end_time_min:nil, end_time_max:nil, is_active:nil, skip:nil, top:nil, custom_headers:nil)
response = list_by_job_async(resource_group_name, server_name, job_agent_name, job_name, create_time_min:create_time_min, create_time_max:create_time_max, end_time_min:end_time_min, end_time_max:end_time_max, is_active:is_active, skip:skip, top:top, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_job_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_by_job_as_lazy(resource_group_name, server_name, job_agent_name, job_name, create_time_min:nil, create_time_max:nil, end_time_min:nil, end_time_max:nil, is_active:nil, skip:nil, top:nil, custom_headers:nil)
response = list_by_job_async(resource_group_name, server_name, job_agent_name, job_name, create_time_min:create_time_min, create_time_max:create_time_max, end_time_min:end_time_min, end_time_max:end_time_max, is_active:is_active, skip:skip, top:top, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_job_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_by_job_as_lazy",
"(",
"resource_group_name",
",",
"server_name",
",",
"job_agent_name",
",",
"job_name",
",",
"create_time_min",
":",
"nil",
",",
"create_time_max",
":",
"nil",
",",
"end_time_min",
":",
"nil",
",",
"end_time_max",
":",
"nil",
",",
"... | Lists a job's executions.
@param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param server_name [String] The name of the server.
@param job_agent_name [String] The name of the job agent.
@param job_name [String] The name of the job to get.
@param create_time_min [DateTime] If specified, only job executions created
at or after the specified time are included.
@param create_time_max [DateTime] If specified, only job executions created
before the specified time are included.
@param end_time_min [DateTime] If specified, only job executions completed at
or after the specified time are included.
@param end_time_max [DateTime] If specified, only job executions completed
before the specified time are included.
@param is_active [Boolean] If specified, only active or only completed job
executions are included.
@param skip [Integer] The number of elements in the collection to skip.
@param top [Integer] The number of elements to return from the collection.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [JobExecutionListResult] which provide lazy access to pages of the
response. | [
"Lists",
"a",
"job",
"s",
"executions",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/job_executions.rb#L1089-L1098 | train | Gets the list of all the image files in a job agent. | [
30522,
13366,
2862,
1035,
2011,
1035,
3105,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
3105,
1035,
4005,
1035,
2171,
1010,
3105,
1035,
2171,
1010,
3443,
1035,
2051,
1035,
8117,
1024,
9152,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/resource_health_metadata_operations.rb | Azure::Web::Mgmt::V2018_02_01.ResourceHealthMetadataOperations.list_by_site_slot | def list_by_site_slot(resource_group_name, name, slot, custom_headers:nil)
first_page = list_by_site_slot_as_lazy(resource_group_name, name, slot, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_by_site_slot(resource_group_name, name, slot, custom_headers:nil)
first_page = list_by_site_slot_as_lazy(resource_group_name, name, slot, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_by_site_slot",
"(",
"resource_group_name",
",",
"name",
",",
"slot",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_by_site_slot_as_lazy",
"(",
"resource_group_name",
",",
"name",
",",
"slot",
",",
"custom_headers",
":custom_headers",
... | Gets the category of ResourceHealthMetadata to use for the given site as a
collection
Gets the category of ResourceHealthMetadata to use for the given site as a
collection
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param name [String] Name of web app.
@param slot [String] Name of web app slot. If not specified then will default
to production slot.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<ResourceHealthMetadata>] operation results. | [
"Gets",
"the",
"category",
"of",
"ResourceHealthMetadata",
"to",
"use",
"for",
"the",
"given",
"site",
"as",
"a",
"collection"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/resource_health_metadata_operations.rb#L451-L454 | train | Gets all the vulnerability assessment of a site. | [
30522,
13366,
2862,
1035,
2011,
1035,
2609,
1035,
10453,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
10453,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2862,
1035,
2011,
1035,
2609,
1035,
10453,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
amatsuda/active_decorator | lib/active_decorator/decorator.rb | ActiveDecorator.Decorator.decorator_for | def decorator_for(model_class)
return @@decorators[model_class] if @@decorators.key? model_class
decorator_name = "#{model_class.name}#{ActiveDecorator.config.decorator_suffix}"
d = Object.const_get decorator_name, false
unless Class === d
d.send :include, ActiveDecorator::Helpers
@@decorators[model_class] = d
else
# Cache nil results
@@decorators[model_class] = nil
end
rescue NameError
if model_class.respond_to?(:base_class) && (model_class.base_class != model_class)
@@decorators[model_class] = decorator_for model_class.base_class
else
# Cache nil results
@@decorators[model_class] = nil
end
end | ruby | def decorator_for(model_class)
return @@decorators[model_class] if @@decorators.key? model_class
decorator_name = "#{model_class.name}#{ActiveDecorator.config.decorator_suffix}"
d = Object.const_get decorator_name, false
unless Class === d
d.send :include, ActiveDecorator::Helpers
@@decorators[model_class] = d
else
# Cache nil results
@@decorators[model_class] = nil
end
rescue NameError
if model_class.respond_to?(:base_class) && (model_class.base_class != model_class)
@@decorators[model_class] = decorator_for model_class.base_class
else
# Cache nil results
@@decorators[model_class] = nil
end
end | [
"def",
"decorator_for",
"(",
"model_class",
")",
"return",
"@@decorators",
"[",
"model_class",
"]",
"if",
"@@decorators",
".",
"key?",
"model_class",
"decorator_name",
"=",
"\"#{model_class.name}#{ActiveDecorator.config.decorator_suffix}\"",
"d",
"=",
"Object",
".",
"cons... | Returns a decorator module for the given class.
Returns `nil` if no decorator module was found. | [
"Returns",
"a",
"decorator",
"module",
"for",
"the",
"given",
"class",
".",
"Returns",
"nil",
"if",
"no",
"decorator",
"module",
"was",
"found",
"."
] | e7cfa764e657ea8bbb4cbe92cb220ee67ebae58e | https://github.com/amatsuda/active_decorator/blob/e7cfa764e657ea8bbb4cbe92cb220ee67ebae58e/lib/active_decorator/decorator.rb#L68-L87 | train | Returns the class that is decorated with the given model class. | [
30522,
13366,
25545,
8844,
1035,
2005,
1006,
2944,
1035,
2465,
1007,
2709,
1030,
1030,
25545,
18926,
1031,
2944,
1035,
2465,
1033,
2065,
1030,
1030,
25545,
18926,
1012,
3145,
1029,
2944,
1035,
2465,
25545,
8844,
1035,
2171,
1027,
1000,
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... |
sporkmonger/addressable | lib/addressable/uri.rb | Addressable.URI.split_path | def split_path(path)
splitted = path.split(SLASH)
splitted << EMPTY_STR if path.end_with? SLASH
splitted
end | ruby | def split_path(path)
splitted = path.split(SLASH)
splitted << EMPTY_STR if path.end_with? SLASH
splitted
end | [
"def",
"split_path",
"(",
"path",
")",
"splitted",
"=",
"path",
".",
"split",
"(",
"SLASH",
")",
"splitted",
"<<",
"EMPTY_STR",
"if",
"path",
".",
"end_with?",
"SLASH",
"splitted",
"end"
] | Splits path string with "/" (slash).
It is considered that there is empty string after last slash when
path ends with slash.
@param [String] path The path to split.
@return [Array<String>] An array of parts of path. | [
"Splits",
"path",
"string",
"with",
"/",
"(",
"slash",
")",
".",
"It",
"is",
"considered",
"that",
"there",
"is",
"empty",
"string",
"after",
"last",
"slash",
"when",
"path",
"ends",
"with",
"slash",
"."
] | 5894c95a7768435cb46d1355954611dbd194832e | https://github.com/sporkmonger/addressable/blob/5894c95a7768435cb46d1355954611dbd194832e/lib/addressable/uri.rb#L2495-L2499 | train | Split a path into its components. | [
30522,
13366,
3975,
1035,
4130,
1006,
4130,
1007,
3975,
3064,
1027,
4130,
1012,
3975,
1006,
18296,
1007,
3975,
3064,
1026,
1026,
4064,
1035,
2358,
2099,
2065,
4130,
1012,
2203,
1035,
2007,
1029,
18296,
3975,
3064,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/subnet.rb | Aws::EC2.Subnet.create_instances | def create_instances(options = {})
batch = []
options = options.merge(subnet_id: @id)
resp = @client.run_instances(options)
resp.data.instances.each do |i|
batch << Instance.new(
id: i.instance_id,
data: i,
client: @client
)
end
Instance::Collection.new([batch], size: batch.size)
end | ruby | def create_instances(options = {})
batch = []
options = options.merge(subnet_id: @id)
resp = @client.run_instances(options)
resp.data.instances.each do |i|
batch << Instance.new(
id: i.instance_id,
data: i,
client: @client
)
end
Instance::Collection.new([batch], size: batch.size)
end | [
"def",
"create_instances",
"(",
"options",
"=",
"{",
"}",
")",
"batch",
"=",
"[",
"]",
"options",
"=",
"options",
".",
"merge",
"(",
"subnet_id",
":",
"@id",
")",
"resp",
"=",
"@client",
".",
"run_instances",
"(",
"options",
")",
"resp",
".",
"data",
... | @!group Actions
@example Request syntax with placeholder values
instance = subnet.create_instances({
block_device_mappings: [
{
device_name: "String",
virtual_name: "String",
ebs: {
delete_on_termination: false,
iops: 1,
snapshot_id: "String",
volume_size: 1,
volume_type: "standard", # accepts standard, io1, gp2, sc1, st1
encrypted: false,
kms_key_id: "String",
},
no_device: "String",
},
],
image_id: "String",
instance_type: "t1.micro", # accepts t1.micro, t2.nano, t2.micro, t2.small, t2.medium, t2.large, t2.xlarge, t2.2xlarge, t3.nano, t3.micro, t3.small, t3.medium, t3.large, t3.xlarge, t3.2xlarge, t3a.nano, t3a.micro, t3a.small, t3a.medium, t3a.large, t3a.xlarge, t3a.2xlarge, m1.small, m1.medium, m1.large, m1.xlarge, m3.medium, m3.large, m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge, m4.16xlarge, m2.xlarge, m2.2xlarge, m2.4xlarge, cr1.8xlarge, r3.large, r3.xlarge, r3.2xlarge, r3.4xlarge, r3.8xlarge, r4.large, r4.xlarge, r4.2xlarge, r4.4xlarge, r4.8xlarge, r4.16xlarge, r5.large, r5.xlarge, r5.2xlarge, r5.4xlarge, r5.12xlarge, r5.24xlarge, r5.metal, r5a.large, r5a.xlarge, r5a.2xlarge, r5a.4xlarge, r5a.12xlarge, r5a.24xlarge, r5d.large, r5d.xlarge, r5d.2xlarge, r5d.4xlarge, r5d.12xlarge, r5d.24xlarge, r5d.metal, r5ad.large, r5ad.xlarge, r5ad.2xlarge, r5ad.4xlarge, r5ad.8xlarge, r5ad.12xlarge, r5ad.16xlarge, r5ad.24xlarge, x1.16xlarge, x1.32xlarge, x1e.xlarge, x1e.2xlarge, x1e.4xlarge, x1e.8xlarge, x1e.16xlarge, x1e.32xlarge, i2.xlarge, i2.2xlarge, i2.4xlarge, i2.8xlarge, i3.large, i3.xlarge, i3.2xlarge, i3.4xlarge, i3.8xlarge, i3.16xlarge, i3.metal, hi1.4xlarge, hs1.8xlarge, c1.medium, c1.xlarge, c3.large, c3.xlarge, c3.2xlarge, c3.4xlarge, c3.8xlarge, c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, c5.large, c5.xlarge, c5.2xlarge, c5.4xlarge, c5.9xlarge, c5.18xlarge, c5d.large, c5d.xlarge, c5d.2xlarge, c5d.4xlarge, c5d.9xlarge, c5d.18xlarge, c5n.large, c5n.xlarge, c5n.2xlarge, c5n.4xlarge, c5n.9xlarge, c5n.18xlarge, cc1.4xlarge, cc2.8xlarge, g2.2xlarge, g2.8xlarge, g3.4xlarge, g3.8xlarge, g3.16xlarge, g3s.xlarge, cg1.4xlarge, p2.xlarge, p2.8xlarge, p2.16xlarge, p3.2xlarge, p3.8xlarge, p3.16xlarge, p3dn.24xlarge, d2.xlarge, d2.2xlarge, d2.4xlarge, d2.8xlarge, f1.2xlarge, f1.4xlarge, f1.16xlarge, m5.large, m5.xlarge, m5.2xlarge, m5.4xlarge, m5.12xlarge, m5.24xlarge, m5.metal, m5a.large, m5a.xlarge, m5a.2xlarge, m5a.4xlarge, m5a.12xlarge, m5a.24xlarge, m5d.large, m5d.xlarge, m5d.2xlarge, m5d.4xlarge, m5d.12xlarge, m5d.24xlarge, m5d.metal, m5ad.large, m5ad.xlarge, m5ad.2xlarge, m5ad.4xlarge, m5ad.8xlarge, m5ad.12xlarge, m5ad.16xlarge, m5ad.24xlarge, h1.2xlarge, h1.4xlarge, h1.8xlarge, h1.16xlarge, z1d.large, z1d.xlarge, z1d.2xlarge, z1d.3xlarge, z1d.6xlarge, z1d.12xlarge, z1d.metal, u-6tb1.metal, u-9tb1.metal, u-12tb1.metal, a1.medium, a1.large, a1.xlarge, a1.2xlarge, a1.4xlarge
ipv_6_address_count: 1,
ipv_6_addresses: [
{
ipv_6_address: "String",
},
],
kernel_id: "String",
key_name: "String",
max_count: 1, # required
min_count: 1, # required
monitoring: {
enabled: false, # required
},
placement: {
availability_zone: "String",
affinity: "String",
group_name: "String",
partition_number: 1,
host_id: "String",
tenancy: "default", # accepts default, dedicated, host
spread_domain: "String",
},
ramdisk_id: "String",
security_group_ids: ["String"],
security_groups: ["String"],
user_data: "String",
additional_info: "String",
client_token: "String",
disable_api_termination: false,
dry_run: false,
ebs_optimized: false,
iam_instance_profile: {
arn: "String",
name: "String",
},
instance_initiated_shutdown_behavior: "stop", # accepts stop, terminate
network_interfaces: [
{
associate_public_ip_address: false,
delete_on_termination: false,
description: "String",
device_index: 1,
groups: ["String"],
ipv_6_address_count: 1,
ipv_6_addresses: [
{
ipv_6_address: "String",
},
],
network_interface_id: "String",
private_ip_address: "String",
private_ip_addresses: [
{
primary: false,
private_ip_address: "String",
},
],
secondary_private_ip_address_count: 1,
subnet_id: "String",
interface_type: "String",
},
],
private_ip_address: "String",
elastic_gpu_specification: [
{
type: "String", # required
},
],
elastic_inference_accelerators: [
{
type: "String", # required
},
],
tag_specifications: [
{
resource_type: "client-vpn-endpoint", # accepts client-vpn-endpoint, customer-gateway, dedicated-host, dhcp-options, elastic-ip, fleet, fpga-image, host-reservation, image, instance, internet-gateway, launch-template, natgateway, network-acl, network-interface, reserved-instances, route-table, security-group, snapshot, spot-instances-request, subnet, transit-gateway, transit-gateway-attachment, transit-gateway-route-table, volume, vpc, vpc-peering-connection, vpn-connection, vpn-gateway
tags: [
{
key: "String",
value: "String",
},
],
},
],
launch_template: {
launch_template_id: "String",
launch_template_name: "String",
version: "String",
},
instance_market_options: {
market_type: "spot", # accepts spot
spot_options: {
max_price: "String",
spot_instance_type: "one-time", # accepts one-time, persistent
block_duration_minutes: 1,
valid_until: Time.now,
instance_interruption_behavior: "hibernate", # accepts hibernate, stop, terminate
},
},
credit_specification: {
cpu_credits: "String", # required
},
cpu_options: {
core_count: 1,
threads_per_core: 1,
},
capacity_reservation_specification: {
capacity_reservation_preference: "open", # accepts open, none
capacity_reservation_target: {
capacity_reservation_id: "String",
},
},
hibernation_options: {
configured: false,
},
license_specifications: [
{
license_configuration_arn: "String",
},
],
})
@param [Hash] options ({})
@option options [Array<Types::BlockDeviceMapping>] :block_device_mappings
The block device mapping entries. You can't specify both a snapshot
ID and an encryption value. This is because only blank volumes can be
encrypted on creation. If a snapshot is the basis for a volume, it is
not blank and its encryption status is used for the volume encryption
status.
@option options [String] :image_id
The ID of the AMI. An AMI is required to launch an instance and must
be specified here or in a launch template.
@option options [String] :instance_type
The instance type. For more information, see [Instance Types][1] in
the *Amazon Elastic Compute Cloud User Guide*.
Default: `m1.small`
[1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html
@option options [Integer] :ipv_6_address_count
\[EC2-VPC\] The number of IPv6 addresses to associate with the primary
network interface. Amazon EC2 chooses the IPv6 addresses from the
range of your subnet. You cannot specify this option and the option to
assign specific IPv6 addresses in the same request. You can specify
this option if you've specified a minimum number of instances to
launch.
You cannot specify this option and the network interfaces option in
the same request.
@option options [Array<Types::InstanceIpv6Address>] :ipv_6_addresses
\[EC2-VPC\] The IPv6 addresses from the range of the subnet to
associate with the primary network interface. You cannot specify this
option and the option to assign a number of IPv6 addresses in the same
request. You cannot specify this option if you've specified a minimum
number of instances to launch.
You cannot specify this option and the network interfaces option in
the same request.
@option options [String] :kernel_id
The ID of the kernel.
We recommend that you use PV-GRUB instead of kernels and RAM disks.
For more information, see [ PV-GRUB][1] in the *Amazon Elastic Compute
Cloud User Guide*.
[1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html
@option options [String] :key_name
The name of the key pair. You can create a key pair using
CreateKeyPair or ImportKeyPair.
If you do not specify a key pair, you can't connect to the instance
unless you choose an AMI that is configured to allow users another way
to log in.
@option options [required, Integer] :max_count
The maximum number of instances to launch. If you specify more
instances than Amazon EC2 can launch in the target Availability Zone,
Amazon EC2 launches the largest possible number of instances above
`MinCount`.
Constraints: Between 1 and the maximum number you're allowed for the
specified instance type. For more information about the default
limits, and how to request an increase, see [How many instances can I
run in Amazon EC2][1] in the Amazon EC2 FAQ.
[1]: http://aws.amazon.com/ec2/faqs/#How_many_instances_can_I_run_in_Amazon_EC2
@option options [required, Integer] :min_count
The minimum number of instances to launch. If you specify a minimum
that is more instances than Amazon EC2 can launch in the target
Availability Zone, Amazon EC2 launches no instances.
Constraints: Between 1 and the maximum number you're allowed for the
specified instance type. For more information about the default
limits, and how to request an increase, see [How many instances can I
run in Amazon EC2][1] in the Amazon EC2 General FAQ.
[1]: http://aws.amazon.com/ec2/faqs/#How_many_instances_can_I_run_in_Amazon_EC2
@option options [Types::RunInstancesMonitoringEnabled] :monitoring
Specifies whether detailed monitoring is enabled for the instance.
@option options [Types::Placement] :placement
The placement for the instance.
@option options [String] :ramdisk_id
The ID of the RAM disk to select. Some kernels require additional
drivers at launch. Check the kernel requirements for information about
whether you need to specify a RAM disk. To find kernel requirements,
go to the AWS Resource Center and search for the kernel ID.
We recommend that you use PV-GRUB instead of kernels and RAM disks.
For more information, see [ PV-GRUB][1] in the *Amazon Elastic Compute
Cloud User Guide*.
[1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html
@option options [Array<String>] :security_group_ids
The IDs of the security groups. You can create a security group using
CreateSecurityGroup.
Default: Amazon EC2 uses the default security group.
You cannot specify this option and the network interfaces option in
the same request.
@option options [Array<String>] :security_groups
\[EC2-Classic, default VPC\] The names of the security groups. For a
nondefault VPC, you must use security group IDs instead.
You cannot specify this option and the network interfaces option in
the same request.
Default: Amazon EC2 uses the default security group.
@option options [String] :user_data
The user data to make available to the instance. For more information,
see [Running Commands on Your Linux Instance at Launch][1] (Linux) and
[Adding User Data][2] (Windows). If you are using a command line tool,
base64-encoding is performed for you, and you can load the text from a
file. Otherwise, you must provide base64-encoded text. User data is
limited to 16 KB.
[1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html
[2]: https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#instancedata-add-user-data
@option options [String] :additional_info
Reserved.
@option options [String] :client_token
Unique, case-sensitive identifier you provide to ensure the
idempotency of the request. For more information, see [Ensuring
Idempotency][1].
Constraints: Maximum 64 ASCII characters
[1]: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html
@option options [Boolean] :disable_api_termination
If you set this parameter to `true`, you can't terminate the instance
using the Amazon EC2 console, CLI, or API; otherwise, you can. To
change this attribute to `false` after launch, use
ModifyInstanceAttribute. Alternatively, if you set
`InstanceInitiatedShutdownBehavior` to `terminate`, you can terminate
the instance by running the shutdown command from the instance.
Default: `false`
@option options [Boolean] :dry_run
Checks whether you have the required permissions for the action,
without actually making the request, and provides an error response.
If you have the required permissions, the error response is
`DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
@option options [Boolean] :ebs_optimized
Indicates whether the instance is optimized for Amazon EBS I/O. This
optimization provides dedicated throughput to Amazon EBS and an
optimized configuration stack to provide optimal Amazon EBS I/O
performance. This optimization isn't available with all instance
types. Additional usage charges apply when using an EBS-optimized
instance.
Default: `false`
@option options [Types::IamInstanceProfileSpecification] :iam_instance_profile
The IAM instance profile.
@option options [String] :instance_initiated_shutdown_behavior
Indicates whether an instance stops or terminates when you initiate
shutdown from the instance (using the operating system command for
system shutdown).
Default: `stop`
@option options [Array<Types::InstanceNetworkInterfaceSpecification>] :network_interfaces
The network interfaces to associate with the instance.
@option options [String] :private_ip_address
\[EC2-VPC\] The primary IPv4 address. You must specify a value from
the IPv4 address range of the subnet.
Only one private IP address can be designated as primary. You can't
specify this option if you've specified the option to designate a
private IP address as the primary IP address in a network interface
specification. You cannot specify this option if you're launching
more than one instance in the request.
You cannot specify this option and the network interfaces option in
the same request.
@option options [Array<Types::ElasticGpuSpecification>] :elastic_gpu_specification
An elastic GPU to associate with the instance. An Elastic GPU is a GPU
resource that you can attach to your Windows instance to accelerate
the graphics performance of your applications. For more information,
see [ Amazon EC2 Elastic GPUs][1] in the *Amazon Elastic Compute Cloud
User Guide*.
[1]: https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/elastic-graphics.html
@option options [Array<Types::ElasticInferenceAccelerator>] :elastic_inference_accelerators
An elastic inference accelerator to associate with the instance.
Elastic inference accelerators are a resource you can attach to your
Amazon EC2 instances to accelerate your Deep Learning (DL) inference
workloads.
@option options [Array<Types::TagSpecification>] :tag_specifications
The tags to apply to the resources during launch. You can only tag
instances and volumes on launch. The specified tags are applied to all
instances or volumes that are created during launch. To tag a resource
after it has been created, see CreateTags.
@option options [Types::LaunchTemplateSpecification] :launch_template
The launch template to use to launch the instances. Any parameters
that you specify in RunInstances override the same parameters in the
launch template. You can specify either the name or ID of a launch
template, but not both.
@option options [Types::InstanceMarketOptionsRequest] :instance_market_options
The market (purchasing) option for the instances.
For RunInstances, persistent Spot Instance requests are only supported
when **InstanceInterruptionBehavior** is set to either `hibernate` or
`stop`.
@option options [Types::CreditSpecificationRequest] :credit_specification
The credit option for CPU usage of the T2 or T3 instance. Valid values
are `standard` and `unlimited`. To change this attribute after launch,
use ModifyInstanceCreditSpecification. For more information, see
[Burstable Performance Instances][1] in the *Amazon Elastic Compute
Cloud User Guide*.
Default: `standard` (T2 instances) or `unlimited` (T3 instances)
[1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances.html
@option options [Types::CpuOptionsRequest] :cpu_options
The CPU options for the instance. For more information, see
[Optimizing CPU Options][1] in the *Amazon Elastic Compute Cloud User
Guide*.
[1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html
@option options [Types::CapacityReservationSpecification] :capacity_reservation_specification
Information about the Capacity Reservation targeting option. If you do
not specify this parameter, the instance's Capacity Reservation
preference defaults to `open`, which enables it to run in any open
Capacity Reservation that has matching attributes (instance type,
platform, Availability Zone).
@option options [Types::HibernationOptionsRequest] :hibernation_options
Indicates whether an instance is enabled for hibernation. For more
information, see [Hibernate Your Instance][1] in the *Amazon Elastic
Compute Cloud User Guide*.
[1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html
@option options [Array<Types::LicenseConfigurationRequest>] :license_specifications
The license configurations.
@return [Instance::Collection] | [
"@!group",
"Actions",
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/subnet.rb#L643-L655 | train | Creates a new instance in the subnet. | [
30522,
13366,
3443,
1035,
12107,
1006,
7047,
1027,
1063,
1065,
1007,
14108,
1027,
1031,
1033,
7047,
1027,
7047,
1012,
13590,
1006,
4942,
7159,
1035,
8909,
1024,
1030,
8909,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
2448,
1035,
12107,
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... |
hanami/hanami | lib/hanami/server.rb | Hanami.Server.middleware | def middleware
mw = Hash.new { |e, m| e[m] = [] }
mw["development"].concat([::Rack::ShowExceptions, ::Rack::Lint])
require 'hanami/assets/static'
mw["development"].push(::Hanami::Assets::Static)
mw
end | ruby | def middleware
mw = Hash.new { |e, m| e[m] = [] }
mw["development"].concat([::Rack::ShowExceptions, ::Rack::Lint])
require 'hanami/assets/static'
mw["development"].push(::Hanami::Assets::Static)
mw
end | [
"def",
"middleware",
"mw",
"=",
"Hash",
".",
"new",
"{",
"|",
"e",
",",
"m",
"|",
"e",
"[",
"m",
"]",
"=",
"[",
"]",
"}",
"mw",
"[",
"\"development\"",
"]",
".",
"concat",
"(",
"[",
"::",
"Rack",
"::",
"ShowExceptions",
",",
"::",
"Rack",
"::",... | @since 0.8.0
@api private
@see Hanami::Environment#initialize
Primarily this removes the ::Rack::Chunked middleware
which is the cause of Safari content-length bugs.
@since 0.8.0 | [
"@since",
"0",
".",
"8",
".",
"0",
"@api",
"private"
] | 8c6e5147e92ef869b25379448572da3698eacfdc | https://github.com/hanami/hanami/blob/8c6e5147e92ef869b25379448572da3698eacfdc/lib/hanami/server.rb#L32-L38 | train | Returns a hash of middleware to use for the middleware | [
30522,
13366,
2690,
8059,
12464,
1027,
23325,
1012,
2047,
1063,
1064,
1041,
1010,
1049,
1064,
1041,
1031,
1049,
1033,
1027,
1031,
1033,
1065,
12464,
1031,
1000,
2458,
1000,
1033,
1012,
9530,
11266,
1006,
1031,
1024,
1024,
14513,
1024,
1024,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_batch/lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb | Azure::Batch::Mgmt::V2017_09_01.CertificateOperations.begin_delete_with_http_info | def begin_delete_with_http_info(resource_group_name, account_name, certificate_name, custom_headers:nil)
begin_delete_async(resource_group_name, account_name, certificate_name, custom_headers:custom_headers).value!
end | ruby | def begin_delete_with_http_info(resource_group_name, account_name, certificate_name, custom_headers:nil)
begin_delete_async(resource_group_name, account_name, certificate_name, custom_headers:custom_headers).value!
end | [
"def",
"begin_delete_with_http_info",
"(",
"resource_group_name",
",",
"account_name",
",",
"certificate_name",
",",
"custom_headers",
":",
"nil",
")",
"begin_delete_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"certificate_name",
",",
"custom_headers",
"... | Deletes the specified certificate.
@param resource_group_name [String] The name of the resource group that
contains the Batch account.
@param account_name [String] The name of the Batch account.
@param certificate_name [String] The identifier for the certificate. This
must be made up of algorithm and thumbprint separated by a dash, and must
match the certificate data in the request. For example SHA1-a3d1c5.
@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",
"the",
"specified",
"certificate",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_batch/lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb#L821-L823 | train | Deletes a certificate. | [
30522,
13366,
4088,
1035,
3972,
12870,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
8196,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
1035,
3972,
12870,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
pythonicrubyist/creek | lib/creek/sheet.rb | Creek.Creek::Sheet.rows_generator | def rows_generator include_meta_data=false, use_simple_rows_format=false
path = if @sheetfile.start_with? "/xl/" or @sheetfile.start_with? "xl/" then @sheetfile else "xl/#{@sheetfile}" end
if @book.files.file.exist?(path)
# SAX parsing, Each element in the stream comes through as two events:
# one to open the element and one to close it.
opener = Nokogiri::XML::Reader::TYPE_ELEMENT
closer = Nokogiri::XML::Reader::TYPE_END_ELEMENT
Enumerator.new do |y|
row, cells, cell = nil, {}, nil
cell_type = nil
cell_style_idx = nil
@book.files.file.open(path) do |xml|
Nokogiri::XML::Reader.from_io(xml).each do |node|
if (node.name.eql? 'row') and (node.node_type.eql? opener)
row = node.attributes
row['cells'] = Hash.new
cells = Hash.new
y << (include_meta_data ? row : cells) if node.self_closing?
elsif (node.name.eql? 'row') and (node.node_type.eql? closer)
processed_cells = fill_in_empty_cells(cells, row['r'], cell, use_simple_rows_format)
if @images_present
processed_cells.each do |cell_name, cell_value|
next unless cell_value.nil?
processed_cells[cell_name] = images_at(cell_name)
end
end
row['cells'] = processed_cells
y << (include_meta_data ? row : processed_cells)
elsif (node.name.eql? 'c') and (node.node_type.eql? opener)
cell_type = node.attributes['t']
cell_style_idx = node.attributes['s']
cell = node.attributes['r']
elsif (['v', 't'].include? node.name) and (node.node_type.eql? opener)
unless cell.nil?
node.read
cells[(use_simple_rows_format ? cell.tr("0-9", "") : cell)] = convert(node.value, cell_type, cell_style_idx)
end
end
end
end
end
end
end | ruby | def rows_generator include_meta_data=false, use_simple_rows_format=false
path = if @sheetfile.start_with? "/xl/" or @sheetfile.start_with? "xl/" then @sheetfile else "xl/#{@sheetfile}" end
if @book.files.file.exist?(path)
# SAX parsing, Each element in the stream comes through as two events:
# one to open the element and one to close it.
opener = Nokogiri::XML::Reader::TYPE_ELEMENT
closer = Nokogiri::XML::Reader::TYPE_END_ELEMENT
Enumerator.new do |y|
row, cells, cell = nil, {}, nil
cell_type = nil
cell_style_idx = nil
@book.files.file.open(path) do |xml|
Nokogiri::XML::Reader.from_io(xml).each do |node|
if (node.name.eql? 'row') and (node.node_type.eql? opener)
row = node.attributes
row['cells'] = Hash.new
cells = Hash.new
y << (include_meta_data ? row : cells) if node.self_closing?
elsif (node.name.eql? 'row') and (node.node_type.eql? closer)
processed_cells = fill_in_empty_cells(cells, row['r'], cell, use_simple_rows_format)
if @images_present
processed_cells.each do |cell_name, cell_value|
next unless cell_value.nil?
processed_cells[cell_name] = images_at(cell_name)
end
end
row['cells'] = processed_cells
y << (include_meta_data ? row : processed_cells)
elsif (node.name.eql? 'c') and (node.node_type.eql? opener)
cell_type = node.attributes['t']
cell_style_idx = node.attributes['s']
cell = node.attributes['r']
elsif (['v', 't'].include? node.name) and (node.node_type.eql? opener)
unless cell.nil?
node.read
cells[(use_simple_rows_format ? cell.tr("0-9", "") : cell)] = convert(node.value, cell_type, cell_style_idx)
end
end
end
end
end
end
end | [
"def",
"rows_generator",
"include_meta_data",
"=",
"false",
",",
"use_simple_rows_format",
"=",
"false",
"path",
"=",
"if",
"@sheetfile",
".",
"start_with?",
"\"/xl/\"",
"or",
"@sheetfile",
".",
"start_with?",
"\"xl/\"",
"then",
"@sheetfile",
"else",
"\"xl/#{@sheetfil... | Returns a hash per row that includes the cell ids and values.
Empty cells will be also included in the hash with a nil value. | [
"Returns",
"a",
"hash",
"per",
"row",
"that",
"includes",
"the",
"cell",
"ids",
"and",
"values",
".",
"Empty",
"cells",
"will",
"be",
"also",
"included",
"in",
"the",
"hash",
"with",
"a",
"nil",
"value",
"."
] | 1a5c99032ee736e8f24ebd524adffba068d236b4 | https://github.com/pythonicrubyist/creek/blob/1a5c99032ee736e8f24ebd524adffba068d236b4/lib/creek/sheet.rb#L83-L127 | train | Returns an enumerator of rows from the workbook. | [
30522,
13366,
10281,
1035,
13103,
2421,
1035,
18804,
1035,
2951,
1027,
6270,
1010,
2224,
1035,
3722,
1035,
10281,
1035,
4289,
1027,
6270,
4130,
1027,
2065,
1030,
7123,
8873,
2571,
1012,
2707,
1035,
2007,
1029,
1000,
1013,
28712,
1013,
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... |
markdownlint/markdownlint | lib/mdl/doc.rb | MarkdownLint.Doc.header_style | def header_style(header)
if header.type != :header
raise "header_style called with non-header element"
end
line = element_line(header)
if line.start_with?("#")
if line.strip.end_with?("#")
:atx_closed
else
:atx
end
else
:setext
end
end | ruby | def header_style(header)
if header.type != :header
raise "header_style called with non-header element"
end
line = element_line(header)
if line.start_with?("#")
if line.strip.end_with?("#")
:atx_closed
else
:atx
end
else
:setext
end
end | [
"def",
"header_style",
"(",
"header",
")",
"if",
"header",
".",
"type",
"!=",
":header",
"raise",
"\"header_style called with non-header element\"",
"end",
"line",
"=",
"element_line",
"(",
"header",
")",
"if",
"line",
".",
"start_with?",
"(",
"\"#\"",
")",
"if"... | Returns the header 'style' - :atx (hashes at the beginning), :atx_closed
(atx header style, but with hashes at the end of the line also), :setext
(underlined). You can pass in the element object or an options hash
here. | [
"Returns",
"the",
"header",
"style",
"-",
":",
"atx",
"(",
"hashes",
"at",
"the",
"beginning",
")",
":",
"atx_closed",
"(",
"atx",
"header",
"style",
"but",
"with",
"hashes",
"at",
"the",
"end",
"of",
"the",
"line",
"also",
")",
":",
"setext",
"(",
"... | a9e80fcf3989d73b654b00bb2225a00be53983e8 | https://github.com/markdownlint/markdownlint/blob/a9e80fcf3989d73b654b00bb2225a00be53983e8/lib/mdl/doc.rb#L168-L182 | train | Returns the header style for the given header element. | [
30522,
13366,
20346,
1035,
2806,
1006,
20346,
1007,
2065,
20346,
1012,
2828,
999,
1027,
1024,
20346,
5333,
1000,
20346,
1035,
2806,
2170,
2007,
2512,
1011,
20346,
5783,
1000,
2203,
2240,
1027,
5783,
1035,
2240,
1006,
20346,
1007,
2065,
2240... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
backup/backup | lib/backup/logger.rb | Backup.Logger.abort! | def abort!
console = Console.new
console.log(messages.shift) until messages.empty?
end | ruby | def abort!
console = Console.new
console.log(messages.shift) until messages.empty?
end | [
"def",
"abort!",
"console",
"=",
"Console",
".",
"new",
"console",
".",
"log",
"(",
"messages",
".",
"shift",
")",
"until",
"messages",
".",
"empty?",
"end"
] | If errors are encountered by Backup::CLI while preparing to perform
the backup jobs, this method is called to dump all messages to the
console before Backup exits. | [
"If",
"errors",
"are",
"encountered",
"by",
"Backup",
"::",
"CLI",
"while",
"preparing",
"to",
"perform",
"the",
"backup",
"jobs",
"this",
"method",
"is",
"called",
"to",
"dump",
"all",
"messages",
"to",
"the",
"console",
"before",
"Backup",
"exits",
"."
] | 64370f925e859f858766b674717a3dbee0de7a26 | https://github.com/backup/backup/blob/64370f925e859f858766b674717a3dbee0de7a26/lib/backup/logger.rb#L177-L180 | train | Aborts the current request. | [
30522,
13366,
11113,
11589,
999,
10122,
1027,
10122,
1012,
2047,
10122,
1012,
8833,
1006,
7696,
1012,
5670,
1007,
2127,
7696,
1012,
4064,
1029,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | frameit/lib/frameit/editor.rb | Frameit.Editor.complex_framing | def complex_framing
background = generate_background
self.space_to_device = vertical_frame_padding
if fetch_config['title']
background = put_title_into_background(background, fetch_config['stack_title'])
end
if self.frame # we have no frame on le mac
resize_frame!
put_into_frame
# Decrease the size of the framed screenshot to fit into the defined padding + background
frame_width = background.width - horizontal_frame_padding * 2
frame_height = background.height - effective_text_height - vertical_frame_padding
if fetch_config['show_complete_frame']
# calculate the final size of the screenshot to resize in one go
# it may be limited either by the width or height of the frame
image_aspect_ratio = @image.width.to_f / @image.height.to_f
image_width = [frame_width, @image.width].min
image_height = [frame_height, image_width / image_aspect_ratio].min
image_width = image_height * image_aspect_ratio
@image.resize("#{image_width}x#{image_height}") if image_width < @image.width || image_height < @image.height
else
# the screenshot size is only limited by width.
# If higher than the frame, the screenshot is cut off at the bottom
@image.resize("#{frame_width}x") if frame_width < @image.width
end
end
@image = put_device_into_background(background)
image
end | ruby | def complex_framing
background = generate_background
self.space_to_device = vertical_frame_padding
if fetch_config['title']
background = put_title_into_background(background, fetch_config['stack_title'])
end
if self.frame # we have no frame on le mac
resize_frame!
put_into_frame
# Decrease the size of the framed screenshot to fit into the defined padding + background
frame_width = background.width - horizontal_frame_padding * 2
frame_height = background.height - effective_text_height - vertical_frame_padding
if fetch_config['show_complete_frame']
# calculate the final size of the screenshot to resize in one go
# it may be limited either by the width or height of the frame
image_aspect_ratio = @image.width.to_f / @image.height.to_f
image_width = [frame_width, @image.width].min
image_height = [frame_height, image_width / image_aspect_ratio].min
image_width = image_height * image_aspect_ratio
@image.resize("#{image_width}x#{image_height}") if image_width < @image.width || image_height < @image.height
else
# the screenshot size is only limited by width.
# If higher than the frame, the screenshot is cut off at the bottom
@image.resize("#{frame_width}x") if frame_width < @image.width
end
end
@image = put_device_into_background(background)
image
end | [
"def",
"complex_framing",
"background",
"=",
"generate_background",
"self",
".",
"space_to_device",
"=",
"vertical_frame_padding",
"if",
"fetch_config",
"[",
"'title'",
"]",
"background",
"=",
"put_title_into_background",
"(",
"background",
",",
"fetch_config",
"[",
"'s... | more complex mode: background, frame and title | [
"more",
"complex",
"mode",
":",
"background",
"frame",
"and",
"title"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/frameit/lib/frameit/editor.rb#L155-L190 | train | This method is used to generate the framing image | [
30522,
13366,
3375,
1035,
20241,
4281,
1027,
9699,
1035,
4281,
2969,
1012,
2686,
1035,
2000,
1035,
5080,
1027,
7471,
1035,
4853,
1035,
11687,
4667,
2065,
18584,
1035,
9530,
8873,
2290,
1031,
1005,
2516,
1005,
1033,
4281,
1027,
2404,
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_scheduler/lib/2016-03-01/generated/azure_mgmt_scheduler/jobs.rb | Azure::Scheduler::Mgmt::V2016_03_01.Jobs.list_job_history_next | def list_job_history_next(next_page_link, custom_headers:nil)
response = list_job_history_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_job_history_next(next_page_link, custom_headers:nil)
response = list_job_history_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_job_history_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_job_history_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"resp... | Lists job history.
@param next_page_link [String] The NextLink from the previous successful call
to List operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [JobHistoryListResult] operation results. | [
"Lists",
"job",
"history",
"."
] | 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#L834-L837 | train | Gets the job history of the current job. | [
30522,
13366,
2862,
1035,
3105,
1035,
2381,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
3105,
1035,
2381,
1035,
2279,
1035,
2004,
6038,
2278,
1006,
2279,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_search/lib/2015-08-19/generated/azure_mgmt_search/query_keys.rb | Azure::Search::Mgmt::V2015_08_19.QueryKeys.list_by_search_service_with_http_info | def list_by_search_service_with_http_info(resource_group_name, search_service_name, search_management_request_options:nil, custom_headers:nil)
list_by_search_service_async(resource_group_name, search_service_name, search_management_request_options:search_management_request_options, custom_headers:custom_headers).value!
end | ruby | def list_by_search_service_with_http_info(resource_group_name, search_service_name, search_management_request_options:nil, custom_headers:nil)
list_by_search_service_async(resource_group_name, search_service_name, search_management_request_options:search_management_request_options, custom_headers:custom_headers).value!
end | [
"def",
"list_by_search_service_with_http_info",
"(",
"resource_group_name",
",",
"search_service_name",
",",
"search_management_request_options",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"list_by_search_service_async",
"(",
"resource_group_name",
",",
"search_service... | Returns the list of query API keys for the given Azure Search service.
@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.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Returns",
"the",
"list",
"of",
"query",
"API",
"keys",
"for",
"the",
"given",
"Azure",
"Search",
"service",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_search/lib/2015-08-19/generated/azure_mgmt_search/query_keys.rb#L178-L180 | train | Gets the list of the documents in a search service. | [
30522,
13366,
2862,
1035,
2011,
1035,
3945,
1035,
2326,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3945,
1035,
2326,
1035,
2171,
1010,
3945,
1035,
2968,
1035,
5227,
1035,
7047,
1024,
9152,
2140,
1010,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activerecord/lib/active_record/core.rb | ActiveRecord.Core.init_with_attributes | def init_with_attributes(attributes, new_record = false) # :nodoc:
@new_record = new_record
@attributes = attributes
init_internals
yield self if block_given?
_run_find_callbacks
_run_initialize_callbacks
self
end | ruby | def init_with_attributes(attributes, new_record = false) # :nodoc:
@new_record = new_record
@attributes = attributes
init_internals
yield self if block_given?
_run_find_callbacks
_run_initialize_callbacks
self
end | [
"def",
"init_with_attributes",
"(",
"attributes",
",",
"new_record",
"=",
"false",
")",
"# :nodoc:",
"@new_record",
"=",
"new_record",
"@attributes",
"=",
"attributes",
"init_internals",
"yield",
"self",
"if",
"block_given?",
"_run_find_callbacks",
"_run_initialize_callba... | Initialize an empty model object from +attributes+.
+attributes+ should be an attributes object, and unlike the
`initialize` method, no assignment calls are made per attribute. | [
"Initialize",
"an",
"empty",
"model",
"object",
"from",
"+",
"attributes",
"+",
".",
"+",
"attributes",
"+",
"should",
"be",
"an",
"attributes",
"object",
"and",
"unlike",
"the",
"initialize",
"method",
"no",
"assignment",
"calls",
"are",
"made",
"per",
"att... | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activerecord/lib/active_record/core.rb#L356-L368 | train | Initialize the object with the given attributes. | [
30522,
13366,
1999,
4183,
1035,
2007,
1035,
12332,
1006,
12332,
1010,
2047,
1035,
2501,
1027,
6270,
1007,
1001,
1024,
7293,
10085,
1024,
1030,
2047,
1035,
2501,
1027,
2047,
1035,
2501,
1030,
12332,
1027,
12332,
1999,
4183,
1035,
4722,
2015,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_container_service/lib/2019-02-01/generated/azure_mgmt_container_service/agent_pools.rb | Azure::ContainerService::Mgmt::V2019_02_01.AgentPools.get_with_http_info | def get_with_http_info(resource_group_name, managed_cluster_name, agent_pool_name, custom_headers:nil)
get_async(resource_group_name, managed_cluster_name, agent_pool_name, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, managed_cluster_name, agent_pool_name, custom_headers:nil)
get_async(resource_group_name, managed_cluster_name, agent_pool_name, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"managed_cluster_name",
",",
"agent_pool_name",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"managed_cluster_name",
",",
"agent_pool_name",
",",
"custom_headers",
":cus... | Gets the agent pool.
Gets the details of the agent pool by managed cluster and resource group.
@param resource_group_name [String] The name of the resource group.
@param managed_cluster_name [String] The name of the managed cluster
resource.
@param agent_pool_name [String] The name of the agent pool.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"agent",
"pool",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_service/lib/2019-02-01/generated/azure_mgmt_container_service/agent_pools.rb#L162-L164 | train | Gets the specified managed cluster agent pool. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3266,
1035,
9324,
1035,
2171,
1010,
4005,
1035,
4770,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
seejohnrun/ice_cube | lib/ice_cube/schedule.rb | IceCube.Schedule.previous_occurrences | def previous_occurrences(num, from)
from = TimeUtil.match_zone(from, start_time) or raise ArgumentError, "Time required, got #{from.inspect}"
return [] if from <= start_time
a = enumerate_occurrences(start_time, from - 1).to_a
a.size > num ? a[-1*num,a.size] : a
end | ruby | def previous_occurrences(num, from)
from = TimeUtil.match_zone(from, start_time) or raise ArgumentError, "Time required, got #{from.inspect}"
return [] if from <= start_time
a = enumerate_occurrences(start_time, from - 1).to_a
a.size > num ? a[-1*num,a.size] : a
end | [
"def",
"previous_occurrences",
"(",
"num",
",",
"from",
")",
"from",
"=",
"TimeUtil",
".",
"match_zone",
"(",
"from",
",",
"start_time",
")",
"or",
"raise",
"ArgumentError",
",",
"\"Time required, got #{from.inspect}\"",
"return",
"[",
"]",
"if",
"from",
"<=",
... | The previous n occurrences before a given time | [
"The",
"previous",
"n",
"occurrences",
"before",
"a",
"given",
"time"
] | fb6c657bdc4f87dfda2bf83f15c5f487b78ccabd | https://github.com/seejohnrun/ice_cube/blob/fb6c657bdc4f87dfda2bf83f15c5f487b78ccabd/lib/ice_cube/schedule.rb#L192-L197 | train | Returns the previous occurrences of the given number of times from the given time. | [
30522,
13366,
3025,
1035,
27247,
1006,
16371,
2213,
1010,
2013,
1007,
2013,
1027,
2051,
21823,
2140,
1012,
2674,
1035,
4224,
1006,
2013,
1010,
2707,
1035,
2051,
1007,
2030,
5333,
6685,
2121,
29165,
1010,
1000,
2051,
3223,
1010,
2288,
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... |
alexreisner/geocoder | lib/geocoder/results/geocoder_ca.rb | Geocoder::Result.GeocoderCa.canadian_province_abbreviations | def canadian_province_abbreviations
%w[ON QC NS NB MB BC PE SK AB NL]
end | ruby | def canadian_province_abbreviations
%w[ON QC NS NB MB BC PE SK AB NL]
end | [
"def",
"canadian_province_abbreviations",
"%w[",
"ON",
"QC",
"NS",
"NB",
"MB",
"BC",
"PE",
"SK",
"AB",
"NL",
"]",
"end"
] | ---------------------------------------------------------------- | [
"----------------------------------------------------------------"
] | e087dc2759264ee6f307b926bb2de4ec2406859e | https://github.com/alexreisner/geocoder/blob/e087dc2759264ee6f307b926bb2de4ec2406859e/lib/geocoder/results/geocoder_ca.rb#L56-L58 | train | Returns the canadian province abbreviations for the given data | [
30522,
13366,
3010,
1035,
2874,
1035,
22498,
2015,
1003,
1059,
1031,
2006,
25196,
24978,
1050,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sunspot/sunspot | sunspot/lib/sunspot/setup.rb | Sunspot.Setup.add_text_field_factory | def add_text_field_factory(name, options = {}, &block)
stored, more_like_this = options[:stored], options[:more_like_this]
field_factory = FieldFactory::Static.new(name, Type::TextType.instance, options, &block)
@text_field_factories[name] = field_factory
@text_field_factories_cache[field_factory.name] = field_factory
if stored
@stored_field_factories_cache[field_factory.name] << field_factory
end
if more_like_this
@more_like_this_field_factories_cache[field_factory.name] << field_factory
end
end | ruby | def add_text_field_factory(name, options = {}, &block)
stored, more_like_this = options[:stored], options[:more_like_this]
field_factory = FieldFactory::Static.new(name, Type::TextType.instance, options, &block)
@text_field_factories[name] = field_factory
@text_field_factories_cache[field_factory.name] = field_factory
if stored
@stored_field_factories_cache[field_factory.name] << field_factory
end
if more_like_this
@more_like_this_field_factories_cache[field_factory.name] << field_factory
end
end | [
"def",
"add_text_field_factory",
"(",
"name",
",",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"stored",
",",
"more_like_this",
"=",
"options",
"[",
":stored",
"]",
",",
"options",
"[",
":more_like_this",
"]",
"field_factory",
"=",
"FieldFactory",
"::"... | Add field_factories for fulltext search
==== Parameters
field_factories<Array>:: Array of Sunspot::Field objects | [
"Add",
"field_factories",
"for",
"fulltext",
"search"
] | 31dd76cd7a14a4ef7bd541de97483d8cd72ff685 | https://github.com/sunspot/sunspot/blob/31dd76cd7a14a4ef7bd541de97483d8cd72ff685/sunspot/lib/sunspot/setup.rb#L59-L70 | train | Adds a text field factory to the document. | [
30522,
13366,
5587,
1035,
3793,
1035,
2492,
1035,
4713,
1006,
2171,
1010,
7047,
1027,
1063,
1065,
1010,
1004,
3796,
1007,
8250,
1010,
2062,
1035,
2066,
1035,
2023,
1027,
7047,
1031,
1024,
8250,
1033,
1010,
7047,
1031,
1024,
2062,
1035,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_container_instance/lib/2018-09-01/generated/azure_mgmt_container_instance/container_operations.rb | Azure::ContainerInstance::Mgmt::V2018_09_01.ContainerOperations.list_logs | def list_logs(resource_group_name, container_group_name, container_name, tail:nil, custom_headers:nil)
response = list_logs_async(resource_group_name, container_group_name, container_name, tail:tail, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_logs(resource_group_name, container_group_name, container_name, tail:nil, custom_headers:nil)
response = list_logs_async(resource_group_name, container_group_name, container_name, tail:tail, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_logs",
"(",
"resource_group_name",
",",
"container_group_name",
",",
"container_name",
",",
"tail",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_logs_async",
"(",
"resource_group_name",
",",
"container_group_name",
",",
"co... | Get the logs for a specified container instance.
Get the logs for a specified container instance in a specified resource group
and container group.
@param resource_group_name [String] The name of the resource group.
@param container_group_name [String] The name of the container group.
@param container_name [String] The name of the container instance.
@param tail [Integer] The number of lines to show from the tail of the
container instance log. If not provided, all available logs are shown up to
4mb.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Logs] operation results. | [
"Get",
"the",
"logs",
"for",
"a",
"specified",
"container",
"instance",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_instance/lib/2018-09-01/generated/azure_mgmt_container_instance/container_operations.rb#L41-L44 | train | Gets the logs for the specified container. | [
30522,
13366,
2862,
1035,
15664,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
11661,
1035,
2177,
1035,
2171,
1010,
11661,
1035,
2171,
1010,
5725,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2015-08-01/generated/azure_mgmt_web/app_service_certificate_orders.rb | Azure::Web::Mgmt::V2015_08_01.AppServiceCertificateOrders.begin_create_or_update_certificate | def begin_create_or_update_certificate(resource_group_name, certificate_order_name, name, key_vault_certificate, custom_headers:nil)
response = begin_create_or_update_certificate_async(resource_group_name, certificate_order_name, name, key_vault_certificate, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_create_or_update_certificate(resource_group_name, certificate_order_name, name, key_vault_certificate, custom_headers:nil)
response = begin_create_or_update_certificate_async(resource_group_name, certificate_order_name, name, key_vault_certificate, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_create_or_update_certificate",
"(",
"resource_group_name",
",",
"certificate_order_name",
",",
"name",
",",
"key_vault_certificate",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_create_or_update_certificate_async",
"(",
"resource_group_name",
... | Creates or updates a certificate and associates with key vault secret.
Creates or updates a certificate and associates with key vault secret.
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param certificate_order_name [String] Name of the certificate order.
@param name [String] Name of the certificate.
@param key_vault_certificate [AppServiceCertificateResource] Key vault
certificate resource Id.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [AppServiceCertificateResource] operation results. | [
"Creates",
"or",
"updates",
"a",
"certificate",
"and",
"associates",
"with",
"key",
"vault",
"secret",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2015-08-01/generated/azure_mgmt_web/app_service_certificate_orders.rb#L2181-L2184 | train | Creates or updates a certificate in the specified certificate order. | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1035,
8196,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8196,
1035,
2344,
1035,
2171,
1010,
2171,
1010,
3145,
1035,
11632,
1035,
8196,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/users.rb | Azure::Labservices::Mgmt::V2018_10_15.Users.update | def update(resource_group_name, lab_account_name, lab_name, user_name, user, custom_headers:nil)
response = update_async(resource_group_name, lab_account_name, lab_name, user_name, user, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def update(resource_group_name, lab_account_name, lab_name, user_name, user, custom_headers:nil)
response = update_async(resource_group_name, lab_account_name, lab_name, user_name, user, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"update",
"(",
"resource_group_name",
",",
"lab_account_name",
",",
"lab_name",
",",
"user_name",
",",
"user",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"update_async",
"(",
"resource_group_name",
",",
"lab_account_name",
",",
"lab_name",
","... | Modify properties of users.
@param resource_group_name [String] The name of the resource group.
@param lab_account_name [String] The name of the lab Account.
@param lab_name [String] The name of the lab.
@param user_name [String] The name of the user.
@param user [UserFragment] The User registered to a lab
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [User] operation results. | [
"Modify",
"properties",
"of",
"users",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/users.rb#L423-L426 | train | Updates a user s index. | [
30522,
13366,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
6845,
1035,
4070,
1035,
2171,
1010,
6845,
1035,
2171,
1010,
5310,
1035,
2171,
1010,
5310,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
10651,
1035,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_policy_insights/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_states.rb | Azure::PolicyInsights::Mgmt::V2018_04_04.PolicyStates.list_query_results_for_resource_with_http_info | def list_query_results_for_resource_with_http_info(policy_states_resource, resource_id, query_options:nil, custom_headers:nil)
list_query_results_for_resource_async(policy_states_resource, resource_id, query_options:query_options, custom_headers:custom_headers).value!
end | ruby | def list_query_results_for_resource_with_http_info(policy_states_resource, resource_id, query_options:nil, custom_headers:nil)
list_query_results_for_resource_async(policy_states_resource, resource_id, query_options:query_options, custom_headers:custom_headers).value!
end | [
"def",
"list_query_results_for_resource_with_http_info",
"(",
"policy_states_resource",
",",
"resource_id",
",",
"query_options",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"list_query_results_for_resource_async",
"(",
"policy_states_resource",
",",
"resource_id",
",... | Queries policy states for the resource.
@param policy_states_resource [PolicyStatesResource] The virtual resource
under PolicyStates resource type. In a given time range, 'latest' represents
the latest policy state(s), whereas 'default' represents all policy state(s).
Possible values include: 'default', 'latest'
@param resource_id [String] Resource ID.
@param query_options [QueryOptions] Additional parameters for the operation
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Queries",
"policy",
"states",
"for",
"the",
"resource",
"."
] | 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#L781-L783 | train | Gets the list of policy states for the resource. | [
30522,
13366,
2862,
1035,
23032,
1035,
3463,
1035,
2005,
1035,
7692,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
3343,
1035,
2163,
1035,
7692,
1010,
7692,
1035,
8909,
1010,
23032,
1035,
7047,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.get_explicit_list | def get_explicit_list(app_id, version_id, entity_id, custom_headers:nil)
response = get_explicit_list_async(app_id, version_id, entity_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_explicit_list(app_id, version_id, entity_id, custom_headers:nil)
response = get_explicit_list_async(app_id, version_id, entity_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_explicit_list",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_explicit_list_async",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"custom_headers",
":custom_headers",
")",
"... | Get the explicit (exception) list of the pattern.any entity in a version of
the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param entity_id The Pattern.Any entity id.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array] operation results. | [
"Get",
"the",
"explicit",
"(",
"exception",
")",
"list",
"of",
"the",
"pattern",
".",
"any",
"entity",
"in",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L7947-L7950 | train | Gets the list of entities in a version of the application. | [
30522,
13366,
2131,
1035,
13216,
1035,
2862,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
9178,
1035,
8909,
30524,
1007,
1012,
3643,
999,
3433,
1012,
2303,
4983,
3433,
1012,
9152,
2140,
1029,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cheezy/page-object | lib/page-object/page_factory.rb | PageObject.PageFactory.if_page | def if_page(page_class, params={:using_params => {}},&block)
page_class = class_from_string(page_class) if page_class.is_a? String
return @current_page unless @current_page.class == page_class
on_page(page_class, params, false, &block)
end | ruby | def if_page(page_class, params={:using_params => {}},&block)
page_class = class_from_string(page_class) if page_class.is_a? String
return @current_page unless @current_page.class == page_class
on_page(page_class, params, false, &block)
end | [
"def",
"if_page",
"(",
"page_class",
",",
"params",
"=",
"{",
":using_params",
"=>",
"{",
"}",
"}",
",",
"&",
"block",
")",
"page_class",
"=",
"class_from_string",
"(",
"page_class",
")",
"if",
"page_class",
".",
"is_a?",
"String",
"return",
"@current_page",... | Create a page object if and only if the current page is the same page to be created
@param [PageObject, String] a class that has included the PageObject module or a string containing the name of the class
@param Hash values that is pass through to page class a
available in the @params instance variable.
@param [block] an optional block to be called
@return [PageObject] the newly created page object | [
"Create",
"a",
"page",
"object",
"if",
"and",
"only",
"if",
"the",
"current",
"page",
"is",
"the",
"same",
"page",
"to",
"be",
"created"
] | 850d775bf63768fbb1551a34480195785fe8e193 | https://github.com/cheezy/page-object/blob/850d775bf63768fbb1551a34480195785fe8e193/lib/page-object/page_factory.rb#L91-L95 | train | If the current page is a page class return the current page. | [
30522,
13366,
2065,
1035,
3931,
1006,
3931,
1035,
2465,
1010,
11498,
5244,
1027,
1063,
1024,
2478,
1035,
11498,
5244,
1027,
1028,
1063,
1065,
1065,
1010,
1004,
3796,
1007,
3931,
1035,
2465,
1027,
2465,
1035,
2013,
1035,
5164,
1006,
3931,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
minimagick/minimagick | lib/mini_magick/image.rb | MiniMagick.Image.validate! | def validate!
identify
rescue MiniMagick::Error => error
raise MiniMagick::Invalid, error.message
end | ruby | def validate!
identify
rescue MiniMagick::Error => error
raise MiniMagick::Invalid, error.message
end | [
"def",
"validate!",
"identify",
"rescue",
"MiniMagick",
"::",
"Error",
"=>",
"error",
"raise",
"MiniMagick",
"::",
"Invalid",
",",
"error",
".",
"message",
"end"
] | Runs `identify` on the current image, and raises an error if it doesn't
pass.
@raise [MiniMagick::Invalid] | [
"Runs",
"identify",
"on",
"the",
"current",
"image",
"and",
"raises",
"an",
"error",
"if",
"it",
"doesn",
"t",
"pass",
"."
] | d484786f35e91f107836d3c86aca61d50a35820b | https://github.com/minimagick/minimagick/blob/d484786f35e91f107836d3c86aca61d50a35820b/lib/mini_magick/image.rb#L205-L209 | train | Validates the structure of the structure | [
30522,
13366,
9398,
3686,
999,
6709,
5343,
7163,
2863,
12863,
2243,
1024,
1024,
7561,
1027,
1028,
7561,
5333,
7163,
2863,
12863,
2243,
1024,
1024,
19528,
1010,
7561,
1012,
4471,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb | Azure::Compute::Mgmt::V2016_04_30_preview.VirtualMachineScaleSets.power_off | def power_off(resource_group_name, vm_scale_set_name, vm_instance_ids:nil, custom_headers:nil)
response = power_off_async(resource_group_name, vm_scale_set_name, vm_instance_ids:vm_instance_ids, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def power_off(resource_group_name, vm_scale_set_name, vm_instance_ids:nil, custom_headers:nil)
response = power_off_async(resource_group_name, vm_scale_set_name, vm_instance_ids:vm_instance_ids, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"power_off",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"vm_instance_ids",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"power_off_async",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"vm_instance_ids",
":vm... | Power off (stop) one or more virtual machines in a VM scale set. Note that
resources are still attached and you are getting charged for the resources.
Instead, use deallocate to release resources and avoid charges.
@param resource_group_name [String] The name of the resource group.
@param vm_scale_set_name [String] The name of the VM scale set.
@param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] A list of
virtual machine instance IDs from the VM scale set.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OperationStatusResponse] operation results. | [
"Power",
"off",
"(",
"stop",
")",
"one",
"or",
"more",
"virtual",
"machines",
"in",
"a",
"VM",
"scale",
"set",
".",
"Note",
"that",
"resources",
"are",
"still",
"attached",
"and",
"you",
"are",
"getting",
"charged",
"for",
"the",
"resources",
".",
"Inste... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb#L678-L681 | train | Power off the virtual machines in a VM scale set. | [
30522,
13366,
2373,
1035,
2125,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
4094,
1035,
2275,
1035,
2171,
1010,
1058,
2213,
1035,
6013,
1035,
8909,
2015,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
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... |
daddyz/phonelib | lib/phonelib/phone_analyzer_helper.rb | Phonelib.PhoneAnalyzerHelper.country_prefix | def country_prefix(country)
country = country.to_s.upcase
Phonelib.phone_data[country] && \
Phonelib.phone_data[country][Core::COUNTRY_CODE]
end | ruby | def country_prefix(country)
country = country.to_s.upcase
Phonelib.phone_data[country] && \
Phonelib.phone_data[country][Core::COUNTRY_CODE]
end | [
"def",
"country_prefix",
"(",
"country",
")",
"country",
"=",
"country",
".",
"to_s",
".",
"upcase",
"Phonelib",
".",
"phone_data",
"[",
"country",
"]",
"&&",
"Phonelib",
".",
"phone_data",
"[",
"country",
"]",
"[",
"Core",
"::",
"COUNTRY_CODE",
"]",
"end"... | returns country prefix for provided country or nil | [
"returns",
"country",
"prefix",
"for",
"provided",
"country",
"or",
"nil"
] | aa0023eab7c896b71275bf342bc7f49735cbdbbf | https://github.com/daddyz/phonelib/blob/aa0023eab7c896b71275bf342bc7f49735cbdbbf/lib/phonelib/phone_analyzer_helper.rb#L36-L40 | train | Returns the prefix for a country | [
30522,
13366,
2406,
1035,
17576,
1006,
2406,
1007,
2406,
1027,
2406,
1012,
2000,
1035,
1055,
1012,
2039,
18382,
3042,
29521,
1012,
3042,
1035,
2951,
1031,
2406,
1033,
1004,
1004,
1032,
3042,
29521,
1012,
3042,
1035,
2951,
1031,
2406,
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... |
tongueroo/jets | lib/jets/job/dsl/s3_event.rb | Jets::Job::Dsl.S3Event.declare_s3_bucket_resources | def declare_s3_bucket_resources(bucket_name)
# If shared s3 bucket resources have already been declared.
# We will not generate them again. However, we still need to always
# add the depends_on declaration to ensure that the shared stack parameters
# are properly passed to the nested child stack.
stack_name = s3_events[bucket_name] # already registered
if stack_name
depends_on stack_name.underscore.to_sym, class_prefix: true # always add this
return stack_name
end
# Create shared resources - one time
stack_name = declare_shared_s3_event_resources(bucket_name)
depends_on stack_name.underscore.to_sym, class_prefix: true # always add this
self.s3_events[bucket_name] = stack_name # tracks buckets already set up
end | ruby | def declare_s3_bucket_resources(bucket_name)
# If shared s3 bucket resources have already been declared.
# We will not generate them again. However, we still need to always
# add the depends_on declaration to ensure that the shared stack parameters
# are properly passed to the nested child stack.
stack_name = s3_events[bucket_name] # already registered
if stack_name
depends_on stack_name.underscore.to_sym, class_prefix: true # always add this
return stack_name
end
# Create shared resources - one time
stack_name = declare_shared_s3_event_resources(bucket_name)
depends_on stack_name.underscore.to_sym, class_prefix: true # always add this
self.s3_events[bucket_name] = stack_name # tracks buckets already set up
end | [
"def",
"declare_s3_bucket_resources",
"(",
"bucket_name",
")",
"# If shared s3 bucket resources have already been declared.",
"# We will not generate them again. However, we still need to always",
"# add the depends_on declaration to ensure that the shared stack parameters",
"# are properly passed t... | Returns stack_name | [
"Returns",
"stack_name"
] | 46943a519224067e58aa3e2d5656e3ca083150f9 | https://github.com/tongueroo/jets/blob/46943a519224067e58aa3e2d5656e3ca083150f9/lib/jets/job/dsl/s3_event.rb#L9-L24 | train | Declare the resources for the given bucket. | [
30522,
13366,
13520,
1035,
1055,
2509,
1035,
13610,
1035,
4219,
1006,
13610,
1035,
2171,
1007,
1001,
2065,
4207,
1055,
2509,
13610,
4219,
2031,
2525,
2042,
4161,
1012,
1001,
2057,
2097,
2025,
9699,
2068,
2153,
1012,
2174,
1010,
2057,
2145,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/form_builder.rb | Decidim.FormBuilder.check_box | def check_box(attribute, options = {}, checked_value = "1", unchecked_value = "0")
custom_label(attribute, options[:label], options[:label_options], true, false) do
options.delete(:label)
options.delete(:label_options)
@template.check_box(@object_name, attribute, objectify_options(options), checked_value, unchecked_value)
end + error_and_help_text(attribute, options)
end | ruby | def check_box(attribute, options = {}, checked_value = "1", unchecked_value = "0")
custom_label(attribute, options[:label], options[:label_options], true, false) do
options.delete(:label)
options.delete(:label_options)
@template.check_box(@object_name, attribute, objectify_options(options), checked_value, unchecked_value)
end + error_and_help_text(attribute, options)
end | [
"def",
"check_box",
"(",
"attribute",
",",
"options",
"=",
"{",
"}",
",",
"checked_value",
"=",
"\"1\"",
",",
"unchecked_value",
"=",
"\"0\"",
")",
"custom_label",
"(",
"attribute",
",",
"options",
"[",
":label",
"]",
",",
"options",
"[",
":label_options",
... | Public: Override so checkboxes are rendered before the label. | [
"Public",
":",
"Override",
"so",
"checkboxes",
"are",
"rendered",
"before",
"the",
"label",
"."
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/lib/decidim/form_builder.rb#L301-L307 | train | Returns a check box with the given attribute. | [
30522,
13366,
4638,
1035,
3482,
1006,
17961,
1010,
7047,
1027,
1063,
1065,
1010,
7039,
1035,
3643,
1027,
1000,
1015,
1000,
1010,
4895,
5403,
18141,
1035,
3643,
1027,
1000,
1014,
1000,
1007,
7661,
1035,
3830,
1006,
17961,
1010,
7047,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb | Azure::KeyVault::V2016_10_01.KeyVaultClient.get_sas_definitions | def get_sas_definitions(vault_base_url, storage_account_name, maxresults:nil, custom_headers:nil)
first_page = get_sas_definitions_as_lazy(vault_base_url, storage_account_name, maxresults:maxresults, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def get_sas_definitions(vault_base_url, storage_account_name, maxresults:nil, custom_headers:nil)
first_page = get_sas_definitions_as_lazy(vault_base_url, storage_account_name, maxresults:maxresults, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"get_sas_definitions",
"(",
"vault_base_url",
",",
"storage_account_name",
",",
"maxresults",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"get_sas_definitions_as_lazy",
"(",
"vault_base_url",
",",
"storage_account_name",
",",
"maxresult... | List storage SAS definitions for the given storage account. This operation
requires the storage/listsas permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param storage_account_name [String] The name of the storage account.
@param maxresults [Integer] Maximum number of results to return in a page. If
not specified the service will return up to 25 results.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<SasDefinitionItem>] operation results. | [
"List",
"storage",
"SAS",
"definitions",
"for",
"the",
"given",
"storage",
"account",
".",
"This",
"operation",
"requires",
"the",
"storage",
"/",
"listsas",
"permission",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb#L7673-L7676 | train | Gets the SAS definitions for the specified storage account. | [
30522,
13366,
2131,
1035,
21871,
1035,
15182,
30524,
1035,
24471,
2140,
1010,
5527,
1035,
4070,
1035,
2171,
1010,
4098,
6072,
11314,
2015,
1024,
4098,
6072,
11314,
2015,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
20346,
2015,
1007,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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_configure | def begin_configure(parameters, resource_group_name, manager_name, custom_headers:nil)
response = begin_configure_async(parameters, resource_group_name, manager_name, custom_headers:custom_headers).value!
nil
end | ruby | def begin_configure(parameters, resource_group_name, manager_name, custom_headers:nil)
response = begin_configure_async(parameters, resource_group_name, manager_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_configure",
"(",
"parameters",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_configure_async",
"(",
"parameters",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
"... | Complete minimal setup before using the device.
@param parameters [ConfigureDeviceRequest] The minimal properties to
configure a device.
@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. | [
"Complete",
"minimal",
"setup",
"before",
"using",
"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#L1219-L1222 | train | Configure the specified managed network interface. | [
30522,
13366,
4088,
1035,
9530,
8873,
27390,
2063,
1006,
11709,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
9530,
8873,
27390,
2063,
1035,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
EugenMayer/docker-sync | lib/docker-sync/sync_process.rb | DockerSync.SyncProcess.set_sync_strategy | def set_sync_strategy
case @options['sync_strategy']
when 'rsync'
@sync_strategy = DockerSync::SyncStrategy::Rsync.new(@sync_name, @options)
when 'unison'
@sync_strategy = DockerSync::SyncStrategy::Unison.new(@sync_name, @options)
when 'native'
@sync_strategy = DockerSync::SyncStrategy::Native.new(@sync_name, @options)
when 'native_osx'
@sync_strategy = DockerSync::SyncStrategy::NativeOsx.new(@sync_name, @options)
else
raise "Unknown sync_strategy #{@options['sync_strategy']}"
end
end | ruby | def set_sync_strategy
case @options['sync_strategy']
when 'rsync'
@sync_strategy = DockerSync::SyncStrategy::Rsync.new(@sync_name, @options)
when 'unison'
@sync_strategy = DockerSync::SyncStrategy::Unison.new(@sync_name, @options)
when 'native'
@sync_strategy = DockerSync::SyncStrategy::Native.new(@sync_name, @options)
when 'native_osx'
@sync_strategy = DockerSync::SyncStrategy::NativeOsx.new(@sync_name, @options)
else
raise "Unknown sync_strategy #{@options['sync_strategy']}"
end
end | [
"def",
"set_sync_strategy",
"case",
"@options",
"[",
"'sync_strategy'",
"]",
"when",
"'rsync'",
"@sync_strategy",
"=",
"DockerSync",
"::",
"SyncStrategy",
"::",
"Rsync",
".",
"new",
"(",
"@sync_name",
",",
"@options",
")",
"when",
"'unison'",
"@sync_strategy",
"="... | noinspection RubyStringKeysInHashInspection | [
"noinspection",
"RubyStringKeysInHashInspection"
] | 7bac0072e959bc1596a8e4075e77fed48360fe04 | https://github.com/EugenMayer/docker-sync/blob/7bac0072e959bc1596a8e4075e77fed48360fe04/lib/docker-sync/sync_process.rb#L43-L56 | train | Sets the sync strategy to use for the current sync | [
30522,
13366,
2275,
1035,
26351,
1035,
5656,
2553,
1030,
7047,
1031,
1005,
26351,
1035,
5656,
1005,
1033,
2043,
1005,
12667,
6038,
2278,
1005,
1030,
26351,
1035,
5656,
1027,
8946,
2545,
6038,
2278,
1024,
1024,
26351,
20528,
2618,
6292,
1024... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
twitter/secure_headers | lib/secure_headers/view_helper.rb | SecureHeaders.ViewHelpers.nonced_stylesheet_link_tag | def nonced_stylesheet_link_tag(*args, &block)
opts = extract_options(args).merge(nonce: _content_security_policy_nonce(:style))
stylesheet_link_tag(*args, opts, &block)
end | ruby | def nonced_stylesheet_link_tag(*args, &block)
opts = extract_options(args).merge(nonce: _content_security_policy_nonce(:style))
stylesheet_link_tag(*args, opts, &block)
end | [
"def",
"nonced_stylesheet_link_tag",
"(",
"*",
"args",
",",
"&",
"block",
")",
"opts",
"=",
"extract_options",
"(",
"args",
")",
".",
"merge",
"(",
"nonce",
":",
"_content_security_policy_nonce",
"(",
":style",
")",
")",
"stylesheet_link_tag",
"(",
"args",
","... | Public: create a stylesheet link tag using the content security policy nonce.
Instructs secure_headers to append a nonce to style-src directive.
Returns an html-safe link tag with the nonce attribute. | [
"Public",
":",
"create",
"a",
"stylesheet",
"link",
"tag",
"using",
"the",
"content",
"security",
"policy",
"nonce",
".",
"Instructs",
"secure_headers",
"to",
"append",
"a",
"nonce",
"to",
"style",
"-",
"src",
"directive",
"."
] | 543e6712aadae08f1653ed973e6b6204f7eac26a | https://github.com/twitter/secure_headers/blob/543e6712aadae08f1653ed973e6b6204f7eac26a/lib/secure_headers/view_helper.rb#L21-L25 | train | Returns a stylesheet link tag with a non - stylesheet nonce. | [
30522,
13366,
2512,
11788,
1035,
6782,
21030,
2102,
1035,
4957,
1035,
6415,
1006,
1008,
12098,
5620,
1010,
1004,
3796,
1007,
23569,
2015,
1027,
14817,
1035,
7047,
1006,
12098,
5620,
1007,
1012,
13590,
1006,
2512,
3401,
1024,
1035,
4180,
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... |
cucumber/aruba | lib/aruba/event_bus.rb | Aruba.EventBus.register | def register(event_ids, handler_object = nil, &handler_proc)
handler = handler_proc || handler_object
fail ArgumentError, 'Please pass either an object#call or a handler block' if handler.nil? || !handler.respond_to?(:call)
Array(event_ids).flatten.each do |id|
@handlers[
@resolver.transform(id).to_s
] << handler
end
nil
end | ruby | def register(event_ids, handler_object = nil, &handler_proc)
handler = handler_proc || handler_object
fail ArgumentError, 'Please pass either an object#call or a handler block' if handler.nil? || !handler.respond_to?(:call)
Array(event_ids).flatten.each do |id|
@handlers[
@resolver.transform(id).to_s
] << handler
end
nil
end | [
"def",
"register",
"(",
"event_ids",
",",
"handler_object",
"=",
"nil",
",",
"&",
"handler_proc",
")",
"handler",
"=",
"handler_proc",
"||",
"handler_object",
"fail",
"ArgumentError",
",",
"'Please pass either an object#call or a handler block'",
"if",
"handler",
".",
... | Create EventBus
@param [#transform] resolver
A resolver which transforms Symbol, String, Class into an event Class.
Register for an event
@param [String, Symbol, Class, Array] event_ids
If Array, register multiple events witht the same handler. If String,
Symbol, Class register handler for given event.
@param [#call] handler_object
The handler object, needs to have method `#call`. Either
`handler_object` or `block` can be defined. The handler object gets the
event passed to `#call`.
@yield
Handler block which gets the event passed as parameter. | [
"Create",
"EventBus"
] | add17615322f575588aef1fccce875396cdf36e9 | https://github.com/cucumber/aruba/blob/add17615322f575588aef1fccce875396cdf36e9/lib/aruba/event_bus.rb#L33-L45 | train | Register a handler for the given event_ids | [
30522,
13366,
4236,
1006,
2724,
1035,
8909,
2015,
1010,
28213,
1035,
4874,
1027,
9152,
2140,
1010,
1004,
28213,
1035,
4013,
2278,
1007,
28213,
1027,
28213,
1035,
4013,
2278,
1064,
1064,
28213,
1035,
4874,
8246,
6685,
2121,
29165,
1010,
1005... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/route_filters.rb | Azure::Network::Mgmt::V2018_07_01.RouteFilters.begin_create_or_update_with_http_info | def begin_create_or_update_with_http_info(resource_group_name, route_filter_name, route_filter_parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, route_filter_name, route_filter_parameters, custom_headers:custom_headers).value!
end | ruby | def begin_create_or_update_with_http_info(resource_group_name, route_filter_name, route_filter_parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, route_filter_name, route_filter_parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_create_or_update_with_http_info",
"(",
"resource_group_name",
",",
"route_filter_name",
",",
"route_filter_parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"route_filter_name",
",",
"route_filter... | Creates or updates a route filter in a specified resource group.
@param resource_group_name [String] The name of the resource group.
@param route_filter_name [String] The name of the route filter.
@param route_filter_parameters [RouteFilter] Parameters supplied to the
create or update route filter operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Creates",
"or",
"updates",
"a",
"route",
"filter",
"in",
"a",
"specified",
"resource",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/route_filters.rb#L534-L536 | train | Creates or updates a route filter in the specified resource group. | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2799,
1035,
11307,
1035,
2171,
1010,
2799,
1035,
11307,
1035,
11709,
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... |
rails/sprockets | lib/sprockets/loader.rb | Sprockets.Loader.fetch_asset_from_dependency_cache | def fetch_asset_from_dependency_cache(unloaded, limit = 3)
key = unloaded.dependency_history_key
history = cache.get(key) || []
history.each_with_index do |deps, index|
expanded_deps = deps.map do |path|
path.start_with?("file-digest://") ? expand_from_root(path) : path
end
if asset = yield(expanded_deps)
cache.set(key, history.rotate!(index)) if index > 0
return asset
end
end
asset = yield
deps = asset[:metadata][:dependencies].dup.map! do |uri|
uri.start_with?("file-digest://") ? compress_from_root(uri) : uri
end
cache.set(key, history.unshift(deps).take(limit))
asset
end | ruby | def fetch_asset_from_dependency_cache(unloaded, limit = 3)
key = unloaded.dependency_history_key
history = cache.get(key) || []
history.each_with_index do |deps, index|
expanded_deps = deps.map do |path|
path.start_with?("file-digest://") ? expand_from_root(path) : path
end
if asset = yield(expanded_deps)
cache.set(key, history.rotate!(index)) if index > 0
return asset
end
end
asset = yield
deps = asset[:metadata][:dependencies].dup.map! do |uri|
uri.start_with?("file-digest://") ? compress_from_root(uri) : uri
end
cache.set(key, history.unshift(deps).take(limit))
asset
end | [
"def",
"fetch_asset_from_dependency_cache",
"(",
"unloaded",
",",
"limit",
"=",
"3",
")",
"key",
"=",
"unloaded",
".",
"dependency_history_key",
"history",
"=",
"cache",
".",
"get",
"(",
"key",
")",
"||",
"[",
"]",
"history",
".",
"each_with_index",
"do",
"|... | Internal: Retrieves an asset based on its digest
unloaded - An UnloadedAsset
limit - A Fixnum which sets the maximum number of versions of "histories"
stored in the cache
This method attempts to retrieve the last `limit` number of histories of an asset
from the cache a "history" which is an array of unresolved "dependencies" that the asset needs
to compile. In this case a dependency can refer to either an asset e.g. index.js
may rely on jquery.js (so jquery.js is a dependency), or other factors that may affect
compilation, such as the VERSION of Sprockets (i.e. the environment) and what "processors"
are used.
For example a history array may look something like this
[["environment-version", "environment-paths", "processors:type=text/css&file_type=text/css",
"file-digest:///Full/path/app/assets/stylesheets/application.css",
"processors:type=text/css&file_digesttype=text/css&pipeline=self",
"file-digest:///Full/path/app/assets/stylesheets"]]
Where the first entry is a Set of dependencies for last generated version of that asset.
Multiple versions are stored since Sprockets keeps the last `limit` number of assets
generated present in the system.
If a "history" of dependencies is present in the cache, each version of "history" will be
yielded to the passed block which is responsible for loading the asset. If found, the existing
history will be saved with the dependency that found a valid asset moved to the front.
If no history is present, or if none of the histories could be resolved to a valid asset then,
the block is yielded to and expected to return a valid asset.
When this happens the dependencies for the returned asset are added to the "history", and older
entries are removed if the "history" is above `limit`. | [
"Internal",
":",
"Retrieves",
"an",
"asset",
"based",
"on",
"its",
"digest"
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/loader.rb#L315-L335 | train | Fetch the asset from the dependency cache. | [
30522,
13366,
18584,
1035,
11412,
1035,
2013,
1035,
24394,
1035,
17053,
1006,
4895,
17468,
1010,
5787,
1027,
1017,
1007,
3145,
1027,
4895,
17468,
1012,
24394,
1035,
2381,
1035,
3145,
2381,
1027,
17053,
1012,
2131,
1006,
3145,
1007,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/tag.rb | Aws::AutoScaling.Tag.create | def create(options = {})
options = Aws::Util.deep_merge(options, tags: [{
resource_type: @resource_type,
resource_id: @resource_id,
key: @key
}])
resp = @client.create_or_update_tags(options)
resp.data
end | ruby | def create(options = {})
options = Aws::Util.deep_merge(options, tags: [{
resource_type: @resource_type,
resource_id: @resource_id,
key: @key
}])
resp = @client.create_or_update_tags(options)
resp.data
end | [
"def",
"create",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"Aws",
"::",
"Util",
".",
"deep_merge",
"(",
"options",
",",
"tags",
":",
"[",
"{",
"resource_type",
":",
"@resource_type",
",",
"resource_id",
":",
"@resource_id",
",",
"key",
":",
"... | @!group Actions
@example Request syntax with placeholder values
tag.create({
tags: [ # required
{
resource_id: "XmlString",
resource_type: "XmlString",
key: "TagKey", # required
value: "TagValue",
propagate_at_launch: false,
},
],
})
@param [Hash] options ({})
@option options [required, Array<Types::Tag>] :tags
One or more tags.
@return [EmptyStructure] | [
"@!group",
"Actions",
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/tag.rb#L220-L228 | train | Creates a new resource or updates an existing resource or updates an existing resource or updates an existing resource. | [
30522,
13366,
3443,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
22091,
2015,
1024,
1024,
21183,
4014,
1012,
2784,
1035,
13590,
1006,
7047,
1010,
22073,
1024,
1031,
1063,
7692,
1035,
2828,
1024,
1030,
7692,
1035,
2828,
1010,
7692,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_consumption/lib/2018-01-31/generated/azure_mgmt_consumption/reservations_summaries.rb | Azure::Consumption::Mgmt::V2018_01_31.ReservationsSummaries.list_by_reservation_order_and_reservation_next | def list_by_reservation_order_and_reservation_next(next_page_link, custom_headers:nil)
response = list_by_reservation_order_and_reservation_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_reservation_order_and_reservation_next(next_page_link, custom_headers:nil)
response = list_by_reservation_order_and_reservation_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_reservation_order_and_reservation_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_reservation_order_and_reservation_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
... | Lists the reservations summaries for daily or monthly grain.
@param next_page_link [String] The NextLink from the previous successful call
to List operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ReservationSummariesListResult] operation results. | [
"Lists",
"the",
"reservations",
"summaries",
"for",
"daily",
"or",
"monthly",
"grain",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_consumption/lib/2018-01-31/generated/azure_mgmt_consumption/reservations_summaries.rb#L333-L336 | train | Gets the list of all the elastic advisors in a resource group. | [
30522,
13366,
2862,
1035,
2011,
1035,
11079,
1035,
2344,
1035,
1998,
1035,
11079,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
11079,
1035,
2344,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_api_management/lib/2016-10-10/generated/azure_mgmt_api_management/product_apis.rb | Azure::ApiManagement::Mgmt::V2016_10_10.ProductApis.list_by_products_next | def list_by_products_next(next_page_link, custom_headers:nil)
response = list_by_products_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_products_next(next_page_link, custom_headers:nil)
response = list_by_products_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_products_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_products_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"resp... | Lists a collection of the APIs associated with a product.
@param next_page_link [String] The NextLink from the previous successful call
to List operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ApiCollection] operation results. | [
"Lists",
"a",
"collection",
"of",
"the",
"APIs",
"associated",
"with",
"a",
"product",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2016-10-10/generated/azure_mgmt_api_management/product_apis.rb#L397-L400 | train | Gets the list of product objects. | [
30522,
13366,
2862,
1035,
2011,
1035,
3688,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
3688,
1035,
2279,
1035,
2004,
6038,
2278,
1006,
2279,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activerecord/lib/active_record/relation/batches.rb | ActiveRecord.Batches.find_in_batches | def find_in_batches(start: nil, finish: nil, batch_size: 1000, error_on_ignore: nil)
relation = self
unless block_given?
return to_enum(:find_in_batches, start: start, finish: finish, batch_size: batch_size, error_on_ignore: error_on_ignore) do
total = apply_limits(relation, start, finish).size
(total - 1).div(batch_size) + 1
end
end
in_batches(of: batch_size, start: start, finish: finish, load: true, error_on_ignore: error_on_ignore) do |batch|
yield batch.to_a
end
end | ruby | def find_in_batches(start: nil, finish: nil, batch_size: 1000, error_on_ignore: nil)
relation = self
unless block_given?
return to_enum(:find_in_batches, start: start, finish: finish, batch_size: batch_size, error_on_ignore: error_on_ignore) do
total = apply_limits(relation, start, finish).size
(total - 1).div(batch_size) + 1
end
end
in_batches(of: batch_size, start: start, finish: finish, load: true, error_on_ignore: error_on_ignore) do |batch|
yield batch.to_a
end
end | [
"def",
"find_in_batches",
"(",
"start",
":",
"nil",
",",
"finish",
":",
"nil",
",",
"batch_size",
":",
"1000",
",",
"error_on_ignore",
":",
"nil",
")",
"relation",
"=",
"self",
"unless",
"block_given?",
"return",
"to_enum",
"(",
":find_in_batches",
",",
"sta... | Yields each batch of records that was found by the find options as
an array.
Person.where("age > 21").find_in_batches do |group|
sleep(50) # Make sure it doesn't get too crowded in there!
group.each { |person| person.party_all_night! }
end
If you do not provide a block to #find_in_batches, it will return an Enumerator
for chaining with other methods:
Person.find_in_batches.with_index do |group, batch|
puts "Processing group ##{batch}"
group.each(&:recover_from_last_night!)
end
To be yielded each record one by one, use #find_each instead.
==== Options
* <tt>:batch_size</tt> - Specifies the size of the batch. Defaults to 1000.
* <tt>:start</tt> - Specifies the primary key value to start from, inclusive of the value.
* <tt>:finish</tt> - Specifies the primary key value to end at, inclusive of the value.
* <tt>:error_on_ignore</tt> - Overrides the application config to specify if an error should be raised when
an order is present in the relation.
Limits are honored, and if present there is no requirement for the batch
size: it can be less than, equal to, or greater than the limit.
The options +start+ and +finish+ are especially useful if you want
multiple workers dealing with the same processing queue. You can make
worker 1 handle all the records between id 1 and 9999 and worker 2
handle from 10000 and beyond by setting the +:start+ and +:finish+
option on each worker.
# Let's process from record 10_000 on.
Person.find_in_batches(start: 10_000) do |group|
group.each { |person| person.party_all_night! }
end
NOTE: It's not possible to set the order. That is automatically set to
ascending on the primary key ("id ASC") to make the batch ordering
work. This also means that this method only works when the primary key is
orderable (e.g. an integer or string).
NOTE: By its nature, batch processing is subject to race conditions if
other processes are modifying the database. | [
"Yields",
"each",
"batch",
"of",
"records",
"that",
"was",
"found",
"by",
"the",
"find",
"options",
"as",
"an",
"array",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activerecord/lib/active_record/relation/batches.rb#L126-L138 | train | Find all the documents in batches of the given size. | [
30522,
13366,
2424,
1035,
1999,
1035,
14108,
2229,
1006,
2707,
1024,
9152,
2140,
1010,
3926,
1024,
9152,
2140,
1010,
14108,
1035,
2946,
1024,
6694,
1010,
7561,
1035,
2006,
1035,
8568,
1024,
9152,
2140,
1007,
7189,
1027,
2969,
4983,
3796,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
puppetlabs/puppet | lib/puppet/module_tool/metadata.rb | Puppet::ModuleTool.Metadata.validate_version_range | def validate_version_range(version_range)
SemanticPuppet::VersionRange.parse(version_range)
rescue ArgumentError => e
raise ArgumentError, _("Invalid 'version_range' field in metadata.json: %{err}") % { err: e }
end | ruby | def validate_version_range(version_range)
SemanticPuppet::VersionRange.parse(version_range)
rescue ArgumentError => e
raise ArgumentError, _("Invalid 'version_range' field in metadata.json: %{err}") % { err: e }
end | [
"def",
"validate_version_range",
"(",
"version_range",
")",
"SemanticPuppet",
"::",
"VersionRange",
".",
"parse",
"(",
"version_range",
")",
"rescue",
"ArgumentError",
"=>",
"e",
"raise",
"ArgumentError",
",",
"_",
"(",
"\"Invalid 'version_range' field in metadata.json: %... | Validates that the version range can be parsed by Semantic. | [
"Validates",
"that",
"the",
"version",
"range",
"can",
"be",
"parsed",
"by",
"Semantic",
"."
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/module_tool/metadata.rb#L216-L220 | train | Validate the version_range field in the metadata. json | [
30522,
13366,
9398,
3686,
1035,
2544,
1035,
2846,
1006,
2544,
1035,
2846,
1007,
21641,
14289,
29519,
1024,
1024,
2544,
24388,
2063,
1012,
11968,
3366,
1006,
2544,
1035,
2846,
1007,
5343,
6685,
2121,
29165,
1027,
1028,
1041,
5333,
6685,
2121... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kmuto/review | lib/review/latexbuilder.rb | ReVIEW.LATEXBuilder.listnum | def listnum(lines, id, caption, lang = nil)
first_line_num = line_num
if highlight_listings?
common_code_block_lst(id, lines, 'reviewlistnumlst', 'caption', caption, lang, first_line_num: first_line_num)
else
common_code_block(id, lines, 'reviewlist', caption, lang) { |line, idx| detab((idx + first_line_num).to_s.rjust(2) + ': ' + line) + "\n" }
end
end | ruby | def listnum(lines, id, caption, lang = nil)
first_line_num = line_num
if highlight_listings?
common_code_block_lst(id, lines, 'reviewlistnumlst', 'caption', caption, lang, first_line_num: first_line_num)
else
common_code_block(id, lines, 'reviewlist', caption, lang) { |line, idx| detab((idx + first_line_num).to_s.rjust(2) + ': ' + line) + "\n" }
end
end | [
"def",
"listnum",
"(",
"lines",
",",
"id",
",",
"caption",
",",
"lang",
"=",
"nil",
")",
"first_line_num",
"=",
"line_num",
"if",
"highlight_listings?",
"common_code_block_lst",
"(",
"id",
",",
"lines",
",",
"'reviewlistnumlst'",
",",
"'caption'",
",",
"captio... | override Builder#listnum | [
"override",
"Builder#listnum"
] | 77d1273e671663f05db2992281fd891b776badf0 | https://github.com/kmuto/review/blob/77d1273e671663f05db2992281fd891b776badf0/lib/review/latexbuilder.rb#L361-L368 | train | Returns the listnum of the lines | [
30522,
13366,
2862,
19172,
1006,
3210,
1010,
8909,
1010,
14408,
3258,
1010,
11374,
1027,
9152,
2140,
1007,
2034,
1035,
2240,
1035,
16371,
2213,
1027,
2240,
1035,
16371,
2213,
2065,
12944,
1035,
26213,
1029,
2691,
1035,
3642,
1035,
3796,
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... |
tomiacannondale/era_ja | lib/era_ja/conversion.rb | EraJa.Conversion.to_era | def to_era(format = "%o%E.%m.%d", era_names: ERA_NAME_DEFAULTS)
raise EraJa::DateOutOfRangeError unless era_convertible?
@era_format = format.gsub(/%J/, "%J%")
str_time = strftime(@era_format)
if @era_format =~ /%([EOo]|1O)/
case
when self.to_time < ::Time.mktime(1912,7,30)
str_time = era_year(year - 1867, :meiji, era_names)
when self.to_time < ::Time.mktime(1926,12,25)
str_time = era_year(year - 1911, :taisho, era_names)
when self.to_time < ::Time.mktime(1989,1,8)
str_time = era_year(year - 1925, :showa, era_names)
when self.to_time < ::Time.mktime(2019, 5, 1)
str_time = era_year(year - 1988, :heisei, era_names)
else
str_time = era_year(year - 2018, :reiwa, era_names)
end
end
str_time.gsub(/%J(\d+)/) { to_kanzi($1) }
end | ruby | def to_era(format = "%o%E.%m.%d", era_names: ERA_NAME_DEFAULTS)
raise EraJa::DateOutOfRangeError unless era_convertible?
@era_format = format.gsub(/%J/, "%J%")
str_time = strftime(@era_format)
if @era_format =~ /%([EOo]|1O)/
case
when self.to_time < ::Time.mktime(1912,7,30)
str_time = era_year(year - 1867, :meiji, era_names)
when self.to_time < ::Time.mktime(1926,12,25)
str_time = era_year(year - 1911, :taisho, era_names)
when self.to_time < ::Time.mktime(1989,1,8)
str_time = era_year(year - 1925, :showa, era_names)
when self.to_time < ::Time.mktime(2019, 5, 1)
str_time = era_year(year - 1988, :heisei, era_names)
else
str_time = era_year(year - 2018, :reiwa, era_names)
end
end
str_time.gsub(/%J(\d+)/) { to_kanzi($1) }
end | [
"def",
"to_era",
"(",
"format",
"=",
"\"%o%E.%m.%d\"",
",",
"era_names",
":",
"ERA_NAME_DEFAULTS",
")",
"raise",
"EraJa",
"::",
"DateOutOfRangeError",
"unless",
"era_convertible?",
"@era_format",
"=",
"format",
".",
"gsub",
"(",
"/",
"/",
",",
"\"%J%\"",
")",
... | Convert to Japanese era.
@param [String] format_string
Time#strftime format string can be used
#### extra format string
* %o - era(alphabet)
* %O - era(kanzi)
* %E - era year
* %J - kanzi number
@param [Hash] era_names
If you want to convert custom to era strings (eg `平`, `h`), you can set this argument.
key is `:meiji' or `:taisho' or `:showa` or `:heisei` or `:reiwa`.
value is ["alphabet era name"(ex `h`, `s`)(related to `%o`), "multibyte era name"(eg `平`, `昭`)(related to `%O`)].
this argument is same as one element of ERA_NAME_DEFAULTS.
@return [String] | [
"Convert",
"to",
"Japanese",
"era",
"."
] | 1ec1b7e1b53caf4290c755967f180719db944d50 | https://github.com/tomiacannondale/era_ja/blob/1ec1b7e1b53caf4290c755967f180719db944d50/lib/era_ja/conversion.rb#L28-L48 | train | Convert the date to an Era object. | [
30522,
13366,
2000,
1035,
3690,
1006,
4289,
1027,
1000,
1003,
1051,
1003,
1041,
1012,
1003,
1049,
1012,
1003,
1040,
1000,
1010,
3690,
1035,
3415,
1024,
3690,
1035,
2171,
1035,
12398,
2015,
1007,
5333,
3690,
3900,
1024,
1024,
3058,
5833,
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... |
samvera/hyrax | app/controllers/concerns/hyrax/deny_access_override_behavior.rb | Hyrax.DenyAccessOverrideBehavior.deny_access | def deny_access(exception)
if current_user&.persisted?
redirect_to root_path, alert: exception.message
else
session['user_return_to'.freeze] = request.url
redirect_to main_app.new_user_session_path, alert: exception.message
end
end | ruby | def deny_access(exception)
if current_user&.persisted?
redirect_to root_path, alert: exception.message
else
session['user_return_to'.freeze] = request.url
redirect_to main_app.new_user_session_path, alert: exception.message
end
end | [
"def",
"deny_access",
"(",
"exception",
")",
"if",
"current_user",
"&.",
"persisted?",
"redirect_to",
"root_path",
",",
"alert",
":",
"exception",
".",
"message",
"else",
"session",
"[",
"'user_return_to'",
".",
"freeze",
"]",
"=",
"request",
".",
"url",
"redi... | Overriding the default behavior from Hydra::Core::ControllerBehavior | [
"Overriding",
"the",
"default",
"behavior",
"from",
"Hydra",
"::",
"Core",
"::",
"ControllerBehavior"
] | e2b4f56e829a53b1f11296324736e9d5b8c9ee5f | https://github.com/samvera/hyrax/blob/e2b4f56e829a53b1f11296324736e9d5b8c9ee5f/app/controllers/concerns/hyrax/deny_access_override_behavior.rb#L4-L11 | train | Deny access to the user | [
30522,
13366,
9772,
1035,
3229,
1006,
6453,
1007,
2065,
2783,
1035,
5310,
1004,
1012,
19035,
1029,
2417,
7442,
6593,
1035,
2000,
7117,
1035,
4130,
1010,
9499,
1024,
6453,
1012,
4471,
2842,
5219,
1031,
1005,
5310,
1035,
2709,
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... |
alexreisner/geocoder | lib/geocoder/calculations.rb | Geocoder.Calculations.endpoint | def endpoint(start, heading, distance, options = {})
radius = earth_radius(options[:units])
start = extract_coordinates(start)
# convert degrees to radians
start = to_radians(start)
lat = start[0]
lon = start[1]
heading = to_radians(heading)
distance = distance.to_f
end_lat = Math.asin(Math.sin(lat)*Math.cos(distance/radius) +
Math.cos(lat)*Math.sin(distance/radius)*Math.cos(heading))
end_lon = lon+Math.atan2(Math.sin(heading)*Math.sin(distance/radius)*Math.cos(lat),
Math.cos(distance/radius)-Math.sin(lat)*Math.sin(end_lat))
to_degrees [end_lat, end_lon]
end | ruby | def endpoint(start, heading, distance, options = {})
radius = earth_radius(options[:units])
start = extract_coordinates(start)
# convert degrees to radians
start = to_radians(start)
lat = start[0]
lon = start[1]
heading = to_radians(heading)
distance = distance.to_f
end_lat = Math.asin(Math.sin(lat)*Math.cos(distance/radius) +
Math.cos(lat)*Math.sin(distance/radius)*Math.cos(heading))
end_lon = lon+Math.atan2(Math.sin(heading)*Math.sin(distance/radius)*Math.cos(lat),
Math.cos(distance/radius)-Math.sin(lat)*Math.sin(end_lat))
to_degrees [end_lat, end_lon]
end | [
"def",
"endpoint",
"(",
"start",
",",
"heading",
",",
"distance",
",",
"options",
"=",
"{",
"}",
")",
"radius",
"=",
"earth_radius",
"(",
"options",
"[",
":units",
"]",
")",
"start",
"=",
"extract_coordinates",
"(",
"start",
")",
"# convert degrees to radian... | Given a start point, heading (in degrees), and distance, provides
an endpoint.
The starting point is given in the same way that points are given to all
Geocoder methods that accept points as arguments. It can be:
* an array of coordinates ([lat,lon])
* a geocodable address (string)
* a geocoded object (one which implements a +to_coordinates+ method
which returns a [lat,lon] array | [
"Given",
"a",
"start",
"point",
"heading",
"(",
"in",
"degrees",
")",
"and",
"distance",
"provides",
"an",
"endpoint",
".",
"The",
"starting",
"point",
"is",
"given",
"in",
"the",
"same",
"way",
"that",
"points",
"are",
"given",
"to",
"all",
"Geocoder",
... | e087dc2759264ee6f307b926bb2de4ec2406859e | https://github.com/alexreisner/geocoder/blob/e087dc2759264ee6f307b926bb2de4ec2406859e/lib/geocoder/calculations.rb#L269-L289 | train | Returns the endpoint of the given start and heading | [
30522,
13366,
2203,
8400,
1006,
2707,
1010,
5825,
1010,
3292,
1010,
7047,
1027,
1063,
1065,
1007,
12177,
1027,
3011,
1035,
12177,
1006,
7047,
1031,
1024,
3197,
1033,
1007,
2707,
1027,
14817,
1035,
12093,
1006,
2707,
1007,
1001,
10463,
5445,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_stream_analytics/lib/2016-03-01/generated/azure_mgmt_stream_analytics/outputs.rb | Azure::StreamAnalytics::Mgmt::V2016_03_01.Outputs.create_or_replace | def create_or_replace(output, resource_group_name, job_name, output_name, if_match:nil, if_none_match:nil, custom_headers:nil)
response = create_or_replace_async(output, resource_group_name, job_name, output_name, if_match:if_match, if_none_match:if_none_match, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_or_replace(output, resource_group_name, job_name, output_name, if_match:nil, if_none_match:nil, custom_headers:nil)
response = create_or_replace_async(output, resource_group_name, job_name, output_name, if_match:if_match, if_none_match:if_none_match, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_or_replace",
"(",
"output",
",",
"resource_group_name",
",",
"job_name",
",",
"output_name",
",",
"if_match",
":",
"nil",
",",
"if_none_match",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_or_replace_async",
"(",
"o... | Creates an output or replaces an already existing output under an existing
streaming job.
@param output [Output] The definition of the output that will be used to
create a new output or replace the existing one under the streaming job.
@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 job_name [String] The name of the streaming job.
@param output_name [String] The name of the output.
@param if_match [String] The ETag of the output. Omit this value to always
overwrite the current output. Specify the last-seen ETag value to prevent
accidentally overwritting concurrent changes.
@param if_none_match [String] Set to '*' to allow a new output to be created,
but to prevent updating an existing output. Other values will result in a 412
Pre-condition Failed response.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Output] operation results. | [
"Creates",
"an",
"output",
"or",
"replaces",
"an",
"already",
"existing",
"output",
"under",
"an",
"existing",
"streaming",
"job",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_stream_analytics/lib/2016-03-01/generated/azure_mgmt_stream_analytics/outputs.rb#L46-L49 | train | Creates or replaces an existing output. | [
30522,
13366,
3443,
1035,
2030,
1035,
5672,
1006,
6434,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3105,
1035,
2171,
1010,
6434,
1035,
2171,
1010,
2065,
1035,
2674,
1024,
9152,
2140,
1010,
2065,
1035,
3904,
1035,
2674,
1024,
9152,
2140,
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... |
sensu/sensu | lib/sensu/daemon.rb | Sensu.Daemon.daemonize | def daemonize
Kernel.srand
exit if Kernel.fork
unless Process.setsid
@logger.fatal("cannot detach from controlling terminal")
@logger.fatal("SENSU NOT RUNNING!")
exit 2
end
Signal.trap("SIGHUP", "IGNORE")
exit if Kernel.fork
Dir.chdir("/")
ObjectSpace.each_object(IO) do |io|
unless [STDIN, STDOUT, STDERR].include?(io)
begin
io.close unless io.closed?
rescue; end
end
end
end | ruby | def daemonize
Kernel.srand
exit if Kernel.fork
unless Process.setsid
@logger.fatal("cannot detach from controlling terminal")
@logger.fatal("SENSU NOT RUNNING!")
exit 2
end
Signal.trap("SIGHUP", "IGNORE")
exit if Kernel.fork
Dir.chdir("/")
ObjectSpace.each_object(IO) do |io|
unless [STDIN, STDOUT, STDERR].include?(io)
begin
io.close unless io.closed?
rescue; end
end
end
end | [
"def",
"daemonize",
"Kernel",
".",
"srand",
"exit",
"if",
"Kernel",
".",
"fork",
"unless",
"Process",
".",
"setsid",
"@logger",
".",
"fatal",
"(",
"\"cannot detach from controlling terminal\"",
")",
"@logger",
".",
"fatal",
"(",
"\"SENSU NOT RUNNING!\"",
")",
"exi... | Daemonize the current process. Seed the random number generator,
fork (& exit), detach from controlling terminal, ignore SIGHUP,
fork (& exit), use root '/' as the current working directory,
and close STDIN/OUT/ERR since the process is no longer attached
to a terminal. | [
"Daemonize",
"the",
"current",
"process",
".",
"Seed",
"the",
"random",
"number",
"generator",
"fork",
"(",
"&",
"exit",
")",
"detach",
"from",
"controlling",
"terminal",
"ignore",
"SIGHUP",
"fork",
"(",
"&",
"exit",
")",
"use",
"root",
"/",
"as",
"the",
... | 51319e4b58c8d9986f101ad71ff729aa3e51e951 | https://github.com/sensu/sensu/blob/51319e4b58c8d9986f101ad71ff729aa3e51e951/lib/sensu/daemon.rb#L376-L394 | train | daemonize the process | [
30522,
13366,
12828,
4697,
16293,
1012,
5034,
5685,
6164,
2065,
16293,
1012,
9292,
4983,
2832,
1012,
4520,
3593,
1030,
8833,
4590,
1012,
10611,
1006,
1000,
3685,
20010,
6776,
2013,
9756,
5536,
1000,
1007,
1030,
8833,
4590,
1012,
10611,
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... |
roo-rb/roo | lib/roo/open_office.rb | Roo.OpenOffice.label | def label(labelname)
read_labels
return [nil, nil, nil] if @label.size < 1 || !@label.key?(labelname)
[
@label[labelname][1].to_i,
::Roo::Utils.letter_to_number(@label[labelname][2]),
@label[labelname][0]
]
end | ruby | def label(labelname)
read_labels
return [nil, nil, nil] if @label.size < 1 || !@label.key?(labelname)
[
@label[labelname][1].to_i,
::Roo::Utils.letter_to_number(@label[labelname][2]),
@label[labelname][0]
]
end | [
"def",
"label",
"(",
"labelname",
")",
"read_labels",
"return",
"[",
"nil",
",",
"nil",
",",
"nil",
"]",
"if",
"@label",
".",
"size",
"<",
"1",
"||",
"!",
"@label",
".",
"key?",
"(",
"labelname",
")",
"[",
"@label",
"[",
"labelname",
"]",
"[",
"1",... | returns the row,col values of the labelled cell
(nil,nil) if label is not defined | [
"returns",
"the",
"row",
"col",
"values",
"of",
"the",
"labelled",
"cell",
"(",
"nil",
"nil",
")",
"if",
"label",
"is",
"not",
"defined"
] | 4ec1104f0c3c2a29711c0c907371cd2be12bcc3c | https://github.com/roo-rb/roo/blob/4ec1104f0c3c2a29711c0c907371cd2be12bcc3c/lib/roo/open_office.rb#L178-L186 | train | Returns the label for the given labelname. | [
30522,
13366,
3830,
1006,
3830,
18442,
1007,
3191,
1035,
10873,
2709,
1031,
9152,
2140,
1010,
9152,
2140,
1010,
9152,
2140,
1033,
2065,
1030,
3830,
1012,
2946,
1026,
1015,
1064,
1064,
999,
1030,
3830,
1012,
3145,
1029,
1006,
3830,
18442,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Shopify/shipit-engine | app/jobs/shipit/destroy_stack_job.rb | Shipit.DestroyStackJob.perform | def perform(stack)
Shipit::ApiClient.where(stack_id: stack.id).delete_all
commits_ids = Shipit::Commit.where(stack_id: stack.id).pluck(:id)
commit_deployments_ids = Shipit::CommitDeployment.where(commit_id: commits_ids).pluck(:id)
Shipit::CommitDeploymentStatus.where(commit_deployment_id: commit_deployments_ids).delete_all
Shipit::CommitDeployment.where(id: commit_deployments_ids).delete_all
Shipit::Status.where(commit_id: commits_ids).delete_all
Shipit::Commit.where(id: commits_ids).delete_all
Shipit::GithubHook.where(stack_id: stack.id).destroy_all
Shipit::Hook.where(stack_id: stack.id).delete_all
Shipit::PullRequest.where(stack_id: stack.id).delete_all
tasks_ids = Shipit::Task.where(stack_id: stack.id).pluck(:id)
tasks_ids.each_slice(100) do |ids|
Shipit::OutputChunk.where(task_id: ids).delete_all
Shipit::Task.where(id: ids).delete_all
end
stack.destroy!
end | ruby | def perform(stack)
Shipit::ApiClient.where(stack_id: stack.id).delete_all
commits_ids = Shipit::Commit.where(stack_id: stack.id).pluck(:id)
commit_deployments_ids = Shipit::CommitDeployment.where(commit_id: commits_ids).pluck(:id)
Shipit::CommitDeploymentStatus.where(commit_deployment_id: commit_deployments_ids).delete_all
Shipit::CommitDeployment.where(id: commit_deployments_ids).delete_all
Shipit::Status.where(commit_id: commits_ids).delete_all
Shipit::Commit.where(id: commits_ids).delete_all
Shipit::GithubHook.where(stack_id: stack.id).destroy_all
Shipit::Hook.where(stack_id: stack.id).delete_all
Shipit::PullRequest.where(stack_id: stack.id).delete_all
tasks_ids = Shipit::Task.where(stack_id: stack.id).pluck(:id)
tasks_ids.each_slice(100) do |ids|
Shipit::OutputChunk.where(task_id: ids).delete_all
Shipit::Task.where(id: ids).delete_all
end
stack.destroy!
end | [
"def",
"perform",
"(",
"stack",
")",
"Shipit",
"::",
"ApiClient",
".",
"where",
"(",
"stack_id",
":",
"stack",
".",
"id",
")",
".",
"delete_all",
"commits_ids",
"=",
"Shipit",
"::",
"Commit",
".",
"where",
"(",
"stack_id",
":",
"stack",
".",
"id",
")",... | stack
+-- api_clients
+-- commits
| +-- commit_deployments
| | +-- statuses
| +-- statuses
+-- github_hooks
+-- hooks
+-- pull_requests
+-- tasks
+-- chunks | [
"stack",
"+",
"--",
"api_clients",
"+",
"--",
"commits",
"|",
"+",
"--",
"commit_deployments",
"|",
"|",
"+",
"--",
"statuses",
"|",
"+",
"--",
"statuses",
"+",
"--",
"github_hooks",
"+",
"--",
"hooks",
"+",
"--",
"pull_requests",
"+",
"--",
"tasks",
"... | f6b93d8a242962016e0f82e99c2eb223bdc75003 | https://github.com/Shopify/shipit-engine/blob/f6b93d8a242962016e0f82e99c2eb223bdc75003/app/jobs/shipit/destroy_stack_job.rb#L17-L34 | train | Delete all the resources in the given stack. | [
30522,
13366,
4685,
30524,
8909,
1024,
9991,
1012,
8909,
1007,
1012,
20228,
12722,
1006,
1024,
8909,
1007,
10797,
1035,
10813,
2015,
1035,
8909,
2015,
1027,
2911,
4183,
1024,
1024,
10797,
3207,
24759,
6977,
3672,
1012,
2073,
1006,
10797,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-iam/lib/aws-sdk-iam/instance_profile.rb | Aws::IAM.InstanceProfile.add_role | def add_role(options = {})
options = options.merge(instance_profile_name: @name)
resp = @client.add_role_to_instance_profile(options)
resp.data
end | ruby | def add_role(options = {})
options = options.merge(instance_profile_name: @name)
resp = @client.add_role_to_instance_profile(options)
resp.data
end | [
"def",
"add_role",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"instance_profile_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"add_role_to_instance_profile",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @!group Actions
@example Request syntax with placeholder values
instance_profile.add_role({
role_name: "roleNameType", # required
})
@param [Hash] options ({})
@option options [required, String] :role_name
The name of the role to add.
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] | [
"@!group",
"Actions",
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-iam/lib/aws-sdk-iam/instance_profile.rb#L256-L260 | train | Add a role to the instance profile | [
30522,
13366,
5587,
1035,
2535,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
6013,
1035,
6337,
1035,
2171,
1024,
1030,
2171,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
5587,
1035,
2535,
1035,
2000,
1035,
6013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
puppetlabs/puppet | lib/puppet/util/windows/registry.rb | Puppet::Util::Windows.Registry.values_by_name | def values_by_name(key, names)
vals = {}
names.each do |name|
FFI::Pointer.from_string_to_wide_string(name) do |subkeyname_ptr|
begin
_, vals[name] = read(key, subkeyname_ptr)
rescue Puppet::Util::Windows::Error => e
# ignore missing names, but raise other errors
raise e unless e.code == Puppet::Util::Windows::Error::ERROR_FILE_NOT_FOUND
end
end
end
vals
end | ruby | def values_by_name(key, names)
vals = {}
names.each do |name|
FFI::Pointer.from_string_to_wide_string(name) do |subkeyname_ptr|
begin
_, vals[name] = read(key, subkeyname_ptr)
rescue Puppet::Util::Windows::Error => e
# ignore missing names, but raise other errors
raise e unless e.code == Puppet::Util::Windows::Error::ERROR_FILE_NOT_FOUND
end
end
end
vals
end | [
"def",
"values_by_name",
"(",
"key",
",",
"names",
")",
"vals",
"=",
"{",
"}",
"names",
".",
"each",
"do",
"|",
"name",
"|",
"FFI",
"::",
"Pointer",
".",
"from_string_to_wide_string",
"(",
"name",
")",
"do",
"|",
"subkeyname_ptr",
"|",
"begin",
"_",
",... | Retrieve a set of values from a registry key given their names
Value names listed but not found in the registry will not be added to the
resultant Hashtable
@param key [RegistryKey] An open handle to a Registry Key
@param names [String[]] An array of names of registry values to return if they exist
@return [Hashtable<String, Object>] A hashtable of all of the found values in the registry key | [
"Retrieve",
"a",
"set",
"of",
"values",
"from",
"a",
"registry",
"key",
"given",
"their",
"names",
"Value",
"names",
"listed",
"but",
"not",
"found",
"in",
"the",
"registry",
"will",
"not",
"be",
"added",
"to",
"the",
"resultant",
"Hashtable"
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/util/windows/registry.rb#L75-L88 | train | Get the values of a set of keys by name | [
30522,
13366,
5300,
1035,
2011,
1035,
2171,
1006,
3145,
1010,
3415,
1007,
11748,
2015,
1027,
1063,
1065,
3415,
1012,
2169,
2079,
1064,
2171,
1064,
21461,
2072,
1024,
1024,
20884,
1012,
2013,
1035,
5164,
1035,
2000,
1035,
2898,
1035,
5164,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
abonas/kubeclient | lib/kubeclient/common.rb | Kubeclient.ClientMixin.watch_entities | def watch_entities(resource_name, options = {})
ns = build_namespace_prefix(options[:namespace])
path = "watch/#{ns}#{resource_name}"
path += "/#{options[:name]}" if options[:name]
uri = @api_endpoint.merge("#{@api_endpoint.path}/#{@api_version}/#{path}")
params = {}
WATCH_ARGUMENTS.each { |k, v| params[k] = options[v] if options[v] }
uri.query = URI.encode_www_form(params) if params.any?
Kubeclient::Common::WatchStream.new(
uri,
http_options(uri),
formatter: ->(value) { format_response(options[:as] || @as, value) }
)
end | ruby | def watch_entities(resource_name, options = {})
ns = build_namespace_prefix(options[:namespace])
path = "watch/#{ns}#{resource_name}"
path += "/#{options[:name]}" if options[:name]
uri = @api_endpoint.merge("#{@api_endpoint.path}/#{@api_version}/#{path}")
params = {}
WATCH_ARGUMENTS.each { |k, v| params[k] = options[v] if options[v] }
uri.query = URI.encode_www_form(params) if params.any?
Kubeclient::Common::WatchStream.new(
uri,
http_options(uri),
formatter: ->(value) { format_response(options[:as] || @as, value) }
)
end | [
"def",
"watch_entities",
"(",
"resource_name",
",",
"options",
"=",
"{",
"}",
")",
"ns",
"=",
"build_namespace_prefix",
"(",
"options",
"[",
":namespace",
"]",
")",
"path",
"=",
"\"watch/#{ns}#{resource_name}\"",
"path",
"+=",
"\"/#{options[:name]}\"",
"if",
"opti... | Accepts the following options:
:namespace (string) - the namespace of the entity.
:name (string) - the name of the entity to watch.
:label_selector (string) - a selector to restrict the list of returned objects by labels.
:field_selector (string) - a selector to restrict the list of returned objects by fields.
:resource_version (string) - shows changes that occur after passed version of a resource.
:as (:raw|:ros) - defaults to :ros
:raw - return the raw response body as a string
:ros - return a collection of RecursiveOpenStruct objects | [
"Accepts",
"the",
"following",
"options",
":",
":",
"namespace",
"(",
"string",
")",
"-",
"the",
"namespace",
"of",
"the",
"entity",
".",
":",
"name",
"(",
"string",
")",
"-",
"the",
"name",
"of",
"the",
"entity",
"to",
"watch",
".",
":",
"label_select... | 3630f6c82532fba04f3e1a62d6b99c6cf2910451 | https://github.com/abonas/kubeclient/blob/3630f6c82532fba04f3e1a62d6b99c6cf2910451/lib/kubeclient/common.rb#L297-L313 | train | Creates a watch stream for the specified resource. | [
30522,
13366,
3422,
1035,
11422,
1006,
7692,
1035,
2171,
1010,
7047,
1027,
1063,
1065,
1007,
24978,
1027,
3857,
1035,
3415,
15327,
1035,
17576,
1006,
7047,
1031,
1024,
3415,
15327,
1033,
1007,
4130,
1027,
1000,
3422,
1013,
1001,
1063,
24978... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.tags_include | def tags_include(class_names:, value: nil)
return unless class_names.is_a? Array
class_names.flat_map do |class_name|
value ? eles_by_json_visible_contains(class_name, value) : tags(class_name)
end
end | ruby | def tags_include(class_names:, value: nil)
return unless class_names.is_a? Array
class_names.flat_map do |class_name|
value ? eles_by_json_visible_contains(class_name, value) : tags(class_name)
end
end | [
"def",
"tags_include",
"(",
"class_names",
":",
",",
"value",
":",
"nil",
")",
"return",
"unless",
"class_names",
".",
"is_a?",
"Array",
"class_names",
".",
"flat_map",
"do",
"|",
"class_name",
"|",
"value",
"?",
"eles_by_json_visible_contains",
"(",
"class_name... | Returns all visible elements matching class_names and value
This method calls find_element/s and element.value/text many times.
So, if you set many class_names, this method's performance become worse.
@param class_names [Array[String]] the class_names to search for
@param value [String] the value to search for
@return [Array[Element]] | [
"Returns",
"all",
"visible",
"elements",
"matching",
"class_names",
"and",
"value",
"This",
"method",
"calls",
"find_element",
"/",
"s",
"and",
"element",
".",
"value",
"/",
"text",
"many",
"times",
".",
"So",
"if",
"you",
"set",
"many",
"class_names",
"this... | 1f5898400dd1928bfe42ddd5f842d1f8738f2f76 | https://github.com/appium/ruby_lib/blob/1f5898400dd1928bfe42ddd5f842d1f8738f2f76/lib/appium_lib/ios/common/helper.rb#L267-L273 | train | Returns an array of the tags that are in the specified class_names. | [
30522,
13366,
22073,
1035,
2421,
1006,
2465,
1035,
3415,
1024,
1010,
3643,
1024,
9152,
2140,
1007,
2709,
4983,
2465,
1035,
3415,
1012,
2003,
1035,
1037,
1029,
9140,
2465,
1035,
3415,
1012,
4257,
1035,
4949,
2079,
1064,
2465,
1035,
2171,
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... |
heroku/legacy-cli | lib/heroku/command/addons.rb | Heroku::Command.Addons.plans | def plans
service = args.shift
raise CommandFailed.new("Missing add-on service") if service.nil?
service = get_service!(service)
display_header("#{service['human_name']} Plans")
plans = get_plans(:service => service['id'])
plans = plans.sort_by { |p| [(!p['default']).to_s, p['price']['cents']] }.map do |plan|
{
"default" => ('default' if plan['default']),
"name" => plan["name"],
"human_name" => plan["human_name"],
"price" => format_price(plan["price"])
}
end
display_table(plans, %w[default name human_name price], [nil, 'Slug', 'Name', 'Price'])
end | ruby | def plans
service = args.shift
raise CommandFailed.new("Missing add-on service") if service.nil?
service = get_service!(service)
display_header("#{service['human_name']} Plans")
plans = get_plans(:service => service['id'])
plans = plans.sort_by { |p| [(!p['default']).to_s, p['price']['cents']] }.map do |plan|
{
"default" => ('default' if plan['default']),
"name" => plan["name"],
"human_name" => plan["human_name"],
"price" => format_price(plan["price"])
}
end
display_table(plans, %w[default name human_name price], [nil, 'Slug', 'Name', 'Price'])
end | [
"def",
"plans",
"service",
"=",
"args",
".",
"shift",
"raise",
"CommandFailed",
".",
"new",
"(",
"\"Missing add-on service\"",
")",
"if",
"service",
".",
"nil?",
"service",
"=",
"get_service!",
"(",
"service",
")",
"display_header",
"(",
"\"#{service['human_name']... | addons:plans SERVICE
list all available plans for an add-on service | [
"addons",
":",
"plans",
"SERVICE"
] | 6f18521a258394bfb79e6b36f7160ad8559a8e16 | https://github.com/heroku/legacy-cli/blob/6f18521a258394bfb79e6b36f7160ad8559a8e16/lib/heroku/command/addons.rb#L71-L90 | train | Get all plans for a service | [
30522,
13366,
3488,
2326,
1027,
12098,
5620,
1012,
5670,
5333,
3094,
7011,
18450,
1012,
2047,
1006,
1000,
4394,
5587,
1011,
2006,
2326,
1000,
1007,
2065,
2326,
1012,
9152,
2140,
1029,
2326,
1027,
2131,
1035,
2326,
999,
1006,
2326,
1007,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_container_registry/lib/2017-03-01/generated/azure_mgmt_container_registry/registries.rb | Azure::ContainerRegistry::Mgmt::V2017_03_01.Registries.begin_create_with_http_info | def begin_create_with_http_info(resource_group_name, registry_name, registry_create_parameters, custom_headers:nil)
begin_create_async(resource_group_name, registry_name, registry_create_parameters, custom_headers:custom_headers).value!
end | ruby | def begin_create_with_http_info(resource_group_name, registry_name, registry_create_parameters, custom_headers:nil)
begin_create_async(resource_group_name, registry_name, registry_create_parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_create_with_http_info",
"(",
"resource_group_name",
",",
"registry_name",
",",
"registry_create_parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_create_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"registry_create_parameters",
",",
... | Creates a container registry with the specified parameters.
@param resource_group_name [String] The name of the resource group to which
the container registry belongs.
@param registry_name [String] The name of the container registry.
@param registry_create_parameters [RegistryCreateParameters] The parameters
for creating a container registry.
@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",
"container",
"registry",
"with",
"the",
"specified",
"parameters",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_registry/lib/2017-03-01/generated/azure_mgmt_container_registry/registries.rb#L901-L903 | train | Creates a new container registry. | [
30522,
13366,
4088,
1035,
3443,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
15584,
1035,
3443,
1035,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
1035,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-opsworks/lib/aws-sdk-opsworks/stack.rb | Aws::OpsWorks.Stack.delete | def delete(options = {})
options = options.merge(stack_id: @id)
resp = @client.delete_stack(options)
resp.data
end | ruby | def delete(options = {})
options = options.merge(stack_id: @id)
resp = @client.delete_stack(options)
resp.data
end | [
"def",
"delete",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"stack_id",
":",
"@id",
")",
"resp",
"=",
"@client",
".",
"delete_stack",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
stack.delete()
@param [Hash] options ({})
@return [EmptyStructure] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-opsworks/lib/aws-sdk-opsworks/stack.rb#L517-L521 | train | Delete a stack | [
30522,
13366,
3972,
12870,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
9991,
1035,
8909,
1024,
1030,
8909,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
3972,
12870,
1035,
9991,
1006,
7047,
1007,
24501,
2361,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_customvisiontraining/lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb | Azure::CognitiveServices::Customvisiontraining::V3_0.CustomvisiontrainingClient.get_iteration_performance_with_http_info | def get_iteration_performance_with_http_info(project_id, iteration_id, threshold:nil, overlap_threshold:nil, custom_headers:nil)
get_iteration_performance_async(project_id, iteration_id, threshold:threshold, overlap_threshold:overlap_threshold, custom_headers:custom_headers).value!
end | ruby | def get_iteration_performance_with_http_info(project_id, iteration_id, threshold:nil, overlap_threshold:nil, custom_headers:nil)
get_iteration_performance_async(project_id, iteration_id, threshold:threshold, overlap_threshold:overlap_threshold, custom_headers:custom_headers).value!
end | [
"def",
"get_iteration_performance_with_http_info",
"(",
"project_id",
",",
"iteration_id",
",",
"threshold",
":",
"nil",
",",
"overlap_threshold",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"get_iteration_performance_async",
"(",
"project_id",
",",
"iteration_i... | Get detailed performance information about an iteration.
@param project_id The id of the project the iteration belongs to.
@param iteration_id The id of the iteration to get.
@param threshold [Float] The threshold used to determine true predictions.
@param overlap_threshold [Float] If applicable, the bounding box overlap
threshold used to determine true predictions.
@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",
"detailed",
"performance",
"information",
"about",
"an",
"iteration",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_customvisiontraining/lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb#L2454-L2456 | train | Gets the performance of the iteration. | [
30522,
13366,
2131,
1035,
27758,
1035,
2836,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2622,
1035,
8909,
1010,
27758,
1035,
8909,
1010,
11207,
1024,
9152,
2140,
1010,
17702,
1035,
11207,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb | Azure::Web::Mgmt::V2018_02_01.AppServiceEnvironments.list_web_worker_metric_definitions_next | def list_web_worker_metric_definitions_next(next_page_link, custom_headers:nil)
response = list_web_worker_metric_definitions_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_web_worker_metric_definitions_next(next_page_link, custom_headers:nil)
response = list_web_worker_metric_definitions_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_web_worker_metric_definitions_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_web_worker_metric_definitions_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
... | Get metric definitions for a worker pool of an App Service Environment.
Get metric definitions for a worker pool of an App Service Environment.
@param next_page_link [String] The NextLink from the previous successful call
to List operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ResourceMetricDefinitionCollection] operation results. | [
"Get",
"metric",
"definitions",
"for",
"a",
"worker",
"pool",
"of",
"an",
"App",
"Service",
"Environment",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb#L6754-L6757 | train | Gets the metric definitions for a worker. | [
30522,
13366,
2862,
1035,
4773,
1035,
7309,
1035,
12046,
1035,
15182,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
4773,
1035,
7309,
1035,
12046,
1035,
15182,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/request.rb | HTTP.Request.proxy_connect_headers | def proxy_connect_headers
connect_headers = HTTP::Headers.coerce(
Headers::HOST => headers[Headers::HOST],
Headers::USER_AGENT => headers[Headers::USER_AGENT]
)
connect_headers[Headers::PROXY_AUTHORIZATION] = proxy_authorization_header if using_authenticated_proxy?
connect_headers.merge!(proxy[:proxy_headers]) if proxy.key?(:proxy_headers)
connect_headers
end | ruby | def proxy_connect_headers
connect_headers = HTTP::Headers.coerce(
Headers::HOST => headers[Headers::HOST],
Headers::USER_AGENT => headers[Headers::USER_AGENT]
)
connect_headers[Headers::PROXY_AUTHORIZATION] = proxy_authorization_header if using_authenticated_proxy?
connect_headers.merge!(proxy[:proxy_headers]) if proxy.key?(:proxy_headers)
connect_headers
end | [
"def",
"proxy_connect_headers",
"connect_headers",
"=",
"HTTP",
"::",
"Headers",
".",
"coerce",
"(",
"Headers",
"::",
"HOST",
"=>",
"headers",
"[",
"Headers",
"::",
"HOST",
"]",
",",
"Headers",
"::",
"USER_AGENT",
"=>",
"headers",
"[",
"Headers",
"::",
"USER... | Headers to send with proxy connect request | [
"Headers",
"to",
"send",
"with",
"proxy",
"connect",
"request"
] | f37a10ea4fab3ee411907ea2e4251ddf0ca33a93 | https://github.com/httprb/http/blob/f37a10ea4fab3ee411907ea2e4251ddf0ca33a93/lib/http/request.rb#L169-L178 | train | Return the connection headers for the proxy | [
30522,
13366,
24540,
1035,
7532,
1035,
20346,
2015,
7532,
1035,
20346,
2015,
1027,
8299,
1024,
1024,
20346,
2015,
1012,
24873,
19170,
1006,
20346,
2015,
1024,
1024,
3677,
1027,
1028,
20346,
2015,
1031,
20346,
2015,
1024,
1024,
3677,
1033,
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_relay/lib/2016-07-01/generated/azure_mgmt_relay/namespaces.rb | Azure::Relay::Mgmt::V2016_07_01.Namespaces.list_post_authorization_rules_next | def list_post_authorization_rules_next(next_page_link, custom_headers:nil)
response = list_post_authorization_rules_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_post_authorization_rules_next(next_page_link, custom_headers:nil)
response = list_post_authorization_rules_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_post_authorization_rules_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_post_authorization_rules_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"... | Authorization rules for a namespace.
@param next_page_link [String] The NextLink from the previous successful call
to List operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [AuthorizationRuleListResult] operation results. | [
"Authorization",
"rules",
"for",
"a",
"namespace",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_relay/lib/2016-07-01/generated/azure_mgmt_relay/namespaces.rb#L1930-L1933 | train | Gets the list of post authorization rules. | [
30522,
13366,
2862,
1035,
2695,
1035,
20104,
1035,
3513,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2695,
1035,
20104,
1035,
3513,
1035,
2279,
1035,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ruby2d/ruby2d | lib/ruby2d/window.rb | Ruby2D.Window.add_object | def add_object(o)
if !@objects.include?(o)
index = @objects.index do |object|
object.z > o.z
end
if index
@objects.insert(index, o)
else
@objects.push(o)
end
true
else
false
end
end | ruby | def add_object(o)
if !@objects.include?(o)
index = @objects.index do |object|
object.z > o.z
end
if index
@objects.insert(index, o)
else
@objects.push(o)
end
true
else
false
end
end | [
"def",
"add_object",
"(",
"o",
")",
"if",
"!",
"@objects",
".",
"include?",
"(",
"o",
")",
"index",
"=",
"@objects",
".",
"index",
"do",
"|",
"object",
"|",
"object",
".",
"z",
">",
"o",
".",
"z",
"end",
"if",
"index",
"@objects",
".",
"insert",
... | An an object to the window, used by the public `add` method | [
"An",
"an",
"object",
"to",
"the",
"window",
"used",
"by",
"the",
"public",
"add",
"method"
] | 43ce9805a7ae8b82b7ab8c50bf6d4c845d395dc4 | https://github.com/ruby2d/ruby2d/blob/43ce9805a7ae8b82b7ab8c50bf6d4c845d395dc4/lib/ruby2d/window.rb#L419-L433 | train | Add an object to the object list | [
30522,
13366,
5587,
1035,
4874,
1006,
1051,
1007,
2065,
999,
1030,
5200,
1012,
2421,
1029,
1006,
1051,
1007,
5950,
1027,
1030,
5200,
1012,
5950,
2079,
1064,
4874,
1064,
4874,
1012,
1062,
1028,
1051,
1012,
1062,
2203,
2065,
5950,
1030,
520... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/key_pair_info.rb | Aws::EC2.KeyPairInfo.delete | def delete(options = {})
options = options.merge(key_name: @name)
resp = @client.delete_key_pair(options)
resp.data
end | ruby | def delete(options = {})
options = options.merge(key_name: @name)
resp = @client.delete_key_pair(options)
resp.data
end | [
"def",
"delete",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"key_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"delete_key_pair",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @!group Actions
@example Request syntax with placeholder values
key_pair_info.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] | [
"@!group",
"Actions",
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/key_pair_info.rb#L187-L191 | train | Delete the key pair | [
30522,
13366,
3972,
12870,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
3145,
1035,
2171,
1024,
1030,
2171,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
3972,
12870,
1035,
3145,
1035,
3940,
1006,
7047,
1007,
24501,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
decidim/decidim | decidim-initiatives/app/models/decidim/initiatives_vote.rb | Decidim.InitiativesVote.sha1 | def sha1
return unless decidim_user_group_id.nil?
title = translated_attribute(initiative.title)
description = translated_attribute(initiative.description)
Digest::SHA1.hexdigest "#{authorization_unique_id}#{title}#{description}"
end | ruby | def sha1
return unless decidim_user_group_id.nil?
title = translated_attribute(initiative.title)
description = translated_attribute(initiative.description)
Digest::SHA1.hexdigest "#{authorization_unique_id}#{title}#{description}"
end | [
"def",
"sha1",
"return",
"unless",
"decidim_user_group_id",
".",
"nil?",
"title",
"=",
"translated_attribute",
"(",
"initiative",
".",
"title",
")",
"description",
"=",
"translated_attribute",
"(",
"initiative",
".",
"description",
")",
"Digest",
"::",
"SHA1",
"."... | PUBLIC
Generates a hashed representation of the initiative support. | [
"PUBLIC"
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-initiatives/app/models/decidim/initiatives_vote.rb#L34-L41 | train | Returns the SHA1 hash of the object | [
30522,
13366,
21146,
2487,
2709,
4983,
11703,
28173,
2213,
1035,
5310,
1035,
2177,
1035,
8909,
1012,
9152,
2140,
1029,
2516,
1027,
5421,
1035,
17961,
1006,
6349,
1012,
2516,
1007,
6412,
1027,
5421,
1035,
17961,
1006,
6349,
1012,
6412,
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_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/event_subscriptions.rb | Azure::EventGrid::Mgmt::V2018_01_01.EventSubscriptions.delete_async | def delete_async(scope, event_subscription_name, custom_headers:nil)
# Send request
promise = begin_delete_async(scope, event_subscription_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 delete_async(scope, event_subscription_name, custom_headers:nil)
# Send request
promise = begin_delete_async(scope, event_subscription_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",
"delete_async",
"(",
"scope",
",",
"event_subscription_name",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_delete_async",
"(",
"scope",
",",
"event_subscription_name",
",",
"custom_headers",
":custom_headers",
")",
"promise",
... | @param scope [String] The scope of the event subscription. The scope can be a
subscription, or a resource group, or a top level resource belonging to a
resource provider namespace, or an EventGrid topic. For example, use
'/subscriptions/{subscriptionId}/' for a subscription,
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
resource group, and
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
for a resource, and
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
for an EventGrid topic.
@param event_subscription_name [String] Name of the event subscription
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"scope",
"[",
"String",
"]",
"The",
"scope",
"of",
"the",
"event",
"subscription",
".",
"The",
"scope",
"can",
"be",
"a",
"subscription",
"or",
"a",
"resource",
"group",
"or",
"a",
"top",
"level",
"resource",
"belonging",
"to",
"a",
"resource",
... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_event_grid/lib/2018-01-01/generated/azure_mgmt_event_grid/event_subscriptions.rb#L264-L278 | train | Deletes an event subscription. | [
30522,
13366,
3972,
12870,
1035,
2004,
6038,
2278,
1006,
9531,
1010,
2724,
1035,
15002,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,
4088,
30524,
1012,
4078,
11610,
3669,
4371,
1035,
4118,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cheezy/page-object | lib/page-object/accessors.rb | PageObject.Accessors.text_area | def text_area(name, identifier={:index => 0}, &block)
standard_methods(name, identifier, 'text_area_for', &block)
define_method(name) do
return platform.text_area_value_for identifier.clone unless block_given?
self.send("#{name}_element").value
end
define_method("#{name}=") do |value|
return platform.text_area_value_set(identifier.clone, value) unless block_given?
self.send("#{name}_element").value = value
end
end | ruby | def text_area(name, identifier={:index => 0}, &block)
standard_methods(name, identifier, 'text_area_for', &block)
define_method(name) do
return platform.text_area_value_for identifier.clone unless block_given?
self.send("#{name}_element").value
end
define_method("#{name}=") do |value|
return platform.text_area_value_set(identifier.clone, value) unless block_given?
self.send("#{name}_element").value = value
end
end | [
"def",
"text_area",
"(",
"name",
",",
"identifier",
"=",
"{",
":index",
"=>",
"0",
"}",
",",
"&",
"block",
")",
"standard_methods",
"(",
"name",
",",
"identifier",
",",
"'text_area_for'",
",",
"block",
")",
"define_method",
"(",
"name",
")",
"do",
"retur... | adds four methods to the page object - one to set text in a text area,
another to retrieve text from a text area, another to return the text
area element, and another to check the text area's existence.
@example
text_area(:address, :id => "address")
# will generate 'address', 'address=', 'address_element',
# 'address?' methods
@param [String] the name used for the generated methods
@param [Hash] identifier how we find a text area.
@param optional block to be invoked when element method is called | [
"adds",
"four",
"methods",
"to",
"the",
"page",
"object",
"-",
"one",
"to",
"set",
"text",
"in",
"a",
"text",
"area",
"another",
"to",
"retrieve",
"text",
"from",
"a",
"text",
"area",
"another",
"to",
"return",
"the",
"text",
"area",
"element",
"and",
... | 850d775bf63768fbb1551a34480195785fe8e193 | https://github.com/cheezy/page-object/blob/850d775bf63768fbb1551a34480195785fe8e193/lib/page-object/accessors.rb#L244-L254 | train | Define a text area method. | [
30522,
13366,
3793,
1035,
2181,
1006,
2171,
1010,
8909,
4765,
18095,
1027,
1063,
1024,
5950,
1027,
1028,
1014,
1065,
1010,
1004,
3796,
1007,
3115,
1035,
4725,
1006,
2171,
1010,
8909,
4765,
18095,
1010,
1005,
3793,
1035,
2181,
1035,
2005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jeremytregunna/ruby-trello | lib/trello/card.rb | Trello.Card.remove_label | def remove_label(label)
unless label.valid?
errors.add(:label, "is not valid.")
return Trello.logger.warn "Label is not valid." unless label.valid?
end
client.delete("/cards/#{id}/idLabels/#{label.id}")
end | ruby | def remove_label(label)
unless label.valid?
errors.add(:label, "is not valid.")
return Trello.logger.warn "Label is not valid." unless label.valid?
end
client.delete("/cards/#{id}/idLabels/#{label.id}")
end | [
"def",
"remove_label",
"(",
"label",
")",
"unless",
"label",
".",
"valid?",
"errors",
".",
"add",
"(",
":label",
",",
"\"is not valid.\"",
")",
"return",
"Trello",
".",
"logger",
".",
"warn",
"\"Label is not valid.\"",
"unless",
"label",
".",
"valid?",
"end",
... | Remove a label | [
"Remove",
"a",
"label"
] | ad79c9d8152ad5395b3b61c43170908f1912bfb2 | https://github.com/jeremytregunna/ruby-trello/blob/ad79c9d8152ad5395b3b61c43170908f1912bfb2/lib/trello/card.rb#L412-L418 | train | Remove a label from the card | [
30522,
13366,
6366,
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... |
guard/guard | lib/guard/dsl_describer.rb | Guard.DslDescriber.show | def show
# collect metadata
groups = Guard.state.session.groups.all
objects = []
empty_plugin = OpenStruct.new
empty_plugin.options = [["", nil]]
groups.each do |group|
plugins = Array(Guard.state.session.plugins.all(group: group.name))
plugins = [empty_plugin] if plugins.empty?
plugins.each do |plugin|
options = plugin.options
options = [["", nil]] if options.empty?
options.each do |option, raw_value|
value = raw_value.nil? ? "" : raw_value.inspect
objects << [group.title, plugin.title, option.to_s, value]
end
end
end
# presentation
rows = []
prev_group = prev_plugin = prev_option = prev_value = nil
objects.each do |group, plugin, option, value|
group_changed = prev_group != group
plugin_changed = (prev_plugin != plugin || group_changed)
rows << :split if group_changed || plugin_changed
rows << {
Group: group_changed ? group : "",
Plugin: plugin_changed ? plugin : "",
Option: option,
Value: value
}
prev_group = group
prev_plugin = plugin
prev_option = option
prev_value = value
end
# render
Formatador.display_compact_table(
rows.drop(1),
[:Group, :Plugin, :Option, :Value]
)
end | ruby | def show
# collect metadata
groups = Guard.state.session.groups.all
objects = []
empty_plugin = OpenStruct.new
empty_plugin.options = [["", nil]]
groups.each do |group|
plugins = Array(Guard.state.session.plugins.all(group: group.name))
plugins = [empty_plugin] if plugins.empty?
plugins.each do |plugin|
options = plugin.options
options = [["", nil]] if options.empty?
options.each do |option, raw_value|
value = raw_value.nil? ? "" : raw_value.inspect
objects << [group.title, plugin.title, option.to_s, value]
end
end
end
# presentation
rows = []
prev_group = prev_plugin = prev_option = prev_value = nil
objects.each do |group, plugin, option, value|
group_changed = prev_group != group
plugin_changed = (prev_plugin != plugin || group_changed)
rows << :split if group_changed || plugin_changed
rows << {
Group: group_changed ? group : "",
Plugin: plugin_changed ? plugin : "",
Option: option,
Value: value
}
prev_group = group
prev_plugin = plugin
prev_option = option
prev_value = value
end
# render
Formatador.display_compact_table(
rows.drop(1),
[:Group, :Plugin, :Option, :Value]
)
end | [
"def",
"show",
"# collect metadata",
"groups",
"=",
"Guard",
".",
"state",
".",
"session",
".",
"groups",
".",
"all",
"objects",
"=",
"[",
"]",
"empty_plugin",
"=",
"OpenStruct",
".",
"new",
"empty_plugin",
".",
"options",
"=",
"[",
"[",
"\"\"",
",",
"ni... | Shows all Guard plugins and their options that are defined in
the `Guardfile`.
@see CLI#show | [
"Shows",
"all",
"Guard",
"plugins",
"and",
"their",
"options",
"that",
"are",
"defined",
"in",
"the",
"Guardfile",
"."
] | e2508cd83badf0d537dbaba35d307adc35d92e4f | https://github.com/guard/guard/blob/e2508cd83badf0d537dbaba35d307adc35d92e4f/lib/guard/dsl_describer.rb#L53-L102 | train | show a list of all the available objects in the current session | [
30522,
13366,
2265,
1001,
8145,
27425,
2967,
1027,
3457,
1012,
2110,
1012,
5219,
1012,
2967,
1012,
2035,
5200,
1027,
1031,
1033,
4064,
1035,
13354,
2378,
1027,
7480,
18300,
1012,
2047,
4064,
1035,
13354,
2378,
1012,
7047,
1027,
1031,
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... |
uken/fluent-plugin-elasticsearch | lib/fluent/plugin/out_elasticsearch.rb | Fluent::Plugin.ElasticsearchOutput.create_time_parser | def create_time_parser
if @time_key_format
begin
# Strptime doesn't support all formats, but for those it does it's
# blazingly fast.
strptime = Strptime.new(@time_key_format)
Proc.new { |value|
value = convert_numeric_time_into_string(value, @time_key_format) if value.is_a?(Numeric)
strptime.exec(value).to_datetime
}
rescue
# Can happen if Strptime doesn't recognize the format; or
# if strptime couldn't be required (because it's not installed -- it's
# ruby 2 only)
Proc.new { |value|
value = convert_numeric_time_into_string(value, @time_key_format) if value.is_a?(Numeric)
DateTime.strptime(value, @time_key_format)
}
end
else
Proc.new { |value|
value = convert_numeric_time_into_string(value) if value.is_a?(Numeric)
DateTime.parse(value)
}
end
end | ruby | def create_time_parser
if @time_key_format
begin
# Strptime doesn't support all formats, but for those it does it's
# blazingly fast.
strptime = Strptime.new(@time_key_format)
Proc.new { |value|
value = convert_numeric_time_into_string(value, @time_key_format) if value.is_a?(Numeric)
strptime.exec(value).to_datetime
}
rescue
# Can happen if Strptime doesn't recognize the format; or
# if strptime couldn't be required (because it's not installed -- it's
# ruby 2 only)
Proc.new { |value|
value = convert_numeric_time_into_string(value, @time_key_format) if value.is_a?(Numeric)
DateTime.strptime(value, @time_key_format)
}
end
else
Proc.new { |value|
value = convert_numeric_time_into_string(value) if value.is_a?(Numeric)
DateTime.parse(value)
}
end
end | [
"def",
"create_time_parser",
"if",
"@time_key_format",
"begin",
"# Strptime doesn't support all formats, but for those it does it's",
"# blazingly fast.",
"strptime",
"=",
"Strptime",
".",
"new",
"(",
"@time_key_format",
")",
"Proc",
".",
"new",
"{",
"|",
"value",
"|",
"v... | once fluent v0.14 is released we might be able to use
Fluent::Parser::TimeParser, but it doesn't quite do what we want - if gives
[sec,nsec] where as we want something we can call `strftime` on... | [
"once",
"fluent",
"v0",
".",
"14",
"is",
"released",
"we",
"might",
"be",
"able",
"to",
"use",
"Fluent",
"::",
"Parser",
"::",
"TimeParser",
"but",
"it",
"doesn",
"t",
"quite",
"do",
"what",
"we",
"want",
"-",
"if",
"gives",
"[",
"sec",
"nsec",
"]",
... | 9f9e51ddd012acb36c7f9d7a16e00970004098bc | https://github.com/uken/fluent-plugin-elasticsearch/blob/9f9e51ddd012acb36c7f9d7a16e00970004098bc/lib/fluent/plugin/out_elasticsearch.rb#L357-L382 | train | Create a new instance of the DateTimeParser class. | [
30522,
13366,
3443,
1035,
2051,
1035,
11968,
8043,
2065,
1030,
2051,
1035,
3145,
1035,
4289,
4088,
1001,
2358,
14536,
7292,
2987,
1005,
1056,
2490,
2035,
11630,
1010,
2021,
2005,
2216,
2009,
2515,
2009,
1005,
1055,
1001,
17162,
2135,
3435,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/encoding_utils.rb | Sprockets.EncodingUtils.detect_unicode | def detect_unicode(str)
str = detect_unicode_bom(str)
# Fallback to UTF-8
if str.encoding == Encoding::BINARY
str.force_encoding(Encoding::UTF_8)
end
str
end | ruby | def detect_unicode(str)
str = detect_unicode_bom(str)
# Fallback to UTF-8
if str.encoding == Encoding::BINARY
str.force_encoding(Encoding::UTF_8)
end
str
end | [
"def",
"detect_unicode",
"(",
"str",
")",
"str",
"=",
"detect_unicode_bom",
"(",
"str",
")",
"# Fallback to UTF-8",
"if",
"str",
".",
"encoding",
"==",
"Encoding",
"::",
"BINARY",
"str",
".",
"force_encoding",
"(",
"Encoding",
"::",
"UTF_8",
")",
"end",
"str... | Public: Detect Unicode string.
Attempts to parse Unicode BOM and falls back to UTF-8.
str - ASCII-8BIT encoded String
Returns encoded String. | [
"Public",
":",
"Detect",
"Unicode",
"string",
"."
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/encoding_utils.rb#L139-L148 | train | Detect unicode encoding of a string | [
30522,
13366,
11487,
1035,
27260,
1006,
2358,
2099,
1007,
2358,
2099,
1027,
11487,
1035,
27260,
1035,
8945,
2213,
1006,
2358,
2099,
1007,
1001,
2991,
5963,
2000,
21183,
2546,
1011,
1022,
2065,
2358,
2099,
1012,
17181,
1027,
1027,
17181,
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... |
jekyll/jekyll | lib/jekyll/renderer.rb | Jekyll.Renderer.run | def run
Jekyll.logger.debug "Rendering:", document.relative_path
assign_pages!
assign_current_document!
assign_highlighter_options!
assign_layout_data!
Jekyll.logger.debug "Pre-Render Hooks:", document.relative_path
document.trigger_hooks(:pre_render, payload)
render_document
end | ruby | def run
Jekyll.logger.debug "Rendering:", document.relative_path
assign_pages!
assign_current_document!
assign_highlighter_options!
assign_layout_data!
Jekyll.logger.debug "Pre-Render Hooks:", document.relative_path
document.trigger_hooks(:pre_render, payload)
render_document
end | [
"def",
"run",
"Jekyll",
".",
"logger",
".",
"debug",
"\"Rendering:\"",
",",
"document",
".",
"relative_path",
"assign_pages!",
"assign_current_document!",
"assign_highlighter_options!",
"assign_layout_data!",
"Jekyll",
".",
"logger",
".",
"debug",
"\"Pre-Render Hooks:\"",
... | Prepare payload and render the document
Returns String rendered document output | [
"Prepare",
"payload",
"and",
"render",
"the",
"document"
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/renderer.rb#L52-L64 | train | Run the document using the specified parameters. | [
30522,
13366,
2448,
15333,
4801,
3363,
1012,
8833,
4590,
1012,
2139,
8569,
2290,
1000,
14259,
1024,
1000,
1010,
6254,
1012,
5816,
1035,
4130,
23911,
1035,
5530,
999,
23911,
1035,
2783,
1035,
6254,
999,
23911,
1035,
12944,
2121,
1035,
7047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sunspot/sunspot | sunspot/lib/sunspot/setup.rb | Sunspot.Setup.all_more_like_this_fields | def all_more_like_this_fields
@more_like_this_field_factories_cache.values.map do |field_factories|
field_factories.map { |field_factory| field_factory.build }
end.flatten
end | ruby | def all_more_like_this_fields
@more_like_this_field_factories_cache.values.map do |field_factories|
field_factories.map { |field_factory| field_factory.build }
end.flatten
end | [
"def",
"all_more_like_this_fields",
"@more_like_this_field_factories_cache",
".",
"values",
".",
"map",
"do",
"|",
"field_factories",
"|",
"field_factories",
".",
"map",
"{",
"|",
"field_factory",
"|",
"field_factory",
".",
"build",
"}",
"end",
".",
"flatten",
"end"... | Return all more_like_this fields | [
"Return",
"all",
"more_like_this",
"fields"
] | 31dd76cd7a14a4ef7bd541de97483d8cd72ff685 | https://github.com/sunspot/sunspot/blob/31dd76cd7a14a4ef7bd541de97483d8cd72ff685/sunspot/lib/sunspot/setup.rb#L200-L204 | train | Returns all the more like this fields | [
30522,
13366,
2035,
1035,
2062,
1035,
2066,
1035,
2023,
1035,
4249,
1030,
2062,
1035,
2066,
1035,
2023,
1035,
2492,
1035,
11123,
1035,
17053,
1012,
5300,
1012,
4949,
2079,
1064,
2492,
1035,
11123,
1064,
2492,
1035,
11123,
1012,
4949,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/express_route_cross_connection_peerings.rb | Azure::Network::Mgmt::V2018_07_01.ExpressRouteCrossConnectionPeerings.list | def list(resource_group_name, cross_connection_name, custom_headers:nil)
first_page = list_as_lazy(resource_group_name, cross_connection_name, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list(resource_group_name, cross_connection_name, custom_headers:nil)
first_page = list_as_lazy(resource_group_name, cross_connection_name, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list",
"(",
"resource_group_name",
",",
"cross_connection_name",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_as_lazy",
"(",
"resource_group_name",
",",
"cross_connection_name",
",",
"custom_headers",
":custom_headers",
")",
"first_page",
"."... | Gets all peerings in a specified ExpressRouteCrossConnection.
@param resource_group_name [String] The name of the resource group.
@param cross_connection_name [String] The name of the
ExpressRouteCrossConnection.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<ExpressRouteCrossConnectionPeering>] operation results. | [
"Gets",
"all",
"peerings",
"in",
"a",
"specified",
"ExpressRouteCrossConnection",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/express_route_cross_connection_peerings.rb#L35-L38 | train | Gets all the available virtual network endpoints in a cross connection. | [
30522,
13366,
2862,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2892,
1035,
4434,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2862,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | spaceship/lib/spaceship/client.rb | Spaceship.Client.send_request | def send_request(method, url_or_path, params, headers, &block)
with_retry do
response = @client.send(method, url_or_path, params, headers, &block)
log_response(method, url_or_path, response, headers, &block)
resp_hash = response.to_hash
if resp_hash[:status] == 401
msg = "Auth lost"
logger.warn(msg)
raise UnauthorizedAccessError.new, "Unauthorized Access"
end
if response.body.to_s.include?("<title>302 Found</title>")
raise AppleTimeoutError.new, "Apple 302 detected - this might be temporary server error, check https://developer.apple.com/system-status/ to see if there is a known downtime"
end
if response.body.to_s.include?("<h3>Bad Gateway</h3>")
raise BadGatewayError.new, "Apple 502 detected - this might be temporary server error, try again later"
end
return response
end
end | ruby | def send_request(method, url_or_path, params, headers, &block)
with_retry do
response = @client.send(method, url_or_path, params, headers, &block)
log_response(method, url_or_path, response, headers, &block)
resp_hash = response.to_hash
if resp_hash[:status] == 401
msg = "Auth lost"
logger.warn(msg)
raise UnauthorizedAccessError.new, "Unauthorized Access"
end
if response.body.to_s.include?("<title>302 Found</title>")
raise AppleTimeoutError.new, "Apple 302 detected - this might be temporary server error, check https://developer.apple.com/system-status/ to see if there is a known downtime"
end
if response.body.to_s.include?("<h3>Bad Gateway</h3>")
raise BadGatewayError.new, "Apple 502 detected - this might be temporary server error, try again later"
end
return response
end
end | [
"def",
"send_request",
"(",
"method",
",",
"url_or_path",
",",
"params",
",",
"headers",
",",
"&",
"block",
")",
"with_retry",
"do",
"response",
"=",
"@client",
".",
"send",
"(",
"method",
",",
"url_or_path",
",",
"params",
",",
"headers",
",",
"block",
... | Actually sends the request to the remote server
Automatically retries the request up to 3 times if something goes wrong | [
"Actually",
"sends",
"the",
"request",
"to",
"the",
"remote",
"server",
"Automatically",
"retries",
"the",
"request",
"up",
"to",
"3",
"times",
"if",
"something",
"goes",
"wrong"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/spaceship/lib/spaceship/client.rb#L843-L865 | train | Send a request to the server | [
30522,
13366,
4604,
1035,
5227,
1006,
4118,
1010,
24471,
2140,
1035,
2030,
1035,
4130,
1010,
11498,
5244,
1010,
20346,
2015,
1010,
1004,
3796,
1007,
2007,
1035,
2128,
11129,
2079,
3433,
1027,
1030,
7396,
1012,
4604,
1006,
4118,
1010,
24471,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_storage/lib/2018-07-01/generated/azure_mgmt_storage/blob_containers.rb | Azure::Storage::Mgmt::V2018_07_01.BlobContainers.clear_legal_hold_with_http_info | def clear_legal_hold_with_http_info(resource_group_name, account_name, container_name, legal_hold, custom_headers:nil)
clear_legal_hold_async(resource_group_name, account_name, container_name, legal_hold, custom_headers:custom_headers).value!
end | ruby | def clear_legal_hold_with_http_info(resource_group_name, account_name, container_name, legal_hold, custom_headers:nil)
clear_legal_hold_async(resource_group_name, account_name, container_name, legal_hold, custom_headers:custom_headers).value!
end | [
"def",
"clear_legal_hold_with_http_info",
"(",
"resource_group_name",
",",
"account_name",
",",
"container_name",
",",
"legal_hold",
",",
"custom_headers",
":",
"nil",
")",
"clear_legal_hold_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"container_name",
"... | Clears legal hold tags. Clearing the same or non-existent tag results in an
idempotent operation. ClearLegalHold clears out only the specified tags in
the request.
@param resource_group_name [String] The name of the resource group within the
user's subscription. The name is case insensitive.
@param account_name [String] The name of the storage account within the
specified resource group. Storage account names must be between 3 and 24
characters in length and use numbers and lower-case letters only.
@param container_name [String] The name of the blob container within the
specified storage account. Blob container names must be between 3 and 63
characters in length and use numbers, lower-case letters and dash (-) only.
Every dash (-) character must be immediately preceded and followed by a
letter or number.
@param legal_hold [LegalHold] The LegalHold property that will be clear from
a blob container.
@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. | [
"Clears",
"legal",
"hold",
"tags",
".",
"Clearing",
"the",
"same",
"or",
"non",
"-",
"existent",
"tag",
"results",
"in",
"an",
"idempotent",
"operation",
".",
"ClearLegalHold",
"clears",
"out",
"only",
"the",
"specified",
"tags",
"in",
"the",
"request",
"."
... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_storage/lib/2018-07-01/generated/azure_mgmt_storage/blob_containers.rb#L866-L868 | train | Clear the legal hold of a container. | [
30522,
13366,
3154,
1035,
3423,
1035,
2907,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
11661,
1035,
2171,
1010,
3423,
1035,
2907,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_event_hub/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/namespaces.rb | Azure::EventHub::Mgmt::V2018_01_01_preview.Namespaces.create_or_update_async | def create_or_update_async(resource_group_name, namespace_name, parameters, custom_headers:nil)
# Send request
promise = begin_create_or_update_async(resource_group_name, namespace_name, parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::EHNamespace.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | ruby | def create_or_update_async(resource_group_name, namespace_name, parameters, custom_headers:nil)
# Send request
promise = begin_create_or_update_async(resource_group_name, namespace_name, parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::EventHub::Mgmt::V2018_01_01_preview::Models::EHNamespace.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | [
"def",
"create_or_update_async",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"parame... | @param resource_group_name [String] Name of the resource group within the
Azure subscription.
@param namespace_name [String] The Namespace name
@param parameters [EHNamespace] Parameters for creating a namespace resource.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"resource_group_name",
"[",
"String",
"]",
"Name",
"of",
"the",
"resource",
"group",
"within",
"the",
"Azure",
"subscription",
".",
"@param",
"namespace_name",
"[",
"String",
"]",
"The",
"Namespace",
"name",
"@param",
"parameters",
"[",
"EHNamespace",
... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_event_hub/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/namespaces.rb#L234-L250 | train | Creates or updates a namespace. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3415,
15327,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,
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 | management/azure_mgmt_storage/lib/2018-07-01/generated/azure_mgmt_storage/blob_containers.rb | Azure::Storage::Mgmt::V2018_07_01.BlobContainers.delete_immutability_policy | def delete_immutability_policy(resource_group_name, account_name, container_name, if_match, custom_headers:nil)
response = delete_immutability_policy_async(resource_group_name, account_name, container_name, if_match, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def delete_immutability_policy(resource_group_name, account_name, container_name, if_match, custom_headers:nil)
response = delete_immutability_policy_async(resource_group_name, account_name, container_name, if_match, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"delete_immutability_policy",
"(",
"resource_group_name",
",",
"account_name",
",",
"container_name",
",",
"if_match",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_immutability_policy_async",
"(",
"resource_group_name",
",",
"account_name",
",",... | Aborts an unlocked immutability policy. The response of delete has
immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required
for this operation. Deleting a locked immutability policy is not allowed,
only way is to delete the container after deleting all blobs inside the
container.
@param resource_group_name [String] The name of the resource group within the
user's subscription. The name is case insensitive.
@param account_name [String] The name of the storage account within the
specified resource group. Storage account names must be between 3 and 24
characters in length and use numbers and lower-case letters only.
@param container_name [String] The name of the blob container within the
specified storage account. Blob container names must be between 3 and 63
characters in length and use numbers, lower-case letters and dash (-) only.
Every dash (-) character must be immediately preceded and followed by a
letter or number.
@param if_match [String] The entity state (ETag) version of the immutability
policy to update. A value of "*" can be used to apply the operation only if
the immutability policy already exists. If omitted, this operation will
always be applied.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ImmutabilityPolicy] operation results. | [
"Aborts",
"an",
"unlocked",
"immutability",
"policy",
".",
"The",
"response",
"of",
"delete",
"has",
"immutabilityPeriodSinceCreationInDays",
"set",
"to",
"0",
".",
"ETag",
"in",
"If",
"-",
"Match",
"is",
"required",
"for",
"this",
"operation",
".",
"Deleting",
... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_storage/lib/2018-07-01/generated/azure_mgmt_storage/blob_containers.rb#L1288-L1291 | train | Deletes the immutability policy for the specified container. | [
30522,
13366,
3972,
12870,
1035,
10047,
28120,
8010,
1035,
3343,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
11661,
1035,
2171,
1010,
2065,
1035,
2674,
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... |
puppetlabs/bolt | lib/bolt/target.rb | Bolt.Target.update_conf | def update_conf(conf)
@protocol = conf[:transport]
t_conf = conf[:transports][transport.to_sym] || {}
# Override url methods
@user = t_conf['user']
@password = t_conf['password']
@port = t_conf['port']
@host = t_conf['host']
# Preserve everything in options so we can easily create copies of a Target.
@options = t_conf.merge(@options)
self
end | ruby | def update_conf(conf)
@protocol = conf[:transport]
t_conf = conf[:transports][transport.to_sym] || {}
# Override url methods
@user = t_conf['user']
@password = t_conf['password']
@port = t_conf['port']
@host = t_conf['host']
# Preserve everything in options so we can easily create copies of a Target.
@options = t_conf.merge(@options)
self
end | [
"def",
"update_conf",
"(",
"conf",
")",
"@protocol",
"=",
"conf",
"[",
":transport",
"]",
"t_conf",
"=",
"conf",
"[",
":transports",
"]",
"[",
"transport",
".",
"to_sym",
"]",
"||",
"{",
"}",
"# Override url methods",
"@user",
"=",
"t_conf",
"[",
"'user'",... | URI can be passes as nil | [
"URI",
"can",
"be",
"passes",
"as",
"nil"
] | 50689a33699939d262ea7c822a4b24fd8c4f8d8a | https://github.com/puppetlabs/bolt/blob/50689a33699939d262ea7c822a4b24fd8c4f8d8a/lib/bolt/target.rb#L53-L67 | train | Update the configuration for this Target. | [
30522,
13366,
10651,
1035,
9530,
2546,
1006,
9530,
2546,
1007,
1030,
8778,
1027,
9530,
2546,
1031,
1024,
3665,
1033,
1056,
1035,
9530,
2546,
1027,
9530,
2546,
1031,
1024,
19003,
1033,
1031,
3665,
1012,
2000,
1035,
25353,
2213,
1033,
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... |
tongueroo/jets | lib/jets/stack/main/extensions/lambda.rb | Jets::Stack::Main::Dsl.Lambda.permission | def permission(id, props={})
defaults = { action: "lambda:InvokeFunction" }
props = defaults.merge(props)
resource(id, "AWS::Lambda::Permission", props)
end | ruby | def permission(id, props={})
defaults = { action: "lambda:InvokeFunction" }
props = defaults.merge(props)
resource(id, "AWS::Lambda::Permission", props)
end | [
"def",
"permission",
"(",
"id",
",",
"props",
"=",
"{",
"}",
")",
"defaults",
"=",
"{",
"action",
":",
"\"lambda:InvokeFunction\"",
"}",
"props",
"=",
"defaults",
".",
"merge",
"(",
"props",
")",
"resource",
"(",
"id",
",",
"\"AWS::Lambda::Permission\"",
"... | Usage:
permission(:my_permission, principal: "events.amazonaws.com") | [
"Usage",
":"
] | 46943a519224067e58aa3e2d5656e3ca083150f9 | https://github.com/tongueroo/jets/blob/46943a519224067e58aa3e2d5656e3ca083150f9/lib/jets/stack/main/extensions/lambda.rb#L72-L76 | train | Returns a permission resource | [
30522,
13366,
6656,
1006,
8909,
1010,
24387,
1027,
1063,
1065,
1007,
12398,
2015,
1027,
1063,
2895,
1024,
1000,
23375,
1024,
1999,
6767,
3489,
11263,
27989,
1000,
1065,
24387,
1027,
12398,
2015,
1012,
13590,
1006,
24387,
1007,
7692,
1006,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
watir/watir | lib/watir/elements/element.rb | Watir.Element.drag_and_drop_by | def drag_and_drop_by(right_by, down_by)
element_call(:wait_for_present) do
driver.action
.drag_and_drop_by(@element, right_by, down_by)
.perform
end
end | ruby | def drag_and_drop_by(right_by, down_by)
element_call(:wait_for_present) do
driver.action
.drag_and_drop_by(@element, right_by, down_by)
.perform
end
end | [
"def",
"drag_and_drop_by",
"(",
"right_by",
",",
"down_by",
")",
"element_call",
"(",
":wait_for_present",
")",
"do",
"driver",
".",
"action",
".",
"drag_and_drop_by",
"(",
"@element",
",",
"right_by",
",",
"down_by",
")",
".",
"perform",
"end",
"end"
] | Drag and drop this element by the given offsets.
Note that browser support may vary.
@example
browser.div(id: "draggable").drag_and_drop_by 100, -200
@param [Integer] right_by
@param [Integer] down_by | [
"Drag",
"and",
"drop",
"this",
"element",
"by",
"the",
"given",
"offsets",
".",
"Note",
"that",
"browser",
"support",
"may",
"vary",
"."
] | 2d8db09811c6221ae401b85b2f61f5fa66e463a3 | https://github.com/watir/watir/blob/2d8db09811c6221ae401b85b2f61f5fa66e463a3/lib/watir/elements/element.rb#L256-L262 | train | Drag and drop the element by the given coordinates. | [
30522,
13366,
8011,
1035,
1998,
1035,
4530,
1035,
2011,
1006,
2157,
1035,
2011,
1010,
2091,
1035,
2011,
1007,
5783,
1035,
2655,
1006,
1024,
3524,
1035,
2005,
1035,
2556,
1007,
2079,
4062,
1012,
2895,
1012,
8011,
1035,
1998,
1035,
4530,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/usages.rb | Azure::Automation::Mgmt::V2015_10_31.Usages.list_by_automation_account | def list_by_automation_account(resource_group_name, automation_account_name, custom_headers:nil)
response = list_by_automation_account_async(resource_group_name, automation_account_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_automation_account(resource_group_name, automation_account_name, custom_headers:nil)
response = list_by_automation_account_async(resource_group_name, automation_account_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_automation_account",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_automation_account_async",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"custom_headers",
":c... | Retrieve the usage for the account id.
@param resource_group_name [String] Name of an Azure Resource group.
@param automation_account_name [String] The name of the automation account.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [UsageListResult] operation results. | [
"Retrieve",
"the",
"usage",
"for",
"the",
"account",
"id",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/usages.rb#L34-L37 | train | Gets the list of all the automation terms of the specified automation account. | [
30522,
13366,
2862,
1035,
2011,
1035,
19309,
1035,
4070,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
19309,
1035,
4070,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
19309,
1035,
4070,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/scss-lint | lib/scss_lint/linter.rb | SCSSLint.Linter.source_from_range | def source_from_range(source_range) # rubocop:disable Metrics/AbcSize
current_line = source_range.start_pos.line - 1
last_line = source_range.end_pos.line - 1
start_pos = source_range.start_pos.offset - 1
source =
if current_line == last_line
engine.lines[current_line][start_pos..(source_range.end_pos.offset - 1)]
else
engine.lines[current_line][start_pos..-1]
end
current_line += 1
while current_line < last_line
source += engine.lines[current_line].to_s
current_line += 1
end
if source_range.start_pos.line != source_range.end_pos.line
source += ((engine.lines[current_line] || '')[0...source_range.end_pos.offset]).to_s
end
source
end | ruby | def source_from_range(source_range) # rubocop:disable Metrics/AbcSize
current_line = source_range.start_pos.line - 1
last_line = source_range.end_pos.line - 1
start_pos = source_range.start_pos.offset - 1
source =
if current_line == last_line
engine.lines[current_line][start_pos..(source_range.end_pos.offset - 1)]
else
engine.lines[current_line][start_pos..-1]
end
current_line += 1
while current_line < last_line
source += engine.lines[current_line].to_s
current_line += 1
end
if source_range.start_pos.line != source_range.end_pos.line
source += ((engine.lines[current_line] || '')[0...source_range.end_pos.offset]).to_s
end
source
end | [
"def",
"source_from_range",
"(",
"source_range",
")",
"# rubocop:disable Metrics/AbcSize",
"current_line",
"=",
"source_range",
".",
"start_pos",
".",
"line",
"-",
"1",
"last_line",
"=",
"source_range",
".",
"end_pos",
".",
"line",
"-",
"1",
"start_pos",
"=",
"sou... | Extracts the original source code given a range.
@param source_range [Sass::Source::Range]
@return [String] the original source code | [
"Extracts",
"the",
"original",
"source",
"code",
"given",
"a",
"range",
"."
] | e99afe4ede041a431a06e585c12ce82f6ad50116 | https://github.com/sds/scss-lint/blob/e99afe4ede041a431a06e585c12ce82f6ad50116/lib/scss_lint/linter.rb#L89-L112 | train | Returns the source code from the given source range. | [
30522,
13366,
3120,
1035,
2013,
1035,
2846,
1006,
3120,
1035,
2846,
1007,
1001,
14548,
24163,
2361,
1024,
4487,
19150,
12046,
2015,
1013,
5925,
5332,
4371,
2783,
1035,
2240,
1027,
3120,
1035,
2846,
1012,
2707,
1035,
13433,
2015,
1012,
2240,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/api/transactions_api.rb | SquareConnect.TransactionsApi.void_transaction | def void_transaction(location_id, transaction_id, opts = {})
data, _status_code, _headers = void_transaction_with_http_info(location_id, transaction_id, opts)
return data
end | ruby | def void_transaction(location_id, transaction_id, opts = {})
data, _status_code, _headers = void_transaction_with_http_info(location_id, transaction_id, opts)
return data
end | [
"def",
"void_transaction",
"(",
"location_id",
",",
"transaction_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"void_transaction_with_http_info",
"(",
"location_id",
",",
"transaction_id",
",",
"opts",
")",
"return",
"d... | VoidTransaction
Cancels a transaction that was created with the [Charge](#endpoint-transactions-charge) endpoint with a `delay_capture` value of `true`. See [Delayed capture transactions](/payments/transactions/overview#delayed-capture) for more information.
@param location_id
@param transaction_id
@param [Hash] opts the optional parameters
@return [VoidTransactionResponse] | [
"VoidTransaction",
"Cancels",
"a",
"transaction",
"that",
"was",
"created",
"with",
"the",
"[",
"Charge",
"]",
"(",
"#endpoint",
"-",
"transactions",
"-",
"charge",
")",
"endpoint",
"with",
"a",
"delay_capture",
"value",
"of",
"true",
".",
"See",
"[",
"Delay... | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/transactions_api.rb#L406-L409 | train | Void a single transaction | [
30522,
13366,
11675,
1035,
12598,
1006,
3295,
1035,
8909,
1010,
12598,
1035,
8909,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
11675,
1035,
12598,
1035,
2007,
1035,
8299,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/service_endpoint_policy_definitions.rb | Azure::Network::Mgmt::V2018_08_01.ServiceEndpointPolicyDefinitions.list_by_resource_group | def list_by_resource_group(resource_group_name, service_endpoint_policy_name, custom_headers:nil)
first_page = list_by_resource_group_as_lazy(resource_group_name, service_endpoint_policy_name, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_by_resource_group(resource_group_name, service_endpoint_policy_name, custom_headers:nil)
first_page = list_by_resource_group_as_lazy(resource_group_name, service_endpoint_policy_name, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_by_resource_group",
"(",
"resource_group_name",
",",
"service_endpoint_policy_name",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_by_resource_group_as_lazy",
"(",
"resource_group_name",
",",
"service_endpoint_policy_name",
",",
"custom_headers",... | Gets all service endpoint policy definitions in a service end point policy.
@param resource_group_name [String] The name of the resource group.
@param service_endpoint_policy_name [String] The name of the service endpoint
policy name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<ServiceEndpointPolicyDefinition>] operation results. | [
"Gets",
"all",
"service",
"endpoint",
"policy",
"definitions",
"in",
"a",
"service",
"end",
"point",
"policy",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/service_endpoint_policy_definitions.rb#L239-L242 | train | Gets all the service endpoint policies in a resource group. | [
30522,
13366,
2862,
1035,
2011,
1035,
7692,
1035,
2177,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2203,
8400,
1035,
3343,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2862,
1035,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fazibear/colorize | lib/colorize/instance_methods.rb | Colorize.InstanceMethods.colors_from_hash | def colors_from_hash(match, hash)
match[0] = mode(hash[:mode]) if mode(hash[:mode])
match[1] = color(hash[:color]) if color(hash[:color])
match[2] = background_color(hash[:background]) if background_color(hash[:background])
end | ruby | def colors_from_hash(match, hash)
match[0] = mode(hash[:mode]) if mode(hash[:mode])
match[1] = color(hash[:color]) if color(hash[:color])
match[2] = background_color(hash[:background]) if background_color(hash[:background])
end | [
"def",
"colors_from_hash",
"(",
"match",
",",
"hash",
")",
"match",
"[",
"0",
"]",
"=",
"mode",
"(",
"hash",
"[",
":mode",
"]",
")",
"if",
"mode",
"(",
"hash",
"[",
":mode",
"]",
")",
"match",
"[",
"1",
"]",
"=",
"color",
"(",
"hash",
"[",
":co... | Set colors from params hash | [
"Set",
"colors",
"from",
"params",
"hash"
] | 526654c6d7dfc5483b70184d06b994eba8359514 | https://github.com/fazibear/colorize/blob/526654c6d7dfc5483b70184d06b994eba8359514/lib/colorize/instance_methods.rb#L71-L75 | train | Returns the colors from the hash | [
30522,
13366,
6087,
1035,
2013,
1035,
23325,
1006,
2674,
1010,
23325,
1007,
2674,
1031,
1014,
1033,
1027,
5549,
1006,
23325,
1031,
1024,
5549,
1033,
1007,
2065,
5549,
1006,
23325,
1031,
1024,
5549,
1033,
1007,
2674,
1031,
1015,
1033,
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... |
petergoldstein/dalli | lib/dalli/client.rb | Dalli.Client.stats | def stats(type=nil)
type = nil if ![nil, :items,:slabs,:settings].include? type
values = {}
ring.servers.each do |server|
values["#{server.name}"] = server.alive? ? server.request(:stats,type.to_s) : nil
end
values
end | ruby | def stats(type=nil)
type = nil if ![nil, :items,:slabs,:settings].include? type
values = {}
ring.servers.each do |server|
values["#{server.name}"] = server.alive? ? server.request(:stats,type.to_s) : nil
end
values
end | [
"def",
"stats",
"(",
"type",
"=",
"nil",
")",
"type",
"=",
"nil",
"if",
"!",
"[",
"nil",
",",
":items",
",",
":slabs",
",",
":settings",
"]",
".",
"include?",
"type",
"values",
"=",
"{",
"}",
"ring",
".",
"servers",
".",
"each",
"do",
"|",
"serve... | Collect the stats for each server.
You can optionally pass a type including :items, :slabs or :settings to get specific stats
Returns a hash like { 'hostname:port' => { 'stat1' => 'value1', ... }, 'hostname2:port' => { ... } } | [
"Collect",
"the",
"stats",
"for",
"each",
"server",
".",
"You",
"can",
"optionally",
"pass",
"a",
"type",
"including",
":",
"items",
":",
"slabs",
"or",
":",
"settings",
"to",
"get",
"specific",
"stats",
"Returns",
"a",
"hash",
"like",
"{",
"hostname",
"... | 5755dbfd06e333a8239f976d4b10492b4555b726 | https://github.com/petergoldstein/dalli/blob/5755dbfd06e333a8239f976d4b10492b4555b726/lib/dalli/client.rb#L220-L227 | train | Get stats for all servers | [
30522,
13366,
26319,
1006,
2828,
1027,
9152,
2140,
1007,
2828,
1027,
9152,
2140,
2065,
999,
1031,
9152,
2140,
1010,
1024,
5167,
1010,
1024,
28761,
1010,
1024,
10906,
1033,
1012,
2421,
1029,
2828,
5300,
1027,
1063,
1065,
3614,
1012,
14903,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
decidim/decidim | decidim-core/app/helpers/decidim/layout_helper.rb | Decidim.LayoutHelper.icon | def icon(name, options = {})
html_properties = {}
html_properties["width"] = options[:width]
html_properties["height"] = options[:height]
html_properties["aria-label"] = options[:aria_label]
html_properties["role"] = options[:role]
html_properties["aria-hidden"] = options[:aria_hidden]
html_properties["class"] = (["icon--#{name}"] + _icon_classes(options)).join(" ")
content_tag :svg, html_properties do
content_tag :use, nil, "xlink:href" => "#{asset_path("decidim/icons.svg")}#icon-#{name}"
end
end | ruby | def icon(name, options = {})
html_properties = {}
html_properties["width"] = options[:width]
html_properties["height"] = options[:height]
html_properties["aria-label"] = options[:aria_label]
html_properties["role"] = options[:role]
html_properties["aria-hidden"] = options[:aria_hidden]
html_properties["class"] = (["icon--#{name}"] + _icon_classes(options)).join(" ")
content_tag :svg, html_properties do
content_tag :use, nil, "xlink:href" => "#{asset_path("decidim/icons.svg")}#icon-#{name}"
end
end | [
"def",
"icon",
"(",
"name",
",",
"options",
"=",
"{",
"}",
")",
"html_properties",
"=",
"{",
"}",
"html_properties",
"[",
"\"width\"",
"]",
"=",
"options",
"[",
":width",
"]",
"html_properties",
"[",
"\"height\"",
"]",
"=",
"options",
"[",
":height",
"]"... | Outputs an SVG-based icon.
name - The String with the icon name.
options - The Hash options used to customize the icon (default {}):
:width - The Number of width in pixels (optional).
:height - The Number of height in pixels (optional).
:aria_label - The String to set as aria label (optional).
:aria_hidden - The Truthy value to enable aria_hidden (optional).
:role - The String to set as the role (optional).
:class - The String to add as a CSS class (optional).
Returns a String. | [
"Outputs",
"an",
"SVG",
"-",
"based",
"icon",
"."
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/app/helpers/decidim/layout_helper.rb#L30-L44 | train | Returns an SVG icon with the given name. | [
30522,
13366,
12696,
1006,
2171,
1010,
7047,
1027,
1063,
1065,
1007,
16129,
1035,
5144,
1027,
1063,
1065,
16129,
1035,
5144,
1031,
1000,
9381,
1000,
1033,
1027,
7047,
1031,
1024,
9381,
1033,
16129,
1035,
5144,
1031,
1000,
4578,
1000,
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... |
sinatra/sinatra | sinatra-contrib/lib/sinatra/link_header.rb | Sinatra.LinkHeader.stylesheet | def stylesheet(*urls)
urls << {} unless urls.last.respond_to? :to_hash
urls.last[:type] ||= mime_type(:css)
link(:stylesheet, *urls)
end | ruby | def stylesheet(*urls)
urls << {} unless urls.last.respond_to? :to_hash
urls.last[:type] ||= mime_type(:css)
link(:stylesheet, *urls)
end | [
"def",
"stylesheet",
"(",
"*",
"urls",
")",
"urls",
"<<",
"{",
"}",
"unless",
"urls",
".",
"last",
".",
"respond_to?",
":to_hash",
"urls",
".",
"last",
"[",
":type",
"]",
"||=",
"mime_type",
"(",
":css",
")",
"link",
"(",
":stylesheet",
",",
"urls",
... | Sets Link HTTP header and returns HTML tags for using stylesheets. | [
"Sets",
"Link",
"HTTP",
"header",
"and",
"returns",
"HTML",
"tags",
"for",
"using",
"stylesheets",
"."
] | 1aa64f9858edc3f93cc8d46e26f724c1ae103b1c | https://github.com/sinatra/sinatra/blob/1aa64f9858edc3f93cc8d46e26f724c1ae103b1c/sinatra-contrib/lib/sinatra/link_header.rb#L65-L69 | train | Returns a link to the stylesheet with the given urls. | [
30522,
13366,
6782,
21030,
2102,
1006,
1008,
24471,
4877,
1007,
24471,
4877,
1026,
1026,
1063,
1065,
4983,
24471,
4877,
1012,
2197,
1012,
6869,
1035,
2000,
1029,
1024,
2000,
1035,
23325,
24471,
4877,
1012,
2197,
1031,
1024,
2828,
1033,
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... |
anycable/anycable | lib/anycable/cli.rb | AnyCable.CLI.parse_cli_options! | def parse_cli_options!(args)
unknown_opts = []
parser = build_cli_parser
begin
parser.parse!(args)
rescue OptionParser::InvalidOption => e
unknown_opts << e.args[0]
unless args.size.zero?
unknown_opts << args.shift unless args.first.start_with?("-")
retry
end
end
unknown_opts
end | ruby | def parse_cli_options!(args)
unknown_opts = []
parser = build_cli_parser
begin
parser.parse!(args)
rescue OptionParser::InvalidOption => e
unknown_opts << e.args[0]
unless args.size.zero?
unknown_opts << args.shift unless args.first.start_with?("-")
retry
end
end
unknown_opts
end | [
"def",
"parse_cli_options!",
"(",
"args",
")",
"unknown_opts",
"=",
"[",
"]",
"parser",
"=",
"build_cli_parser",
"begin",
"parser",
".",
"parse!",
"(",
"args",
")",
"rescue",
"OptionParser",
"::",
"InvalidOption",
"=>",
"e",
"unknown_opts",
"<<",
"e",
".",
"... | rubocop:disable Metrics/MethodLength | [
"rubocop",
":",
"disable",
"Metrics",
"/",
"MethodLength"
] | d7515e8e034d42e86ebeb09786a92aad2a11b25f | https://github.com/anycable/anycable/blob/d7515e8e034d42e86ebeb09786a92aad2a11b25f/lib/anycable/cli.rb#L251-L267 | train | Parse the command line options | [
30522,
13366,
11968,
3366,
1035,
18856,
2072,
1035,
7047,
999,
1006,
12098,
5620,
1007,
4242,
1035,
23569,
2015,
1027,
1031,
1033,
11968,
8043,
1027,
3857,
1035,
18856,
2072,
1035,
11968,
8043,
4088,
11968,
8043,
1012,
11968,
3366,
999,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-glacier/lib/aws-sdk-glacier/client.rb | Aws::Glacier.Client.get_job_output | def get_job_output(params = {}, options = {}, &block)
req = build_request(:get_job_output, params)
req.send_request(options, &block)
end | ruby | def get_job_output(params = {}, options = {}, &block)
req = build_request(:get_job_output, params)
req.send_request(options, &block)
end | [
"def",
"get_job_output",
"(",
"params",
"=",
"{",
"}",
",",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"req",
"=",
"build_request",
"(",
":get_job_output",
",",
"params",
")",
"req",
".",
"send_request",
"(",
"options",
",",
"block",
")",
"end"
... | This operation downloads the output of the job you initiated using
InitiateJob. Depending on the job type you specified when you
initiated the job, the output will be either the content of an archive
or a vault inventory.
You can download all the job output or download a portion of the
output by specifying a byte range. In the case of an archive retrieval
job, depending on the byte range you specify, Amazon Glacier returns
the checksum for the portion of the data. You can compute the checksum
on the client and verify that the values match to ensure the portion
you downloaded is the correct data.
A job ID will not expire for at least 24 hours after Amazon Glacier
completes the job. That a byte range. For both archive and inventory
retrieval jobs, you should verify the downloaded size against the size
returned in the headers from the **Get Job Output** response.
For archive retrieval jobs, you should also verify that the size is
what you expected. If you download a portion of the output, the
expected size is based on the range of bytes you specified. For
example, if you specify a range of `bytes=0-1048575`, you should
verify your download size is 1,048,576 bytes. If you download an
entire archive, the expected size is the size of the archive when you
uploaded it to Amazon Glacier The expected size is also returned in
the headers from the **Get Job Output** response.
In the case of an archive retrieval job, depending on the byte range
you specify, Amazon Glacier returns the checksum for the portion of
the data. To ensure the portion you downloaded is the correct data,
compute the checksum on the client, verify that the values match, and
verify that the size is what you expected.
A job ID does not expire for at least 24 hours after Amazon Glacier
completes the job. That is, you can download the job output within the
24 hours period after Amazon Glacier completes the job.
An AWS account has full permission to perform all operations
(actions). However, AWS Identity and Access Management (IAM) users
don't have any permissions by default. You must grant them explicit
permission to perform specific actions. For more information, see
[Access Control Using AWS Identity and Access Management (IAM)][1].
For conceptual information and the underlying REST API, see
[Downloading a Vault Inventory][2], [Downloading an Archive][3], and
[Get Job Output ][4]
[1]: http://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html
[2]: http://docs.aws.amazon.com/amazonglacier/latest/dev/vault-inventory.html
[3]: http://docs.aws.amazon.com/amazonglacier/latest/dev/downloading-an-archive.html
[4]: http://docs.aws.amazon.com/amazonglacier/latest/dev/api-job-output-get.html
@option params [required, String] :account_id
The `AccountId` value is the AWS account ID of the account that owns
the vault. You can either specify an AWS account ID or optionally a
single '`-`' (hyphen), in which case Amazon Glacier uses the AWS
account ID associated with the credentials used to sign the request.
If you use an account ID, do not include any hyphens ('-') in the
ID.
@option params [required, String] :vault_name
The name of the vault.
@option params [required, String] :job_id
The job ID whose data is downloaded.
@option params [String] :range
The range of bytes to retrieve from the output. For example, if you
want to download the first 1,048,576 bytes, specify the range as
`bytes=0-1048575`. By default, this operation downloads the entire
output.
If the job output is large, then you can use a range to retrieve a
portion of the output. This allows you to download the entire output
in smaller chunks of bytes. For example, suppose you have 1 GB of job
output you want to download and you decide to download 128 MB chunks
of data at a time, which is a total of eight Get Job Output requests.
You use the following process to download the job output:
1. Download a 128 MB chunk of output by specifying the appropriate
byte range. Verify that all 128 MB of data was received.
2. Along with the data, the response includes a SHA256 tree hash of
the payload. You compute the checksum of the payload on the client
and compare it with the checksum you received in the response to
ensure you received all the expected data.
3. Repeat steps 1 and 2 for all the eight 128 MB chunks of output
data, each time specifying the appropriate byte range.
4. After downloading all the parts of the job output, you have a list
of eight checksum values. Compute the tree hash of these values to
find the checksum of the entire output. Using the DescribeJob API,
obtain job information of the job that provided you the output.
The response includes the checksum of the entire archive stored in
Amazon Glacier. You compare this value with the checksum you
computed to ensure you have downloaded the entire archive content
with no errors.
@return [Types::GetJobOutputOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
* {Types::GetJobOutputOutput#body #body} => IO
* {Types::GetJobOutputOutput#checksum #checksum} => String
* {Types::GetJobOutputOutput#status #status} => Integer
* {Types::GetJobOutputOutput#content_range #content_range} => String
* {Types::GetJobOutputOutput#accept_ranges #accept_ranges} => String
* {Types::GetJobOutputOutput#content_type #content_type} => String
* {Types::GetJobOutputOutput#archive_description #archive_description} => String
@example Example: To get the output of a previously initiated job
# The example downloads the output of a previously initiated inventory retrieval job that is identified by the job ID.
resp = client.get_job_output({
account_id: "-",
job_id: "zbxcm3Z_3z5UkoroF7SuZKrxgGoDc3RloGduS7Eg-RO47Yc6FxsdGBgf_Q2DK5Ejh18CnTS5XW4_XqlNHS61dsO4CnMW",
range: "",
vault_name: "my-vaul",
})
resp.to_h outputs the following:
{
accept_ranges: "bytes",
body: "inventory-data",
content_type: "application/json",
status: 200,
}
@example Request syntax with placeholder values
resp = client.get_job_output({
account_id: "string", # required
vault_name: "string", # required
job_id: "string", # required
range: "string",
})
@example Response structure
resp.body #=> IO
resp.checksum #=> String
resp.status #=> Integer
resp.content_range #=> String
resp.accept_ranges #=> String
resp.content_type #=> String
resp.archive_description #=> String
@overload get_job_output(params = {})
@param [Hash] params ({}) | [
"This",
"operation",
"downloads",
"the",
"output",
"of",
"the",
"job",
"you",
"initiated",
"using",
"InitiateJob",
".",
"Depending",
"on",
"the",
"job",
"type",
"you",
"specified",
"when",
"you",
"initiated",
"the",
"job",
"the",
"output",
"will",
"be",
"eit... | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-glacier/lib/aws-sdk-glacier/client.rb#L1448-L1451 | train | Get the output of a job | [
30522,
13366,
2131,
1035,
3105,
1035,
6434,
1006,
11498,
5244,
1027,
1063,
1065,
1010,
7047,
1027,
1063,
1065,
1010,
1004,
3796,
1007,
2128,
4160,
1027,
3857,
1035,
5227,
1006,
1024,
2131,
1035,
3105,
1035,
6434,
1010,
11498,
5244,
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_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machines.rb | Azure::Compute::Mgmt::V2016_04_30_preview.VirtualMachines.delete_async | def delete_async(resource_group_name, vm_name, custom_headers:nil)
# Send request
promise = begin_delete_async(resource_group_name, vm_name, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Compute::Mgmt::V2016_04_30_preview::Models::OperationStatusResponse.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 delete_async(resource_group_name, vm_name, custom_headers:nil)
# Send request
promise = begin_delete_async(resource_group_name, vm_name, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Compute::Mgmt::V2016_04_30_preview::Models::OperationStatusResponse.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",
"delete_async",
"(",
"resource_group_name",
",",
"vm_name",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_delete_async",
"(",
"resource_group_name",
",",
"vm_name",
",",
"custom_headers",
":custom_headers",
")",
"promise",
"="... | @param resource_group_name [String] The name of the resource group.
@param vm_name [String] The name of the virtual machine.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"resource_group_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"resource",
"group",
".",
"@param",
"vm_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"virtual",
"machine",
".",
"@param",
"custom_headers",
"[",
"Hash",
"{",
"String",... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machines.rb#L239-L255 | train | Deletes a virtual machine. | [
30522,
13366,
3972,
12870,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,
4088,
1035,
3972,
12870,
1035,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/versions.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Versions.import_with_http_info | def import_with_http_info(app_id, luis_app, version_id:nil, custom_headers:nil)
import_async(app_id, luis_app, version_id:version_id, custom_headers:custom_headers).value!
end | ruby | def import_with_http_info(app_id, luis_app, version_id:nil, custom_headers:nil)
import_async(app_id, luis_app, version_id:version_id, custom_headers:custom_headers).value!
end | [
"def",
"import_with_http_info",
"(",
"app_id",
",",
"luis_app",
",",
"version_id",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"import_async",
"(",
"app_id",
",",
"luis_app",
",",
"version_id",
":version_id",
",",
"custom_headers",
":custom_headers",
")",
... | Imports a new version into a LUIS application.
@param app_id The application ID.
@param luis_app [LuisApp] A LUIS application structure.
@param version_id [String] The new versionId to import. If not specified, the
versionId will be read from the imported object.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Imports",
"a",
"new",
"version",
"into",
"a",
"LUIS",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/versions.rb#L662-L664 | train | Import a luis specification into a LUIS specification. | [
30522,
13366,
12324,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
6446,
1035,
10439,
1010,
2544,
1035,
8909,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
12324,
1035,
2004,
6038,
2278,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_datalake_analytics/lib/2016-11-01/generated/azure_mgmt_datalake_analytics/storage_accounts.rb | Azure::DataLakeAnalytics::Mgmt::V2016_11_01.StorageAccounts.add_with_http_info | def add_with_http_info(resource_group_name, account_name, storage_account_name, parameters, custom_headers:nil)
add_async(resource_group_name, account_name, storage_account_name, parameters, custom_headers:custom_headers).value!
end | ruby | def add_with_http_info(resource_group_name, account_name, storage_account_name, parameters, custom_headers:nil)
add_async(resource_group_name, account_name, storage_account_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"add_with_http_info",
"(",
"resource_group_name",
",",
"account_name",
",",
"storage_account_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"add_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"storage_account_name",
",",
"paramet... | Updates the specified Data Lake Analytics account to add an Azure Storage
account.
@param resource_group_name [String] The name of the Azure resource group.
@param account_name [String] The name of the Data Lake Analytics account.
@param storage_account_name [String] The name of the Azure Storage account to
add
@param parameters [AddStorageAccountParameters] The parameters containing the
access key and optional suffix for the Azure Storage Account.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Updates",
"the",
"specified",
"Data",
"Lake",
"Analytics",
"account",
"to",
"add",
"an",
"Azure",
"Storage",
"account",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_datalake_analytics/lib/2016-11-01/generated/azure_mgmt_datalake_analytics/storage_accounts.rb#L200-L202 | train | Adds a new chunk of data to the specified storage account. | [
30522,
13366,
5587,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
5527,
1035,
4070,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
5587,
1035,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
meew0/discordrb | lib/discordrb/commands/command_bot.rb | Discordrb::Commands.CommandBot.permission? | def permission?(user, level, server)
determined_level = if user.webhook? || server.nil?
0
else
user.roles.reduce(0) do |memo, role|
[@permissions[:roles][role.id] || 0, memo].max
end
end
[@permissions[:users][user.id] || 0, determined_level].max >= level
end | ruby | def permission?(user, level, server)
determined_level = if user.webhook? || server.nil?
0
else
user.roles.reduce(0) do |memo, role|
[@permissions[:roles][role.id] || 0, memo].max
end
end
[@permissions[:users][user.id] || 0, determined_level].max >= level
end | [
"def",
"permission?",
"(",
"user",
",",
"level",
",",
"server",
")",
"determined_level",
"=",
"if",
"user",
".",
"webhook?",
"||",
"server",
".",
"nil?",
"0",
"else",
"user",
".",
"roles",
".",
"reduce",
"(",
"0",
")",
"do",
"|",
"memo",
",",
"role",... | Check if a user has permission to do something
@param user [User] The user to check
@param level [Integer] The minimum permission level the user should have (inclusive)
@param server [Server] The server on which to check
@return [true, false] whether or not the user has the given permission | [
"Check",
"if",
"a",
"user",
"has",
"permission",
"to",
"do",
"something"
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/commands/command_bot.rb#L353-L363 | train | Check if the user has permission to the user | [
30522,
13366,
6656,
1029,
1006,
5310,
1010,
2504,
1010,
8241,
1007,
4340,
1035,
2504,
1027,
2065,
5310,
1012,
4773,
6806,
6559,
1029,
1064,
1064,
8241,
1012,
9152,
2140,
1029,
1014,
2842,
5310,
1012,
4395,
1012,
5547,
1006,
1014,
1007,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
plataformatec/responders | lib/responders/collection_responder.rb | Responders.CollectionResponder.navigation_location | def navigation_location
return options[:location] if options[:location]
klass = resources.last.class
if klass.respond_to?(:model_name)
resources[0...-1] << klass.model_name.route_key.to_sym
else
resources
end
end | ruby | def navigation_location
return options[:location] if options[:location]
klass = resources.last.class
if klass.respond_to?(:model_name)
resources[0...-1] << klass.model_name.route_key.to_sym
else
resources
end
end | [
"def",
"navigation_location",
"return",
"options",
"[",
":location",
"]",
"if",
"options",
"[",
":location",
"]",
"klass",
"=",
"resources",
".",
"last",
".",
"class",
"if",
"klass",
".",
"respond_to?",
"(",
":model_name",
")",
"resources",
"[",
"0",
"...",
... | Returns the collection location for redirecting after POST/PUT/DELETE.
This method, converts the following resources array to the following:
[:admin, @post] #=> [:admin, :posts]
[@user, @post] #=> [@user, :posts]
When these new arrays are given to redirect_to, it will generate the
proper URL pointing to the index action.
[:admin, @post] #=> admin_posts_url
[@user, @post] #=> user_posts_url(@user.to_param) | [
"Returns",
"the",
"collection",
"location",
"for",
"redirecting",
"after",
"POST",
"/",
"PUT",
"/",
"DELETE",
".",
"This",
"method",
"converts",
"the",
"following",
"resources",
"array",
"to",
"the",
"following",
":"
] | a1a2706091d4ffcbbe387407ddfc5671a59ad842 | https://github.com/plataformatec/responders/blob/a1a2706091d4ffcbbe387407ddfc5671a59ad842/lib/responders/collection_responder.rb#L19-L28 | train | Returns the location of the current page. | [
30522,
13366,
9163,
1035,
3295,
2709,
7047,
1031,
1024,
3295,
1033,
2065,
7047,
1031,
1024,
3295,
1033,
1047,
27102,
1027,
4219,
1012,
2197,
1012,
2465,
2065,
1047,
27102,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
2944,
1035,
2171,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.