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 | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.get_deployed_application_info | def get_deployed_application_info(node_name, application_id, timeout:60, include_health_state:false, custom_headers:nil)
response = get_deployed_application_info_async(node_name, application_id, timeout:timeout, include_health_state:include_health_state, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_deployed_application_info(node_name, application_id, timeout:60, include_health_state:false, custom_headers:nil)
response = get_deployed_application_info_async(node_name, application_id, timeout:timeout, include_health_state:include_health_state, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_deployed_application_info",
"(",
"node_name",
",",
"application_id",
",",
"timeout",
":",
"60",
",",
"include_health_state",
":",
"false",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_deployed_application_info_async",
"(",
"node_name",
","... | Gets the information about an application deployed on a Service Fabric node.
Gets the information about an application deployed on a Service Fabric node.
This query returns system application information if the application ID
provided is for system application. Results encompass deployed applications
in active, activating, and downloading states. This query requires that the
node name corresponds to a node on the cluster. The query fails if the
provided node name does not point to any active Service Fabric nodes on the
cluster.
@param node_name [String] The name of the node.
@param application_id [String] The identity of the application. This is
typically the full name of the application without the 'fabric:' URI scheme.
Starting from version 6.0, hierarchical names are delimited with the "~"
character.
For example, if the application name is "fabric:/myapp/app1", the application
identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param include_health_state [Boolean] Include the health state of an entity.
If this parameter is false or not specified, then the health state returned
is "Unknown".
When set to true, the query goes in parallel to the node and the health
system service before the results are merged.
As a result, the query is more expensive and may take a longer time.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [DeployedApplicationInfo] operation results. | [
"Gets",
"the",
"information",
"about",
"an",
"application",
"deployed",
"on",
"a",
"Service",
"Fabric",
"node",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L8578-L8581 | train | Gets the information about the deployment of the application. | [
30522,
13366,
2131,
1035,
7333,
1035,
4646,
1035,
18558,
1006,
13045,
1035,
2171,
1010,
4646,
1035,
8909,
1010,
2051,
5833,
1024,
3438,
1010,
2421,
1035,
2740,
1035,
2110,
1024,
6270,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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.update_with_http_info | def update_with_http_info(resource_group_name, certificate_order_name, certificate_distinguished_name, custom_headers:nil)
update_async(resource_group_name, certificate_order_name, certificate_distinguished_name, custom_headers:custom_headers).value!
end | ruby | def update_with_http_info(resource_group_name, certificate_order_name, certificate_distinguished_name, custom_headers:nil)
update_async(resource_group_name, certificate_order_name, certificate_distinguished_name, custom_headers:custom_headers).value!
end | [
"def",
"update_with_http_info",
"(",
"resource_group_name",
",",
"certificate_order_name",
",",
"certificate_distinguished_name",
",",
"custom_headers",
":",
"nil",
")",
"update_async",
"(",
"resource_group_name",
",",
"certificate_order_name",
",",
"certificate_distinguished_n... | Create or update a certificate purchase order.
Create or update a certificate purchase order.
@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 certificate_distinguished_name
[AppServiceCertificateOrderPatchResource] Distinguished name to to use for
the certificate order.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Create",
"or",
"update",
"a",
"certificate",
"purchase",
"order",
"."
] | 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#L591-L593 | train | Updates a certificate order s covering specification. | [
30522,
13366,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8196,
1035,
2344,
1035,
2171,
1010,
8196,
1035,
5182,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
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_automation/lib/2015-10-31/generated/azure_mgmt_automation/hybrid_runbook_worker_group_operations.rb | Azure::Automation::Mgmt::V2015_10_31.HybridRunbookWorkerGroupOperations.delete_with_http_info | def delete_with_http_info(resource_group_name, automation_account_name, hybrid_runbook_worker_group_name, custom_headers:nil)
delete_async(resource_group_name, automation_account_name, hybrid_runbook_worker_group_name, custom_headers:custom_headers).value!
end | ruby | def delete_with_http_info(resource_group_name, automation_account_name, hybrid_runbook_worker_group_name, custom_headers:nil)
delete_async(resource_group_name, automation_account_name, hybrid_runbook_worker_group_name, custom_headers:custom_headers).value!
end | [
"def",
"delete_with_http_info",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"hybrid_runbook_worker_group_name",
",",
"custom_headers",
":",
"nil",
")",
"delete_async",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"hybrid_runbook_worker_g... | Delete a hybrid runbook worker group.
@param resource_group_name [String] Name of an Azure Resource group.
@param automation_account_name [String] The name of the automation account.
@param hybrid_runbook_worker_group_name [String] The hybrid runbook worker
group name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Delete",
"a",
"hybrid",
"runbook",
"worker",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/hybrid_runbook_worker_group_operations.rb#L52-L54 | train | Deletes a hybrid runbook worker group. | [
30522,
13366,
3972,
12870,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
19309,
1035,
4070,
1035,
2171,
1010,
8893,
1035,
2448,
8654,
1035,
7309,
1035,
2177,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.start_cluster_upgrade_with_http_info | def start_cluster_upgrade_with_http_info(start_cluster_upgrade_description, timeout:60, custom_headers:nil)
start_cluster_upgrade_async(start_cluster_upgrade_description, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def start_cluster_upgrade_with_http_info(start_cluster_upgrade_description, timeout:60, custom_headers:nil)
start_cluster_upgrade_async(start_cluster_upgrade_description, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"start_cluster_upgrade_with_http_info",
"(",
"start_cluster_upgrade_description",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"start_cluster_upgrade_async",
"(",
"start_cluster_upgrade_description",
",",
"timeout",
":",
"timeout",
",",
"custom_... | Start upgrading the code or configuration version of a Service Fabric
cluster.
Validate the supplied upgrade parameters and start upgrading the code or
configuration version of a Service Fabric cluster if the parameters are
valid.
@param start_cluster_upgrade_description [StartClusterUpgradeDescription]
Describes the parameters for starting a cluster upgrade.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Start",
"upgrading",
"the",
"code",
"or",
"configuration",
"version",
"of",
"a",
"Service",
"Fabric",
"cluster",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L2799-L2801 | train | Start a cluster upgrade. | [
30522,
13366,
2707,
1035,
9324,
1035,
12200,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2707,
1035,
9324,
1035,
12200,
1035,
6412,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2707,
1035,
9324,
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... |
comfy/comfortable-mexican-sofa | lib/comfortable_mexican_sofa/seeds.rb | ComfortableMexicanSofa::Seeds.Exporter.write_file_content | def write_file_content(path, data)
::File.open(::File.join(path), "wb") do |f|
data.each do |item|
f.write("[#{item[:header]}]\n")
f.write("#{item[:content]}\n")
end
end
end | ruby | def write_file_content(path, data)
::File.open(::File.join(path), "wb") do |f|
data.each do |item|
f.write("[#{item[:header]}]\n")
f.write("#{item[:content]}\n")
end
end
end | [
"def",
"write_file_content",
"(",
"path",
",",
"data",
")",
"::",
"File",
".",
"open",
"(",
"::",
"File",
".",
"join",
"(",
"path",
")",
",",
"\"wb\"",
")",
"do",
"|",
"f",
"|",
"data",
".",
"each",
"do",
"|",
"item",
"|",
"f",
".",
"write",
"(... | Writing to the seed file. Takes in file handler and array of hashes with
`header` and `content` keys | [
"Writing",
"to",
"the",
"seed",
"file",
".",
"Takes",
"in",
"file",
"handler",
"and",
"array",
"of",
"hashes",
"with",
"header",
"and",
"content",
"keys"
] | 38a31428f6e2c07d5bda64f0371eebfb29a3abc4 | https://github.com/comfy/comfortable-mexican-sofa/blob/38a31428f6e2c07d5bda64f0371eebfb29a3abc4/lib/comfortable_mexican_sofa/seeds.rb#L98-L105 | train | Write the file content to a file | [
30522,
13366,
4339,
1035,
5371,
1035,
4180,
1006,
4130,
1010,
2951,
1007,
1024,
1024,
5371,
1012,
2330,
1006,
1024,
1024,
5371,
1012,
3693,
1006,
4130,
1007,
1010,
1000,
25610,
1000,
1007,
2079,
1064,
1042,
1064,
2951,
1012,
2169,
2079,
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... |
guard/guard | lib/guard/dsl_describer.rb | Guard.DslDescriber.notifiers | def notifiers
supported = Notifier.supported
Notifier.connect(notify: true, silent: true)
detected = Notifier.detected
Notifier.disconnect
detected_names = detected.map { |item| item[:name] }
final_rows = supported.each_with_object([]) do |(name, _), rows|
available = detected_names.include?(name) ? "✔" : "✘"
notifier = detected.detect { |n| n[:name] == name }
used = notifier ? "✔" : "✘"
options = notifier ? notifier[:options] : {}
if options.empty?
rows << :split
_add_row(rows, name, available, used, "", "")
else
options.each_with_index do |(option, value), index|
if index == 0
rows << :split
_add_row(rows, name, available, used, option.to_s, value.inspect)
else
_add_row(rows, "", "", "", option.to_s, value.inspect)
end
end
end
rows
end
Formatador.display_compact_table(
final_rows.drop(1),
[:Name, :Available, :Used, :Option, :Value]
)
end | ruby | def notifiers
supported = Notifier.supported
Notifier.connect(notify: true, silent: true)
detected = Notifier.detected
Notifier.disconnect
detected_names = detected.map { |item| item[:name] }
final_rows = supported.each_with_object([]) do |(name, _), rows|
available = detected_names.include?(name) ? "✔" : "✘"
notifier = detected.detect { |n| n[:name] == name }
used = notifier ? "✔" : "✘"
options = notifier ? notifier[:options] : {}
if options.empty?
rows << :split
_add_row(rows, name, available, used, "", "")
else
options.each_with_index do |(option, value), index|
if index == 0
rows << :split
_add_row(rows, name, available, used, option.to_s, value.inspect)
else
_add_row(rows, "", "", "", option.to_s, value.inspect)
end
end
end
rows
end
Formatador.display_compact_table(
final_rows.drop(1),
[:Name, :Available, :Used, :Option, :Value]
)
end | [
"def",
"notifiers",
"supported",
"=",
"Notifier",
".",
"supported",
"Notifier",
".",
"connect",
"(",
"notify",
":",
"true",
",",
"silent",
":",
"true",
")",
"detected",
"=",
"Notifier",
".",
"detected",
"Notifier",
".",
"disconnect",
"detected_names",
"=",
"... | Shows all notifiers and their options that are defined in
the `Guardfile`.
@see CLI#show | [
"Shows",
"all",
"notifiers",
"and",
"their",
"options",
"that",
"are",
"defined",
"in",
"the",
"Guardfile",
"."
] | e2508cd83badf0d537dbaba35d307adc35d92e4f | https://github.com/guard/guard/blob/e2508cd83badf0d537dbaba35d307adc35d92e4f/lib/guard/dsl_describer.rb#L109-L146 | train | Returns an array of all notifiers | [
30522,
13366,
2025,
28295,
3569,
1027,
2025,
18095,
1012,
3569,
2025,
18095,
1012,
7532,
1006,
2025,
8757,
1024,
2995,
1010,
4333,
1024,
2995,
1007,
11156,
1027,
2025,
18095,
1012,
11156,
2025,
18095,
1012,
12532,
10087,
6593,
11156,
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... |
kpumuk/meta-tags | lib/meta_tags/renderer.rb | MetaTags.Renderer.render_refresh | def render_refresh(tags)
refresh = meta_tags.extract(:refresh)
tags << Tag.new(:meta, 'http-equiv' => 'refresh', content: refresh.to_s) if refresh.present?
end | ruby | def render_refresh(tags)
refresh = meta_tags.extract(:refresh)
tags << Tag.new(:meta, 'http-equiv' => 'refresh', content: refresh.to_s) if refresh.present?
end | [
"def",
"render_refresh",
"(",
"tags",
")",
"refresh",
"=",
"meta_tags",
".",
"extract",
"(",
":refresh",
")",
"tags",
"<<",
"Tag",
".",
"new",
"(",
":meta",
",",
"'http-equiv'",
"=>",
"'refresh'",
",",
"content",
":",
"refresh",
".",
"to_s",
")",
"if",
... | Renders refresh meta tag.
@param [Array<Tag>] tags a buffer object to store tag in. | [
"Renders",
"refresh",
"meta",
"tag",
"."
] | 03585f95edf96cd17024c5c155ce46ec8bc47232 | https://github.com/kpumuk/meta-tags/blob/03585f95edf96cd17024c5c155ce46ec8bc47232/lib/meta_tags/renderer.rb#L109-L112 | train | Render the refresh meta tag | [
30522,
13366,
17552,
1035,
25416,
21898,
1006,
22073,
1007,
25416,
21898,
1027,
18804,
1035,
22073,
1012,
14817,
1006,
1024,
25416,
21898,
1007,
22073,
1026,
1026,
6415,
1012,
2047,
1006,
1024,
18804,
1010,
1005,
8299,
1011,
1041,
15549,
2615... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hashicorp/vagrant | lib/vagrant/environment.rb | Vagrant.Environment.push | def push(name)
@logger.info("Getting push: #{name}")
name = name.to_sym
pushes = self.vagrantfile.config.push.__compiled_pushes
if !pushes.key?(name)
raise Vagrant::Errors::PushStrategyNotDefined,
name: name,
pushes: pushes.keys
end
strategy, config = pushes[name]
push_registry = Vagrant.plugin("2").manager.pushes
klass, _ = push_registry.get(strategy)
if klass.nil?
raise Vagrant::Errors::PushStrategyNotLoaded,
name: strategy,
pushes: push_registry.keys
end
klass.new(self, config).push
end | ruby | def push(name)
@logger.info("Getting push: #{name}")
name = name.to_sym
pushes = self.vagrantfile.config.push.__compiled_pushes
if !pushes.key?(name)
raise Vagrant::Errors::PushStrategyNotDefined,
name: name,
pushes: pushes.keys
end
strategy, config = pushes[name]
push_registry = Vagrant.plugin("2").manager.pushes
klass, _ = push_registry.get(strategy)
if klass.nil?
raise Vagrant::Errors::PushStrategyNotLoaded,
name: strategy,
pushes: push_registry.keys
end
klass.new(self, config).push
end | [
"def",
"push",
"(",
"name",
")",
"@logger",
".",
"info",
"(",
"\"Getting push: #{name}\"",
")",
"name",
"=",
"name",
".",
"to_sym",
"pushes",
"=",
"self",
".",
"vagrantfile",
".",
"config",
".",
"push",
".",
"__compiled_pushes",
"if",
"!",
"pushes",
".",
... | This executes the push with the given name, raising any exceptions that
occur.
Precondition: the push is not nil and exists. | [
"This",
"executes",
"the",
"push",
"with",
"the",
"given",
"name",
"raising",
"any",
"exceptions",
"that",
"occur",
"."
] | c22a145c59790c098f95d50141d9afb48e1ef55f | https://github.com/hashicorp/vagrant/blob/c22a145c59790c098f95d50141d9afb48e1ef55f/lib/vagrant/environment.rb#L651-L673 | train | Get the push object for a given name | [
30522,
13366,
5245,
1006,
2171,
1007,
1030,
8833,
4590,
1012,
18558,
1006,
1000,
2893,
5245,
1024,
1001,
1063,
2171,
1065,
1000,
1007,
2171,
1027,
2171,
1012,
2000,
1035,
25353,
2213,
13956,
1027,
2969,
1012,
12436,
18980,
8873,
2571,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | produce/lib/produce/service.rb | Produce.Service.update | def update(on, app, options)
updated = valid_services_for(options).count
if options.access_wifi
UI.message("\tAccess WiFi")
if on
app.update_service(Spaceship.app_service.access_wifi.on)
else
app.update_service(Spaceship.app_service.access_wifi.off)
end
end
if options.app_group
UI.message("\tApp Groups")
if on
app.update_service(Spaceship.app_service.app_group.on)
else
app.update_service(Spaceship.app_service.app_group.off)
end
end
if options.apple_pay
UI.message("\tApple Pay")
if on
app.update_service(Spaceship.app_service.apple_pay.on)
else
app.update_service(Spaceship.app_service.apple_pay.off)
end
end
if options.associated_domains
UI.message("\tAssociated Domains")
if on
app.update_service(Spaceship.app_service.associated_domains.on)
else
app.update_service(Spaceship.app_service.associated_domains.off)
end
end
if options.auto_fill_credential
UI.message("\tAutoFill Credential")
if on
app.update_service(Spaceship.app_service.auto_fill_credential.on)
else
app.update_service(Spaceship.app_service.auto_fill_credential.off)
end
end
if options.data_protection
UI.message("\tData Protection")
if on
case options.data_protection
when "complete"
app.update_service(Spaceship.app_service.data_protection.complete)
when "unlessopen"
app.update_service(Spaceship.app_service.data_protection.unless_open)
when "untilfirstauth"
app.update_service(Spaceship.app_service.data_protection.until_first_auth)
else
UI.user_error!("Unknown service '#{options.data_protection}'. Valid values: 'complete', 'unlessopen', 'untilfirstauth'")
end
else
app.update_service(Spaceship.app_service.data_protection.off)
end
end
if options.game_center
UI.message("\tGame Center")
if on
app.update_service(Spaceship.app_service.game_center.on)
else
app.update_service(Spaceship.app_service.game_center.off)
end
end
if options.healthkit
UI.message("\tHealthKit")
if on
app.update_service(Spaceship.app_service.health_kit.on)
else
app.update_service(Spaceship.app_service.health_kit.off)
end
end
if options.homekit
UI.message("\tHomeKit")
if on
app.update_service(Spaceship.app_service.home_kit.on)
else
app.update_service(Spaceship.app_service.home_kit.off)
end
end
if options.wallet
UI.message("\tWallet")
if on
app.update_service(Spaceship.app_service.wallet.on)
else
app.update_service(Spaceship.app_service.wallet.off)
end
end
if options.wireless_conf
UI.message("\tWireless Accessory Configuration")
if on
app.update_service(Spaceship.app_service.wireless_accessory.on)
else
app.update_service(Spaceship.app_service.wireless_accessory.off)
end
end
if options.icloud
UI.message("\tiCloud")
if on
case options.icloud
when "legacy"
app.update_service(Spaceship.app_service.cloud.on)
app.update_service(Spaceship.app_service.cloud_kit.xcode5_compatible)
when "cloudkit"
app.update_service(Spaceship.app_service.cloud.on)
app.update_service(Spaceship.app_service.cloud_kit.cloud_kit)
else
UI.user_error!("Unknown service '#{options.icloud}'. Valid values: 'legacy', 'cloudkit'")
end
else
app.update_service(Spaceship.app_service.cloud.off)
end
end
if options.in_app_purchase
UI.message("\tIn-App Purchase")
if on
app.update_service(Spaceship.app_service.in_app_purchase.on)
else
app.update_service(Spaceship.app_service.in_app_purchase.off)
end
end
if options.inter_app_audio
UI.message("\tInter-App Audio")
if on
app.update_service(Spaceship.app_service.inter_app_audio.on)
else
app.update_service(Spaceship.app_service.inter_app_audio.off)
end
end
if options.personal_vpn
UI.message("\tPersonal VPN")
if on
app.update_service(Spaceship.app_service.personal_vpn.on)
else
app.update_service(Spaceship.app_service.personal_vpn.off)
end
end
# deprecated
if options.passbook
UI.message("\tPassbook")
if on
app.update_service(Spaceship.app_service.passbook.on)
else
app.update_service(Spaceship.app_service.passbook.off)
end
end
if options.push_notification
UI.message("\tPush Notifications")
if on
app.update_service(Spaceship.app_service.push_notification.on)
else
app.update_service(Spaceship.app_service.push_notification.off)
end
end
if options.sirikit
UI.message("\tSiriKit")
if on
app.update_service(Spaceship.app_service.siri_kit.on)
else
app.update_service(Spaceship.app_service.siri_kit.off)
end
end
# deprecated
if options.vpn_conf
UI.message("\tVPN Configuration")
if on
app.update_service(Spaceship.app_service.vpn_configuration.on)
else
app.update_service(Spaceship.app_service.vpn_configuration.off)
end
end
if options.network_extension
UI.message("\tNetwork Extension")
if on
app.update_service(Spaceship.app_service.network_extension.on)
else
app.update_service(Spaceship.app_service.network_extension.off)
end
end
if options.hotspot
UI.message("\tHotspot")
if on
app.update_service(Spaceship.app_service.hotspot.on)
else
app.update_service(Spaceship.app_service.hotspot.off)
end
end
if options.multipath
UI.message("\tMultipath")
if on
app.update_service(Spaceship.app_service.multipath.on)
else
app.update_service(Spaceship.app_service.multipath.off)
end
end
if options.nfc_tag_reading
UI.message("\tNFC Tag Reading")
if on
app.update_service(Spaceship.app_service.nfc_tag_reading.on)
else
app.update_service(Spaceship.app_service.nfc_tag_reading.off)
end
end
updated
end | ruby | def update(on, app, options)
updated = valid_services_for(options).count
if options.access_wifi
UI.message("\tAccess WiFi")
if on
app.update_service(Spaceship.app_service.access_wifi.on)
else
app.update_service(Spaceship.app_service.access_wifi.off)
end
end
if options.app_group
UI.message("\tApp Groups")
if on
app.update_service(Spaceship.app_service.app_group.on)
else
app.update_service(Spaceship.app_service.app_group.off)
end
end
if options.apple_pay
UI.message("\tApple Pay")
if on
app.update_service(Spaceship.app_service.apple_pay.on)
else
app.update_service(Spaceship.app_service.apple_pay.off)
end
end
if options.associated_domains
UI.message("\tAssociated Domains")
if on
app.update_service(Spaceship.app_service.associated_domains.on)
else
app.update_service(Spaceship.app_service.associated_domains.off)
end
end
if options.auto_fill_credential
UI.message("\tAutoFill Credential")
if on
app.update_service(Spaceship.app_service.auto_fill_credential.on)
else
app.update_service(Spaceship.app_service.auto_fill_credential.off)
end
end
if options.data_protection
UI.message("\tData Protection")
if on
case options.data_protection
when "complete"
app.update_service(Spaceship.app_service.data_protection.complete)
when "unlessopen"
app.update_service(Spaceship.app_service.data_protection.unless_open)
when "untilfirstauth"
app.update_service(Spaceship.app_service.data_protection.until_first_auth)
else
UI.user_error!("Unknown service '#{options.data_protection}'. Valid values: 'complete', 'unlessopen', 'untilfirstauth'")
end
else
app.update_service(Spaceship.app_service.data_protection.off)
end
end
if options.game_center
UI.message("\tGame Center")
if on
app.update_service(Spaceship.app_service.game_center.on)
else
app.update_service(Spaceship.app_service.game_center.off)
end
end
if options.healthkit
UI.message("\tHealthKit")
if on
app.update_service(Spaceship.app_service.health_kit.on)
else
app.update_service(Spaceship.app_service.health_kit.off)
end
end
if options.homekit
UI.message("\tHomeKit")
if on
app.update_service(Spaceship.app_service.home_kit.on)
else
app.update_service(Spaceship.app_service.home_kit.off)
end
end
if options.wallet
UI.message("\tWallet")
if on
app.update_service(Spaceship.app_service.wallet.on)
else
app.update_service(Spaceship.app_service.wallet.off)
end
end
if options.wireless_conf
UI.message("\tWireless Accessory Configuration")
if on
app.update_service(Spaceship.app_service.wireless_accessory.on)
else
app.update_service(Spaceship.app_service.wireless_accessory.off)
end
end
if options.icloud
UI.message("\tiCloud")
if on
case options.icloud
when "legacy"
app.update_service(Spaceship.app_service.cloud.on)
app.update_service(Spaceship.app_service.cloud_kit.xcode5_compatible)
when "cloudkit"
app.update_service(Spaceship.app_service.cloud.on)
app.update_service(Spaceship.app_service.cloud_kit.cloud_kit)
else
UI.user_error!("Unknown service '#{options.icloud}'. Valid values: 'legacy', 'cloudkit'")
end
else
app.update_service(Spaceship.app_service.cloud.off)
end
end
if options.in_app_purchase
UI.message("\tIn-App Purchase")
if on
app.update_service(Spaceship.app_service.in_app_purchase.on)
else
app.update_service(Spaceship.app_service.in_app_purchase.off)
end
end
if options.inter_app_audio
UI.message("\tInter-App Audio")
if on
app.update_service(Spaceship.app_service.inter_app_audio.on)
else
app.update_service(Spaceship.app_service.inter_app_audio.off)
end
end
if options.personal_vpn
UI.message("\tPersonal VPN")
if on
app.update_service(Spaceship.app_service.personal_vpn.on)
else
app.update_service(Spaceship.app_service.personal_vpn.off)
end
end
# deprecated
if options.passbook
UI.message("\tPassbook")
if on
app.update_service(Spaceship.app_service.passbook.on)
else
app.update_service(Spaceship.app_service.passbook.off)
end
end
if options.push_notification
UI.message("\tPush Notifications")
if on
app.update_service(Spaceship.app_service.push_notification.on)
else
app.update_service(Spaceship.app_service.push_notification.off)
end
end
if options.sirikit
UI.message("\tSiriKit")
if on
app.update_service(Spaceship.app_service.siri_kit.on)
else
app.update_service(Spaceship.app_service.siri_kit.off)
end
end
# deprecated
if options.vpn_conf
UI.message("\tVPN Configuration")
if on
app.update_service(Spaceship.app_service.vpn_configuration.on)
else
app.update_service(Spaceship.app_service.vpn_configuration.off)
end
end
if options.network_extension
UI.message("\tNetwork Extension")
if on
app.update_service(Spaceship.app_service.network_extension.on)
else
app.update_service(Spaceship.app_service.network_extension.off)
end
end
if options.hotspot
UI.message("\tHotspot")
if on
app.update_service(Spaceship.app_service.hotspot.on)
else
app.update_service(Spaceship.app_service.hotspot.off)
end
end
if options.multipath
UI.message("\tMultipath")
if on
app.update_service(Spaceship.app_service.multipath.on)
else
app.update_service(Spaceship.app_service.multipath.off)
end
end
if options.nfc_tag_reading
UI.message("\tNFC Tag Reading")
if on
app.update_service(Spaceship.app_service.nfc_tag_reading.on)
else
app.update_service(Spaceship.app_service.nfc_tag_reading.off)
end
end
updated
end | [
"def",
"update",
"(",
"on",
",",
"app",
",",
"options",
")",
"updated",
"=",
"valid_services_for",
"(",
"options",
")",
".",
"count",
"if",
"options",
".",
"access_wifi",
"UI",
".",
"message",
"(",
"\"\\tAccess WiFi\"",
")",
"if",
"on",
"app",
".",
"upda... | rubocop:disable Metrics/PerceivedComplexity | [
"rubocop",
":",
"disable",
"Metrics",
"/",
"PerceivedComplexity"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/produce/lib/produce/service.rb#L47-L300 | train | Updates the service | [
30522,
13366,
10651,
1006,
2006,
1010,
10439,
1010,
7047,
1007,
7172,
1027,
9398,
1035,
2578,
1035,
2005,
1006,
7047,
1007,
1012,
4175,
2065,
7047,
1012,
3229,
1035,
15536,
8873,
21318,
1012,
4471,
1006,
1000,
1032,
11937,
9468,
7971,
15536... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_links/lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb | Azure::Links::Mgmt::V2016_09_01.ResourceLinks.list_at_subscription_as_lazy | def list_at_subscription_as_lazy(filter:nil, custom_headers:nil)
response = list_at_subscription_async(filter:filter, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_at_subscription_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_at_subscription_as_lazy(filter:nil, custom_headers:nil)
response = list_at_subscription_async(filter:filter, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_at_subscription_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_at_subscription_as_lazy",
"(",
"filter",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_at_subscription_async",
"(",
"filter",
":",
"filter",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"unless",
"response",... | Gets all the linked resources for the subscription.
@param filter [String] The filter to apply on the list resource links
operation. The supported filter for list resource links is targetid. For
example, $filter=targetid eq {value}
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ResourceLinkResult] which provide lazy access to pages of the
response. | [
"Gets",
"all",
"the",
"linked",
"resources",
"for",
"the",
"subscription",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_links/lib/2016-09-01/generated/azure_mgmt_links/resource_links.rb#L719-L728 | train | Gets the list of all the available Central App Service Environment objects. | [
30522,
13366,
2862,
1035,
2012,
1035,
15002,
1035,
2004,
1035,
13971,
1006,
11307,
1024,
9152,
2140,
1010,
30524,
1024,
11307,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
20346,
2015,
1007,
1012,
3643,
999,
4983,
3433,
1012,
9152,
2140... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_marketplace_ordering/lib/2015-06-01/generated/azure_mgmt_marketplace_ordering/marketplace_agreements.rb | Azure::MarketplaceOrdering::Mgmt::V2015_06_01.MarketplaceAgreements.cancel | def cancel(publisher_id, offer_id, plan_id, custom_headers:nil)
response = cancel_async(publisher_id, offer_id, plan_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def cancel(publisher_id, offer_id, plan_id, custom_headers:nil)
response = cancel_async(publisher_id, offer_id, plan_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"cancel",
"(",
"publisher_id",
",",
"offer_id",
",",
"plan_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"cancel_async",
"(",
"publisher_id",
",",
"offer_id",
",",
"plan_id",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
... | Cancel marketplace terms.
@param publisher_id [String] Publisher identifier string of image being
deployed.
@param offer_id [String] Offer identifier string of image being deployed.
@param plan_id [String] Plan identifier string of image being deployed.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [AgreementTerms] operation results. | [
"Cancel",
"marketplace",
"terms",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_marketplace_ordering/lib/2015-06-01/generated/azure_mgmt_marketplace_ordering/marketplace_agreements.rb#L349-L352 | train | Cancels an offer plan. | [
30522,
13366,
17542,
1006,
6674,
1035,
8909,
1010,
3749,
1035,
8909,
1010,
2933,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
17542,
1035,
2004,
6038,
2278,
1006,
6674,
1035,
8909,
1010,
3749,
1035,
8909,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.disable_service_backup_with_http_info | def disable_service_backup_with_http_info(service_id, timeout:60, custom_headers:nil)
disable_service_backup_async(service_id, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def disable_service_backup_with_http_info(service_id, timeout:60, custom_headers:nil)
disable_service_backup_async(service_id, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"disable_service_backup_with_http_info",
"(",
"service_id",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"disable_service_backup_async",
"(",
"service_id",
",",
"timeout",
":",
"timeout",
",",
"custom_headers",
":custom_headers",
")",
".",... | Disables periodic backup of Service Fabric service which was previously
enabled.
Disables periodic backup of Service Fabric service which was previously
enabled. Backup must be explicitly enabled before it can be disabled.
In case the backup is enabled for the Service Fabric application, which this
service is part of, this service would continue to be periodically backed up
as per the policy mapped at the application level.
@param service_id [String] The identity of the service. This is typically the
full name of the service without the 'fabric:' URI scheme.
Starting from version 6.0, hierarchical names are delimited with the "~"
character.
For example, if the service name is "fabric:/myapp/app1/svc1", the service
identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
versions.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Disables",
"periodic",
"backup",
"of",
"Service",
"Fabric",
"service",
"which",
"was",
"previously",
"enabled",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L24009-L24011 | train | Disables backup of the specified service. | [
30522,
13366,
4487,
19150,
1035,
2326,
1035,
10200,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2326,
1035,
8909,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4487,
19150,
1035,
2326,
1035,
10200,
1035... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
gocardless/hutch | lib/hutch/broker.rb | Hutch.Broker.unbind_redundant_bindings | def unbind_redundant_bindings(queue, routing_keys)
return unless http_api_use_enabled?
bindings.each do |dest, keys|
next unless dest == queue.name
keys.reject { |key| routing_keys.include?(key) }.each do |key|
logger.debug "removing redundant binding #{queue.name} <--> #{key}"
queue.unbind(exchange, routing_key: key)
end
end
end | ruby | def unbind_redundant_bindings(queue, routing_keys)
return unless http_api_use_enabled?
bindings.each do |dest, keys|
next unless dest == queue.name
keys.reject { |key| routing_keys.include?(key) }.each do |key|
logger.debug "removing redundant binding #{queue.name} <--> #{key}"
queue.unbind(exchange, routing_key: key)
end
end
end | [
"def",
"unbind_redundant_bindings",
"(",
"queue",
",",
"routing_keys",
")",
"return",
"unless",
"http_api_use_enabled?",
"bindings",
".",
"each",
"do",
"|",
"dest",
",",
"keys",
"|",
"next",
"unless",
"dest",
"==",
"queue",
".",
"name",
"keys",
".",
"reject",
... | Find the existing bindings, and unbind any redundant bindings | [
"Find",
"the",
"existing",
"bindings",
"and",
"unbind",
"any",
"redundant",
"bindings"
] | 9314b3b8c84abeb78170730757f3eb8ccc4f54c5 | https://github.com/gocardless/hutch/blob/9314b3b8c84abeb78170730757f3eb8ccc4f54c5/lib/hutch/broker.rb#L194-L204 | train | Unbinds redundant bindings from the queue | [
30522,
13366,
4895,
8428,
2094,
1035,
21707,
1035,
8031,
2015,
1006,
24240,
1010,
16972,
1035,
6309,
1007,
2709,
4983,
8299,
1035,
17928,
1035,
2224,
1035,
9124,
1029,
8031,
2015,
1012,
2169,
2079,
1064,
4078,
2102,
1010,
6309,
1064,
2279,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-iam/lib/aws-sdk-iam/user.rb | Aws::IAM.User.enable_mfa | def enable_mfa(options = {})
options = options.merge(user_name: @name)
resp = @client.enable_mfa_device(options)
MfaDevice.new(
user_name: @name,
serial_number: options[:serial_number],
client: @client
)
end | ruby | def enable_mfa(options = {})
options = options.merge(user_name: @name)
resp = @client.enable_mfa_device(options)
MfaDevice.new(
user_name: @name,
serial_number: options[:serial_number],
client: @client
)
end | [
"def",
"enable_mfa",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"user_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"enable_mfa_device",
"(",
"options",
")",
"MfaDevice",
".",
"new",
"(",
"user_name",
":",
... | @example Request syntax with placeholder values
mfadevice = user.enable_mfa({
serial_number: "serialNumberType", # required
authentication_code_1: "authenticationCodeType", # required
authentication_code_2: "authenticationCodeType", # required
})
@param [Hash] options ({})
@option options [required, String] :serial_number
The serial number that uniquely identifies the MFA device. For virtual
MFA devices, the serial number is the device ARN.
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
@option options [required, String] :authentication_code_1
An authentication code emitted by the device.
The format for this parameter is a string of six digits.
Submit your request immediately after generating the authentication
codes. If you generate the codes and then wait too long to submit the
request, the MFA device successfully associates with the user but the
MFA device becomes out of sync. This happens because time-based
one-time passwords (TOTP) expire after a short period of time. If this
happens, you can [resync the device][1].
[1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_sync.html
@option options [required, String] :authentication_code_2
A subsequent authentication code emitted by the device.
The format for this parameter is a string of six digits.
Submit your request immediately after generating the authentication
codes. If you generate the codes and then wait too long to submit the
request, the MFA device successfully associates with the user but the
MFA device becomes out of sync. This happens because time-based
one-time passwords (TOTP) expire after a short period of time. If this
happens, you can [resync the device][1].
[1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_sync.html
@return [MfaDevice] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-iam/lib/aws-sdk-iam/user.rb#L588-L596 | train | Enable the MFA device | [
30522,
13366,
9585,
1035,
26913,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
5310,
1035,
2171,
1024,
1030,
2171,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
9585,
1035,
26913,
1035,
5080,
1006,
7047,
1007,
26913,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_media_services/lib/2018-07-01/generated/azure_mgmt_media_services/jobs.rb | Azure::MediaServices::Mgmt::V2018_07_01.Jobs.cancel_job_with_http_info | def cancel_job_with_http_info(resource_group_name, account_name, transform_name, job_name, custom_headers:nil)
cancel_job_async(resource_group_name, account_name, transform_name, job_name, custom_headers:custom_headers).value!
end | ruby | def cancel_job_with_http_info(resource_group_name, account_name, transform_name, job_name, custom_headers:nil)
cancel_job_async(resource_group_name, account_name, transform_name, job_name, custom_headers:custom_headers).value!
end | [
"def",
"cancel_job_with_http_info",
"(",
"resource_group_name",
",",
"account_name",
",",
"transform_name",
",",
"job_name",
",",
"custom_headers",
":",
"nil",
")",
"cancel_job_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"transform_name",
",",
"job_nam... | Cancel Job
Cancel a Job.
@param resource_group_name [String] The name of the resource group within the
Azure subscription.
@param account_name [String] The Media Services account name.
@param transform_name [String] The Transform name.
@param job_name [String] The Job name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Cancel",
"Job"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_media_services/lib/2018-07-01/generated/azure_mgmt_media_services/jobs.rb#L625-L627 | train | Cancels a job. | [
30522,
13366,
17542,
1035,
3105,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
10938,
1035,
2171,
1010,
3105,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
17542,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/global_users.rb | Azure::Labservices::Mgmt::V2018_10_15.GlobalUsers.get_operation_batch_status | def get_operation_batch_status(user_name, operation_batch_status_payload, custom_headers:nil)
response = get_operation_batch_status_async(user_name, operation_batch_status_payload, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_operation_batch_status(user_name, operation_batch_status_payload, custom_headers:nil)
response = get_operation_batch_status_async(user_name, operation_batch_status_payload, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_operation_batch_status",
"(",
"user_name",
",",
"operation_batch_status_payload",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_operation_batch_status_async",
"(",
"user_name",
",",
"operation_batch_status_payload",
",",
"custom_headers",
":custom_... | Get batch operation status
@param user_name [String] The name of the user.
@param operation_batch_status_payload [OperationBatchStatusPayload] Payload
to get the status of an operation
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OperationBatchStatusResponse] operation results. | [
"Get",
"batch",
"operation",
"status"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/global_users.rb#L145-L148 | train | Gets the batch status of the user. | [
30522,
13366,
2131,
1035,
3169,
1035,
14108,
1035,
3570,
1006,
5310,
1035,
2171,
1010,
3169,
1035,
14108,
1035,
3570,
1035,
18093,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
3169,
1035,
14108,
1035,
3570,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/managed_clusters.rb | Azure::ContainerService::Mgmt::V2019_02_01.ManagedClusters.create_or_update_async | def create_or_update_async(resource_group_name, resource_name, parameters, custom_headers:nil)
# Send request
promise = begin_create_or_update_async(resource_group_name, resource_name, parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::ContainerService::Mgmt::V2019_02_01::Models::ManagedCluster.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, resource_name, parameters, custom_headers:nil)
# Send request
promise = begin_create_or_update_async(resource_group_name, resource_name, parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::ContainerService::Mgmt::V2019_02_01::Models::ManagedCluster.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",
",",
"resource_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"resource_name",
",",
"paramete... | @param resource_group_name [String] The name of the resource group.
@param resource_name [String] The name of the managed cluster resource.
@param parameters [ManagedCluster] Parameters supplied to the Create or
Update a Managed Cluster operation.
@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",
"resource_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"managed",
"cluster",
"resource",
".",
"@param",
"parameters",
"[",
"ManagedCl... | 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/managed_clusters.rb#L763-L779 | train | Creates or updates a managed cluster. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7692,
1035,
2171,
1010,
11709,
1010,
7661,
30524,
3443,
1035,
2030,
1035,
10651,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Dynamoid/dynamoid | lib/dynamoid/fields.rb | Dynamoid.Fields.set_created_at | def set_created_at
self.created_at ||= DateTime.now.in_time_zone(Time.zone) if Dynamoid::Config.timestamps
end | ruby | def set_created_at
self.created_at ||= DateTime.now.in_time_zone(Time.zone) if Dynamoid::Config.timestamps
end | [
"def",
"set_created_at",
"self",
".",
"created_at",
"||=",
"DateTime",
".",
"now",
".",
"in_time_zone",
"(",
"Time",
".",
"zone",
")",
"if",
"Dynamoid",
"::",
"Config",
".",
"timestamps",
"end"
] | Automatically called during the created callback to set the created_at time.
@since 0.2.0 | [
"Automatically",
"called",
"during",
"the",
"created",
"callback",
"to",
"set",
"the",
"created_at",
"time",
"."
] | 9e3d006b039e45877b003564ded65509b10b6354 | https://github.com/Dynamoid/dynamoid/blob/9e3d006b039e45877b003564ded65509b10b6354/lib/dynamoid/fields.rb#L160-L162 | train | Set the created_at property for the object. | [
30522,
13366,
2275,
1035,
2580,
1035,
2012,
2969,
1012,
2580,
1035,
2012,
1064,
1064,
1027,
3058,
7292,
1012,
2085,
1012,
1999,
1035,
2051,
1035,
4224,
1006,
2051,
1012,
4224,
1007,
2065,
17205,
3593,
1024,
1024,
9530,
8873,
2290,
1012,
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... |
decidim/decidim | decidim-core/app/helpers/decidim/omniauth_helper.rb | Decidim.OmniauthHelper.oauth_icon | def oauth_icon(provider)
info = Rails.application.secrets.dig(:omniauth, provider.to_sym)
if info
icon_path = info[:icon_path]
return external_icon(icon_path) if icon_path
name = info[:icon]
end
name ||= normalize_provider_name(provider)
icon(name)
end | ruby | def oauth_icon(provider)
info = Rails.application.secrets.dig(:omniauth, provider.to_sym)
if info
icon_path = info[:icon_path]
return external_icon(icon_path) if icon_path
name = info[:icon]
end
name ||= normalize_provider_name(provider)
icon(name)
end | [
"def",
"oauth_icon",
"(",
"provider",
")",
"info",
"=",
"Rails",
".",
"application",
".",
"secrets",
".",
"dig",
"(",
":omniauth",
",",
"provider",
".",
"to_sym",
")",
"if",
"info",
"icon_path",
"=",
"info",
"[",
":icon_path",
"]",
"return",
"external_icon... | Public: icon for omniauth buttons | [
"Public",
":",
"icon",
"for",
"omniauth",
"buttons"
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/app/helpers/decidim/omniauth_helper.rb#L25-L37 | train | Returns the icon for the given provider. | [
30522,
13366,
1051,
4887,
2705,
1035,
12696,
1006,
10802,
1007,
18558,
1027,
15168,
1012,
4646,
1012,
7800,
1012,
10667,
1006,
1024,
18168,
6200,
14317,
1010,
10802,
1012,
2000,
1035,
25353,
2213,
1007,
2065,
18558,
12696,
1035,
4130,
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... |
projectcypress/health-data-standards | lib/hqmf-parser/2.0/population_criteria.rb | HQMF2.PopulationCriteria.handle_preconditions | def handle_preconditions(id_generator)
# Nest multiple preconditions under a single root precondition
@preconditions = @entry.xpath('./*/cda:precondition[not(@nullFlavor)]', HQMF2::Document::NAMESPACES)
.collect do |pre|
precondition = Precondition.parse(pre, @doc, id_generator)
precondition.reference.nil? && precondition.preconditions.empty? ? nil : precondition
end
# Remove uneeded nils from the array
@preconditions.compact!
end | ruby | def handle_preconditions(id_generator)
# Nest multiple preconditions under a single root precondition
@preconditions = @entry.xpath('./*/cda:precondition[not(@nullFlavor)]', HQMF2::Document::NAMESPACES)
.collect do |pre|
precondition = Precondition.parse(pre, @doc, id_generator)
precondition.reference.nil? && precondition.preconditions.empty? ? nil : precondition
end
# Remove uneeded nils from the array
@preconditions.compact!
end | [
"def",
"handle_preconditions",
"(",
"id_generator",
")",
"# Nest multiple preconditions under a single root precondition",
"@preconditions",
"=",
"@entry",
".",
"xpath",
"(",
"'./*/cda:precondition[not(@nullFlavor)]'",
",",
"HQMF2",
"::",
"Document",
"::",
"NAMESPACES",
")",
... | specifically handles extracting the preconditions for the population criteria | [
"specifically",
"handles",
"extracting",
"the",
"preconditions",
"for",
"the",
"population",
"criteria"
] | 252d4f0927c513eacde6b9ea41b76faa1423c34b | https://github.com/projectcypress/health-data-standards/blob/252d4f0927c513eacde6b9ea41b76faa1423c34b/lib/hqmf-parser/2.0/population_criteria.rb#L57-L66 | train | Returns the array of preconditions for this entry | [
30522,
13366,
5047,
1035,
3653,
8663,
20562,
2015,
1006,
8909,
1035,
13103,
1007,
1001,
9089,
3674,
3653,
8663,
20562,
2015,
2104,
1037,
2309,
7117,
3653,
8663,
20562,
1030,
3653,
8663,
20562,
2015,
1027,
1030,
4443,
1012,
26726,
8988,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb | Azure::CognitiveServices::ComputerVision::V2_0.ComputerVisionClient.generate_thumbnail_with_http_info | def generate_thumbnail_with_http_info(width, height, url, smart_cropping:false, custom_headers:nil)
generate_thumbnail_async(width, height, url, smart_cropping:smart_cropping, custom_headers:custom_headers).value!
end | ruby | def generate_thumbnail_with_http_info(width, height, url, smart_cropping:false, custom_headers:nil)
generate_thumbnail_async(width, height, url, smart_cropping:smart_cropping, custom_headers:custom_headers).value!
end | [
"def",
"generate_thumbnail_with_http_info",
"(",
"width",
",",
"height",
",",
"url",
",",
"smart_cropping",
":",
"false",
",",
"custom_headers",
":",
"nil",
")",
"generate_thumbnail_async",
"(",
"width",
",",
"height",
",",
"url",
",",
"smart_cropping",
":smart_cr... | This operation generates a thumbnail image with the user-specified width and
height. By default, the service analyzes the image, identifies the region of
interest (ROI), and generates smart cropping coordinates based on the ROI.
Smart cropping helps when you specify an aspect ratio that differs from that
of the input image.
A successful response contains the thumbnail image binary. If the request
failed, the response contains an error code and a message to help determine
what went wrong.
Upon failure, the error code and an error message are returned. The error
code could be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize,
InvalidThumbnailSize, NotSupportedImage, FailedToProcess, Timeout, or
InternalServerError.
@param width [Integer] Width of the thumbnail, in pixels. It must be between
1 and 1024. Recommended minimum of 50.
@param height [Integer] Height of the thumbnail, in pixels. It must be
between 1 and 1024. Recommended minimum of 50.
@param url [String] Publicly reachable URL of an image.
@param smart_cropping [Boolean] Boolean flag for enabling smart cropping.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"This",
"operation",
"generates",
"a",
"thumbnail",
"image",
"with",
"the",
"user",
"-",
"specified",
"width",
"and",
"height",
".",
"By",
"default",
"the",
"service",
"analyzes",
"the",
"image",
"identifies",
"the",
"region",
"of",
"interest",
"(",
"ROI",
"... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb#L1154-L1156 | train | Generates a thumbnail of the image. | [
30522,
13366,
9699,
1035,
7639,
25464,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
9381,
1010,
4578,
1010,
24471,
2140,
1010,
6047,
1035,
10416,
4691,
1024,
6270,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
9699,
1035,
7639,
25464... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/interceptable.rb | Mongoid.Interceptable.cascadable_children | def cascadable_children(kind, children = Set.new)
embedded_relations.each_pair do |name, association|
next unless association.cascading_callbacks?
without_autobuild do
delayed_pulls = delayed_atomic_pulls[name]
delayed_unsets = delayed_atomic_unsets[name]
children.merge(delayed_pulls) if delayed_pulls
children.merge(delayed_unsets) if delayed_unsets
relation = send(name)
Array.wrap(relation).each do |child|
next if children.include?(child)
children.add(child) if cascadable_child?(kind, child, association)
child.send(:cascadable_children, kind, children)
end
end
end
children.to_a
end | ruby | def cascadable_children(kind, children = Set.new)
embedded_relations.each_pair do |name, association|
next unless association.cascading_callbacks?
without_autobuild do
delayed_pulls = delayed_atomic_pulls[name]
delayed_unsets = delayed_atomic_unsets[name]
children.merge(delayed_pulls) if delayed_pulls
children.merge(delayed_unsets) if delayed_unsets
relation = send(name)
Array.wrap(relation).each do |child|
next if children.include?(child)
children.add(child) if cascadable_child?(kind, child, association)
child.send(:cascadable_children, kind, children)
end
end
end
children.to_a
end | [
"def",
"cascadable_children",
"(",
"kind",
",",
"children",
"=",
"Set",
".",
"new",
")",
"embedded_relations",
".",
"each_pair",
"do",
"|",
"name",
",",
"association",
"|",
"next",
"unless",
"association",
".",
"cascading_callbacks?",
"without_autobuild",
"do",
... | Get all the child embedded documents that are flagged as cascadable.
@example Get all the cascading children.
document.cascadable_children(:update)
@param [ Symbol ] kind The type of callback.
@return [ Array<Document> ] The children.
@since 2.3.0 | [
"Get",
"all",
"the",
"child",
"embedded",
"documents",
"that",
"are",
"flagged",
"as",
"cascadable",
"."
] | 56976e32610f4c2450882b0bfe14da099f0703f4 | https://github.com/mongodb/mongoid/blob/56976e32610f4c2450882b0bfe14da099f0703f4/lib/mongoid/interceptable.rb#L163-L180 | train | Returns the cascadable children of the given kind. | [
30522,
13366,
25222,
3540,
20782,
1035,
2336,
1006,
2785,
1010,
2336,
1027,
2275,
1012,
2047,
1007,
11157,
1035,
4262,
1012,
2169,
1035,
3940,
2079,
1064,
30524,
8569,
4014,
2094,
2079,
8394,
1035,
8005,
1027,
8394,
1035,
9593,
1035,
8005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_face/lib/1.0/generated/azure_cognitiveservices_face/large_person_group_person.rb | Azure::CognitiveServices::Face::V1_0.LargePersonGroupPerson.get | def get(large_person_group_id, person_id, custom_headers:nil)
response = get_async(large_person_group_id, person_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get(large_person_group_id, person_id, custom_headers:nil)
response = get_async(large_person_group_id, person_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get",
"(",
"large_person_group_id",
",",
"person_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_async",
"(",
"large_person_group_id",
",",
"person_id",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body... | Retrieve a person's information, including registered persisted faces, name
and userData.
@param large_person_group_id [String] Id referencing a particular large
person group.
@param person_id Id referencing a particular person.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Person] operation results. | [
"Retrieve",
"a",
"person",
"s",
"information",
"including",
"registered",
"persisted",
"faces",
"name",
"and",
"userData",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_face/lib/1.0/generated/azure_cognitiveservices_face/large_person_group_person.rb#L365-L368 | train | Gets the large person group s segmentation. | [
30522,
13366,
2131,
1006,
2312,
1035,
2711,
1035,
2177,
1035,
8909,
1010,
2711,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
2004,
6038,
2278,
1006,
2312,
1035,
2711,
1035,
2177,
1035,
8909,
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 | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/versions.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Versions.import | def import(app_id, luis_app, version_id:nil, custom_headers:nil)
response = import_async(app_id, luis_app, version_id:version_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def import(app_id, luis_app, version_id:nil, custom_headers:nil)
response = import_async(app_id, luis_app, version_id:version_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"import",
"(",
"app_id",
",",
"luis_app",
",",
"version_id",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"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 [String] operation results. | [
"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#L645-L648 | train | Import a luis language into a LUIS language. | [
30522,
13366,
12324,
1006,
10439,
1035,
8909,
1010,
6446,
1035,
10439,
1010,
2544,
1035,
8909,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
12324,
1035,
2004,
6038,
2278,
1006,
10439,
1035,
8909,
1010... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cucumber/aruba | lib/aruba/hooks.rb | Aruba.Hooks.append | def append(label, block)
if store.key?(label.to_sym) && store[label.to_sym].respond_to?(:<<)
store[label.to_sym] << block
else
store[label.to_sym] = []
store[label.to_sym] << block
end
end | ruby | def append(label, block)
if store.key?(label.to_sym) && store[label.to_sym].respond_to?(:<<)
store[label.to_sym] << block
else
store[label.to_sym] = []
store[label.to_sym] << block
end
end | [
"def",
"append",
"(",
"label",
",",
"block",
")",
"if",
"store",
".",
"key?",
"(",
"label",
".",
"to_sym",
")",
"&&",
"store",
"[",
"label",
".",
"to_sym",
"]",
".",
"respond_to?",
"(",
":<<",
")",
"store",
"[",
"label",
".",
"to_sym",
"]",
"<<",
... | Create store
Add new hook
@param [String, Symbol] label
The name of the hook
@param [Proc] block
The block which should be run for the hook | [
"Create",
"store",
"Add",
"new",
"hook"
] | add17615322f575588aef1fccce875396cdf36e9 | https://github.com/cucumber/aruba/blob/add17615322f575588aef1fccce875396cdf36e9/lib/aruba/hooks.rb#L23-L30 | train | Append a block to the cache | [
30522,
13366,
10439,
10497,
1006,
3830,
1010,
3796,
1007,
2065,
3573,
1012,
3145,
1029,
1006,
3830,
1012,
2000,
1035,
25353,
2213,
1007,
1004,
1004,
3573,
1031,
3830,
1012,
2000,
1035,
25353,
2213,
1033,
1012,
6869,
1035,
2000,
1029,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cheezy/page-object | lib/page-object/accessors.rb | PageObject.Accessors.file_field | def file_field(name, identifier={:index => 0}, &block)
standard_methods(name, identifier, 'file_field_for', &block)
define_method("#{name}=") do |value|
return platform.file_field_value_set(identifier.clone, value) unless block_given?
self.send("#{name}_element").value = value
end
end | ruby | def file_field(name, identifier={:index => 0}, &block)
standard_methods(name, identifier, 'file_field_for', &block)
define_method("#{name}=") do |value|
return platform.file_field_value_set(identifier.clone, value) unless block_given?
self.send("#{name}_element").value = value
end
end | [
"def",
"file_field",
"(",
"name",
",",
"identifier",
"=",
"{",
":index",
"=>",
"0",
"}",
",",
"&",
"block",
")",
"standard_methods",
"(",
"name",
",",
"identifier",
",",
"'file_field_for'",
",",
"block",
")",
"define_method",
"(",
"\"#{name}=\"",
")",
"do"... | adds three methods - one to set the file for a file field, another to retrieve
the file field element, and another to check it's existence.
@example
file_field(:the_file, :id => 'file_to_upload')
# will generate 'the_file=', 'the_file_element', and 'the_file?' methods
@param [Symbol] the name used for the generated methods
@param [Hash] identifier how we find a file_field.
@param optional block to be invoked when element method is called | [
"adds",
"three",
"methods",
"-",
"one",
"to",
"set",
"the",
"file",
"for",
"a",
"file",
"field",
"another",
"to",
"retrieve",
"the",
"file",
"field",
"element",
"and",
"another",
"to",
"check",
"it",
"s",
"existence",
"."
] | 850d775bf63768fbb1551a34480195785fe8e193 | https://github.com/cheezy/page-object/blob/850d775bf63768fbb1551a34480195785fe8e193/lib/page-object/accessors.rb#L803-L809 | train | Define a file field. | [
30522,
13366,
5371,
1035,
2492,
1006,
30524,
1004,
3796,
1007,
9375,
1035,
4118,
1006,
1000,
1001,
1063,
2171,
1065,
1027,
1000,
1007,
2079,
1064,
3643,
1064,
2709,
4132,
1012,
5371,
1035,
2492,
1035,
3643,
1035,
2275,
1006,
8909,
4765,
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... |
puppetlabs/puppet | lib/puppet/network/resolver.rb | Puppet::Network.Resolver.find_weighted_server | def find_weighted_server(records)
return nil if records.nil? || records.empty?
return records.first if records.size == 1
# Calculate the sum of all weights in the list of resource records,
# This is used to then select hosts until the weight exceeds what
# random number we selected. For example, if we have weights of 1 8 and 3:
#
# |-|--------|---|
# ^
# We generate a random number 5, and iterate through the records, adding
# the current record's weight to the accumulator until the weight of the
# current record plus previous records is greater than the random number.
total_weight = records.inject(0) { |sum,record|
sum + weight(record)
}
current_weight = 0
chosen_weight = 1 + Kernel.rand(total_weight)
records.each do |record|
current_weight += weight(record)
return record if current_weight >= chosen_weight
end
end | ruby | def find_weighted_server(records)
return nil if records.nil? || records.empty?
return records.first if records.size == 1
# Calculate the sum of all weights in the list of resource records,
# This is used to then select hosts until the weight exceeds what
# random number we selected. For example, if we have weights of 1 8 and 3:
#
# |-|--------|---|
# ^
# We generate a random number 5, and iterate through the records, adding
# the current record's weight to the accumulator until the weight of the
# current record plus previous records is greater than the random number.
total_weight = records.inject(0) { |sum,record|
sum + weight(record)
}
current_weight = 0
chosen_weight = 1 + Kernel.rand(total_weight)
records.each do |record|
current_weight += weight(record)
return record if current_weight >= chosen_weight
end
end | [
"def",
"find_weighted_server",
"(",
"records",
")",
"return",
"nil",
"if",
"records",
".",
"nil?",
"||",
"records",
".",
"empty?",
"return",
"records",
".",
"first",
"if",
"records",
".",
"size",
"==",
"1",
"# Calculate the sum of all weights in the list of resource... | Given a list of records of the same priority, chooses a random one
from among them, favoring those with higher weights.
@param [[Resolv::DNS::Resource::IN::SRV]] records a list of records
of the same priority
@return [Resolv::DNS::Resource::IN:SRV] the chosen record | [
"Given",
"a",
"list",
"of",
"records",
"of",
"the",
"same",
"priority",
"chooses",
"a",
"random",
"one",
"from",
"among",
"them",
"favoring",
"those",
"with",
"higher",
"weights",
"."
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/network/resolver.rb#L87-L110 | train | Find a weighted server based on the weight of the records. | [
30522,
13366,
2424,
1035,
18215,
1035,
8241,
1006,
2636,
1007,
2709,
9152,
2140,
2065,
2636,
1012,
9152,
2140,
1029,
1064,
1064,
2636,
1012,
4064,
1029,
2709,
2636,
1012,
2034,
2065,
2636,
1012,
2946,
1027,
1027,
1015,
1001,
18422,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
huginn/huginn | app/concerns/liquid_interpolatable.rb | LiquidInterpolatable.Filters.uri_expand | def uri_expand(url, limit = 5)
case url
when URI
uri = url
else
url = url.to_s
begin
uri = Utils.normalize_uri(url)
rescue URI::Error
return url
end
end
http = Faraday.new do |builder|
builder.adapter :net_http
# builder.use FaradayMiddleware::FollowRedirects, limit: limit
# ...does not handle non-HTTP URLs.
end
limit.times do
begin
case uri
when URI::HTTP
return uri.to_s unless uri.host
response = http.head(uri)
case response.status
when 301, 302, 303, 307
if location = response['location']
uri += Utils.normalize_uri(location)
next
end
end
end
rescue URI::Error, Faraday::Error, SystemCallError => e
logger.error "#{e.class} in #{__method__}(#{url.inspect}) [uri=#{uri.to_s.inspect}]: #{e.message}:\n#{e.backtrace.join("\n")}"
end
return uri.to_s
end
logger.error "Too many rediretions in #{__method__}(#{url.inspect}) [uri=#{uri.to_s.inspect}]"
url
end | ruby | def uri_expand(url, limit = 5)
case url
when URI
uri = url
else
url = url.to_s
begin
uri = Utils.normalize_uri(url)
rescue URI::Error
return url
end
end
http = Faraday.new do |builder|
builder.adapter :net_http
# builder.use FaradayMiddleware::FollowRedirects, limit: limit
# ...does not handle non-HTTP URLs.
end
limit.times do
begin
case uri
when URI::HTTP
return uri.to_s unless uri.host
response = http.head(uri)
case response.status
when 301, 302, 303, 307
if location = response['location']
uri += Utils.normalize_uri(location)
next
end
end
end
rescue URI::Error, Faraday::Error, SystemCallError => e
logger.error "#{e.class} in #{__method__}(#{url.inspect}) [uri=#{uri.to_s.inspect}]: #{e.message}:\n#{e.backtrace.join("\n")}"
end
return uri.to_s
end
logger.error "Too many rediretions in #{__method__}(#{url.inspect}) [uri=#{uri.to_s.inspect}]"
url
end | [
"def",
"uri_expand",
"(",
"url",
",",
"limit",
"=",
"5",
")",
"case",
"url",
"when",
"URI",
"uri",
"=",
"url",
"else",
"url",
"=",
"url",
".",
"to_s",
"begin",
"uri",
"=",
"Utils",
".",
"normalize_uri",
"(",
"url",
")",
"rescue",
"URI",
"::",
"Erro... | Get the destination URL of a given URL by recursively following
redirects, up to 5 times in a row. If a given string is not a
valid absolute HTTP URL or in case of too many redirects, the
original string is returned. If any network/protocol error
occurs while following redirects, the last URL followed is
returned. | [
"Get",
"the",
"destination",
"URL",
"of",
"a",
"given",
"URL",
"by",
"recursively",
"following",
"redirects",
"up",
"to",
"5",
"times",
"in",
"a",
"row",
".",
"If",
"a",
"given",
"string",
"is",
"not",
"a",
"valid",
"absolute",
"HTTP",
"URL",
"or",
"in... | 01e18fef7b6bd827a5d48a89391e460b5fb1bee3 | https://github.com/huginn/huginn/blob/01e18fef7b6bd827a5d48a89391e460b5fb1bee3/app/concerns/liquid_interpolatable.rb#L159-L202 | train | Expand a URI into a full URI | [
30522,
13366,
24471,
2072,
1035,
7818,
1006,
24471,
2140,
1010,
5787,
1027,
1019,
1007,
2553,
24471,
2140,
2043,
24471,
2072,
24471,
2072,
1027,
24471,
2140,
2842,
24471,
2140,
1027,
24471,
2140,
1012,
2000,
1035,
1055,
4088,
24471,
2072,
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_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/global_users.rb | Azure::Labservices::Mgmt::V2018_10_15.GlobalUsers.begin_start_environment | def begin_start_environment(user_name, environment_operations_payload, custom_headers:nil)
response = begin_start_environment_async(user_name, environment_operations_payload, custom_headers:custom_headers).value!
nil
end | ruby | def begin_start_environment(user_name, environment_operations_payload, custom_headers:nil)
response = begin_start_environment_async(user_name, environment_operations_payload, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_start_environment",
"(",
"user_name",
",",
"environment_operations_payload",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_start_environment_async",
"(",
"user_name",
",",
"environment_operations_payload",
",",
"custom_headers",
":custom_header... | Starts an environment by starting all resources inside the environment. This
operation can take a while to complete
@param user_name [String] The name of the user.
@param environment_operations_payload [EnvironmentOperationsPayload]
Represents payload for any Environment operations like get, start, stop,
connect
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Starts",
"an",
"environment",
"by",
"starting",
"all",
"resources",
"inside",
"the",
"environment",
".",
"This",
"operation",
"can",
"take",
"a",
"while",
"to",
"complete"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/global_users.rb#L950-L953 | train | Starts an environment. | [
30522,
13366,
4088,
1035,
2707,
1035,
4044,
1006,
5310,
1035,
2171,
1010,
4044,
1035,
3136,
1035,
18093,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
2707,
1035,
4044,
1035,
2004,
6038,
2278,
1006,
5310,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hashicorp/vault-ruby | lib/vault/persistent.rb | Vault.PersistentHTTP.reset | def reset connection
http = connection.http
finish connection
start http
rescue Errno::ECONNREFUSED
e = Error.new "connection refused: #{http.address}:#{http.port}"
e.set_backtrace $@
raise e
rescue Errno::EHOSTDOWN
e = Error.new "host down: #{http.address}:#{http.port}"
e.set_backtrace $@
raise e
end | ruby | def reset connection
http = connection.http
finish connection
start http
rescue Errno::ECONNREFUSED
e = Error.new "connection refused: #{http.address}:#{http.port}"
e.set_backtrace $@
raise e
rescue Errno::EHOSTDOWN
e = Error.new "host down: #{http.address}:#{http.port}"
e.set_backtrace $@
raise e
end | [
"def",
"reset",
"connection",
"http",
"=",
"connection",
".",
"http",
"finish",
"connection",
"start",
"http",
"rescue",
"Errno",
"::",
"ECONNREFUSED",
"e",
"=",
"Error",
".",
"new",
"\"connection refused: #{http.address}:#{http.port}\"",
"e",
".",
"set_backtrace",
... | Finishes then restarts the Net::HTTP +connection+ | [
"Finishes",
"then",
"restarts",
"the",
"Net",
"::",
"HTTP",
"+",
"connection",
"+"
] | 02f0532a802ba1a2a0d8703a4585dab76eb9d864 | https://github.com/hashicorp/vault-ruby/blob/02f0532a802ba1a2a0d8703a4585dab76eb9d864/lib/vault/persistent.rb#L897-L911 | train | reset connection
| [
30522,
13366,
25141,
4434,
8299,
1027,
4434,
1012,
8299,
3926,
4434,
2707,
8299,
5343,
9413,
19139,
1024,
1024,
17338,
10695,
2890,
25608,
2098,
1041,
1027,
7561,
1012,
2047,
1000,
4434,
4188,
1024,
1001,
1063,
8299,
1012,
4769,
1065,
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... |
hashicorp/vagrant | lib/vagrant/registry.rb | Vagrant.Registry.get | def get(key)
return nil if !@items.key?(key)
return @results_cache[key] if @results_cache.key?(key)
@results_cache[key] = @items[key].call
end | ruby | def get(key)
return nil if !@items.key?(key)
return @results_cache[key] if @results_cache.key?(key)
@results_cache[key] = @items[key].call
end | [
"def",
"get",
"(",
"key",
")",
"return",
"nil",
"if",
"!",
"@items",
".",
"key?",
"(",
"key",
")",
"return",
"@results_cache",
"[",
"key",
"]",
"if",
"@results_cache",
".",
"key?",
"(",
"key",
")",
"@results_cache",
"[",
"key",
"]",
"=",
"@items",
"[... | Get a value by the given key.
This will evaluate the block given to `register` and return the
resulting value. | [
"Get",
"a",
"value",
"by",
"the",
"given",
"key",
"."
] | c22a145c59790c098f95d50141d9afb48e1ef55f | https://github.com/hashicorp/vagrant/blob/c22a145c59790c098f95d50141d9afb48e1ef55f/lib/vagrant/registry.rb#L24-L28 | train | Get the result of a given key from the cache. | [
30522,
13366,
2131,
1006,
3145,
1007,
2709,
9152,
2140,
2065,
999,
1030,
5167,
1012,
3145,
1029,
1006,
3145,
1007,
2709,
1030,
3463,
1035,
17053,
1031,
3145,
1033,
2065,
1030,
3463,
1035,
17053,
1012,
3145,
1029,
1006,
3145,
1007,
1030,
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 | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/train.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Train.get_status | def get_status(app_id, version_id, custom_headers:nil)
response = get_status_async(app_id, version_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_status(app_id, version_id, custom_headers:nil)
response = get_status_async(app_id, version_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_status",
"(",
"app_id",
",",
"version_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_status_async",
"(",
"app_id",
",",
"version_id",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",... | Gets the training status of all models (intents and entities) for the
specified LUIS app. You must call the train API to train the LUIS app before
you call this API to get training status. "appID" specifies the LUIS app ID.
"versionId" specifies the version number of the LUIS app. For example, "0.1".
@param app_id The application ID.
@param version_id [String] The version ID.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array] operation results. | [
"Gets",
"the",
"training",
"status",
"of",
"all",
"models",
"(",
"intents",
"and",
"entities",
")",
"for",
"the",
"specified",
"LUIS",
"app",
".",
"You",
"must",
"call",
"the",
"train",
"API",
"to",
"train",
"the",
"LUIS",
"app",
"before",
"you",
"call",... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/train.rb#L143-L146 | train | Gets the status of the current sequence of applications in a version of the application. | [
30522,
13366,
2131,
1035,
3570,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
3570,
1035,
2004,
6038,
2278,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb | Azure::SQL::Mgmt::V2015_05_01_preview.SyncGroups.refresh_hub_schema_async | def refresh_hub_schema_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil)
# Send request
promise = begin_refresh_hub_schema_async(resource_group_name, server_name, database_name, sync_group_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 refresh_hub_schema_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil)
# Send request
promise = begin_refresh_hub_schema_async(resource_group_name, server_name, database_name, sync_group_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",
"refresh_hub_schema_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"database_name",
",",
"sync_group_name",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_refresh_hub_schema_async",
"(",
"resource_group_name",
",",
"s... | @param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param server_name [String] The name of the server.
@param database_name [String] The name of the database on which the sync
group is hosted.
@param sync_group_name [String] The name of the sync group.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"resource_group_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"resource",
"group",
"that",
"contains",
"the",
"resource",
".",
"You",
"can",
"obtain",
"this",
"value",
"from",
"the",
"Azure",
"Resource",
"Manager",
"API",
"or",
"the",
"por... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb#L150-L164 | train | Refresh hub schema. | [
30522,
13366,
25416,
21898,
1035,
9594,
1035,
8040,
28433,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
30524,
2171,
1010,
8241,
1035,
2171,
1010,
7809,
1035,
2171,
1010,
26351,
1035,
2177,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
7661... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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_as_lazy | def list_web_worker_metric_definitions_as_lazy(resource_group_name, name, worker_pool_name, custom_headers:nil)
response = list_web_worker_metric_definitions_async(resource_group_name, name, worker_pool_name, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_web_worker_metric_definitions_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_web_worker_metric_definitions_as_lazy(resource_group_name, name, worker_pool_name, custom_headers:nil)
response = list_web_worker_metric_definitions_async(resource_group_name, name, worker_pool_name, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_web_worker_metric_definitions_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_web_worker_metric_definitions_as_lazy",
"(",
"resource_group_name",
",",
"name",
",",
"worker_pool_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_web_worker_metric_definitions_async",
"(",
"resource_group_name",
",",
"name",
",",
"worker_... | 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 resource_group_name [String] Name of the resource group to which the
resource belongs.
@param name [String] Name of the App Service Environment.
@param worker_pool_name [String] Name of the worker pool.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ResourceMetricDefinitionCollection] which provide lazy access to
pages of the response. | [
"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#L7916-L7925 | train | Gets the metric definitions for a worker pool. | [
30522,
13366,
2862,
1035,
4773,
1035,
7309,
1035,
12046,
1035,
15182,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
7309,
1035,
4770,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
attr-encrypted/attr_encrypted | lib/attr_encrypted.rb | AttrEncrypted.InstanceMethods.encrypt | def encrypt(attribute, value)
encrypted_attributes[attribute.to_sym][:operation] = :encrypting
encrypted_attributes[attribute.to_sym][:value_present] = self.class.not_empty?(value)
self.class.encrypt(attribute, value, evaluated_attr_encrypted_options_for(attribute))
end | ruby | def encrypt(attribute, value)
encrypted_attributes[attribute.to_sym][:operation] = :encrypting
encrypted_attributes[attribute.to_sym][:value_present] = self.class.not_empty?(value)
self.class.encrypt(attribute, value, evaluated_attr_encrypted_options_for(attribute))
end | [
"def",
"encrypt",
"(",
"attribute",
",",
"value",
")",
"encrypted_attributes",
"[",
"attribute",
".",
"to_sym",
"]",
"[",
":operation",
"]",
"=",
":encrypting",
"encrypted_attributes",
"[",
"attribute",
".",
"to_sym",
"]",
"[",
":value_present",
"]",
"=",
"sel... | Encrypts a value for the attribute specified using options evaluated in the current object's scope
Example
class User
attr_accessor :secret_key
attr_encrypted :email, key: :secret_key
def initialize(secret_key)
self.secret_key = secret_key
end
end
@user = User.new('some-secret-key')
@user.encrypt(:email, 'test@example.com') | [
"Encrypts",
"a",
"value",
"for",
"the",
"attribute",
"specified",
"using",
"options",
"evaluated",
"in",
"the",
"current",
"object",
"s",
"scope"
] | 11df93aef14c661dd0c03169d382a0412f93124e | https://github.com/attr-encrypted/attr_encrypted/blob/11df93aef14c661dd0c03169d382a0412f93124e/lib/attr_encrypted.rb#L349-L353 | train | Encrypt the given attribute with the given value. | [
30522,
13366,
4372,
26775,
22571,
2102,
1006,
17961,
1010,
3643,
1007,
4372,
26775,
22571,
3064,
1035,
12332,
1031,
17961,
1012,
2000,
1035,
25353,
2213,
1033,
1031,
1024,
3169,
1033,
1027,
1024,
4372,
26775,
22571,
3436,
4372,
26775,
22571,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/source_map_utils.rb | Sprockets.SourceMapUtils.encode_source_map | def encode_source_map(map)
return nil unless map
{
"version" => map[:version],
"file" => map[:file],
"mappings" => encode_vlq_mappings(map[:mappings], sources: map[:sources], names: map[:names]),
"sources" => map[:sources],
"names" => map[:names]
}
end | ruby | def encode_source_map(map)
return nil unless map
{
"version" => map[:version],
"file" => map[:file],
"mappings" => encode_vlq_mappings(map[:mappings], sources: map[:sources], names: map[:names]),
"sources" => map[:sources],
"names" => map[:names]
}
end | [
"def",
"encode_source_map",
"(",
"map",
")",
"return",
"nil",
"unless",
"map",
"{",
"\"version\"",
"=>",
"map",
"[",
":version",
"]",
",",
"\"file\"",
"=>",
"map",
"[",
":file",
"]",
",",
"\"mappings\"",
"=>",
"encode_vlq_mappings",
"(",
"map",
"[",
":mapp... | Public: Compress source map
Example:
encode_source_map(map)
# => {
"version" => 3,
"file" => "..",
"mappings" => "AAAA;AACA;..;AACA",
"sources" => [..],
"names" => [..]
}
map - Source map hash (uncompressed)
Returns a compressed source map hash according to source map spec v3 | [
"Public",
":",
"Compress",
"source",
"map"
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/source_map_utils.rb#L235-L244 | train | Encode a source map | [
30522,
13366,
4372,
16044,
1035,
3120,
1035,
4949,
1006,
4949,
1007,
2709,
9152,
2140,
4983,
4949,
1063,
1000,
2544,
1000,
1027,
1028,
4949,
1031,
1024,
2544,
1033,
1010,
1000,
5371,
1000,
1027,
1028,
4949,
1031,
1024,
5371,
1033,
1010,
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/sprockets | lib/sprockets/paths.rb | Sprockets.Paths.prepend_path | def prepend_path(path)
self.config = hash_reassoc(config, :paths) do |paths|
path = File.expand_path(path, config[:root]).freeze
paths.unshift(path)
end
end | ruby | def prepend_path(path)
self.config = hash_reassoc(config, :paths) do |paths|
path = File.expand_path(path, config[:root]).freeze
paths.unshift(path)
end
end | [
"def",
"prepend_path",
"(",
"path",
")",
"self",
".",
"config",
"=",
"hash_reassoc",
"(",
"config",
",",
":paths",
")",
"do",
"|",
"paths",
"|",
"path",
"=",
"File",
".",
"expand_path",
"(",
"path",
",",
"config",
"[",
":root",
"]",
")",
".",
"freeze... | Prepend a `path` to the `paths` list.
Paths at the end of the `Array` have the least priority. | [
"Prepend",
"a",
"path",
"to",
"the",
"paths",
"list",
"."
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/paths.rb#L37-L42 | train | Prepend a path to the current directory. | [
30522,
13366,
17463,
10497,
1035,
4130,
1006,
4130,
1007,
2969,
1012,
9530,
8873,
2290,
1027,
23325,
1035,
2128,
12054,
10085,
1006,
9530,
8873,
2290,
1010,
1024,
10425,
1007,
2079,
1064,
10425,
1064,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2018-09-30/generated/azure_mgmt_compute/disks.rb | Azure::Compute::Mgmt::V2018_09_30.Disks.delete | def delete(resource_group_name, disk_name, custom_headers:nil)
response = delete_async(resource_group_name, disk_name, custom_headers:custom_headers).value!
nil
end | ruby | def delete(resource_group_name, disk_name, custom_headers:nil)
response = delete_async(resource_group_name, disk_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"delete",
"(",
"resource_group_name",
",",
"disk_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_async",
"(",
"resource_group_name",
",",
"disk_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"nil",
"end"
] | Deletes a disk.
@param resource_group_name [String] The name of the resource group.
@param disk_name [String] The name of the managed disk that is being created.
The name can't be changed after the disk is created. Supported characters for
the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Deletes",
"a",
"disk",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2018-09-30/generated/azure_mgmt_compute/disks.rb#L232-L235 | train | Deletes a disk in a resource group. | [
30522,
13366,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
9785,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
9785,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_face/lib/1.0/generated/azure_cognitiveservices_face/snapshot_operations.rb | Azure::CognitiveServices::Face::V1_0.SnapshotOperations.update_async | def update_async(snapshot_id, apply_scope:nil, user_data:nil, custom_headers:nil)
fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
fail ArgumentError, 'snapshot_id is nil' if snapshot_id.nil?
fail ArgumentError, "'user_data' should satisfy the constraint - 'MaxLength': '16384'" if !user_data.nil? && user_data.length > 16384
body = UpdateSnapshotRequest.new
unless apply_scope.nil? && user_data.nil?
body.apply_scope = apply_scope
body.user_data = user_data
end
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
# Serialize Request
request_mapper = Azure::CognitiveServices::Face::V1_0::Models::UpdateSnapshotRequest.mapper()
request_content = @client.serialize(request_mapper, body)
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
path_template = 'snapshots/{snapshotId}'
request_url = @base_url || @client.base_url
request_url = request_url.gsub('{Endpoint}', @client.endpoint)
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'snapshotId' => snapshot_id},
body: request_content,
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:patch, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200
error_model = JSON.load(response_content)
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
result
end
promise.execute
end | ruby | def update_async(snapshot_id, apply_scope:nil, user_data:nil, custom_headers:nil)
fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
fail ArgumentError, 'snapshot_id is nil' if snapshot_id.nil?
fail ArgumentError, "'user_data' should satisfy the constraint - 'MaxLength': '16384'" if !user_data.nil? && user_data.length > 16384
body = UpdateSnapshotRequest.new
unless apply_scope.nil? && user_data.nil?
body.apply_scope = apply_scope
body.user_data = user_data
end
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
# Serialize Request
request_mapper = Azure::CognitiveServices::Face::V1_0::Models::UpdateSnapshotRequest.mapper()
request_content = @client.serialize(request_mapper, body)
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
path_template = 'snapshots/{snapshotId}'
request_url = @base_url || @client.base_url
request_url = request_url.gsub('{Endpoint}', @client.endpoint)
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'snapshotId' => snapshot_id},
body: request_content,
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:patch, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200
error_model = JSON.load(response_content)
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
result
end
promise.execute
end | [
"def",
"update_async",
"(",
"snapshot_id",
",",
"apply_scope",
":",
"nil",
",",
"user_data",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"fail",
"ArgumentError",
",",
"'@client.endpoint is nil'",
"if",
"@client",
".",
"endpoint",
".",
"nil?",
"fail",
"... | Update the information of a snapshot. Only the source subscription who took
the snapshot can update the snapshot.
@param snapshot_id Id referencing a particular snapshot.
@param apply_scope Array of the target Face subscription ids for the
snapshot, specified by the user who created the snapshot when calling
Snapshot - Take. For each snapshot, only subscriptions included in the
applyScope of Snapshot - Take can apply it.
@param user_data [String] User specified data about the snapshot for any
purpose. Length should not exceed 16KB.
@param [Hash{String => String}] A hash of custom headers that will be added
to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response. | [
"Update",
"the",
"information",
"of",
"a",
"snapshot",
".",
"Only",
"the",
"source",
"subscription",
"who",
"took",
"the",
"snapshot",
"can",
"update",
"the",
"snapshot",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_face/lib/1.0/generated/azure_cognitiveservices_face/snapshot_operations.rb#L519-L571 | train | Update a snapshot | [
30522,
13366,
10651,
1035,
2004,
6038,
2278,
1006,
20057,
12326,
1035,
8909,
1010,
6611,
1035,
9531,
1024,
9152,
2140,
1010,
5310,
1035,
2951,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
8246,
6685,
2121,
29165,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/databases.rb | Azure::SQL::Mgmt::V2014_04_01.Databases.get_by_recommended_elastic_pool | def get_by_recommended_elastic_pool(resource_group_name, server_name, recommended_elastic_pool_name, database_name, custom_headers:nil)
response = get_by_recommended_elastic_pool_async(resource_group_name, server_name, recommended_elastic_pool_name, database_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_by_recommended_elastic_pool(resource_group_name, server_name, recommended_elastic_pool_name, database_name, custom_headers:nil)
response = get_by_recommended_elastic_pool_async(resource_group_name, server_name, recommended_elastic_pool_name, database_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_by_recommended_elastic_pool",
"(",
"resource_group_name",
",",
"server_name",
",",
"recommended_elastic_pool_name",
",",
"database_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_by_recommended_elastic_pool_async",
"(",
"resource_group_name",
... | Gets a database inside of a recommended elastic pool.
@param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param server_name [String] The name of the server.
@param recommended_elastic_pool_name [String] The name of the elastic pool to
be retrieved.
@param database_name [String] The name of the database to be retrieved.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Database] operation results. | [
"Gets",
"a",
"database",
"inside",
"of",
"a",
"recommended",
"elastic",
"pool",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/databases.rb#L765-L768 | train | Gets the elastic pool information for a database. | [
30522,
13366,
2131,
1035,
2011,
1035,
6749,
1035,
21274,
1035,
4770,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
6749,
1035,
21274,
1035,
4770,
1035,
2171,
1010,
7809,
1035,
2171,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2017-11-01/generated/azure_mgmt_network/express_route_circuit_authorizations.rb | Azure::Network::Mgmt::V2017_11_01.ExpressRouteCircuitAuthorizations.list | def list(resource_group_name, circuit_name, custom_headers:nil)
first_page = list_as_lazy(resource_group_name, circuit_name, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list(resource_group_name, circuit_name, custom_headers:nil)
first_page = list_as_lazy(resource_group_name, circuit_name, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list",
"(",
"resource_group_name",
",",
"circuit_name",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_as_lazy",
"(",
"resource_group_name",
",",
"circuit_name",
",",
"custom_headers",
":custom_headers",
")",
"first_page",
".",
"get_all_items... | Gets all authorizations in an express route circuit.
@param resource_group_name [String] The name of the resource group.
@param circuit_name [String] The name of the circuit.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<ExpressRouteCircuitAuthorization>] operation results. | [
"Gets",
"all",
"authorizations",
"in",
"an",
"express",
"route",
"circuit",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2017-11-01/generated/azure_mgmt_network/express_route_circuit_authorizations.rb#L220-L223 | train | Gets all the items in the specified ExpressRouteCircuit. | [
30522,
13366,
2862,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4984,
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,
1010,
4984,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_face/lib/1.0/generated/azure_cognitiveservices_face/large_person_group_person.rb | Azure::CognitiveServices::Face::V1_0.LargePersonGroupPerson.delete_face_with_http_info | def delete_face_with_http_info(large_person_group_id, person_id, persisted_face_id, custom_headers:nil)
delete_face_async(large_person_group_id, person_id, persisted_face_id, custom_headers:custom_headers).value!
end | ruby | def delete_face_with_http_info(large_person_group_id, person_id, persisted_face_id, custom_headers:nil)
delete_face_async(large_person_group_id, person_id, persisted_face_id, custom_headers:custom_headers).value!
end | [
"def",
"delete_face_with_http_info",
"(",
"large_person_group_id",
",",
"person_id",
",",
"persisted_face_id",
",",
"custom_headers",
":",
"nil",
")",
"delete_face_async",
"(",
"large_person_group_id",
",",
"person_id",
",",
"persisted_face_id",
",",
"custom_headers",
":c... | Delete a face from a person. Relative feature for the persisted face will
also be deleted.
@param large_person_group_id [String] Id referencing a particular large
person group.
@param person_id Id referencing a particular person.
@param persisted_face_id Id referencing a particular persistedFaceId of an
existing face.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Delete",
"a",
"face",
"from",
"a",
"person",
".",
"Relative",
"feature",
"for",
"the",
"persisted",
"face",
"will",
"also",
"be",
"deleted",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_face/lib/1.0/generated/azure_cognitiveservices_face/large_person_group_person.rb#L589-L591 | train | Deletes a persisted face from a person. | [
30522,
13366,
3972,
12870,
1035,
2227,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2312,
1035,
2711,
1035,
2177,
1035,
8909,
1010,
2711,
1035,
8909,
1010,
19035,
30524,
9152,
2140,
1007,
3972,
12870,
1035,
2227,
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... |
square/connect-ruby-sdk | lib/square_connect/models/order_fulfillment.rb | SquareConnect.OrderFulfillment.valid? | def valid?
type_validator = EnumAttributeValidator.new('String', ["PICKUP"])
return false unless type_validator.valid?(@type)
state_validator = EnumAttributeValidator.new('String', ["PROPOSED", "RESERVED", "PREPARED", "COMPLETED", "CANCELED", "FAILED"])
return false unless state_validator.valid?(@state)
return true
end | ruby | def valid?
type_validator = EnumAttributeValidator.new('String', ["PICKUP"])
return false unless type_validator.valid?(@type)
state_validator = EnumAttributeValidator.new('String', ["PROPOSED", "RESERVED", "PREPARED", "COMPLETED", "CANCELED", "FAILED"])
return false unless state_validator.valid?(@state)
return true
end | [
"def",
"valid?",
"type_validator",
"=",
"EnumAttributeValidator",
".",
"new",
"(",
"'String'",
",",
"[",
"\"PICKUP\"",
"]",
")",
"return",
"false",
"unless",
"type_validator",
".",
"valid?",
"(",
"@type",
")",
"state_validator",
"=",
"EnumAttributeValidator",
".",... | Check to see if the all the properties in the model are valid
@return true if the model is valid | [
"Check",
"to",
"see",
"if",
"the",
"all",
"the",
"properties",
"in",
"the",
"model",
"are",
"valid"
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/models/order_fulfillment.rb#L95-L101 | train | Returns true if the object is valid for this object. | [
30522,
13366,
9398,
1029,
2828,
1035,
9398,
8844,
1027,
4372,
12248,
4779,
3089,
8569,
2618,
10175,
8524,
4263,
1012,
2047,
1006,
1005,
5164,
1005,
1010,
1031,
1000,
15373,
1000,
1033,
1007,
2709,
6270,
4983,
2828,
1035,
9398,
8844,
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... |
appium/ruby_lib | lib/appium_lib/common/wait.rb | Appium.Common.wait_true | def wait_true(opts = {})
opts = opts.is_a?(Numeric) ? { timeout: opts } : opts
if opts.is_a? Hash
opts.empty? ? @core.wait_true { yield } : @core.wait_true(opts) { yield }
else
::Appium::Logger.warn('Arguments should be Hash like {timeout: 100}')
end
end | ruby | def wait_true(opts = {})
opts = opts.is_a?(Numeric) ? { timeout: opts } : opts
if opts.is_a? Hash
opts.empty? ? @core.wait_true { yield } : @core.wait_true(opts) { yield }
else
::Appium::Logger.warn('Arguments should be Hash like {timeout: 100}')
end
end | [
"def",
"wait_true",
"(",
"opts",
"=",
"{",
"}",
")",
"opts",
"=",
"opts",
".",
"is_a?",
"(",
"Numeric",
")",
"?",
"{",
"timeout",
":",
"opts",
"}",
":",
"opts",
"if",
"opts",
".",
"is_a?",
"Hash",
"opts",
".",
"empty?",
"?",
"@core",
".",
"wait_t... | Check every interval seconds to see if yield returns a truthy value.
Note this isn't a strict boolean true, any truthy value is accepted.
false and nil are considered failures.
Give up after timeout seconds.
Wait code from the selenium Ruby gem
https://github.com/SeleniumHQ/selenium/blob/cf501dda3f0ed12233de51ce8170c0e8090f0c20/rb/lib/selenium/webdriver/common/wait.rb
If only a number is provided then it's treated as the timeout value.
@param [Hash|Numeric] opts Options. If the value is _Numeric_, the value is set as `{ timeout: value }`
@option opts [Numeric] :timeout Seconds to wait before timing out. Set default by `appium_wait_timeout` (30).
@option opts [Numeric] :interval Seconds to sleep between polls. Set default by `appium_wait_interval` (0.5).
@option opts [String] :message Exception message if timed out.
@option opts [Array, Exception] :ignore Exceptions to ignore while polling (default: Exception)
@example
wait_true(timeout: 20, interval: 0.2, message: 'custom message') { button_exact('Back') }.click
wait_true(20) { button_exact('Back') }.click | [
"Check",
"every",
"interval",
"seconds",
"to",
"see",
"if",
"yield",
"returns",
"a",
"truthy",
"value",
".",
"Note",
"this",
"isn",
"t",
"a",
"strict",
"boolean",
"true",
"any",
"truthy",
"value",
"is",
"accepted",
".",
"false",
"and",
"nil",
"are",
"con... | 1f5898400dd1928bfe42ddd5f842d1f8738f2f76 | https://github.com/appium/ruby_lib/blob/1f5898400dd1928bfe42ddd5f842d1f8738f2f76/lib/appium_lib/common/wait.rb#L44-L52 | train | Wait for true | [
30522,
13366,
3524,
1035,
2995,
1006,
23569,
2015,
1027,
1063,
1065,
1007,
23569,
2015,
1027,
23569,
2015,
1012,
2003,
1035,
1037,
1029,
1006,
16371,
25531,
1007,
1029,
1063,
2051,
5833,
1024,
23569,
2015,
1065,
1024,
23569,
2015,
2065,
235... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mikel/mail | lib/mail/header.rb | Mail.Header.fields= | def fields=(unfolded_fields)
@fields = Mail::FieldList.new
if unfolded_fields.size > self.class.maximum_amount
Kernel.warn "WARNING: More than #{self.class.maximum_amount} header fields; only using the first #{self.class.maximum_amount} and ignoring the rest"
unfolded_fields = unfolded_fields.slice(0...self.class.maximum_amount)
end
unfolded_fields.each do |field|
if field = Field.parse(field, charset)
@fields.add_field field
end
end
end | ruby | def fields=(unfolded_fields)
@fields = Mail::FieldList.new
if unfolded_fields.size > self.class.maximum_amount
Kernel.warn "WARNING: More than #{self.class.maximum_amount} header fields; only using the first #{self.class.maximum_amount} and ignoring the rest"
unfolded_fields = unfolded_fields.slice(0...self.class.maximum_amount)
end
unfolded_fields.each do |field|
if field = Field.parse(field, charset)
@fields.add_field field
end
end
end | [
"def",
"fields",
"=",
"(",
"unfolded_fields",
")",
"@fields",
"=",
"Mail",
"::",
"FieldList",
".",
"new",
"if",
"unfolded_fields",
".",
"size",
">",
"self",
".",
"class",
".",
"maximum_amount",
"Kernel",
".",
"warn",
"\"WARNING: More than #{self.class.maximum_amou... | 3.6. Field definitions
It is important to note that the header fields are not guaranteed to
be in a particular order. They may appear in any order, and they
have been known to be reordered occasionally when transported over
the Internet. However, for the purposes of this standard, header
fields SHOULD NOT be reordered when a message is transported or
transformed. More importantly, the trace header fields and resent
header fields MUST NOT be reordered, and SHOULD be kept in blocks
prepended to the message. See sections 3.6.6 and 3.6.7 for more
information.
Populates the fields container with Field objects in the order it
receives them in.
Acceps an array of field string values, for example:
h = Header.new
h.fields = ['From: mikel@me.com', 'To: bob@you.com'] | [
"3",
".",
"6",
".",
"Field",
"definitions"
] | fb53fb369eb2bf0494ac70675970c90cdcc3f495 | https://github.com/mikel/mail/blob/fb53fb369eb2bf0494ac70675970c90cdcc3f495/lib/mail/header.rb#L90-L103 | train | Returns a new FieldList with the fields that are unfolded. | [
30522,
13366,
4249,
1027,
1006,
23959,
1035,
4249,
1007,
1030,
4249,
1027,
5653,
1024,
1024,
2492,
9863,
1012,
2047,
2065,
23959,
1035,
4249,
1012,
2946,
1028,
2969,
1012,
2465,
1012,
4555,
1035,
3815,
16293,
1012,
11582,
1000,
5432,
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... |
lostisland/faraday | lib/faraday/options.rb | Faraday.Options.update | def update(obj)
obj.each do |key, value|
sub_options = self.class.options_for(key)
if sub_options
new_value = sub_options.from(value) if value
elsif value.is_a?(Hash)
new_value = value.dup
else
new_value = value
end
send("#{key}=", new_value) unless new_value.nil?
end
self
end | ruby | def update(obj)
obj.each do |key, value|
sub_options = self.class.options_for(key)
if sub_options
new_value = sub_options.from(value) if value
elsif value.is_a?(Hash)
new_value = value.dup
else
new_value = value
end
send("#{key}=", new_value) unless new_value.nil?
end
self
end | [
"def",
"update",
"(",
"obj",
")",
"obj",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"sub_options",
"=",
"self",
".",
"class",
".",
"options_for",
"(",
"key",
")",
"if",
"sub_options",
"new_value",
"=",
"sub_options",
".",
"from",
"(",
"value",
... | Public | [
"Public"
] | 3abe9d1eea4bdf61cdf7b76ff9f1ae7e09482e70 | https://github.com/lostisland/faraday/blob/3abe9d1eea4bdf61cdf7b76ff9f1ae7e09482e70/lib/faraday/options.rb#L22-L36 | train | Update the object with the options from the given hash. | [
30522,
13366,
10651,
1006,
27885,
3501,
1007,
27885,
3501,
1012,
2169,
2079,
1064,
3145,
1010,
3643,
1064,
4942,
1035,
7047,
1027,
2969,
1012,
2465,
1012,
7047,
1035,
2005,
1006,
3145,
1007,
2065,
4942,
1035,
7047,
2047,
1035,
3643,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.suspend_partition_backup_with_http_info | def suspend_partition_backup_with_http_info(partition_id, timeout:60, custom_headers:nil)
suspend_partition_backup_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def suspend_partition_backup_with_http_info(partition_id, timeout:60, custom_headers:nil)
suspend_partition_backup_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"suspend_partition_backup_with_http_info",
"(",
"partition_id",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"suspend_partition_backup_async",
"(",
"partition_id",
",",
"timeout",
":",
"timeout",
",",
"custom_headers",
":custom_headers",
")"... | Suspends periodic backup for the specified partition.
The partition which is configured to take periodic backups, is suspended for
taking further backups till it is resumed again.
@param partition_id The identity of the partition.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Suspends",
"periodic",
"backup",
"for",
"the",
"specified",
"partition",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L25239-L25241 | train | Suspend backup of the specified partition. | [
30522,
13366,
28324,
1035,
13571,
1035,
10200,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
13571,
1035,
8909,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
28324,
1035,
13571,
1035,
10200,
1035,
2004,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/models/charge_request_additional_recipient.rb | SquareConnect.ChargeRequestAdditionalRecipient.description= | def description=(description)
if description.nil?
fail ArgumentError, "description cannot be nil"
end
if description.to_s.length > 100
fail ArgumentError, "invalid value for 'description', the character length must be smaller than or equal to 100."
end
if description.to_s.length < 1
fail ArgumentError, "invalid value for 'description', the character length must be great than or equal to 1."
end
@description = description
end | ruby | def description=(description)
if description.nil?
fail ArgumentError, "description cannot be nil"
end
if description.to_s.length > 100
fail ArgumentError, "invalid value for 'description', the character length must be smaller than or equal to 100."
end
if description.to_s.length < 1
fail ArgumentError, "invalid value for 'description', the character length must be great than or equal to 1."
end
@description = description
end | [
"def",
"description",
"=",
"(",
"description",
")",
"if",
"description",
".",
"nil?",
"fail",
"ArgumentError",
",",
"\"description cannot be nil\"",
"end",
"if",
"description",
".",
"to_s",
".",
"length",
">",
"100",
"fail",
"ArgumentError",
",",
"\"invalid value ... | Custom attribute writer method with validation
@param [Object] description Value to be assigned | [
"Custom",
"attribute",
"writer",
"method",
"with",
"validation"
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/models/charge_request_additional_recipient.rb#L133-L147 | train | Set the description of the object. | [
30522,
13366,
6412,
1027,
1006,
6412,
1007,
2065,
6412,
1012,
9152,
2140,
1029,
8246,
6685,
2121,
29165,
1010,
1000,
6412,
3685,
2022,
9152,
2140,
1000,
2203,
2065,
6412,
1012,
2000,
1035,
1055,
1012,
3091,
1028,
2531,
8246,
6685,
2121,
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 | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.get_regex_entity_entity_info | def get_regex_entity_entity_info(app_id, version_id, regex_entity_id, custom_headers:nil)
response = get_regex_entity_entity_info_async(app_id, version_id, regex_entity_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_regex_entity_entity_info(app_id, version_id, regex_entity_id, custom_headers:nil)
response = get_regex_entity_entity_info_async(app_id, version_id, regex_entity_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_regex_entity_entity_info",
"(",
"app_id",
",",
"version_id",
",",
"regex_entity_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_regex_entity_entity_info_async",
"(",
"app_id",
",",
"version_id",
",",
"regex_entity_id",
",",
"custom_headers... | Gets information about a regular expression entity in a version of the
application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param regex_entity_id The regular expression entity model ID.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [RegexEntityExtractor] operation results. | [
"Gets",
"information",
"about",
"a",
"regular",
"expression",
"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#L8177-L8180 | train | Gets the entity information for a given regex entity. | [
30522,
13366,
2131,
1035,
19723,
10288,
1035,
9178,
1035,
9178,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
19723,
10288,
1035,
9178,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
213... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activesupport/lib/active_support/xml_mini/nokogiri.rb | ActiveSupport.XmlMini_Nokogiri.parse | def parse(data)
if !data.respond_to?(:read)
data = StringIO.new(data || "")
end
if data.eof?
{}
else
doc = Nokogiri::XML(data)
raise doc.errors.first if doc.errors.length > 0
doc.to_hash
end
end | ruby | def parse(data)
if !data.respond_to?(:read)
data = StringIO.new(data || "")
end
if data.eof?
{}
else
doc = Nokogiri::XML(data)
raise doc.errors.first if doc.errors.length > 0
doc.to_hash
end
end | [
"def",
"parse",
"(",
"data",
")",
"if",
"!",
"data",
".",
"respond_to?",
"(",
":read",
")",
"data",
"=",
"StringIO",
".",
"new",
"(",
"data",
"||",
"\"\"",
")",
"end",
"if",
"data",
".",
"eof?",
"{",
"}",
"else",
"doc",
"=",
"Nokogiri",
"::",
"XM... | Parse an XML Document string or IO into a simple hash using libxml / nokogiri.
data::
XML Document string or IO to parse | [
"Parse",
"an",
"XML",
"Document",
"string",
"or",
"IO",
"into",
"a",
"simple",
"hash",
"using",
"libxml",
"/",
"nokogiri",
".",
"data",
"::",
"XML",
"Document",
"string",
"or",
"IO",
"to",
"parse"
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/xml_mini/nokogiri.rb#L19-L31 | train | Parse the XML data | [
30522,
13366,
11968,
3366,
1006,
2951,
1007,
2065,
999,
2951,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
3191,
1007,
2951,
1027,
5164,
3695,
1012,
2047,
1006,
2951,
1064,
1064,
1000,
1000,
1007,
2203,
2065,
2951,
1012,
1041,
11253,
1029,
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... |
danger/danger | lib/danger/danger_core/plugins/dangerfile_github_plugin.rb | Danger.DangerfileGitHubPlugin.html_link | def html_link(paths, full_path: true)
paths = [paths] unless paths.kind_of?(Array)
commit = head_commit
repo = pr_json["head"]["repo"]["html_url"]
paths = paths.map do |path|
url_path = path.start_with?("/") ? path : "/#{path}"
text = full_path ? path : File.basename(path)
create_link("#{repo}/blob/#{commit}#{url_path}", text)
end
return paths.first if paths.count < 2
paths.first(paths.count - 1).join(", ") + " & " + paths.last
end | ruby | def html_link(paths, full_path: true)
paths = [paths] unless paths.kind_of?(Array)
commit = head_commit
repo = pr_json["head"]["repo"]["html_url"]
paths = paths.map do |path|
url_path = path.start_with?("/") ? path : "/#{path}"
text = full_path ? path : File.basename(path)
create_link("#{repo}/blob/#{commit}#{url_path}", text)
end
return paths.first if paths.count < 2
paths.first(paths.count - 1).join(", ") + " & " + paths.last
end | [
"def",
"html_link",
"(",
"paths",
",",
"full_path",
":",
"true",
")",
"paths",
"=",
"[",
"paths",
"]",
"unless",
"paths",
".",
"kind_of?",
"(",
"Array",
")",
"commit",
"=",
"head_commit",
"repo",
"=",
"pr_json",
"[",
"\"head\"",
"]",
"[",
"\"repo\"",
"... | @!group GitHub Misc
Returns a list of HTML anchors for a file, or files in the head repository. An example would be:
`<a href='https://github.com/artsy/eigen/blob/561827e46167077b5e53515b4b7349b8ae04610b/file.txt'>file.txt</a>`. It returns a string of multiple anchors if passed an array.
@param [String or Array<String>] paths
A list of strings to convert to github anchors
@param [Bool] full_path
Shows the full path as the link's text, defaults to `true`.
@return [String] | [
"@!group",
"GitHub",
"Misc",
"Returns",
"a",
"list",
"of",
"HTML",
"anchors",
"for",
"a",
"file",
"or",
"files",
"in",
"the",
"head",
"repository",
".",
"An",
"example",
"would",
"be",
":",
"<a",
"href",
"=",
"https",
":",
"//",
"github",
".",
"com",
... | 0d6d09f2d949c287fe75202d947374042b0679f4 | https://github.com/danger/danger/blob/0d6d09f2d949c287fe75202d947374042b0679f4/lib/danger/danger_core/plugins/dangerfile_github_plugin.rb#L212-L225 | train | Creates a link to a list of files in the repository. | [
30522,
13366,
16129,
1035,
4957,
1006,
10425,
1010,
2440,
1035,
4130,
1024,
2995,
1007,
10425,
1027,
1031,
10425,
1033,
4983,
10425,
1012,
2785,
1035,
1997,
1029,
1006,
9140,
1007,
10797,
1027,
2132,
1035,
10797,
16360,
2080,
1027,
10975,
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... |
github/linguist | samples/Ruby/sinatra.rb | Sinatra.Helpers.uri | def uri(addr = nil, absolute = true, add_script_name = true)
return addr if addr =~ /\A[A-z][A-z0-9\+\.\-]*:/
uri = [host = ""]
if absolute
host << "http#{'s' if request.secure?}://"
if request.forwarded? or request.port != (request.secure? ? 443 : 80)
host << request.host_with_port
else
host << request.host
end
end
uri << request.script_name.to_s if add_script_name
uri << (addr ? addr : request.path_info).to_s
File.join uri
end | ruby | def uri(addr = nil, absolute = true, add_script_name = true)
return addr if addr =~ /\A[A-z][A-z0-9\+\.\-]*:/
uri = [host = ""]
if absolute
host << "http#{'s' if request.secure?}://"
if request.forwarded? or request.port != (request.secure? ? 443 : 80)
host << request.host_with_port
else
host << request.host
end
end
uri << request.script_name.to_s if add_script_name
uri << (addr ? addr : request.path_info).to_s
File.join uri
end | [
"def",
"uri",
"(",
"addr",
"=",
"nil",
",",
"absolute",
"=",
"true",
",",
"add_script_name",
"=",
"true",
")",
"return",
"addr",
"if",
"addr",
"=~",
"/",
"\\A",
"\\+",
"\\.",
"\\-",
"/",
"uri",
"=",
"[",
"host",
"=",
"\"\"",
"]",
"if",
"absolute",
... | Generates the absolute URI for a given path in the app.
Takes Rack routers and reverse proxies into account. | [
"Generates",
"the",
"absolute",
"URI",
"for",
"a",
"given",
"path",
"in",
"the",
"app",
".",
"Takes",
"Rack",
"routers",
"and",
"reverse",
"proxies",
"into",
"account",
"."
] | 9116c90fcbb82ac03b4b33c58cfbde1fcf745e99 | https://github.com/github/linguist/blob/9116c90fcbb82ac03b4b33c58cfbde1fcf745e99/samples/Ruby/sinatra.rb#L182-L196 | train | Returns the URI for the current request. | [
30522,
13366,
24471,
2072,
1006,
5587,
2099,
1027,
9152,
2140,
1010,
7619,
1027,
2995,
1010,
5587,
1035,
5896,
1035,
2171,
1027,
2995,
1007,
2709,
5587,
2099,
2065,
5587,
2099,
1027,
1066,
1013,
1032,
1037,
1031,
1037,
1011,
1062,
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_compute/lib/2018-06-01/generated/azure_mgmt_compute/gallery_images.rb | Azure::Compute::Mgmt::V2018_06_01.GalleryImages.begin_create_or_update_with_http_info | def begin_create_or_update_with_http_info(resource_group_name, gallery_name, gallery_image_name, gallery_image, custom_headers:nil)
begin_create_or_update_async(resource_group_name, gallery_name, gallery_image_name, gallery_image, custom_headers:custom_headers).value!
end | ruby | def begin_create_or_update_with_http_info(resource_group_name, gallery_name, gallery_image_name, gallery_image, custom_headers:nil)
begin_create_or_update_async(resource_group_name, gallery_name, gallery_image_name, gallery_image, custom_headers:custom_headers).value!
end | [
"def",
"begin_create_or_update_with_http_info",
"(",
"resource_group_name",
",",
"gallery_name",
",",
"gallery_image_name",
",",
"gallery_image",
",",
"custom_headers",
":",
"nil",
")",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"gallery_name",
",",
"g... | Create or update a gallery Image Definition.
@param resource_group_name [String] The name of the resource group.
@param gallery_name [String] The name of the Shared Image Gallery in which
the Image Definition is to be created.
@param gallery_image_name [String] The name of the gallery Image Definition
to be created or updated. The allowed characters are alphabets and numbers
with dots, dashes, and periods allowed in the middle. The maximum length is
80 characters.
@param gallery_image [GalleryImage] Parameters supplied to the create or
update gallery image 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. | [
"Create",
"or",
"update",
"a",
"gallery",
"Image",
"Definition",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2018-06-01/generated/azure_mgmt_compute/gallery_images.rb#L360-L362 | train | Creates or updates a new image in the gallery. | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3916,
1035,
2171,
1010,
3916,
1035,
3746,
1035,
2171,
1010,
3916,
1035,
3746,
1010,
7661,
1035,
20346,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
puppetlabs/puppet | lib/puppet/metatype/manager.rb | Puppet::MetaType.Manager.newtype | def newtype(name, options = {}, &block)
# Handle backward compatibility
unless options.is_a?(Hash)
#TRANSLATORS 'Puppet::Type.newtype' should not be translated
Puppet.warning(_("Puppet::Type.newtype(%{name}) now expects a hash as the second argument, not %{argument}") %
{ name: name, argument: options.inspect})
end
# First make sure we don't have a method sitting around
name = name.intern
newmethod = "new#{name}"
# Used for method manipulation.
selfobj = singleton_class
@types ||= {}
if @types.include?(name)
if self.respond_to?(newmethod)
# Remove the old newmethod
selfobj.send(:remove_method,newmethod)
end
end
# Then create the class.
klass = genclass(
name,
:parent => Puppet::Type,
:overwrite => true,
:hash => @types,
:attributes => options,
&block
)
# Now define a "new<type>" method for convenience.
if self.respond_to? newmethod
# Refuse to overwrite existing methods like 'newparam' or 'newtype'.
#TRANSLATORS 'new%{method}' will become a method name, do not translate this string
Puppet.warning(_("'new%{method}' method already exists; skipping") % { method: name.to_s })
else
selfobj.send(:define_method, newmethod) do |*args|
klass.new(*args)
end
end
# If they've got all the necessary methods defined and they haven't
# already added the property, then do so now.
klass.ensurable if klass.ensurable? and ! klass.validproperty?(:ensure)
# Now set up autoload any providers that might exist for this type.
klass.providerloader = Puppet::Util::Autoload.new(klass, "puppet/provider/#{klass.name.to_s}")
# We have to load everything so that we can figure out the default provider.
klass.providerloader.loadall(Puppet.lookup(:current_environment))
klass.providify unless klass.providers.empty?
loc = block_given? ? block.source_location : nil
uri = loc.nil? ? nil : URI("#{Puppet::Util.path_to_uri(loc[0])}?line=#{loc[1]}")
Puppet::Pops::Loaders.register_runtime3_type(name, uri)
klass
end | ruby | def newtype(name, options = {}, &block)
# Handle backward compatibility
unless options.is_a?(Hash)
#TRANSLATORS 'Puppet::Type.newtype' should not be translated
Puppet.warning(_("Puppet::Type.newtype(%{name}) now expects a hash as the second argument, not %{argument}") %
{ name: name, argument: options.inspect})
end
# First make sure we don't have a method sitting around
name = name.intern
newmethod = "new#{name}"
# Used for method manipulation.
selfobj = singleton_class
@types ||= {}
if @types.include?(name)
if self.respond_to?(newmethod)
# Remove the old newmethod
selfobj.send(:remove_method,newmethod)
end
end
# Then create the class.
klass = genclass(
name,
:parent => Puppet::Type,
:overwrite => true,
:hash => @types,
:attributes => options,
&block
)
# Now define a "new<type>" method for convenience.
if self.respond_to? newmethod
# Refuse to overwrite existing methods like 'newparam' or 'newtype'.
#TRANSLATORS 'new%{method}' will become a method name, do not translate this string
Puppet.warning(_("'new%{method}' method already exists; skipping") % { method: name.to_s })
else
selfobj.send(:define_method, newmethod) do |*args|
klass.new(*args)
end
end
# If they've got all the necessary methods defined and they haven't
# already added the property, then do so now.
klass.ensurable if klass.ensurable? and ! klass.validproperty?(:ensure)
# Now set up autoload any providers that might exist for this type.
klass.providerloader = Puppet::Util::Autoload.new(klass, "puppet/provider/#{klass.name.to_s}")
# We have to load everything so that we can figure out the default provider.
klass.providerloader.loadall(Puppet.lookup(:current_environment))
klass.providify unless klass.providers.empty?
loc = block_given? ? block.source_location : nil
uri = loc.nil? ? nil : URI("#{Puppet::Util.path_to_uri(loc[0])}?line=#{loc[1]}")
Puppet::Pops::Loaders.register_runtime3_type(name, uri)
klass
end | [
"def",
"newtype",
"(",
"name",
",",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"# Handle backward compatibility",
"unless",
"options",
".",
"is_a?",
"(",
"Hash",
")",
"#TRANSLATORS 'Puppet::Type.newtype' should not be translated",
"Puppet",
".",
"warning",
"(... | Defines a new type or redefines an existing type with the given name.
A convenience method on the form `new<name>` where name is the name of the type is also created.
(If this generated method happens to clash with an existing method, a warning is issued and the original
method is kept).
@param name [String] the name of the type to create or redefine.
@param options [Hash] options passed on to {Puppet::Util::ClassGen#genclass} as the option `:attributes`.
@option options [Puppet::Type]
Puppet::Type. This option is not passed on as an attribute to genclass.
@yield [ ] a block evaluated in the context of the created class, thus allowing further detailing of
that class.
@return [Class<inherits Puppet::Type>] the created subclass
@see Puppet::Util::ClassGen.genclass
@dsl type
@api public | [
"Defines",
"a",
"new",
"type",
"or",
"redefines",
"an",
"existing",
"type",
"with",
"the",
"given",
"name",
".",
"A",
"convenience",
"method",
"on",
"the",
"form",
"new<name",
">",
"where",
"name",
"is",
"the",
"name",
"of",
"the",
"type",
"is",
"also",
... | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/metatype/manager.rb#L72-L135 | train | Create a new type | [
30522,
13366,
25597,
18863,
1006,
2171,
1010,
7047,
1027,
1063,
1065,
1010,
1004,
3796,
1007,
1001,
5047,
8848,
21778,
4983,
7047,
1012,
2003,
1035,
1037,
1029,
1006,
23325,
1007,
1001,
28396,
1005,
13997,
1024,
1024,
2828,
1012,
25597,
188... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/api/v1_employees_api.rb | SquareConnect.V1EmployeesApi.retrieve_employee_role | def retrieve_employee_role(role_id, opts = {})
data, _status_code, _headers = retrieve_employee_role_with_http_info(role_id, opts)
return data
end | ruby | def retrieve_employee_role(role_id, opts = {})
data, _status_code, _headers = retrieve_employee_role_with_http_info(role_id, opts)
return data
end | [
"def",
"retrieve_employee_role",
"(",
"role_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"retrieve_employee_role_with_http_info",
"(",
"role_id",
",",
"opts",
")",
"return",
"data",
"end"
] | RetrieveEmployeeRole
Provides the details for a single employee role.
@param role_id The role's ID.
@param [Hash] opts the optional parameters
@return [V1EmployeeRole] | [
"RetrieveEmployeeRole",
"Provides",
"the",
"details",
"for",
"a",
"single",
"employee",
"role",
"."
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/v1_employees_api.rb#L715-L718 | train | Retrieve the EmployeeRole Returns the EmployeeRole object | [
30522,
13366,
12850,
1035,
7904,
1035,
2535,
1006,
2535,
1035,
8909,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
12850,
1035,
7904,
1035,
2535,
1035,
2007,
1035,
8299,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
boazsegev/combine_pdf | lib/combine_pdf/pdf_public.rb | CombinePDF.PDF.new_page | def new_page(mediabox = [0, 0, 612.0, 792.0], _location = -1)
p = PDFWriter.new(mediabox)
insert(-1, p)
p
end | ruby | def new_page(mediabox = [0, 0, 612.0, 792.0], _location = -1)
p = PDFWriter.new(mediabox)
insert(-1, p)
p
end | [
"def",
"new_page",
"(",
"mediabox",
"=",
"[",
"0",
",",
"0",
",",
"612.0",
",",
"792.0",
"]",
",",
"_location",
"=",
"-",
"1",
")",
"p",
"=",
"PDFWriter",
".",
"new",
"(",
"mediabox",
")",
"insert",
"(",
"-",
"1",
",",
"p",
")",
"p",
"end"
] | adds a new page to the end of the PDF object.
returns the new page object.
unless the media box is specified, it defaults to US Letter: [0, 0, 612.0, 792.0] | [
"adds",
"a",
"new",
"page",
"to",
"the",
"end",
"of",
"the",
"PDF",
"object",
"."
] | 09054051019c069f551f3e60be789577c0f93900 | https://github.com/boazsegev/combine_pdf/blob/09054051019c069f551f3e60be789577c0f93900/lib/combine_pdf/pdf_public.rb#L122-L126 | train | Create a new page | [
30522,
13366,
2047,
1035,
3931,
1006,
2865,
8758,
1027,
1031,
1014,
1010,
1014,
1010,
6079,
2475,
1012,
1014,
1010,
6535,
2475,
1012,
1014,
1033,
1010,
1035,
3295,
1027,
1011,
1015,
1007,
1052,
1027,
11135,
15994,
1012,
2047,
1006,
2865,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
randym/axlsx | lib/axlsx/workbook/worksheet/color_scale.rb | Axlsx.ColorScale.add | def add(options={})
value_objects << Cfvo.new(:type => options[:type] || :min, :val => options[:val] || 0)
colors << Color.new(:rgb => options[:color] || "FF000000")
{:cfvo => value_objects.last, :color => colors.last}
end | ruby | def add(options={})
value_objects << Cfvo.new(:type => options[:type] || :min, :val => options[:val] || 0)
colors << Color.new(:rgb => options[:color] || "FF000000")
{:cfvo => value_objects.last, :color => colors.last}
end | [
"def",
"add",
"(",
"options",
"=",
"{",
"}",
")",
"value_objects",
"<<",
"Cfvo",
".",
"new",
"(",
":type",
"=>",
"options",
"[",
":type",
"]",
"||",
":min",
",",
":val",
"=>",
"options",
"[",
":val",
"]",
"||",
"0",
")",
"colors",
"<<",
"Color",
... | creates a new ColorScale object.
@see Cfvo
@see Color
@example
color_scale = Axlsx::ColorScale.new({:type => :num, :val => 0.55, :color => 'fff7696c'})
adds a new cfvo / color pair to the color scale and returns a hash containing
a reference to the newly created cfvo and color objects so you can alter the default properties.
@return [Hash] a hash with :cfvo and :color keys referencing the newly added objects.
@param [Hash] options options for the new cfvo and color objects
@option [Symbol] type The type of cfvo you to add
@option [Any] val The value of the cfvo to add
@option [String] The rgb color for the cfvo | [
"creates",
"a",
"new",
"ColorScale",
"object",
"."
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/worksheet/color_scale.rb#L70-L74 | train | Adds a new object to the object list. | [
30522,
13366,
5587,
1006,
7047,
1027,
1063,
1065,
1007,
3643,
1035,
5200,
1026,
1026,
12935,
6767,
1012,
2047,
1006,
1024,
2828,
1027,
1028,
7047,
1031,
1024,
2828,
1033,
1064,
1064,
1024,
8117,
1010,
1024,
11748,
1027,
1028,
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... |
rails/rails | activesupport/lib/active_support/core_ext/date_and_time/calculations.rb | DateAndTime.Calculations.beginning_of_week | def beginning_of_week(start_day = Date.beginning_of_week)
result = days_ago(days_to_week_start(start_day))
acts_like?(:time) ? result.midnight : result
end | ruby | def beginning_of_week(start_day = Date.beginning_of_week)
result = days_ago(days_to_week_start(start_day))
acts_like?(:time) ? result.midnight : result
end | [
"def",
"beginning_of_week",
"(",
"start_day",
"=",
"Date",
".",
"beginning_of_week",
")",
"result",
"=",
"days_ago",
"(",
"days_to_week_start",
"(",
"start_day",
")",
")",
"acts_like?",
"(",
":time",
")",
"?",
"result",
".",
"midnight",
":",
"result",
"end"
] | Returns a new date/time representing the start of this week on the given day.
Week is assumed to start on +start_day+, default is
+Date.beginning_of_week+ or +config.beginning_of_week+ when set.
+DateTime+ objects have their time set to 0:00. | [
"Returns",
"a",
"new",
"date",
"/",
"time",
"representing",
"the",
"start",
"of",
"this",
"week",
"on",
"the",
"given",
"day",
".",
"Week",
"is",
"assumed",
"to",
"start",
"on",
"+",
"start_day",
"+",
"default",
"is",
"+",
"Date",
".",
"beginning_of_week... | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/core_ext/date_and_time/calculations.rb#L274-L277 | train | Returns the beginning of the week | [
30522,
13366,
2927,
1035,
1997,
1035,
2733,
1006,
2707,
1035,
2154,
1027,
3058,
1012,
2927,
1035,
1997,
1035,
2733,
1007,
2765,
1027,
2420,
1035,
3283,
1006,
2420,
1035,
2000,
1035,
2733,
1035,
2707,
1006,
2707,
1035,
2154,
1007,
1007,
44... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
forward3d/rbhive | lib/rbhive/t_c_l_i_connection.rb | RBHive.TCLIConnection.fetch | def fetch(query, max_rows = 100)
# Execute the query and check the result
exec_result = execute(query)
raise_error_if_failed!(exec_result)
# Get search operation handle to fetch the results
op_handle = exec_result.operationHandle
# Fetch the rows
fetch_rows(op_handle, :first, max_rows)
end | ruby | def fetch(query, max_rows = 100)
# Execute the query and check the result
exec_result = execute(query)
raise_error_if_failed!(exec_result)
# Get search operation handle to fetch the results
op_handle = exec_result.operationHandle
# Fetch the rows
fetch_rows(op_handle, :first, max_rows)
end | [
"def",
"fetch",
"(",
"query",
",",
"max_rows",
"=",
"100",
")",
"# Execute the query and check the result",
"exec_result",
"=",
"execute",
"(",
"query",
")",
"raise_error_if_failed!",
"(",
"exec_result",
")",
"# Get search operation handle to fetch the results",
"op_handle"... | Performs a query on the server, fetches up to *max_rows* rows and returns them as an array. | [
"Performs",
"a",
"query",
"on",
"the",
"server",
"fetches",
"up",
"to",
"*",
"max_rows",
"*",
"rows",
"and",
"returns",
"them",
"as",
"an",
"array",
"."
] | a630b57332f2face03501da3ecad2905c78056fa | https://github.com/forward3d/rbhive/blob/a630b57332f2face03501da3ecad2905c78056fa/lib/rbhive/t_c_l_i_connection.rb#L319-L329 | train | Fetch the results of a query | [
30522,
13366,
18584,
1006,
23032,
1010,
4098,
1035,
10281,
1027,
2531,
1007,
1001,
15389,
1996,
23032,
1998,
4638,
1996,
2765,
4654,
8586,
1035,
2765,
1027,
15389,
1006,
23032,
1007,
5333,
1035,
7561,
1035,
2065,
1035,
3478,
999,
1006,
4654... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
toptal/chewy | lib/chewy/config.rb | Chewy.Config.configuration | def configuration
yaml_settings.merge(settings.deep_symbolize_keys).tap do |configuration|
configuration[:logger] = transport_logger if transport_logger
configuration[:indices_path] ||= indices_path if indices_path
configuration.merge!(tracer: transport_tracer) if transport_tracer
end
end | ruby | def configuration
yaml_settings.merge(settings.deep_symbolize_keys).tap do |configuration|
configuration[:logger] = transport_logger if transport_logger
configuration[:indices_path] ||= indices_path if indices_path
configuration.merge!(tracer: transport_tracer) if transport_tracer
end
end | [
"def",
"configuration",
"yaml_settings",
".",
"merge",
"(",
"settings",
".",
"deep_symbolize_keys",
")",
".",
"tap",
"do",
"|",
"configuration",
"|",
"configuration",
"[",
":logger",
"]",
"=",
"transport_logger",
"if",
"transport_logger",
"configuration",
"[",
":i... | Chewy core configurations. There is two ways to set it up:
use `Chewy.settings=` method or, for Rails application,
create `config/chewy.yml` file. Btw, `config/chewy.yml` supports
ERB the same way as ActiveRecord's config.
Configuration options:
1. Chewy client options. All the options Elasticsearch::Client
supports.
test:
host: 'localhost:9250'
2. Chewy self-configuration:
:prefix - used as prefix for any index created.
test:
host: 'localhost:9250'
prefix: test<%= ENV['TEST_ENV_NUMBER'] %>
Then UsersIndex.index_name will be "test42_users"
in case TEST_ENV_NUMBER=42
:wait_for_status - if this option set - chewy actions such
as creating or deleting index, importing data will wait for
the status specified. Extremely useful for tests under heavy
indexes manipulations.
test:
host: 'localhost:9250'
wait_for_status: green
3. Index settings. All the possible ElasticSearch index settings.
Will be merged as defaults with index settings on every index
creation.
test: &test
host: 'localhost:9250'
index:
number_of_shards: 1
number_of_replicas: 0 | [
"Chewy",
"core",
"configurations",
".",
"There",
"is",
"two",
"ways",
"to",
"set",
"it",
"up",
":",
"use",
"Chewy",
".",
"settings",
"=",
"method",
"or",
"for",
"Rails",
"application",
"create",
"config",
"/",
"chewy",
".",
"yml",
"file",
".",
"Btw",
"... | cb1bb3efb1bd8a31e7e31add6072189cb1f4f01b | https://github.com/toptal/chewy/blob/cb1bb3efb1bd8a31e7e31add6072189cb1f4f01b/lib/chewy/config.rb#L133-L139 | train | Returns the configuration hash for the current object. | [
30522,
13366,
9563,
8038,
19968,
1035,
10906,
1012,
13590,
1006,
10906,
1012,
2784,
1035,
6454,
4697,
1035,
6309,
1007,
1012,
11112,
2079,
1064,
9563,
1064,
9563,
1031,
1024,
8833,
4590,
1033,
1027,
3665,
1035,
8833,
4590,
2065,
3665,
1035,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/network_watchers.rb | Azure::Network::Mgmt::V2018_08_01.NetworkWatchers.list_all | def list_all(custom_headers:nil)
response = list_all_async(custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_all(custom_headers:nil)
response = list_all_async(custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_all",
"(",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_all_async",
"(",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"response",
".",
"nil?",
"end"
] | Gets all network watchers by subscription.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [NetworkWatcherListResult] operation results. | [
"Gets",
"all",
"network",
"watchers",
"by",
"subscription",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/network_watchers.rb#L472-L475 | train | Gets all the available image types. | [
30522,
13366,
2862,
1035,
2035,
1006,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2035,
1035,
2004,
6038,
2278,
1006,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
20346,
2015,
1007,
1012,
3643,
999,
3433,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hashicorp/vagrant | lib/vagrant/box_collection.rb | Vagrant.BoxCollection.upgrade_v1_1_v1_5 | def upgrade_v1_1_v1_5
with_collection_lock do
temp_dir = Pathname.new(Dir.mktmpdir(TEMP_PREFIX, @temp_root))
@directory.children(true).each do |boxdir|
# Ignore all non-directories because they can't be boxes
next if !boxdir.directory?
box_name = boxdir.basename.to_s
# If it is a v1 box, then we need to upgrade it first
if v1_box?(boxdir)
upgrade_dir = v1_upgrade(boxdir)
FileUtils.mv(upgrade_dir, boxdir.join("virtualbox"))
end
# Create the directory for this box
new_box_dir = temp_dir.join(dir_name(box_name), "0")
new_box_dir.mkpath
# Go through each provider and move it
boxdir.children(true).each do |providerdir|
FileUtils.cp_r(providerdir, new_box_dir.join(providerdir.basename))
end
end
# Move the folder into place
@directory.rmtree
FileUtils.mv(temp_dir.to_s, @directory.to_s)
end
end | ruby | def upgrade_v1_1_v1_5
with_collection_lock do
temp_dir = Pathname.new(Dir.mktmpdir(TEMP_PREFIX, @temp_root))
@directory.children(true).each do |boxdir|
# Ignore all non-directories because they can't be boxes
next if !boxdir.directory?
box_name = boxdir.basename.to_s
# If it is a v1 box, then we need to upgrade it first
if v1_box?(boxdir)
upgrade_dir = v1_upgrade(boxdir)
FileUtils.mv(upgrade_dir, boxdir.join("virtualbox"))
end
# Create the directory for this box
new_box_dir = temp_dir.join(dir_name(box_name), "0")
new_box_dir.mkpath
# Go through each provider and move it
boxdir.children(true).each do |providerdir|
FileUtils.cp_r(providerdir, new_box_dir.join(providerdir.basename))
end
end
# Move the folder into place
@directory.rmtree
FileUtils.mv(temp_dir.to_s, @directory.to_s)
end
end | [
"def",
"upgrade_v1_1_v1_5",
"with_collection_lock",
"do",
"temp_dir",
"=",
"Pathname",
".",
"new",
"(",
"Dir",
".",
"mktmpdir",
"(",
"TEMP_PREFIX",
",",
"@temp_root",
")",
")",
"@directory",
".",
"children",
"(",
"true",
")",
".",
"each",
"do",
"|",
"boxdir"... | This upgrades a v1.1 - v1.4 box directory structure up to a v1.5
directory structure. This will raise exceptions if it fails in any
way. | [
"This",
"upgrades",
"a",
"v1",
".",
"1",
"-",
"v1",
".",
"4",
"box",
"directory",
"structure",
"up",
"to",
"a",
"v1",
".",
"5",
"directory",
"structure",
".",
"This",
"will",
"raise",
"exceptions",
"if",
"it",
"fails",
"in",
"any",
"way",
"."
] | c22a145c59790c098f95d50141d9afb48e1ef55f | https://github.com/hashicorp/vagrant/blob/c22a145c59790c098f95d50141d9afb48e1ef55f/lib/vagrant/box_collection.rb#L340-L370 | train | Upgrade the v1. 1. 5 box | [
30522,
13366,
12200,
1035,
1058,
2487,
1035,
1015,
1035,
1058,
2487,
1035,
1019,
2007,
1035,
3074,
1035,
5843,
2079,
8915,
8737,
1035,
16101,
1027,
4130,
18442,
1012,
2047,
1006,
16101,
1012,
12395,
21246,
17299,
4313,
1006,
8915,
8737,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-ec2/lib/aws-sdk-ec2/instance.rb | Aws::EC2.Instance.console_output | def console_output(options = {})
options = options.merge(instance_id: @id)
resp = @client.get_console_output(options)
resp.data
end | ruby | def console_output(options = {})
options = options.merge(instance_id: @id)
resp = @client.get_console_output(options)
resp.data
end | [
"def",
"console_output",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"instance_id",
":",
"@id",
")",
"resp",
"=",
"@client",
".",
"get_console_output",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
instance.console_output({
dry_run: false,
latest: 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`.
@option options [Boolean] :latest
When enabled, retrieves the latest console output for the instance.
Default: disabled (`false`)
@return [Types::GetConsoleOutputResult] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/instance.rb#L607-L611 | train | Returns the console output for this instance | [
30522,
13366,
10122,
1035,
6434,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
6013,
1035,
8909,
1024,
1030,
8909,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
2131,
1035,
10122,
1035,
6434,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-iam/lib/aws-sdk-iam/resource.rb | Aws::IAM.Resource.create_user | def create_user(options = {})
resp = @client.create_user(options)
User.new(
name: options[:user_name],
data: resp.data.user,
client: @client
)
end | ruby | def create_user(options = {})
resp = @client.create_user(options)
User.new(
name: options[:user_name],
data: resp.data.user,
client: @client
)
end | [
"def",
"create_user",
"(",
"options",
"=",
"{",
"}",
")",
"resp",
"=",
"@client",
".",
"create_user",
"(",
"options",
")",
"User",
".",
"new",
"(",
"name",
":",
"options",
"[",
":user_name",
"]",
",",
"data",
":",
"resp",
".",
"data",
".",
"user",
... | @example Request syntax with placeholder values
user = iam.create_user({
path: "pathType",
user_name: "userNameType", # required
permissions_boundary: "arnType",
tags: [
{
key: "tagKeyType", # required
value: "tagValueType", # required
},
],
})
@param [Hash] options ({})
@option options [String] :path
The path for the user name. For more information about paths, see [IAM
Identifiers][1] in the *IAM User Guide*.
This parameter is optional. If it is not included, it defaults to a
slash (/).
This parameter allows (through its [regex pattern][2]) a string of
characters consisting of either a forward slash (/) by itself or a
string that must begin and end with forward slashes. In addition, it
can contain any ASCII character from the ! (\\u0021) through the DEL
character (\\u007F), including most punctuation characters, digits,
and upper and lowercased letters.
[1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
[2]: http://wikipedia.org/wiki/regex
@option options [required, String] :user_name
The name of the user to create.
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:
\_+=,.@-. User names are not distinguished by case. For example, you
cannot create users named both "TESTUSER" and "testuser".
[1]: http://wikipedia.org/wiki/regex
@option options [String] :permissions_boundary
The ARN of the policy that is used to set the permissions boundary for
the user.
@option options [Array<Types::Tag>] :tags
A list of tags that you want to attach to the newly created user. Each
tag consists of a key name and an associated value. For more
information about tagging, see [Tagging IAM Identities][1] in the *IAM
User Guide*.
<note markdown="1"> If any one of the tags is invalid or if you exceed the allowed number
of tags per user, then the entire request fails and the user is not
created.
</note>
[1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html
@return [User] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-iam/lib/aws-sdk-iam/resource.rb#L717-L724 | train | Create a user | [
30522,
13366,
3443,
1035,
5310,
1006,
7047,
1027,
1063,
1065,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
3443,
1035,
5310,
1006,
7047,
1007,
5310,
1012,
2047,
1006,
2171,
1024,
7047,
1031,
1024,
5310,
1035,
2171,
1033,
1010,
2951,
1024,
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... |
rmagick/rmagick | lib/rmagick_internal.rb | Magick.Draw.polygon | def polygon(*points)
if points.length.zero?
Kernel.raise ArgumentError, 'no points specified'
elsif points.length.odd?
Kernel.raise ArgumentError, 'odd number of points specified'
end
primitive 'polygon ' + points.join(',')
end | ruby | def polygon(*points)
if points.length.zero?
Kernel.raise ArgumentError, 'no points specified'
elsif points.length.odd?
Kernel.raise ArgumentError, 'odd number of points specified'
end
primitive 'polygon ' + points.join(',')
end | [
"def",
"polygon",
"(",
"*",
"points",
")",
"if",
"points",
".",
"length",
".",
"zero?",
"Kernel",
".",
"raise",
"ArgumentError",
",",
"'no points specified'",
"elsif",
"points",
".",
"length",
".",
"odd?",
"Kernel",
".",
"raise",
"ArgumentError",
",",
"'odd ... | Draw a polygon | [
"Draw",
"a",
"polygon"
] | ef6688ed9d76bf123c2ea1a483eff8635051adb7 | https://github.com/rmagick/rmagick/blob/ef6688ed9d76bf123c2ea1a483eff8635051adb7/lib/rmagick_internal.rb#L459-L466 | train | Polygons the points in the polygon. | [
30522,
13366,
26572,
7446,
1006,
1008,
2685,
1007,
2065,
2685,
1012,
3091,
1012,
5717,
1029,
16293,
1012,
5333,
6685,
2121,
29165,
1010,
1005,
2053,
2685,
9675,
1005,
3449,
5332,
2546,
2685,
1012,
3091,
1012,
5976,
1029,
16293,
1012,
5333,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
meew0/discordrb | lib/discordrb/data/server.rb | Discordrb.Server.webhooks | def webhooks
webhooks = JSON.parse(API::Server.webhooks(@bot.token, @id))
webhooks.map { |webhook| Webhook.new(webhook, @bot) }
end | ruby | def webhooks
webhooks = JSON.parse(API::Server.webhooks(@bot.token, @id))
webhooks.map { |webhook| Webhook.new(webhook, @bot) }
end | [
"def",
"webhooks",
"webhooks",
"=",
"JSON",
".",
"parse",
"(",
"API",
"::",
"Server",
".",
"webhooks",
"(",
"@bot",
".",
"token",
",",
"@id",
")",
")",
"webhooks",
".",
"map",
"{",
"|",
"webhook",
"|",
"Webhook",
".",
"new",
"(",
"webhook",
",",
"@... | Requests a list of Webhooks on the server.
@return [Array<Webhook>] webhooks on the server. | [
"Requests",
"a",
"list",
"of",
"Webhooks",
"on",
"the",
"server",
"."
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/data/server.rb#L732-L735 | train | Returns an array of Webhook objects. | [
30522,
13366,
4773,
6806,
6559,
2015,
4773,
6806,
6559,
2015,
1027,
1046,
3385,
1012,
11968,
3366,
1006,
17928,
1024,
1024,
8241,
1012,
4773,
6806,
6559,
2015,
1006,
30524,
1006,
4773,
6806,
6559,
1010,
1030,
28516,
1007,
1065,
2203,
102,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ruby/rake | lib/rake/task_manager.rb | Rake.TaskManager.enhance_with_matching_rule | def enhance_with_matching_rule(task_name, level=0)
fail Rake::RuleRecursionOverflowError,
"Rule Recursion Too Deep" if level >= 16
@rules.each do |pattern, args, extensions, block|
if pattern && pattern.match(task_name)
task = attempt_rule(task_name, pattern, args, extensions, block, level)
return task if task
end
end
nil
rescue Rake::RuleRecursionOverflowError => ex
ex.add_target(task_name)
fail ex
end | ruby | def enhance_with_matching_rule(task_name, level=0)
fail Rake::RuleRecursionOverflowError,
"Rule Recursion Too Deep" if level >= 16
@rules.each do |pattern, args, extensions, block|
if pattern && pattern.match(task_name)
task = attempt_rule(task_name, pattern, args, extensions, block, level)
return task if task
end
end
nil
rescue Rake::RuleRecursionOverflowError => ex
ex.add_target(task_name)
fail ex
end | [
"def",
"enhance_with_matching_rule",
"(",
"task_name",
",",
"level",
"=",
"0",
")",
"fail",
"Rake",
"::",
"RuleRecursionOverflowError",
",",
"\"Rule Recursion Too Deep\"",
"if",
"level",
">=",
"16",
"@rules",
".",
"each",
"do",
"|",
"pattern",
",",
"args",
",",
... | If a rule can be found that matches the task name, enhance the
task with the prerequisites and actions from the rule. Set the
source attribute of the task appropriately for the rule. Return
the enhanced task or nil of no rule was found. | [
"If",
"a",
"rule",
"can",
"be",
"found",
"that",
"matches",
"the",
"task",
"name",
"enhance",
"the",
"task",
"with",
"the",
"prerequisites",
"and",
"actions",
"from",
"the",
"rule",
".",
"Set",
"the",
"source",
"attribute",
"of",
"the",
"task",
"appropriat... | 1c22b490ee6cb8bd614fa8d0d6145f671466206b | https://github.com/ruby/rake/blob/1c22b490ee6cb8bd614fa8d0d6145f671466206b/lib/rake/task_manager.rb#L145-L158 | train | Enhance the task with the matching rule | [
30522,
13366,
11598,
1035,
2007,
1035,
9844,
1035,
3627,
1006,
4708,
1035,
2171,
1010,
2504,
1027,
1014,
1007,
8246,
26008,
1024,
1024,
7786,
8586,
9236,
3258,
7840,
14156,
29165,
1010,
1000,
3627,
28667,
9236,
3258,
2205,
2784,
1000,
2065,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2018-04-01/generated/azure_mgmt_compute/virtual_machine_images.rb | Azure::Compute::Mgmt::V2018_04_01.VirtualMachineImages.list_publishers | def list_publishers(location, custom_headers:nil)
response = list_publishers_async(location, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_publishers(location, custom_headers:nil)
response = list_publishers_async(location, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_publishers",
"(",
"location",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_publishers_async",
"(",
"location",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"response",
".",
"nil?",
... | Gets a list of virtual machine image publishers for the specified Azure
location.
@param location [String] The name of a supported Azure region.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array] operation results. | [
"Gets",
"a",
"list",
"of",
"virtual",
"machine",
"image",
"publishers",
"for",
"the",
"specified",
"Azure",
"location",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2018-04-01/generated/azure_mgmt_compute/virtual_machine_images.rb#L377-L380 | train | Gets the list of all published publishers. | [
30522,
13366,
2862,
1035,
8544,
1006,
3295,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
8544,
1035,
2004,
6038,
2278,
1006,
3295,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
20346,
2015,
1007,
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... |
rmagick/rmagick | lib/rmagick_internal.rb | Magick.Draw.arc | def arc(start_x, start_y, end_x, end_y, start_degrees, end_degrees)
primitive 'arc ' + format('%g,%g %g,%g %g,%g',
start_x, start_y, end_x, end_y, start_degrees, end_degrees)
end | ruby | def arc(start_x, start_y, end_x, end_y, start_degrees, end_degrees)
primitive 'arc ' + format('%g,%g %g,%g %g,%g',
start_x, start_y, end_x, end_y, start_degrees, end_degrees)
end | [
"def",
"arc",
"(",
"start_x",
",",
"start_y",
",",
"end_x",
",",
"end_y",
",",
"start_degrees",
",",
"end_degrees",
")",
"primitive",
"'arc '",
"+",
"format",
"(",
"'%g,%g %g,%g %g,%g'",
",",
"start_x",
",",
"start_y",
",",
"end_x",
",",
"end_y",
",",
"sta... | Draw an arc. | [
"Draw",
"an",
"arc",
"."
] | ef6688ed9d76bf123c2ea1a483eff8635051adb7 | https://github.com/rmagick/rmagick/blob/ef6688ed9d76bf123c2ea1a483eff8635051adb7/lib/rmagick_internal.rb#L233-L236 | train | Returns a new Arc object with the given coordinates. | [
30522,
13366,
8115,
1006,
2707,
1035,
1060,
1010,
2707,
1035,
1061,
1010,
2203,
1035,
1060,
1010,
2203,
1035,
1061,
1010,
30524,
1060,
1010,
2707,
1035,
1061,
1010,
2203,
1035,
1060,
1010,
2203,
1035,
1061,
1010,
2707,
1035,
5445,
1010,
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... |
excon/excon | lib/excon/utils.rb | Excon.Utils.escape_uri | def escape_uri(str)
str = str.dup
binary_encode(str)
str.gsub(UNESCAPED) { "%%%02X" % $1[0].ord }
end | ruby | def escape_uri(str)
str = str.dup
binary_encode(str)
str.gsub(UNESCAPED) { "%%%02X" % $1[0].ord }
end | [
"def",
"escape_uri",
"(",
"str",
")",
"str",
"=",
"str",
".",
"dup",
"binary_encode",
"(",
"str",
")",
"str",
".",
"gsub",
"(",
"UNESCAPED",
")",
"{",
"\"%%%02X\"",
"%",
"$1",
"[",
"0",
"]",
".",
"ord",
"}",
"end"
] | Escapes HTTP reserved and unwise characters in +str+ | [
"Escapes",
"HTTP",
"reserved",
"and",
"unwise",
"characters",
"in",
"+",
"str",
"+"
] | d4975a8a5b49d5901a769b289fb5054a6d064f6d | https://github.com/excon/excon/blob/d4975a8a5b49d5901a769b289fb5054a6d064f6d/lib/excon/utils.rb#L87-L91 | train | escape a URI | [
30522,
13366,
4019,
1035,
24471,
2072,
1006,
2358,
2099,
1007,
2358,
2099,
1027,
2358,
2099,
1012,
4241,
2361,
12441,
1035,
4372,
16044,
1006,
2358,
2099,
1007,
2358,
2099,
1012,
28177,
12083,
1006,
16655,
15782,
5669,
1007,
1063,
1000,
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... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_face/lib/1.0/generated/azure_cognitiveservices_face/face_list_operations.rb | Azure::CognitiveServices::Face::V1_0.FaceListOperations.create_with_http_info | def create_with_http_info(face_list_id, name:nil, user_data:nil, recognition_model:nil, custom_headers:nil)
create_async(face_list_id, name:name, user_data:user_data, recognition_model:recognition_model, custom_headers:custom_headers).value!
end | ruby | def create_with_http_info(face_list_id, name:nil, user_data:nil, recognition_model:nil, custom_headers:nil)
create_async(face_list_id, name:name, user_data:user_data, recognition_model:recognition_model, custom_headers:custom_headers).value!
end | [
"def",
"create_with_http_info",
"(",
"face_list_id",
",",
"name",
":",
"nil",
",",
"user_data",
":",
"nil",
",",
"recognition_model",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"create_async",
"(",
"face_list_id",
",",
"name",
":",
"name",
",",
"use... | Create an empty face list with user-specified faceListId, name, an optional
userData and recognitionModel. Up to 64 face lists are allowed in one
subscription.
<br /> Face list is a list of faces, up to 1,000 faces, and used by [Face -
Find
Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237).
<br /> After creation, user should use [FaceList - Add
Face](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395250)
to import the faces. Faces are stored on server until [FaceList -
Delete](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039524f)
is called.
<br /> Find Similar is used for scenario like finding celebrity-like faces,
similar face filtering, or as a light way face identification. But if the
actual use is to identify person, please use
[PersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395244)
/
[LargePersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d)
and [Face -
Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
<br /> Please consider
[LargeFaceList](/docs/services/563879b61984550e40cbbe8d/operations/5a157b68d2de3616c086f2cc)
when the face number is large. It can support up to 1,000,000 faces.
'recognitionModel' should be specified to associate with this face list. The
default value for 'recognitionModel' is 'recognition_01', if the latest model
needed, please explicitly specify the model you need in this parameter. New
faces that are added to an existing face list will use the recognition model
that's already associated with the collection. Existing face features in a
face list can't be updated to features extracted by another version of
recognition model.
@param face_list_id [String] Id referencing a particular face list.
@param name [String] User defined name, maximum length is 128.
@param user_data [String] User specified data. Length should not exceed 16KB.
@param recognition_model [RecognitionModel] Possible values include:
'recognition_01', 'recognition_02'
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Create",
"an",
"empty",
"face",
"list",
"with",
"user",
"-",
"specified",
"faceListId",
"name",
"an",
"optional",
"userData",
"and",
"recognitionModel",
".",
"Up",
"to",
"64",
"face",
"lists",
"are",
"allowed",
"in",
"one",
"subscription",
".",
"<br",
"/",
... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_face/lib/1.0/generated/azure_cognitiveservices_face/face_list_operations.rb#L112-L114 | train | Creates a new face list. | [
30522,
13366,
3443,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2227,
1035,
2862,
1035,
8909,
1010,
2171,
1024,
9152,
2140,
1010,
5310,
1035,
2951,
1024,
9152,
2140,
1010,
5038,
1035,
2944,
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.delete_pattern_any_entity_model_with_http_info | def delete_pattern_any_entity_model_with_http_info(app_id, version_id, entity_id, custom_headers:nil)
delete_pattern_any_entity_model_async(app_id, version_id, entity_id, custom_headers:custom_headers).value!
end | ruby | def delete_pattern_any_entity_model_with_http_info(app_id, version_id, entity_id, custom_headers:nil)
delete_pattern_any_entity_model_async(app_id, version_id, entity_id, custom_headers:custom_headers).value!
end | [
"def",
"delete_pattern_any_entity_model_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"custom_headers",
":",
"nil",
")",
"delete_pattern_any_entity_model_async",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"custom_headers",
":custo... | Deletes a Pattern.Any entity extractor from 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 extractor ID.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Deletes",
"a",
"Pattern",
".",
"Any",
"entity",
"extractor",
"from",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L8701-L8703 | train | Deletes an entity model in a version of the application. | [
30522,
13366,
3972,
12870,
1035,
5418,
1035,
2151,
1035,
9178,
1035,
2944,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
30524,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3972,
12870,
1035,
5418,
1035,
2151... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.clone_with_http_info | def clone_with_http_info(app_id, version_id, version_clone_object, custom_headers:nil)
clone_async(app_id, version_id, version_clone_object, custom_headers:custom_headers).value!
end | ruby | def clone_with_http_info(app_id, version_id, version_clone_object, custom_headers:nil)
clone_async(app_id, version_id, version_clone_object, custom_headers:custom_headers).value!
end | [
"def",
"clone_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"version_clone_object",
",",
"custom_headers",
":",
"nil",
")",
"clone_async",
"(",
"app_id",
",",
"version_id",
",",
"version_clone_object",
",",
"custom_headers",
":custom_headers",
")",
".",
"v... | Creates a new version from the selected version.
@param app_id The application ID.
@param version_id [String] The version ID.
@param version_clone_object [TaskUpdateObject] A model containing the new
version ID.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [String] operation results.
Creates a new version from the selected version.
@param app_id The application ID.
@param version_id [String] The version ID.
@param version_clone_object [TaskUpdateObject] A model containing the new
version ID.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Creates",
"a",
"new",
"version",
"from",
"the",
"selected",
"version",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/versions.rb#L53-L55 | train | Clone the existing version of the application. | [
30522,
13366,
17598,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
2544,
1035,
17598,
1035,
4874,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
17598,
1035,
2004,
6038,
2278,
1006,
1043... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/2015-05-01-preview/generated/azure_mgmt_network/network_interfaces.rb | Azure::Network::Mgmt::V2015_05_01_preview.NetworkInterfaces.list_virtual_machine_scale_set_network_interfaces | def list_virtual_machine_scale_set_network_interfaces(resource_group_name, virtual_machine_scale_set_name, custom_headers:nil)
first_page = list_virtual_machine_scale_set_network_interfaces_as_lazy(resource_group_name, virtual_machine_scale_set_name, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_virtual_machine_scale_set_network_interfaces(resource_group_name, virtual_machine_scale_set_name, custom_headers:nil)
first_page = list_virtual_machine_scale_set_network_interfaces_as_lazy(resource_group_name, virtual_machine_scale_set_name, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_virtual_machine_scale_set_network_interfaces",
"(",
"resource_group_name",
",",
"virtual_machine_scale_set_name",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_virtual_machine_scale_set_network_interfaces_as_lazy",
"(",
"resource_group_name",
",",
"v... | The list network interface operation retrieves information about all network
interfaces in a virtual machine scale set.
@param resource_group_name [String] The name of the resource group.
@param virtual_machine_scale_set_name [String] The name of the virtual
machine scale set.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<NetworkInterface>] operation results. | [
"The",
"list",
"network",
"interface",
"operation",
"retrieves",
"information",
"about",
"all",
"network",
"interfaces",
"in",
"a",
"virtual",
"machine",
"scale",
"set",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2015-05-01-preview/generated/azure_mgmt_network/network_interfaces.rb#L317-L320 | train | Gets all network interfaces in a virtual machine scale set. | [
30522,
13366,
2862,
1035,
7484,
1035,
3698,
1035,
4094,
1035,
2275,
1035,
2897,
1035,
19706,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7484,
1035,
3698,
1035,
4094,
1035,
2275,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
david942j/one_gadget | lib/one_gadget/helper.rb | OneGadget.Helper.function_offsets | def function_offsets(file, functions)
arch = architecture(file)
objdump_bin = find_objdump(arch)
objdump_cmd = ::Shellwords.join([objdump_bin, '-T', file])
functions.map! { |f| '\\b' + f + '\\b' }
ret = {}
`#{objdump_cmd} | grep -iP '(#{functions.join('|')})'`.lines.map(&:chomp).each do |line|
tokens = line.split
ret[tokens.last] = tokens.first.to_i(16)
end
ret
end | ruby | def function_offsets(file, functions)
arch = architecture(file)
objdump_bin = find_objdump(arch)
objdump_cmd = ::Shellwords.join([objdump_bin, '-T', file])
functions.map! { |f| '\\b' + f + '\\b' }
ret = {}
`#{objdump_cmd} | grep -iP '(#{functions.join('|')})'`.lines.map(&:chomp).each do |line|
tokens = line.split
ret[tokens.last] = tokens.first.to_i(16)
end
ret
end | [
"def",
"function_offsets",
"(",
"file",
",",
"functions",
")",
"arch",
"=",
"architecture",
"(",
"file",
")",
"objdump_bin",
"=",
"find_objdump",
"(",
"arch",
")",
"objdump_cmd",
"=",
"::",
"Shellwords",
".",
"join",
"(",
"[",
"objdump_bin",
",",
"'-T'",
"... | Returns a dictionary that maps functions to their offsets.
@param [String] file
@param [Array<String>] functions
@return [Hash{String => Integer}] | [
"Returns",
"a",
"dictionary",
"that",
"maps",
"functions",
"to",
"their",
"offsets",
"."
] | ff6ef04541e83441bfe3c2664a6febd1640f4263 | https://github.com/david942j/one_gadget/blob/ff6ef04541e83441bfe3c2664a6febd1640f4263/lib/one_gadget/helper.rb#L338-L349 | train | Get the function offsets for a given file. | [
30522,
13366,
3853,
1035,
16396,
2015,
1006,
5371,
1010,
4972,
1007,
7905,
1027,
4294,
1006,
5371,
1007,
27885,
3501,
8566,
8737,
1035,
8026,
1027,
2424,
1035,
27885,
3501,
8566,
8737,
1006,
7905,
1007,
27885,
3501,
8566,
8737,
1035,
4642,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_policy_insights/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_states.rb | Azure::PolicyInsights::Mgmt::V2018_04_04.PolicyStates.summarize_for_subscription | def summarize_for_subscription(subscription_id, query_options:nil, custom_headers:nil)
response = summarize_for_subscription_async(subscription_id, query_options:query_options, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def summarize_for_subscription(subscription_id, query_options:nil, custom_headers:nil)
response = summarize_for_subscription_async(subscription_id, query_options:query_options, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"summarize_for_subscription",
"(",
"subscription_id",
",",
"query_options",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"summarize_for_subscription_async",
"(",
"subscription_id",
",",
"query_options",
":query_options",
",",
"custom_headers... | Summarizes policy states for the resources under the subscription.
@param subscription_id [String] Microsoft Azure subscription 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 [SummarizeResults] operation results. | [
"Summarizes",
"policy",
"states",
"for",
"the",
"resources",
"under",
"the",
"subscription",
"."
] | 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#L405-L408 | train | Gets the number of documents that are available for a subscription. | [
30522,
13366,
7680,
7849,
4697,
1035,
2005,
1035,
15002,
1006,
15002,
1035,
8909,
1010,
23032,
1035,
7047,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
7680,
7849,
4697,
1035,
2005,
1035,
15002,
1035,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_media_services/lib/2018-07-01/generated/azure_mgmt_media_services/live_events.rb | Azure::MediaServices::Mgmt::V2018_07_01.LiveEvents.begin_reset_with_http_info | def begin_reset_with_http_info(resource_group_name, account_name, live_event_name, custom_headers:nil)
begin_reset_async(resource_group_name, account_name, live_event_name, custom_headers:custom_headers).value!
end | ruby | def begin_reset_with_http_info(resource_group_name, account_name, live_event_name, custom_headers:nil)
begin_reset_async(resource_group_name, account_name, live_event_name, custom_headers:custom_headers).value!
end | [
"def",
"begin_reset_with_http_info",
"(",
"resource_group_name",
",",
"account_name",
",",
"live_event_name",
",",
"custom_headers",
":",
"nil",
")",
"begin_reset_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"live_event_name",
",",
"custom_headers",
":cus... | Reset Live Event
Resets an existing Live Event.
@param resource_group_name [String] The name of the resource group within the
Azure subscription.
@param account_name [String] The Media Services account name.
@param live_event_name [String] The name of the Live Event.
@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. | [
"Reset",
"Live",
"Event"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_media_services/lib/2018-07-01/generated/azure_mgmt_media_services/live_events.rb#L1105-L1107 | train | Reset the live event. | [
30522,
13366,
4088,
1035,
25141,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
2444,
1035,
2724,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
1035,
25141,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hashicorp/vault-ruby | lib/vault/api/approle.rb | Vault.AppRole.role_id | def role_id(name)
json = client.get("/v1/auth/approle/role/#{encode_path(name)}/role-id")
return Secret.decode(json).data[:role_id]
rescue HTTPError => e
return nil if e.code == 404
raise
end | ruby | def role_id(name)
json = client.get("/v1/auth/approle/role/#{encode_path(name)}/role-id")
return Secret.decode(json).data[:role_id]
rescue HTTPError => e
return nil if e.code == 404
raise
end | [
"def",
"role_id",
"(",
"name",
")",
"json",
"=",
"client",
".",
"get",
"(",
"\"/v1/auth/approle/role/#{encode_path(name)}/role-id\"",
")",
"return",
"Secret",
".",
"decode",
"(",
"json",
")",
".",
"data",
"[",
":role_id",
"]",
"rescue",
"HTTPError",
"=>",
"e",... | Reads the RoleID of an existing AppRole. If an AppRole does not exist by
that name, +nil+ is returned.
@example
Vault.approle.role_id("testrole") #=> #<Vault::Secret lease_id="...">
@return [Secret, nil] | [
"Reads",
"the",
"RoleID",
"of",
"an",
"existing",
"AppRole",
".",
"If",
"an",
"AppRole",
"does",
"not",
"exist",
"by",
"that",
"name",
"+",
"nil",
"+",
"is",
"returned",
"."
] | 02f0532a802ba1a2a0d8703a4585dab76eb9d864 | https://github.com/hashicorp/vault-ruby/blob/02f0532a802ba1a2a0d8703a4585dab76eb9d864/lib/vault/api/approle.rb#L102-L108 | train | Get the role id for a given role | [
30522,
13366,
2535,
1035,
8909,
1006,
2171,
1007,
1046,
3385,
1027,
7396,
1012,
2131,
1006,
1000,
1013,
1058,
2487,
1013,
8740,
2705,
1013,
10439,
13153,
2063,
1013,
2535,
1013,
1001,
1063,
4372,
16044,
1035,
4130,
1006,
2171,
1007,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
middleman/middleman | middleman-core/lib/middleman-core/application.rb | Middleman.Application.apply_cli_options | def apply_cli_options
config[:cli_options].each do |k, v|
setting = config.setting(k.to_sym)
next unless setting
v = setting.options[:import].call(v) if setting.options[:import]
config[k.to_sym] = v
end
end | ruby | def apply_cli_options
config[:cli_options].each do |k, v|
setting = config.setting(k.to_sym)
next unless setting
v = setting.options[:import].call(v) if setting.options[:import]
config[k.to_sym] = v
end
end | [
"def",
"apply_cli_options",
"config",
"[",
":cli_options",
"]",
".",
"each",
"do",
"|",
"k",
",",
"v",
"|",
"setting",
"=",
"config",
".",
"setting",
"(",
"k",
".",
"to_sym",
")",
"next",
"unless",
"setting",
"v",
"=",
"setting",
".",
"options",
"[",
... | Initialize the Middleman project | [
"Initialize",
"the",
"Middleman",
"project"
] | a0dd9f78094813162895511e8516e0c5507cee50 | https://github.com/middleman/middleman/blob/a0dd9f78094813162895511e8516e0c5507cee50/middleman-core/lib/middleman-core/application.rb#L309-L318 | train | Apply the cli_options to the current configuration | [
30522,
13366,
6611,
1035,
18856,
2072,
1035,
7047,
9530,
8873,
2290,
1031,
1024,
18856,
2072,
1035,
7047,
1033,
1012,
2169,
2079,
1064,
1047,
1010,
1058,
1064,
4292,
1027,
9530,
8873,
2290,
1012,
4292,
1006,
1047,
1012,
2000,
1035,
25353,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/group.rb | Aws::IAM.Group.detach_policy | def detach_policy(options = {})
options = options.merge(group_name: @name)
resp = @client.detach_group_policy(options)
resp.data
end | ruby | def detach_policy(options = {})
options = options.merge(group_name: @name)
resp = @client.detach_group_policy(options)
resp.data
end | [
"def",
"detach_policy",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"group_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"detach_group_policy",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
group.detach_policy({
policy_arn: "arnType", # required
})
@param [Hash] options ({})
@option options [required, String] :policy_arn
The Amazon Resource Name (ARN) of the IAM policy you want to detach.
For more information about ARNs, see [Amazon Resource Names (ARNs) and
AWS Service Namespaces][1] in the *AWS General Reference*.
[1]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
@return [EmptyStructure] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-iam/lib/aws-sdk-iam/group.rb#L367-L371 | train | Detach policy from group | [
30522,
13366,
20010,
6776,
1035,
3343,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
2177,
1035,
2171,
1024,
1030,
2171,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
20010,
6776,
1035,
2177,
1035,
3343,
1006,
7047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
deivid-rodriguez/pry-byebug | lib/byebug/processors/pry_processor.rb | Byebug.PryProcessor.run | def run(&_block)
return_value = nil
command = catch(:breakout_nav) do # Throws from PryByebug::Commands
return_value = allowing_other_threads { yield }
{} # Nothing thrown == no navigational command
end
# Pry instance to resume after stepping
@pry = command[:pry]
perform(command[:action], command[:options])
return_value
end | ruby | def run(&_block)
return_value = nil
command = catch(:breakout_nav) do # Throws from PryByebug::Commands
return_value = allowing_other_threads { yield }
{} # Nothing thrown == no navigational command
end
# Pry instance to resume after stepping
@pry = command[:pry]
perform(command[:action], command[:options])
return_value
end | [
"def",
"run",
"(",
"&",
"_block",
")",
"return_value",
"=",
"nil",
"command",
"=",
"catch",
"(",
":breakout_nav",
")",
"do",
"# Throws from PryByebug::Commands",
"return_value",
"=",
"allowing_other_threads",
"{",
"yield",
"}",
"{",
"}",
"# Nothing thrown == no navi... | Wrap a Pry REPL to catch navigational commands and act on them. | [
"Wrap",
"a",
"Pry",
"REPL",
"to",
"catch",
"navigational",
"commands",
"and",
"act",
"on",
"them",
"."
] | d2923e7a1629c2b860a4ea66a71dec09a4a15763 | https://github.com/deivid-rodriguez/pry-byebug/blob/d2923e7a1629c2b860a4ea66a71dec09a4a15763/lib/byebug/processors/pry_processor.rb#L26-L40 | train | Run a block in the current thread | [
30522,
13366,
2448,
1006,
1004,
1035,
3796,
1007,
2709,
1035,
3643,
1027,
9152,
2140,
3094,
1027,
4608,
1006,
1024,
25129,
1035,
6583,
2615,
1007,
2079,
1001,
11618,
2013,
29198,
3762,
15878,
15916,
1024,
1024,
10954,
2709,
1035,
3643,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | deliver/lib/deliver/runner.rb | Deliver.Runner.prepare_app_icons | def prepare_app_icons(options = {})
return unless options[:metadata_path]
default_app_icon_path = Dir[File.join(options[:metadata_path], "app_icon.{png,jpg}")].first
options[:app_icon] ||= default_app_icon_path if default_app_icon_path && File.exist?(default_app_icon_path)
default_watch_icon_path = Dir[File.join(options[:metadata_path], "watch_icon.{png,jpg}")].first
options[:apple_watch_app_icon] ||= default_watch_icon_path if default_watch_icon_path && File.exist?(default_watch_icon_path)
end | ruby | def prepare_app_icons(options = {})
return unless options[:metadata_path]
default_app_icon_path = Dir[File.join(options[:metadata_path], "app_icon.{png,jpg}")].first
options[:app_icon] ||= default_app_icon_path if default_app_icon_path && File.exist?(default_app_icon_path)
default_watch_icon_path = Dir[File.join(options[:metadata_path], "watch_icon.{png,jpg}")].first
options[:apple_watch_app_icon] ||= default_watch_icon_path if default_watch_icon_path && File.exist?(default_watch_icon_path)
end | [
"def",
"prepare_app_icons",
"(",
"options",
"=",
"{",
"}",
")",
"return",
"unless",
"options",
"[",
":metadata_path",
"]",
"default_app_icon_path",
"=",
"Dir",
"[",
"File",
".",
"join",
"(",
"options",
"[",
":metadata_path",
"]",
",",
"\"app_icon.{png,jpg}\"",
... | If options[:app_icon]/options[:apple_watch_app_icon]
is supplied value/path will be used.
If it is unset files (app_icon/watch_icon) exists in
the fastlane/metadata/ folder, those will be used | [
"If",
"options",
"[",
":",
"app_icon",
"]",
"/",
"options",
"[",
":",
"apple_watch_app_icon",
"]",
"is",
"supplied",
"value",
"/",
"path",
"will",
"be",
"used",
".",
"If",
"it",
"is",
"unset",
"files",
"(",
"app_icon",
"/",
"watch_icon",
")",
"exists",
... | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/deliver/lib/deliver/runner.rb#L130-L138 | train | Prepare app icons for the app | [
30522,
13366,
7374,
1035,
10439,
1035,
18407,
1006,
7047,
1027,
1063,
1065,
1007,
2709,
4983,
7047,
1031,
1024,
27425,
1035,
4130,
1033,
12398,
1035,
10439,
1035,
12696,
1035,
4130,
1027,
16101,
1031,
5371,
1012,
3693,
1006,
7047,
1031,
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... |
doorkeeper-gem/doorkeeper | lib/doorkeeper/models/access_token_mixin.rb | Doorkeeper.AccessTokenMixin.generate_token | def generate_token
self.created_at ||= Time.now.utc
@raw_token = token_generator.generate(
resource_owner_id: resource_owner_id,
scopes: scopes,
application: application,
expires_in: expires_in,
created_at: created_at
)
secret_strategy.store_secret(self, :token, @raw_token)
@raw_token
end | ruby | def generate_token
self.created_at ||= Time.now.utc
@raw_token = token_generator.generate(
resource_owner_id: resource_owner_id,
scopes: scopes,
application: application,
expires_in: expires_in,
created_at: created_at
)
secret_strategy.store_secret(self, :token, @raw_token)
@raw_token
end | [
"def",
"generate_token",
"self",
".",
"created_at",
"||=",
"Time",
".",
"now",
".",
"utc",
"@raw_token",
"=",
"token_generator",
".",
"generate",
"(",
"resource_owner_id",
":",
"resource_owner_id",
",",
"scopes",
":",
"scopes",
",",
"application",
":",
"applicat... | Generates and sets the token value with the
configured Generator class (see Doorkeeper.configuration).
@return [String] generated token value
@raise [Doorkeeper::Errors::UnableToGenerateToken]
custom class doesn't implement .generate method
@raise [Doorkeeper::Errors::TokenGeneratorNotFound]
custom class doesn't exist | [
"Generates",
"and",
"sets",
"the",
"token",
"value",
"with",
"the",
"configured",
"Generator",
"class",
"(",
"see",
"Doorkeeper",
".",
"configuration",
")",
"."
] | f1be81891c3d54a42928c1b9e03c5d6833b8af87 | https://github.com/doorkeeper-gem/doorkeeper/blob/f1be81891c3d54a42928c1b9e03c5d6833b8af87/lib/doorkeeper/models/access_token_mixin.rb#L283-L296 | train | Generate a token from the token generator | [
30522,
13366,
9699,
1035,
19204,
2969,
1012,
2580,
1035,
2012,
1064,
1064,
1027,
2051,
1012,
2085,
1012,
11396,
1030,
6315,
1035,
19204,
1027,
19204,
1035,
13103,
1012,
9699,
1006,
7692,
1035,
3954,
1035,
8909,
1024,
7692,
1035,
3954,
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... |
haml/haml | lib/haml/parser.rb | Haml.Parser.process_indent | def process_indent(line)
return unless line.tabs <= @template_tabs && @template_tabs > 0
to_close = @template_tabs - line.tabs
to_close.times {|i| close unless to_close - 1 - i == 0 && continuation_script?(line.text)}
end | ruby | def process_indent(line)
return unless line.tabs <= @template_tabs && @template_tabs > 0
to_close = @template_tabs - line.tabs
to_close.times {|i| close unless to_close - 1 - i == 0 && continuation_script?(line.text)}
end | [
"def",
"process_indent",
"(",
"line",
")",
"return",
"unless",
"line",
".",
"tabs",
"<=",
"@template_tabs",
"&&",
"@template_tabs",
">",
"0",
"to_close",
"=",
"@template_tabs",
"-",
"line",
".",
"tabs",
"to_close",
".",
"times",
"{",
"|",
"i",
"|",
"close"... | Processes and deals with lowering indentation. | [
"Processes",
"and",
"deals",
"with",
"lowering",
"indentation",
"."
] | 9aa0fbe4a91b999978927be569d2ad0cd39076f1 | https://github.com/haml/haml/blob/9aa0fbe4a91b999978927be569d2ad0cd39076f1/lib/haml/parser.rb#L233-L238 | train | process indents | [
30522,
13366,
2832,
1035,
27427,
4765,
1006,
2240,
1007,
2709,
4983,
2240,
1012,
21628,
2015,
1026,
1027,
1030,
23561,
1035,
21628,
2015,
1004,
1004,
1030,
23561,
1035,
21628,
2015,
1028,
1014,
2000,
1035,
2485,
1027,
1030,
23561,
1035,
216... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Fullscreen/yt | lib/yt/request.rb | Yt.Request.run | def run
if matches_expectations?
response.tap{parse_response!}
elsif run_again?
run
else
raise response_error, error_message.to_json
end
end | ruby | def run
if matches_expectations?
response.tap{parse_response!}
elsif run_again?
run
else
raise response_error, error_message.to_json
end
end | [
"def",
"run",
"if",
"matches_expectations?",
"response",
".",
"tap",
"{",
"parse_response!",
"}",
"elsif",
"run_again?",
"run",
"else",
"raise",
"response_error",
",",
"error_message",
".",
"to_json",
"end",
"end"
] | Initializes a Request object.
@param [Hash] options the options for the request.
@option options [String, Symbol] :method (:get) The HTTP method to use.
@option options [Class] :expected_response (Net::HTTPSuccess) The class
of response that the request should obtain when run.
@option options [String, Symbol] :response_format (:json) The expected
format of the response body. If passed, the response body will be
parsed according to the format before being returned.
@option options [String] :host The host component of the request URI.
@option options [String] :path The path component of the request URI.
@option options [Hash] :params ({}) The params to use as the query
component of the request URI, for instance the Hash +{a: 1, b: 2}+
corresponds to the query parameters "a=1&b=2".
@option options [Hash] :camelize_params (true) whether to transform
each key of params into a camel-case symbol before sending the request.
@option options [Hash] :request_format (:json) The format of the
request body. If a request body is passed, it will be parsed
according to this format before sending it in the request.
@option options [#size] :body The body component of the request.
@option options [Hash] :headers ({}) The headers component of the
request.
@option options [#access_token, #refreshed_access_token?] :auth The
authentication object. If set, must respond to +access_token+ and
return the OAuth token to make an authenticated request, and must
respond to +refreshed_access_token?+ and return whether the access
token can be refreshed if expired.
Sends the request and returns the response.
If the request fails once for a temporary server error or an expired
token, tries the request again before eventually raising an error.
@return [Net::HTTPResponse] if the request succeeds and matches the
expectations, the response with the body appropriately parsed.
@raise [Yt::RequestError] if the request fails or the response does
not match the expectations. | [
"Initializes",
"a",
"Request",
"object",
"."
] | bf5c33b977cb162bb7735ad5b80d1abdb5a38215 | https://github.com/Fullscreen/yt/blob/bf5c33b977cb162bb7735ad5b80d1abdb5a38215/lib/yt/request.rb#L77-L85 | train | Runs the request against the current request. | [
30522,
13366,
2448,
2065,
3503,
1035,
10908,
1029,
3433,
1012,
11112,
1063,
11968,
3366,
1035,
3433,
999,
1065,
3449,
5332,
2546,
2448,
1035,
2153,
1029,
2448,
2842,
5333,
3433,
1035,
7561,
1010,
7561,
1035,
4471,
1012,
2000,
1035,
1046,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.create_prebuilt_entity_role | def create_prebuilt_entity_role(app_id, version_id, entity_id, entity_role_create_object, custom_headers:nil)
response = create_prebuilt_entity_role_async(app_id, version_id, entity_id, entity_role_create_object, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_prebuilt_entity_role(app_id, version_id, entity_id, entity_role_create_object, custom_headers:nil)
response = create_prebuilt_entity_role_async(app_id, version_id, entity_id, entity_role_create_object, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_prebuilt_entity_role",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"entity_role_create_object",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_prebuilt_entity_role_async",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
... | Create a role for a prebuilt entity in a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param entity_id The entity model ID.
@param entity_role_create_object [EntityRoleCreateObject] An entity role
object containing the name of role.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Uuid] operation results. | [
"Create",
"a",
"role",
"for",
"a",
"prebuilt",
"entity",
"in",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L6464-L6467 | train | Creates an entity role for a given entity in a version of the application. | [
30522,
13366,
3443,
1035,
3653,
8569,
4014,
2102,
1035,
9178,
1035,
2535,
1006,
10439,
1035,
8909,
1010,
2544,
30524,
1010,
9178,
1035,
8909,
1010,
9178,
1035,
2535,
1035,
3443,
1035,
4874,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2018-04-01/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb | Azure::Compute::Mgmt::V2018_04_01.VirtualMachineScaleSets.reimage_async | def reimage_async(resource_group_name, vm_scale_set_name, vm_instance_ids:nil, custom_headers:nil)
# Send request
promise = begin_reimage_async(resource_group_name, vm_scale_set_name, vm_instance_ids:vm_instance_ids, 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 reimage_async(resource_group_name, vm_scale_set_name, vm_instance_ids:nil, custom_headers:nil)
# Send request
promise = begin_reimage_async(resource_group_name, vm_scale_set_name, vm_instance_ids:vm_instance_ids, 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",
"reimage_async",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"vm_instance_ids",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_reimage_async",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
... | @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 [Concurrent::Promise] promise which provides async access to http
response. | [
"@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",
"[",
"VirtualMachi... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2018-04-01/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb#L1077-L1091 | train | Reimage a virtual machine in a VM scale set. | [
30522,
13366,
24964,
26860,
1035,
2004,
6038,
2278,
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,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/lookups/bing.rb | Geocoder::Lookup.Bing.base_query_url | def base_query_url(query)
text = CGI.escape(query.sanitized_text.strip)
url = "#{protocol}://dev.virtualearth.net/REST/v1/Locations/"
if query.reverse_geocode?
url + "#{text}?"
else
if r = query.options[:region]
url << "#{r}/"
end
# use the more forgiving 'unstructured' query format to allow special
# chars, newlines, brackets, typos.
url + "?q=#{text}&"
end
end | ruby | def base_query_url(query)
text = CGI.escape(query.sanitized_text.strip)
url = "#{protocol}://dev.virtualearth.net/REST/v1/Locations/"
if query.reverse_geocode?
url + "#{text}?"
else
if r = query.options[:region]
url << "#{r}/"
end
# use the more forgiving 'unstructured' query format to allow special
# chars, newlines, brackets, typos.
url + "?q=#{text}&"
end
end | [
"def",
"base_query_url",
"(",
"query",
")",
"text",
"=",
"CGI",
".",
"escape",
"(",
"query",
".",
"sanitized_text",
".",
"strip",
")",
"url",
"=",
"\"#{protocol}://dev.virtualearth.net/REST/v1/Locations/\"",
"if",
"query",
".",
"reverse_geocode?",
"url",
"+",
"\"#... | --------------------------------------------------------------- | [
"---------------------------------------------------------------"
] | e087dc2759264ee6f307b926bb2de4ec2406859e | https://github.com/alexreisner/geocoder/blob/e087dc2759264ee6f307b926bb2de4ec2406859e/lib/geocoder/lookups/bing.rb#L21-L34 | train | Returns the base url for a query | [
30522,
13366,
2918,
1035,
23032,
1035,
24471,
2140,
1006,
23032,
1007,
3793,
1027,
1039,
5856,
1012,
4019,
1006,
23032,
1012,
2624,
25090,
5422,
1035,
3793,
1012,
6167,
1007,
24471,
2140,
1027,
1000,
1001,
1063,
8778,
1065,
1024,
1013,
1013... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
RailsEventStore/rails_event_store | ruby_event_store/lib/ruby_event_store/specification.rb | RubyEventStore.Specification.limit | def limit(count)
raise InvalidPageSize unless count && count > 0
Specification.new(reader, result.dup { |r| r.count = count })
end | ruby | def limit(count)
raise InvalidPageSize unless count && count > 0
Specification.new(reader, result.dup { |r| r.count = count })
end | [
"def",
"limit",
"(",
"count",
")",
"raise",
"InvalidPageSize",
"unless",
"count",
"&&",
"count",
">",
"0",
"Specification",
".",
"new",
"(",
"reader",
",",
"result",
".",
"dup",
"{",
"|",
"r",
"|",
"r",
".",
"count",
"=",
"count",
"}",
")",
"end"
] | Limits the query to specified number of events.
{http://railseventstore.org/docs/read/ Find out more}.
@param count [Integer] maximal number of events to retrieve
@return [Specification] | [
"Limits",
"the",
"query",
"to",
"specified",
"number",
"of",
"events",
".",
"{",
"http",
":",
"//",
"railseventstore",
".",
"org",
"/",
"docs",
"/",
"read",
"/",
"Find",
"out",
"more",
"}",
"."
] | 3ee4f3148499794154ee6fec74ccf6d4670d85ac | https://github.com/RailsEventStore/rails_event_store/blob/3ee4f3148499794154ee6fec74ccf6d4670d85ac/ruby_event_store/lib/ruby_event_store/specification.rb#L65-L68 | train | Limit the result to the specified number of pages. | [
30522,
13366,
5787,
1006,
4175,
1007,
5333,
19528,
13704,
5332,
4371,
4983,
4175,
1004,
1004,
4175,
1028,
1014,
12827,
1012,
2047,
1006,
8068,
1010,
2765,
1012,
4241,
2361,
1063,
1064,
1054,
1064,
1054,
1012,
4175,
1027,
4175,
1065,
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... |
piotrmurach/github | lib/github_api/client/repos/pub_sub_hubbub.rb | Github.Client::Repos::PubSubHubbub.unsubscribe_service | def unsubscribe_service(*args)
params = arguments(args, required: [:user, :repo, :service]).params
event = params.delete('event') || 'push'
topic = "#{site}/#{arguments.user}/#{arguments.repo}/events/#{event}"
callback = "github://#{arguments.service}"
unsubscribe(topic, callback)
end | ruby | def unsubscribe_service(*args)
params = arguments(args, required: [:user, :repo, :service]).params
event = params.delete('event') || 'push'
topic = "#{site}/#{arguments.user}/#{arguments.repo}/events/#{event}"
callback = "github://#{arguments.service}"
unsubscribe(topic, callback)
end | [
"def",
"unsubscribe_service",
"(",
"*",
"args",
")",
"params",
"=",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":service",
"]",
")",
".",
"params",
"event",
"=",
"params",
".",
"delete",
"(",
"'event'",
")",
"||",
... | Subscribe repository to service hook through pubsubhubbub
@param [Hash] params
@input params [String] :event
Optional hash key for the type of event. The default event is push.
@example
github = Github.new oauth_token: '...'
github.repos.pubsubhubbub.unsubscribe_service 'user-name', 'repo-name',
'campfire'
@example
github.repos.pubsubhubbub.unsubscribe_service
user: 'user-name',
repo: 'repo-name',
service: 'service-name'
@api public | [
"Subscribe",
"repository",
"to",
"service",
"hook",
"through",
"pubsubhubbub"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/repos/pub_sub_hubbub.rb#L109-L116 | train | Unsubscribe a service from a GitHub topic | [
30522,
13366,
4895,
6342,
5910,
26775,
20755,
1035,
2326,
1006,
1008,
12098,
5620,
1007,
11498,
5244,
1027,
9918,
1006,
12098,
5620,
1010,
3223,
1024,
1031,
1024,
5310,
1010,
1024,
16360,
2080,
1010,
1024,
2326,
1033,
1007,
1012,
11498,
524... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | deliver/lib/deliver/upload_metadata.rb | Deliver.UploadMetadata.upload_individual_item | def upload_individual_item(app, version, language, key, value)
details = app.details
version.send(key)[language] = value if LOCALISED_VERSION_VALUES.include?(key)
details.send(key)[language] = value if LOCALISED_APP_VALUES.include?(key)
Helper.show_loading_indicator("Uploading #{language} #{key} to App Store Connect")
version.save!
Helper.hide_loading_indicator
begin
details.save!
UI.success("Successfully uploaded #{language} #{key} to App Store Connect")
rescue Spaceship::TunesClient::ITunesConnectError => e
UI.error("Error in #{language} #{key}: \n#{value}")
UI.error(e.message) # Don't use user_error to allow all values to get checked
end
end | ruby | def upload_individual_item(app, version, language, key, value)
details = app.details
version.send(key)[language] = value if LOCALISED_VERSION_VALUES.include?(key)
details.send(key)[language] = value if LOCALISED_APP_VALUES.include?(key)
Helper.show_loading_indicator("Uploading #{language} #{key} to App Store Connect")
version.save!
Helper.hide_loading_indicator
begin
details.save!
UI.success("Successfully uploaded #{language} #{key} to App Store Connect")
rescue Spaceship::TunesClient::ITunesConnectError => e
UI.error("Error in #{language} #{key}: \n#{value}")
UI.error(e.message) # Don't use user_error to allow all values to get checked
end
end | [
"def",
"upload_individual_item",
"(",
"app",
",",
"version",
",",
"language",
",",
"key",
",",
"value",
")",
"details",
"=",
"app",
".",
"details",
"version",
".",
"send",
"(",
"key",
")",
"[",
"language",
"]",
"=",
"value",
"if",
"LOCALISED_VERSION_VALUES... | Uploads metadata individually by language to help identify exactly which items have issues | [
"Uploads",
"metadata",
"individually",
"by",
"language",
"to",
"help",
"identify",
"exactly",
"which",
"items",
"have",
"issues"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/deliver/lib/deliver/upload_metadata.rb#L155-L169 | train | Upload an individual item to the App Store Connect | [
30522,
13366,
2039,
11066,
1035,
3265,
1035,
8875,
1006,
10439,
1010,
2544,
1010,
2653,
1010,
3145,
1010,
3643,
1007,
4751,
1027,
10439,
1012,
4751,
2544,
1012,
4604,
1006,
3145,
1007,
1031,
2653,
1033,
1027,
3643,
2065,
2334,
5084,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/subscription.rb | Azure::ApiManagement::Mgmt::V2018_01_01.Subscription.list_with_http_info | def list_with_http_info(resource_group_name, service_name, filter:nil, top:nil, skip:nil, custom_headers:nil)
list_async(resource_group_name, service_name, filter:filter, top:top, skip:skip, custom_headers:custom_headers).value!
end | ruby | def list_with_http_info(resource_group_name, service_name, filter:nil, top:nil, skip:nil, custom_headers:nil)
list_async(resource_group_name, service_name, filter:filter, top:top, skip:skip, custom_headers:custom_headers).value!
end | [
"def",
"list_with_http_info",
"(",
"resource_group_name",
",",
"service_name",
",",
"filter",
":",
"nil",
",",
"top",
":",
"nil",
",",
"skip",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"list_async",
"(",
"resource_group_name",
",",
"service_name",
",... | Lists all subscriptions of the API Management service instance.
@param resource_group_name [String] The name of the resource group.
@param service_name [String] The name of the API Management service.
@param filter [String] | Field | Supported operators | Supported
functions |
|--------------|------------------------|---------------------------------------------|
| id | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
endswith |
| name | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
endswith |
| stateComment | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
endswith |
| userId | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
endswith |
| productId | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
endswith |
| state | eq |
|
@param top [Integer] Number of records to return.
@param skip [Integer] Number of records to skip.
@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. | [
"Lists",
"all",
"subscriptions",
"of",
"the",
"API",
"Management",
"service",
"instance",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/subscription.rb#L83-L85 | train | Gets the list of the available advisor s advisors. | [
30522,
13366,
2862,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
11307,
1024,
9152,
2140,
1010,
2327,
1024,
9152,
2140,
1010,
13558,
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... |
meew0/discordrb | lib/discordrb/commands/command_bot.rb | Discordrb::Commands.CommandBot.execute_command | def execute_command(name, event, arguments, chained = false, check_permissions = true)
debug("Executing command #{name} with arguments #{arguments}")
return unless @commands
command = @commands[name]
command = command.aliased_command if command.is_a?(CommandAlias)
return unless !check_permissions || channels?(event.channel, @attributes[:channels]) ||
(command && !command.attributes[:channels].nil?)
unless command
event.respond @attributes[:command_doesnt_exist_message].gsub('%command%', name.to_s) if @attributes[:command_doesnt_exist_message]
return
end
return unless !check_permissions || channels?(event.channel, command.attributes[:channels])
arguments = arg_check(arguments, command.attributes[:arg_types], event.server) if check_permissions
if (check_permissions &&
permission?(event.author, command.attributes[:permission_level], event.server) &&
required_permissions?(event.author, command.attributes[:required_permissions], event.channel) &&
required_roles?(event.author, command.attributes[:required_roles]) &&
allowed_roles?(event.author, command.attributes[:allowed_roles])) ||
!check_permissions
event.command = command
result = command.call(event, arguments, chained, check_permissions)
stringify(result)
else
event.respond command.attributes[:permission_message].gsub('%name%', name.to_s) if command.attributes[:permission_message]
nil
end
rescue Discordrb::Errors::NoPermission
event.respond @attributes[:no_permission_message] unless @attributes[:no_permission_message].nil?
raise
end | ruby | def execute_command(name, event, arguments, chained = false, check_permissions = true)
debug("Executing command #{name} with arguments #{arguments}")
return unless @commands
command = @commands[name]
command = command.aliased_command if command.is_a?(CommandAlias)
return unless !check_permissions || channels?(event.channel, @attributes[:channels]) ||
(command && !command.attributes[:channels].nil?)
unless command
event.respond @attributes[:command_doesnt_exist_message].gsub('%command%', name.to_s) if @attributes[:command_doesnt_exist_message]
return
end
return unless !check_permissions || channels?(event.channel, command.attributes[:channels])
arguments = arg_check(arguments, command.attributes[:arg_types], event.server) if check_permissions
if (check_permissions &&
permission?(event.author, command.attributes[:permission_level], event.server) &&
required_permissions?(event.author, command.attributes[:required_permissions], event.channel) &&
required_roles?(event.author, command.attributes[:required_roles]) &&
allowed_roles?(event.author, command.attributes[:allowed_roles])) ||
!check_permissions
event.command = command
result = command.call(event, arguments, chained, check_permissions)
stringify(result)
else
event.respond command.attributes[:permission_message].gsub('%name%', name.to_s) if command.attributes[:permission_message]
nil
end
rescue Discordrb::Errors::NoPermission
event.respond @attributes[:no_permission_message] unless @attributes[:no_permission_message].nil?
raise
end | [
"def",
"execute_command",
"(",
"name",
",",
"event",
",",
"arguments",
",",
"chained",
"=",
"false",
",",
"check_permissions",
"=",
"true",
")",
"debug",
"(",
"\"Executing command #{name} with arguments #{arguments}\"",
")",
"return",
"unless",
"@commands",
"command",... | Executes a particular command on the bot. Mostly useful for internal stuff, but one can never know.
@param name [Symbol] The command to execute.
@param event [CommandEvent] The event to pass to the command.
@param arguments [Array<String>] The arguments to pass to the command.
@param chained [true, false] Whether or not it should be executed as part of a command chain. If this is false,
commands that have chain_usable set to false will not work.
@param check_permissions [true, false] Whether permission parameters such as `required_permission` or
`permission_level` should be checked.
@return [String, nil] the command's result, if there is any. | [
"Executes",
"a",
"particular",
"command",
"on",
"the",
"bot",
".",
"Mostly",
"useful",
"for",
"internal",
"stuff",
"but",
"one",
"can",
"never",
"know",
"."
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/commands/command_bot.rb#L208-L240 | train | Execute a command | [
30522,
13366,
15389,
1035,
3094,
1006,
2171,
1010,
2724,
1010,
9918,
1010,
22075,
1027,
6270,
1010,
4638,
1035,
6656,
2015,
1027,
2995,
1007,
2139,
8569,
2290,
1006,
1000,
23448,
3094,
1001,
1063,
2171,
1065,
2007,
9918,
1001,
1063,
9918,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
danger/danger | lib/danger/danger_core/plugins/dangerfile_danger_plugin.rb | Danger.DangerfileDangerPlugin.import_local | def import_local(path)
Dir[path].each do |file|
validate_file_contains_plugin!(file) do
# Without the expand_path it would fail if the path doesn't start with ./
require File.expand_path(file)
end
refresh_plugins
end
end | ruby | def import_local(path)
Dir[path].each do |file|
validate_file_contains_plugin!(file) do
# Without the expand_path it would fail if the path doesn't start with ./
require File.expand_path(file)
end
refresh_plugins
end
end | [
"def",
"import_local",
"(",
"path",
")",
"Dir",
"[",
"path",
"]",
".",
"each",
"do",
"|",
"file",
"|",
"validate_file_contains_plugin!",
"(",
"file",
")",
"do",
"# Without the expand_path it would fail if the path doesn't start with ./",
"require",
"File",
".",
"expan... | @!group Plugins
Import one or more local plugins.
@param [String] path
The path to the file to import
Can also be a pattern (./**/*plugin.rb)
@return [void] | [
"@!group",
"Plugins",
"Import",
"one",
"or",
"more",
"local",
"plugins",
"."
] | 0d6d09f2d949c287fe75202d947374042b0679f4 | https://github.com/danger/danger/blob/0d6d09f2d949c287fe75202d947374042b0679f4/lib/danger/danger_core/plugins/dangerfile_danger_plugin.rb#L208-L217 | train | Imports the local file | [
30522,
13366,
12324,
1035,
2334,
1006,
4130,
1007,
16101,
1031,
4130,
1033,
1012,
2169,
2079,
1064,
5371,
1064,
9398,
3686,
1035,
5371,
1035,
3397,
1035,
13354,
2378,
999,
1006,
5371,
1007,
2079,
1001,
2302,
1996,
7818,
1035,
4130,
2009,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/diagnostics.rb | Azure::Web::Mgmt::V2018_02_01.Diagnostics.get_site_detector_next | def get_site_detector_next(next_page_link, custom_headers:nil)
response = get_site_detector_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_site_detector_next(next_page_link, custom_headers:nil)
response = get_site_detector_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_site_detector_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_site_detector_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"re... | Get Detector
Get Detector
@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 [DiagnosticDetectorCollection] operation results. | [
"Get",
"Detector"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/diagnostics.rb#L3004-L3007 | train | Gets the site detector. | [
30522,
13366,
2131,
1035,
2609,
1035,
19034,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
30524,
2278,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
20346,
2015,
1007,
1012,
3643,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.attach | def attach
unless addon_name = args.shift
error("Usage: heroku addons:attach ADDON_NAME\nMust specify add-on resource to attach.")
end
addon = resolve_addon!(addon_name)
requires_preauth
attachment_name = options[:as]
msg = attachment_name ?
"Attaching #{addon['name']} as #{attachment_name} to #{app}" :
"Attaching #{addon['name']} to #{app}"
display("#{msg}... ", false)
response = api.request(
:body => json_encode({
"app" => {"name" => app},
"addon" => {"name" => addon['name']},
"confirm" => options[:confirm],
"name" => attachment_name
}),
:expects => [201, 422],
:headers => { "Accept" => "application/vnd.heroku+json; version=3" },
:method => :post,
:path => "/addon-attachments"
)
case response.status
when 201
display("done")
action("Setting #{response.body["name"]} vars and restarting #{app}") do
@status = api.get_release(app, 'current').body['name']
end
when 422 # add-on resource not found or cannot be attached
display("failed")
output_with_bang(response.body["message"])
output_with_bang("List available resources with `heroku addons`.")
output_with_bang("Provision a new add-on resource with `heroku addons:create ADDON_PLAN`.")
end
end | ruby | def attach
unless addon_name = args.shift
error("Usage: heroku addons:attach ADDON_NAME\nMust specify add-on resource to attach.")
end
addon = resolve_addon!(addon_name)
requires_preauth
attachment_name = options[:as]
msg = attachment_name ?
"Attaching #{addon['name']} as #{attachment_name} to #{app}" :
"Attaching #{addon['name']} to #{app}"
display("#{msg}... ", false)
response = api.request(
:body => json_encode({
"app" => {"name" => app},
"addon" => {"name" => addon['name']},
"confirm" => options[:confirm],
"name" => attachment_name
}),
:expects => [201, 422],
:headers => { "Accept" => "application/vnd.heroku+json; version=3" },
:method => :post,
:path => "/addon-attachments"
)
case response.status
when 201
display("done")
action("Setting #{response.body["name"]} vars and restarting #{app}") do
@status = api.get_release(app, 'current').body['name']
end
when 422 # add-on resource not found or cannot be attached
display("failed")
output_with_bang(response.body["message"])
output_with_bang("List available resources with `heroku addons`.")
output_with_bang("Provision a new add-on resource with `heroku addons:create ADDON_PLAN`.")
end
end | [
"def",
"attach",
"unless",
"addon_name",
"=",
"args",
".",
"shift",
"error",
"(",
"\"Usage: heroku addons:attach ADDON_NAME\\nMust specify add-on resource to attach.\"",
")",
"end",
"addon",
"=",
"resolve_addon!",
"(",
"addon_name",
")",
"requires_preauth",
"attachment_name",... | addons:attach ADDON_NAME
attach add-on resource to an app
--as ATTACHMENT_NAME # (optional) name for add-on attachment
--confirm APP_NAME # overwrite existing add-on attachment with same name | [
"addons",
":",
"attach",
"ADDON_NAME"
] | 6f18521a258394bfb79e6b36f7160ad8559a8e16 | https://github.com/heroku/legacy-cli/blob/6f18521a258394bfb79e6b36f7160ad8559a8e16/lib/heroku/command/addons.rb#L159-L200 | train | Attaches an add - on to an app | [
30522,
13366,
22476,
4983,
5587,
2239,
1035,
2171,
1027,
12098,
5620,
1012,
5670,
7561,
1006,
1000,
8192,
1024,
5394,
5283,
5587,
5644,
1024,
22476,
5587,
2239,
1035,
2171,
1032,
13221,
19966,
20648,
5587,
1011,
2006,
7692,
2000,
22476,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mojombo/chronic | lib/chronic/handlers.rb | Chronic.Handlers.handle_o_r_g_r | def handle_o_r_g_r(tokens, options)
outer_span = get_anchor(tokens[2..3], options)
handle_orr(tokens[0..1], outer_span, options)
end | ruby | def handle_o_r_g_r(tokens, options)
outer_span = get_anchor(tokens[2..3], options)
handle_orr(tokens[0..1], outer_span, options)
end | [
"def",
"handle_o_r_g_r",
"(",
"tokens",
",",
"options",
")",
"outer_span",
"=",
"get_anchor",
"(",
"tokens",
"[",
"2",
"..",
"3",
"]",
",",
"options",
")",
"handle_orr",
"(",
"tokens",
"[",
"0",
"..",
"1",
"]",
",",
"outer_span",
",",
"options",
")",
... | Handle ordinal/repeater/grabber/repeater | [
"Handle",
"ordinal",
"/",
"repeater",
"/",
"grabber",
"/",
"repeater"
] | 2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c | https://github.com/mojombo/chronic/blob/2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c/lib/chronic/handlers.rb#L513-L516 | train | Handle O R G R | [
30522,
13366,
5047,
1035,
1051,
1035,
1054,
1035,
1043,
1035,
1054,
1006,
19204,
2015,
1010,
7047,
1007,
6058,
1035,
8487,
1027,
2131,
1035,
8133,
1006,
19204,
2015,
1031,
1016,
1012,
1012,
1017,
1033,
1010,
7047,
1007,
5047,
1035,
26914,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
braintree/braintree_ruby | lib/braintree/transparent_redirect_gateway.rb | Braintree.TransparentRedirectGateway.confirm | def confirm(query_string)
params = @gateway.transparent_redirect.parse_and_validate_query_string query_string
confirmation_gateway = {
TransparentRedirect::Kind::CreateCustomer => :customer,
TransparentRedirect::Kind::UpdateCustomer => :customer,
TransparentRedirect::Kind::CreatePaymentMethod => :credit_card,
TransparentRedirect::Kind::UpdatePaymentMethod => :credit_card,
TransparentRedirect::Kind::CreateTransaction => :transaction
}[params[:kind]]
@gateway.send(confirmation_gateway)._do_create("/transparent_redirect_requests/#{params[:id]}/confirm")
end | ruby | def confirm(query_string)
params = @gateway.transparent_redirect.parse_and_validate_query_string query_string
confirmation_gateway = {
TransparentRedirect::Kind::CreateCustomer => :customer,
TransparentRedirect::Kind::UpdateCustomer => :customer,
TransparentRedirect::Kind::CreatePaymentMethod => :credit_card,
TransparentRedirect::Kind::UpdatePaymentMethod => :credit_card,
TransparentRedirect::Kind::CreateTransaction => :transaction
}[params[:kind]]
@gateway.send(confirmation_gateway)._do_create("/transparent_redirect_requests/#{params[:id]}/confirm")
end | [
"def",
"confirm",
"(",
"query_string",
")",
"params",
"=",
"@gateway",
".",
"transparent_redirect",
".",
"parse_and_validate_query_string",
"query_string",
"confirmation_gateway",
"=",
"{",
"TransparentRedirect",
"::",
"Kind",
"::",
"CreateCustomer",
"=>",
":customer",
... | :nodoc: | [
":",
"nodoc",
":"
] | 6e56c7099ea55bcdc4073cbea60b2688cef69663 | https://github.com/braintree/braintree_ruby/blob/6e56c7099ea55bcdc4073cbea60b2688cef69663/lib/braintree/transparent_redirect_gateway.rb#L16-L27 | train | confirm a request | [
30522,
13366,
12210,
1006,
23032,
1035,
5164,
1007,
11498,
5244,
1027,
1030,
11909,
1012,
13338,
1035,
2417,
7442,
6593,
1012,
11968,
3366,
1035,
1998,
1035,
9398,
3686,
1035,
23032,
1035,
5164,
23032,
1035,
5164,
13964,
1035,
11909,
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... |
deivid-rodriguez/byebug | lib/byebug/runner.rb | Byebug.Runner.option_parser | def option_parser
@option_parser ||= OptionParser.new(banner, 25) do |opts|
opts.banner = banner
OptionSetter.new(self, opts).setup
end
end | ruby | def option_parser
@option_parser ||= OptionParser.new(banner, 25) do |opts|
opts.banner = banner
OptionSetter.new(self, opts).setup
end
end | [
"def",
"option_parser",
"@option_parser",
"||=",
"OptionParser",
".",
"new",
"(",
"banner",
",",
"25",
")",
"do",
"|",
"opts",
"|",
"opts",
".",
"banner",
"=",
"banner",
"OptionSetter",
".",
"new",
"(",
"self",
",",
"opts",
")",
".",
"setup",
"end",
"e... | Processes options passed from the command line. | [
"Processes",
"options",
"passed",
"from",
"the",
"command",
"line",
"."
] | bf41a63858a648baa7fb621600d6451786d1572a | https://github.com/deivid-rodriguez/byebug/blob/bf41a63858a648baa7fb621600d6451786d1572a/lib/byebug/runner.rb#L118-L124 | train | The option parser for the
| [
30522,
13366,
5724,
1035,
11968,
8043,
1030,
5724,
1035,
11968,
8043,
1064,
1064,
1027,
5724,
19362,
8043,
1012,
2047,
1006,
9484,
1010,
2423,
1007,
2079,
1064,
23569,
2015,
1064,
23569,
2015,
1012,
9484,
1027,
9484,
7047,
7585,
2099,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_container_registry/lib/2018-02-01-preview/generated/azure_mgmt_container_registry/build_tasks.rb | Azure::ContainerRegistry::Mgmt::V2018_02_01_preview.BuildTasks.update_async | def update_async(resource_group_name, registry_name, build_task_name, build_task_update_parameters, custom_headers:nil)
# Send request
promise = begin_update_async(resource_group_name, registry_name, build_task_name, build_task_update_parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::ContainerRegistry::Mgmt::V2018_02_01_preview::Models::BuildTask.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 update_async(resource_group_name, registry_name, build_task_name, build_task_update_parameters, custom_headers:nil)
# Send request
promise = begin_update_async(resource_group_name, registry_name, build_task_name, build_task_update_parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::ContainerRegistry::Mgmt::V2018_02_01_preview::Models::BuildTask.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",
"update_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"build_task_name",
",",
"build_task_update_parameters",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_update_async",
"(",
"resource_group_name",
",",
"registry... | @param resource_group_name [String] The name of the resource group to which
the container registry belongs.
@param registry_name [String] The name of the container registry.
@param build_task_name [String] The name of the container registry build
task.
@param build_task_update_parameters [BuildTaskUpdateParameters] The
parameters for updating a build task.
@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",
"to",
"which",
"the",
"container",
"registry",
"belongs",
".",
"@param",
"registry_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"container",
"regist... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_registry/lib/2018-02-01-preview/generated/azure_mgmt_container_registry/build_tasks.rb#L369-L385 | train | Updates a build task. | [
30522,
13366,
10651,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
30524,
1007,
1001,
4604,
5227,
4872,
1027,
4088,
1035,
10651,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
3857,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.