repo stringclasses 235 values | path stringlengths 11 168 | func_name stringlengths 12 143 | original_string stringlengths 83 6.91k | language stringclasses 1 value | code stringlengths 83 6.91k | code_tokens listlengths 15 1.01k | docstring stringlengths 5 25.7k | docstring_tokens listlengths 1 427 | sha stringclasses 235 values | url stringlengths 99 268 | partition stringclasses 1 value | summary stringlengths 7 202 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/network_watchers.rb | Azure::Network::Mgmt::V2018_08_01.NetworkWatchers.begin_get_troubleshooting | def begin_get_troubleshooting(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
response = begin_get_troubleshooting_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_get_troubleshooting(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
response = begin_get_troubleshooting_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_get_troubleshooting",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_get_troubleshooting_async",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"paramet... | Initiate troubleshooting on a specified resource
@param resource_group_name [String] The name of the resource group.
@param network_watcher_name [String] The name of the network watcher
resource.
@param parameters [TroubleshootingParameters] Parameters that define the
resource to troubleshoot.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [TroubleshootingResult] operation results. | [
"Initiate",
"troubleshooting",
"on",
"a",
"specified",
"resource"
] | 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#L1635-L1638 | train | Gets the troubleshooting of a virtual network. | [
30522,
13366,
4088,
1035,
2131,
1035,
13460,
23416,
2075,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2897,
1035,
3422,
2121,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
2131,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_datalake_analytics/lib/2016-11-01/generated/azure_mgmt_datalake_analytics/data_lake_store_accounts.rb | Azure::DataLakeAnalytics::Mgmt::V2016_11_01.DataLakeStoreAccounts.add_with_http_info | def add_with_http_info(resource_group_name, account_name, data_lake_store_account_name, parameters:nil, custom_headers:nil)
add_async(resource_group_name, account_name, data_lake_store_account_name, parameters:parameters, custom_headers:custom_headers).value!
end | ruby | def add_with_http_info(resource_group_name, account_name, data_lake_store_account_name, parameters:nil, custom_headers:nil)
add_async(resource_group_name, account_name, data_lake_store_account_name, parameters:parameters, custom_headers:custom_headers).value!
end | [
"def",
"add_with_http_info",
"(",
"resource_group_name",
",",
"account_name",
",",
"data_lake_store_account_name",
",",
"parameters",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"add_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"data_lake_store_... | Updates the specified Data Lake Analytics account to include the additional
Data Lake Store account.
@param resource_group_name [String] The name of the Azure resource group.
@param account_name [String] The name of the Data Lake Analytics account.
@param data_lake_store_account_name [String] The name of the Data Lake Store
account to add.
@param parameters [AddDataLakeStoreParameters] The details of the Data Lake
Store account.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Updates",
"the",
"specified",
"Data",
"Lake",
"Analytics",
"account",
"to",
"include",
"the",
"additional",
"Data",
"Lake",
"Store",
"account",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_datalake_analytics/lib/2016-11-01/generated/azure_mgmt_datalake_analytics/data_lake_store_accounts.rb#L200-L202 | train | Adds a data lake store account to the specified Data Lake Store account. | [
30522,
13366,
5587,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
2951,
1035,
2697,
1035,
3573,
1035,
4070,
1035,
2171,
1010,
11709,
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... |
randym/axlsx | lib/axlsx/content_type/content_type.rb | Axlsx.ContentType.to_xml_string | def to_xml_string(str = '')
str << '<?xml version="1.0" encoding="UTF-8"?>'
str << ('<Types xmlns="' << XML_NS_T << '">')
each { |type| type.to_xml_string(str) }
str << '</Types>'
end | ruby | def to_xml_string(str = '')
str << '<?xml version="1.0" encoding="UTF-8"?>'
str << ('<Types xmlns="' << XML_NS_T << '">')
each { |type| type.to_xml_string(str) }
str << '</Types>'
end | [
"def",
"to_xml_string",
"(",
"str",
"=",
"''",
")",
"str",
"<<",
"'<?xml version=\"1.0\" encoding=\"UTF-8\"?>'",
"str",
"<<",
"(",
"'<Types xmlns=\"'",
"<<",
"XML_NS_T",
"<<",
"'\">'",
")",
"each",
"{",
"|",
"type",
"|",
"type",
".",
"to_xml_string",
"(",
"str... | Serializes the object
@param [String] str
@return [String] | [
"Serializes",
"the",
"object"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/content_type/content_type.rb#L17-L22 | train | Convert the type list to XML string. | [
30522,
13366,
2000,
1035,
20950,
1035,
5164,
1006,
2358,
2099,
1027,
1005,
1005,
1007,
2358,
2099,
1026,
1026,
1005,
1026,
1029,
20950,
2544,
1027,
1000,
1015,
1012,
1014,
1000,
17181,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1029,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.report_application_health | def report_application_health(application_id, health_information, immediate:false, timeout:60, custom_headers:nil)
response = report_application_health_async(application_id, health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
nil
end | ruby | def report_application_health(application_id, health_information, immediate:false, timeout:60, custom_headers:nil)
response = report_application_health_async(application_id, health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
nil
end | [
"def",
"report_application_health",
"(",
"application_id",
",",
"health_information",
",",
"immediate",
":",
"false",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"report_application_health_async",
"(",
"application_id",
",",
"... | Sends a health report on the Service Fabric application.
Reports health state of the specified Service Fabric application. The report
must contain the information about the source of the health report and
property on which it is reported.
The report is sent to a Service Fabric gateway Application, which forwards to
the health store.
The report may be accepted by the gateway, but rejected by the health store
after extra validation.
For example, the health store may reject the report because of an invalid
parameter, like a stale sequence number.
To see whether the report was applied in the health store, get application
health and check that the report appears in the HealthEvents section.
@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 health_information [HealthInformation] Describes the health
information for the health report. This information needs to be present in
all of the health reports sent to the health manager.
@param immediate [Boolean] A flag which indicates whether the report should
be sent immediately.
A health report is sent to a Service Fabric gateway Application, which
forwards to the health store.
If Immediate is set to true, the report is sent immediately from HTTP Gateway
to the health store, regardless of the fabric client settings that the HTTP
Gateway Application is using.
This is useful for critical reports that should be sent as soon as possible.
Depending on timing and other conditions, sending the report may still fail,
for example if the HTTP Gateway is closed or the message doesn't reach the
Gateway.
If Immediate is set to false, the report is sent based on the health client
settings from the HTTP Gateway. Therefore, it will be batched according to
the HealthReportSendInterval configuration.
This is the recommended setting because it allows the health client to
optimize health reporting messages to health store as well as health report
processing.
By default, reports are not sent immediately.
@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. | [
"Sends",
"a",
"health",
"report",
"on",
"the",
"Service",
"Fabric",
"application",
"."
] | 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#L7546-L7549 | train | Report application health. | [
30522,
13366,
3189,
1035,
4646,
1035,
2740,
1006,
4646,
1035,
8909,
1010,
2740,
1035,
2592,
1010,
6234,
1024,
6270,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3189,
1035,
4646,
1035,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/ddos_protection_plans.rb | Azure::Network::Mgmt::V2019_02_01.DdosProtectionPlans.begin_update_tags_with_http_info | def begin_update_tags_with_http_info(resource_group_name, ddos_protection_plan_name, parameters, custom_headers:nil)
begin_update_tags_async(resource_group_name, ddos_protection_plan_name, parameters, custom_headers:custom_headers).value!
end | ruby | def begin_update_tags_with_http_info(resource_group_name, ddos_protection_plan_name, parameters, custom_headers:nil)
begin_update_tags_async(resource_group_name, ddos_protection_plan_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_update_tags_with_http_info",
"(",
"resource_group_name",
",",
"ddos_protection_plan_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_update_tags_async",
"(",
"resource_group_name",
",",
"ddos_protection_plan_name",
",",
"parameters",
",",... | Update a DDoS protection plan tags
@param resource_group_name [String] The name of the resource group.
@param ddos_protection_plan_name [String] The name of the DDoS protection
plan.
@param parameters [TagsObject] Parameters supplied to the update DDoS
protection plan resource tags.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Update",
"a",
"DDoS",
"protection",
"plan",
"tags"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/ddos_protection_plans.rb#L661-L663 | train | Updates a DDoS protection plan tags. | [
30522,
13366,
4088,
1035,
10651,
1035,
22073,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
20315,
2891,
1035,
3860,
1035,
2933,
1035,
2171,
1010,
11709,
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... |
hashicorp/vagrant | lib/vagrant/box.rb | Vagrant.Box.in_use? | def in_use?(index)
results = []
index.each do |entry|
box_data = entry.extra_data["box"]
next if !box_data
# If all the data matches, record it
if box_data["name"] == self.name &&
box_data["provider"] == self.provider.to_s &&
box_data["version"] == self.version.to_s
results << entry
end
end
return nil if results.empty?
results
end | ruby | def in_use?(index)
results = []
index.each do |entry|
box_data = entry.extra_data["box"]
next if !box_data
# If all the data matches, record it
if box_data["name"] == self.name &&
box_data["provider"] == self.provider.to_s &&
box_data["version"] == self.version.to_s
results << entry
end
end
return nil if results.empty?
results
end | [
"def",
"in_use?",
"(",
"index",
")",
"results",
"=",
"[",
"]",
"index",
".",
"each",
"do",
"|",
"entry",
"|",
"box_data",
"=",
"entry",
".",
"extra_data",
"[",
"\"box\"",
"]",
"next",
"if",
"!",
"box_data",
"# If all the data matches, record it",
"if",
"bo... | Checks if this box is in use according to the given machine
index and returns the entries that appear to be using the box.
The entries returned, if any, are not tested for validity
with {MachineIndex::Entry#valid?}, so the caller should do that
if the caller cares.
@param [MachineIndex] index
@return [Array<MachineIndex::Entry>] | [
"Checks",
"if",
"this",
"box",
"is",
"in",
"use",
"according",
"to",
"the",
"given",
"machine",
"index",
"and",
"returns",
"the",
"entries",
"that",
"appear",
"to",
"be",
"using",
"the",
"box",
"."
] | c22a145c59790c098f95d50141d9afb48e1ef55f | https://github.com/hashicorp/vagrant/blob/c22a145c59790c098f95d50141d9afb48e1ef55f/lib/vagrant/box.rb#L100-L116 | train | Returns the array of objects that are in use by this object. | [
30522,
13366,
1999,
1035,
2224,
1029,
1006,
5950,
1007,
3463,
1027,
1031,
1033,
5950,
1012,
2169,
2079,
1064,
4443,
1064,
3482,
1035,
2951,
1027,
4443,
1012,
4469,
1035,
2951,
1031,
1000,
3482,
1000,
1033,
2279,
2065,
999,
3482,
1035,
295... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/saml_provider.rb | Aws::IAM.SamlProvider.update | def update(options = {})
options = options.merge(saml_provider_arn: @arn)
resp = @client.update_saml_provider(options)
resp.data
end | ruby | def update(options = {})
options = options.merge(saml_provider_arn: @arn)
resp = @client.update_saml_provider(options)
resp.data
end | [
"def",
"update",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"saml_provider_arn",
":",
"@arn",
")",
"resp",
"=",
"@client",
".",
"update_saml_provider",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
saml_provider.update({
saml_metadata_document: "SAMLMetadataDocumentType", # required
})
@param [Hash] options ({})
@option options [required, String] :saml_metadata_document
An XML document generated by an identity provider (IdP) that supports
SAML 2.0. The document includes the issuer's name, expiration
information, and keys that can be used to validate the SAML
authentication response (assertions) that are received from the IdP.
You must generate the metadata document using the identity management
software that is used as your organization's IdP.
@return [Types::UpdateSAMLProviderResponse] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-iam/lib/aws-sdk-iam/saml_provider.rb#L209-L213 | train | Update the SAML provider | [
30522,
13366,
10651,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
3520,
2140,
1035,
10802,
1035,
12098,
2078,
1024,
1030,
12098,
2078,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
10651,
1035,
3520,
2140,
1035,
108... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb | Aws::EC2.Resource.route_tables | def route_tables(options = {})
batches = Enumerator.new do |y|
resp = @client.describe_route_tables(options)
resp.each_page do |page|
batch = []
page.data.route_tables.each do |r|
batch << RouteTable.new(
id: r.route_table_id,
data: r,
client: @client
)
end
y.yield(batch)
end
end
RouteTable::Collection.new(batches)
end | ruby | def route_tables(options = {})
batches = Enumerator.new do |y|
resp = @client.describe_route_tables(options)
resp.each_page do |page|
batch = []
page.data.route_tables.each do |r|
batch << RouteTable.new(
id: r.route_table_id,
data: r,
client: @client
)
end
y.yield(batch)
end
end
RouteTable::Collection.new(batches)
end | [
"def",
"route_tables",
"(",
"options",
"=",
"{",
"}",
")",
"batches",
"=",
"Enumerator",
".",
"new",
"do",
"|",
"y",
"|",
"resp",
"=",
"@client",
".",
"describe_route_tables",
"(",
"options",
")",
"resp",
".",
"each_page",
"do",
"|",
"page",
"|",
"batc... | @example Request syntax with placeholder values
route_tables = ec2.route_tables({
filters: [
{
name: "String",
values: ["String"],
},
],
dry_run: false,
route_table_ids: ["String"],
})
@param [Hash] options ({})
@option options [Array<Types::Filter>] :filters
One or more filters.
* `association.route-table-association-id` - The ID of an association
ID for the route table.
* `association.route-table-id` - The ID of the route table involved in
the association.
* `association.subnet-id` - The ID of the subnet involved in the
association.
* `association.main` - Indicates whether the route table is the main
route table for the VPC (`true` \| `false`). Route tables that do
not have an association ID are not returned in the response.
* `owner-id` - The ID of the AWS account that owns the route table.
* `route-table-id` - The ID of the route table.
* `route.destination-cidr-block` - The IPv4 CIDR range specified in a
route in the table.
* `route.destination-ipv6-cidr-block` - The IPv6 CIDR range specified
in a route in the route table.
* `route.destination-prefix-list-id` - The ID (prefix) of the AWS
service specified in a route in the table.
* `route.egress-only-internet-gateway-id` - The ID of an egress-only
Internet gateway specified in a route in the route table.
* `route.gateway-id` - The ID of a gateway specified in a route in the
table.
* `route.instance-id` - The ID of an instance specified in a route in
the table.
* `route.nat-gateway-id` - The ID of a NAT gateway.
* `route.transit-gateway-id` - The ID of a transit gateway.
* `route.origin` - Describes how the route was created.
`CreateRouteTable` indicates that the route was automatically
created when the route table was created; `CreateRoute` indicates
that the route was manually added to the route table;
`EnableVgwRoutePropagation` indicates that the route was propagated
by route propagation.
* `route.state` - The state of a route in the route table (`active` \|
`blackhole`). The blackhole state indicates that the route's target
isn't available (for example, the specified gateway isn't attached
to the VPC, the specified NAT instance has been terminated, and so
on).
* `route.vpc-peering-connection-id` - The ID of a VPC peering
connection specified in a route in the table.
* `tag`\:<key> - The key/value combination of a tag assigned to
the resource. Use the tag key in the filter name and the tag value
as the filter value. For example, to find all resources that have a
tag with the key `Owner` and the value `TeamA`, specify `tag:Owner`
for the filter name and `TeamA` for the filter value.
* `tag-key` - The key of a tag assigned to the resource. Use this
filter to find all resources assigned a tag with a specific key,
regardless of the tag value.
* `transit-gateway-id` - The ID of a transit gateway.
* `vpc-id` - The ID of the VPC for the route table.
@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 [Array<String>] :route_table_ids
One or more route table IDs.
Default: Describes all your route tables.
@return [RouteTable::Collection] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb#L2369-L2385 | train | Returns an array of RouteTables | [
30522,
13366,
2799,
1035,
7251,
1006,
7047,
1027,
1063,
1065,
1007,
14108,
2229,
1027,
4372,
17897,
16259,
1012,
2047,
2079,
1064,
1061,
1064,
24501,
2361,
1027,
1030,
7396,
1012,
6235,
1035,
2799,
1035,
7251,
1006,
7047,
1007,
24501,
2361,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_group | def create_group(options = {})
resp = @client.create_group(options)
Group.new(
name: options[:group_name],
data: resp.data.group,
client: @client
)
end | ruby | def create_group(options = {})
resp = @client.create_group(options)
Group.new(
name: options[:group_name],
data: resp.data.group,
client: @client
)
end | [
"def",
"create_group",
"(",
"options",
"=",
"{",
"}",
")",
"resp",
"=",
"@client",
".",
"create_group",
"(",
"options",
")",
"Group",
".",
"new",
"(",
"name",
":",
"options",
"[",
":group_name",
"]",
",",
"data",
":",
"resp",
".",
"data",
".",
"group... | @example Request syntax with placeholder values
group = iam.create_group({
path: "pathType",
group_name: "groupNameType", # required
})
@param [Hash] options ({})
@option options [String] :path
The path to the group. 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] :group_name
The name of the group to create. Do not include the path in this
value.
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:
\_+=,.@-. The group name must be unique within the account. Group
names are not distinguished by case. For example, you cannot create
groups named both "ADMINS" and "admins".
[1]: http://wikipedia.org/wiki/regex
@return [Group] | [
"@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#L208-L215 | train | Creates a group | [
30522,
13366,
3443,
1035,
2177,
1006,
7047,
1027,
1063,
1065,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
3443,
1035,
2177,
1006,
7047,
1007,
2177,
1012,
2047,
1006,
2171,
1024,
7047,
1031,
1024,
2177,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_cdn/lib/2016-04-02/generated/azure_mgmt_cdn/profiles.rb | Azure::CDN::Mgmt::V2016_04_02.Profiles.delete_if_exists_async | def delete_if_exists_async(profile_name, resource_group_name, custom_headers:nil)
# Send request
promise = begin_delete_if_exists_async(profile_name, resource_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 delete_if_exists_async(profile_name, resource_group_name, custom_headers:nil)
# Send request
promise = begin_delete_if_exists_async(profile_name, resource_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",
"delete_if_exists_async",
"(",
"profile_name",
",",
"resource_group_name",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_delete_if_exists_async",
"(",
"profile_name",
",",
"resource_group_name",
",",
"custom_headers",
":custom_heade... | @param profile_name [String] Name of the CDN profile within the resource
group.
@param resource_group_name [String] Name of the resource group within the
Azure subscription.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"profile_name",
"[",
"String",
"]",
"Name",
"of",
"the",
"CDN",
"profile",
"within",
"the",
"resource",
"group",
".",
"@param",
"resource_group_name",
"[",
"String",
"]",
"Name",
"of",
"the",
"resource",
"group",
"within",
"the",
"Azure",
"subscripti... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_cdn/lib/2016-04-02/generated/azure_mgmt_cdn/profiles.rb#L428-L442 | train | Deletes the specified profile. | [
30522,
13366,
3972,
12870,
1035,
2065,
1035,
6526,
1035,
2004,
6038,
2278,
1006,
6337,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,
4088,
1035,
3972,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cerebris/jsonapi-resources | lib/jsonapi/resource_serializer.rb | JSONAPI.ResourceSerializer.serialize_resource_set_to_hash_single | def serialize_resource_set_to_hash_single(resource_set)
primary_objects = []
included_objects = []
resource_set.resource_klasses.each_value do |resource_klass|
resource_klass.each_value do |resource|
serialized_resource = object_hash(resource[:resource], resource[:relationships])
if resource[:primary]
primary_objects.push(serialized_resource)
else
included_objects.push(serialized_resource)
end
end
end
fail "To Many primary objects for show" if (primary_objects.count > 1)
primary_hash = { 'data' => primary_objects[0] }
primary_hash['included'] = included_objects if included_objects.size > 0
primary_hash
end | ruby | def serialize_resource_set_to_hash_single(resource_set)
primary_objects = []
included_objects = []
resource_set.resource_klasses.each_value do |resource_klass|
resource_klass.each_value do |resource|
serialized_resource = object_hash(resource[:resource], resource[:relationships])
if resource[:primary]
primary_objects.push(serialized_resource)
else
included_objects.push(serialized_resource)
end
end
end
fail "To Many primary objects for show" if (primary_objects.count > 1)
primary_hash = { 'data' => primary_objects[0] }
primary_hash['included'] = included_objects if included_objects.size > 0
primary_hash
end | [
"def",
"serialize_resource_set_to_hash_single",
"(",
"resource_set",
")",
"primary_objects",
"=",
"[",
"]",
"included_objects",
"=",
"[",
"]",
"resource_set",
".",
"resource_klasses",
".",
"each_value",
"do",
"|",
"resource_klass",
"|",
"resource_klass",
".",
"each_va... | initialize
Options can include
include:
Purpose: determines which objects will be side loaded with the source objects in a linked section
Example: ['comments','author','comments.tags','author.posts']
fields:
Purpose: determines which fields are serialized for a resource type. This encompasses both attributes and
relationship ids in the links section for a resource. Fields are global for a resource type.
Example: { people: [:id, :email, :comments], posts: [:id, :title, :author], comments: [:id, :body, :post]}
key_formatter: KeyFormatter instance to override the default configuration
serialization_options: additional options that will be passed to resource meta and links lambdas
Converts a resource_set to a hash, conforming to the JSONAPI structure | [
"initialize",
"Options",
"can",
"include",
"include",
":",
"Purpose",
":",
"determines",
"which",
"objects",
"will",
"be",
"side",
"loaded",
"with",
"the",
"source",
"objects",
"in",
"a",
"linked",
"section",
"Example",
":",
"[",
"comments",
"author",
"comment... | 1ac6bba777e364eaa36706f888792b99b63d8d1a | https://github.com/cerebris/jsonapi-resources/blob/1ac6bba777e364eaa36706f888792b99b63d8d1a/lib/jsonapi/resource_serializer.rb#L45-L67 | train | Serialize a resource set to a hash | [
30522,
13366,
7642,
4697,
1035,
7692,
1035,
2275,
1035,
2000,
1035,
23325,
1035,
2309,
1006,
7692,
1035,
2275,
1007,
3078,
1035,
5200,
1027,
1031,
1033,
2443,
1035,
5200,
1027,
1031,
1033,
7692,
1035,
2275,
1012,
7692,
1035,
1047,
27102,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/fonts.rb | CombinePDF.Fonts.register_font_from_pdf_object | def register_font_from_pdf_object(font_name, font_object)
# FIXME:
# - add stream deflation for the CMap file.
# - add :Encoding CMaps (such as :WinAnsiEncoding etc`)
# - the ToUnicode CMap parsing assumes 8 Bytes <0F0F> while 16 Bytes and multiple unicode chars are also possible.
# first, create cmap, as it will be used to correctly create the widths directory.
# find the CMap from one of the two systems (TrueType vs. Type0 fonts)
# at the moment doen't suppot :Encoding cmaps...
cmap = {}
if font_object[:ToUnicode]
to_unicode = font_object[:ToUnicode]
to_unicode = to_unicode[:referenced_object] if to_unicode[:is_reference_only]
# deflate the cmap file stream before parsing
to_unicode = create_deep_copy to_unicode
CombinePDF::PDFFilter.inflate_object to_unicode
# parse the deflated stream
cmap = parse_cmap to_unicode[:raw_stream_content]
else
warn "didn't find ToUnicode object for #{font_object}"
return false
end
# second, create the metrics directory.
metrics = {}
old_widths = font_object
if font_object[:DescendantFonts]
old_widths = font_object[:DescendantFonts]
old_widths = old_widths[:referenced_object][:indirect_without_dictionary] if old_widths.is_a?(Hash) && old_widths[:is_reference_only]
old_widths = old_widths[0][:referenced_object]
avrg_height = 360
avrg_height = old_widths[:XHeight] if old_widths[:XHeight]
avrg_height = (avrg_height + old_widths[:CapHeight]) / 2 if old_widths[:CapHeight]
avrg_width = old_widths[:AvgWidth] || 0
avarage_bbox = [0, 0, avrg_width, avrg_height] # data is missing for full box metrics, just ignore
end
# compute the metrics values using the appropiate system (TrueType vs. Type0 fonts)
cmap_inverted = {}
cmap.each { |k, v| cmap_inverted[v.hex] = k }
if old_widths[:W]
old_widths = old_widths[:W]
if old_widths.is_a?(Hash) && old_widths[:is_reference_only]
old_widths = old_widths[:referenced_object][:indirect_without_dictionary]
end
old_widths = create_deep_copy old_widths
while old_widths[0]
a = old_widths.shift
b = old_widths.shift
if b.is_a?(Array)
b.each_index { |i| metrics[cmap_inverted[(a + i)] || (a + i)] = { wx: b[i], boundingbox: avarage_bbox } }
else
c = old_widths.shift
(b - a).times { |i| metrics[cmap_inverted[(a + i)] || (a + i)] = { wx: c[0], boundingbox: avarage_bbox } }
end
end
elsif old_widths[:Widths]
first_char = old_widths[:FirstChar]
old_widths = old_widths[:Widths]
if old_widths.is_a?(Hash) && old_widths[:is_reference_only]
old_widths = old_widths[:referenced_object][:indirect_without_dictionary]
end
old_widths.each_index { |i| metrics[cmap_inverted[(i + first_char)] || (i + first_char)] = { wx: old_widths[i], boundingbox: avarage_bbox } }
else
warn "didn't find widths object for #{old_widths}"
return false
end
# register the font and return the font object
cmap = nil if cmap.empty?
CombinePDF::Fonts.register_font font_name, metrics, font_object, cmap
end | ruby | def register_font_from_pdf_object(font_name, font_object)
# FIXME:
# - add stream deflation for the CMap file.
# - add :Encoding CMaps (such as :WinAnsiEncoding etc`)
# - the ToUnicode CMap parsing assumes 8 Bytes <0F0F> while 16 Bytes and multiple unicode chars are also possible.
# first, create cmap, as it will be used to correctly create the widths directory.
# find the CMap from one of the two systems (TrueType vs. Type0 fonts)
# at the moment doen't suppot :Encoding cmaps...
cmap = {}
if font_object[:ToUnicode]
to_unicode = font_object[:ToUnicode]
to_unicode = to_unicode[:referenced_object] if to_unicode[:is_reference_only]
# deflate the cmap file stream before parsing
to_unicode = create_deep_copy to_unicode
CombinePDF::PDFFilter.inflate_object to_unicode
# parse the deflated stream
cmap = parse_cmap to_unicode[:raw_stream_content]
else
warn "didn't find ToUnicode object for #{font_object}"
return false
end
# second, create the metrics directory.
metrics = {}
old_widths = font_object
if font_object[:DescendantFonts]
old_widths = font_object[:DescendantFonts]
old_widths = old_widths[:referenced_object][:indirect_without_dictionary] if old_widths.is_a?(Hash) && old_widths[:is_reference_only]
old_widths = old_widths[0][:referenced_object]
avrg_height = 360
avrg_height = old_widths[:XHeight] if old_widths[:XHeight]
avrg_height = (avrg_height + old_widths[:CapHeight]) / 2 if old_widths[:CapHeight]
avrg_width = old_widths[:AvgWidth] || 0
avarage_bbox = [0, 0, avrg_width, avrg_height] # data is missing for full box metrics, just ignore
end
# compute the metrics values using the appropiate system (TrueType vs. Type0 fonts)
cmap_inverted = {}
cmap.each { |k, v| cmap_inverted[v.hex] = k }
if old_widths[:W]
old_widths = old_widths[:W]
if old_widths.is_a?(Hash) && old_widths[:is_reference_only]
old_widths = old_widths[:referenced_object][:indirect_without_dictionary]
end
old_widths = create_deep_copy old_widths
while old_widths[0]
a = old_widths.shift
b = old_widths.shift
if b.is_a?(Array)
b.each_index { |i| metrics[cmap_inverted[(a + i)] || (a + i)] = { wx: b[i], boundingbox: avarage_bbox } }
else
c = old_widths.shift
(b - a).times { |i| metrics[cmap_inverted[(a + i)] || (a + i)] = { wx: c[0], boundingbox: avarage_bbox } }
end
end
elsif old_widths[:Widths]
first_char = old_widths[:FirstChar]
old_widths = old_widths[:Widths]
if old_widths.is_a?(Hash) && old_widths[:is_reference_only]
old_widths = old_widths[:referenced_object][:indirect_without_dictionary]
end
old_widths.each_index { |i| metrics[cmap_inverted[(i + first_char)] || (i + first_char)] = { wx: old_widths[i], boundingbox: avarage_bbox } }
else
warn "didn't find widths object for #{old_widths}"
return false
end
# register the font and return the font object
cmap = nil if cmap.empty?
CombinePDF::Fonts.register_font font_name, metrics, font_object, cmap
end | [
"def",
"register_font_from_pdf_object",
"(",
"font_name",
",",
"font_object",
")",
"# FIXME:",
"# - add stream deflation for the CMap file.",
"# - add :Encoding CMaps (such as :WinAnsiEncoding etc`)",
"# - the ToUnicode CMap parsing assumes 8 Bytes <0F0F> while 16 Bytes and multiple unicode char... | Register a font that already exists in a pdf object into the font library.
The implementation is experimental, but this function attempts to deconstruct a font object in order to
extract it's cmap and metric data, allowing it's use in the CombinePDF library. | [
"Register",
"a",
"font",
"that",
"already",
"exists",
"in",
"a",
"pdf",
"object",
"into",
"the",
"font",
"library",
"."
] | 09054051019c069f551f3e60be789577c0f93900 | https://github.com/boazsegev/combine_pdf/blob/09054051019c069f551f3e60be789577c0f93900/lib/combine_pdf/fonts.rb#L205-L277 | train | This function is used to register a font from a PDF object. | [
30522,
13366,
4236,
1035,
15489,
1035,
2013,
1035,
11135,
1035,
4874,
1006,
15489,
1035,
2171,
1010,
15489,
1035,
30524,
1012,
1001,
1011,
5587,
1024,
17181,
4642,
9331,
2015,
1006,
2107,
2004,
1024,
2663,
6962,
9013,
3597,
4667,
4385,
1036... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
activeadmin/activeadmin | lib/active_admin/resource_dsl.rb | ActiveAdmin.ResourceDSL.show | def show(options = {}, &block)
config.set_page_presenter :show, ActiveAdmin::PagePresenter.new(options, &block)
end | ruby | def show(options = {}, &block)
config.set_page_presenter :show, ActiveAdmin::PagePresenter.new(options, &block)
end | [
"def",
"show",
"(",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"config",
".",
"set_page_presenter",
":show",
",",
"ActiveAdmin",
"::",
"PagePresenter",
".",
"new",
"(",
"options",
",",
"block",
")",
"end"
] | Configure the show page for the resource | [
"Configure",
"the",
"show",
"page",
"for",
"the",
"resource"
] | 0759c8dcf97865748c9344459162ac3c7e65a6cd | https://github.com/activeadmin/activeadmin/blob/0759c8dcf97865748c9344459162ac3c7e65a6cd/lib/active_admin/resource_dsl.rb#L89-L91 | train | Set the page presenter to show the current page. | [
30522,
13366,
2265,
1006,
7047,
1027,
1063,
1065,
1010,
1004,
3796,
1007,
9530,
8873,
2290,
1012,
2275,
1035,
3931,
1035,
10044,
1024,
2265,
1010,
3161,
4215,
10020,
1024,
1024,
3931,
28994,
29110,
1012,
2047,
1006,
7047,
1010,
1004,
3796,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/diagnostics.rb | Azure::Web::Mgmt::V2018_02_01.Diagnostics.list_site_analyses_as_lazy | def list_site_analyses_as_lazy(resource_group_name, site_name, diagnostic_category, custom_headers:nil)
response = list_site_analyses_async(resource_group_name, site_name, diagnostic_category, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_site_analyses_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_site_analyses_as_lazy(resource_group_name, site_name, diagnostic_category, custom_headers:nil)
response = list_site_analyses_async(resource_group_name, site_name, diagnostic_category, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_site_analyses_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_site_analyses_as_lazy",
"(",
"resource_group_name",
",",
"site_name",
",",
"diagnostic_category",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_site_analyses_async",
"(",
"resource_group_name",
",",
"site_name",
",",
"diagnostic_category",
",... | Get Site Analyses
Get Site Analyses
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param site_name [String] Site Name
@param diagnostic_category [String] Diagnostic Category
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [DiagnosticAnalysisCollection] which provide lazy access to pages of
the response. | [
"Get",
"Site",
"Analyses"
] | 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#L3646-L3655 | train | Gets all the analyses for a site. | [
30522,
13366,
2862,
1035,
2609,
1035,
16478,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2609,
1035,
2171,
1010,
16474,
1035,
4696,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2609,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/route_filter_rules.rb | Azure::Network::Mgmt::V2018_07_01.RouteFilterRules.begin_create_or_update_with_http_info | def begin_create_or_update_with_http_info(resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers:custom_headers).value!
end | ruby | def begin_create_or_update_with_http_info(resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_create_or_update_with_http_info",
"(",
"resource_group_name",
",",
"route_filter_name",
",",
"rule_name",
",",
"route_filter_rule_parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"route_filter_na... | Creates or updates a route in the specified route filter.
@param resource_group_name [String] The name of the resource group.
@param route_filter_name [String] The name of the route filter.
@param rule_name [String] The name of the route filter rule.
@param route_filter_rule_parameters [RouteFilterRule] Parameters supplied to
the create or update route filter rule operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Creates",
"or",
"updates",
"a",
"route",
"in",
"the",
"specified",
"route",
"filter",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/route_filter_rules.rb#L464-L466 | train | Creates or updates a route filter rule. | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2799,
1035,
11307,
1035,
2171,
1010,
3627,
1035,
2171,
1010,
2799,
1035,
11307,
1035,
3627,
1035,
11709,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
opal/opal | stdlib/racc/parser.rb | Racc.Parser.racc_read_token | def racc_read_token(t, tok, val)
@racc_debug_out.print 'read '
@racc_debug_out.print tok.inspect, '(', racc_token2str(t), ') '
@racc_debug_out.puts val.inspect
@racc_debug_out.puts
end | ruby | def racc_read_token(t, tok, val)
@racc_debug_out.print 'read '
@racc_debug_out.print tok.inspect, '(', racc_token2str(t), ') '
@racc_debug_out.puts val.inspect
@racc_debug_out.puts
end | [
"def",
"racc_read_token",
"(",
"t",
",",
"tok",
",",
"val",
")",
"@racc_debug_out",
".",
"print",
"'read '",
"@racc_debug_out",
".",
"print",
"tok",
".",
"inspect",
",",
"'('",
",",
"racc_token2str",
"(",
"t",
")",
",",
"') '",
"@racc_debug_out",
".",
"... | For debugging output | [
"For",
"debugging",
"output"
] | 41aedc0fd62aab00d3c117ba0caf00206bedd981 | https://github.com/opal/opal/blob/41aedc0fd62aab00d3c117ba0caf00206bedd981/stdlib/racc/parser.rb#L555-L560 | train | Read a token from the input stream | [
30522,
13366,
10958,
9468,
1035,
3191,
1035,
19204,
1006,
1056,
1010,
2000,
2243,
1010,
11748,
1007,
1030,
10958,
9468,
1035,
2139,
8569,
2290,
1035,
2041,
1012,
6140,
1005,
3191,
1005,
1030,
10958,
9468,
1035,
2139,
8569,
2290,
1035,
2041,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/data_criteria.rb | HQMF2.DataCriteria.handle_derived_specific_occurrence_variable | def handle_derived_specific_occurrence_variable
# If the first child is all the exists, and it has been marked as a "group" element, switch this over to map to
# the new element.
if !@data_criteria_references["GROUP_#{@children_criteria.first}"].nil? && @children_criteria.length == 1
@children_criteria[0] = "GROUP_#{@children_criteria.first}"
# If the group element is not found, extract the information from the child and force it into the variable.
elsif @children_criteria.length == 1 && @children_criteria.first.present?
reference_criteria = @data_criteria_references[@children_criteria.first]
return if reference_criteria.nil?
duplicate_child_info(reference_criteria)
@children_criteria = reference_criteria.children_criteria
end
end | ruby | def handle_derived_specific_occurrence_variable
# If the first child is all the exists, and it has been marked as a "group" element, switch this over to map to
# the new element.
if !@data_criteria_references["GROUP_#{@children_criteria.first}"].nil? && @children_criteria.length == 1
@children_criteria[0] = "GROUP_#{@children_criteria.first}"
# If the group element is not found, extract the information from the child and force it into the variable.
elsif @children_criteria.length == 1 && @children_criteria.first.present?
reference_criteria = @data_criteria_references[@children_criteria.first]
return if reference_criteria.nil?
duplicate_child_info(reference_criteria)
@children_criteria = reference_criteria.children_criteria
end
end | [
"def",
"handle_derived_specific_occurrence_variable",
"# If the first child is all the exists, and it has been marked as a \"group\" element, switch this over to map to",
"# the new element.",
"if",
"!",
"@data_criteria_references",
"[",
"\"GROUP_#{@children_criteria.first}\"",
"]",
".",
"nil?... | Handle elements that are marked as variable groupers that should not be turned into a "holding element"
(defined as a data criteria that encapsulates the calculation material for other data criteria elements,
where the other data criteria elements reference the holding element as a child element) | [
"Handle",
"elements",
"that",
"are",
"marked",
"as",
"variable",
"groupers",
"that",
"should",
"not",
"be",
"turned",
"into",
"a",
"holding",
"element",
"(",
"defined",
"as",
"a",
"data",
"criteria",
"that",
"encapsulates",
"the",
"calculation",
"material",
"f... | 252d4f0927c513eacde6b9ea41b76faa1423c34b | https://github.com/projectcypress/health-data-standards/blob/252d4f0927c513eacde6b9ea41b76faa1423c34b/lib/hqmf-parser/2.0/data_criteria.rb#L132-L144 | train | This function handles the derived specific occurrence variable | [
30522,
13366,
5047,
1035,
5173,
1035,
3563,
1035,
14404,
1035,
8023,
1001,
2065,
1996,
2034,
2775,
2003,
2035,
1996,
6526,
1010,
1998,
2009,
2038,
2042,
4417,
2004,
1037,
1000,
2177,
1000,
5783,
1010,
6942,
2023,
2058,
2000,
4949,
2000,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
awesome-print/awesome_print | lib/awesome_print/ext/active_record.rb | AwesomePrint.ActiveRecord.awesome_active_record_class | def awesome_active_record_class(object)
return object.inspect if !defined?(::ActiveSupport::OrderedHash) || !object.respond_to?(:columns) || object.to_s == 'ActiveRecord::Base'
return awesome_class(object) if object.respond_to?(:abstract_class?) && object.abstract_class?
data = object.columns.inject(::ActiveSupport::OrderedHash.new) do |hash, c|
hash[c.name.to_sym] = c.type
hash
end
name = "class #{awesome_simple(object.to_s, :class)}"
base = "< #{awesome_simple(object.superclass.to_s, :class)}"
[name, base, awesome_hash(data)].join(' ')
end | ruby | def awesome_active_record_class(object)
return object.inspect if !defined?(::ActiveSupport::OrderedHash) || !object.respond_to?(:columns) || object.to_s == 'ActiveRecord::Base'
return awesome_class(object) if object.respond_to?(:abstract_class?) && object.abstract_class?
data = object.columns.inject(::ActiveSupport::OrderedHash.new) do |hash, c|
hash[c.name.to_sym] = c.type
hash
end
name = "class #{awesome_simple(object.to_s, :class)}"
base = "< #{awesome_simple(object.superclass.to_s, :class)}"
[name, base, awesome_hash(data)].join(' ')
end | [
"def",
"awesome_active_record_class",
"(",
"object",
")",
"return",
"object",
".",
"inspect",
"if",
"!",
"defined?",
"(",
"::",
"ActiveSupport",
"::",
"OrderedHash",
")",
"||",
"!",
"object",
".",
"respond_to?",
"(",
":columns",
")",
"||",
"object",
".",
"to... | Format ActiveRecord class object.
------------------------------------------------------------------------------ | [
"Format",
"ActiveRecord",
"class",
"object",
".",
"------------------------------------------------------------------------------"
] | 4564fd74721562cbef2443f7d97109bf9192343d | https://github.com/awesome-print/awesome_print/blob/4564fd74721562cbef2443f7d97109bf9192343d/lib/awesome_print/ext/active_record.rb#L63-L76 | train | Returns the awesome class of the object. | [
30522,
13366,
12476,
1035,
3161,
1035,
2501,
1035,
2465,
1006,
4874,
1007,
2709,
4874,
1012,
22459,
2065,
999,
4225,
1029,
1006,
1024,
1024,
3161,
6342,
9397,
11589,
1024,
1024,
3641,
14949,
2232,
1007,
1064,
1064,
999,
4874,
1012,
6869,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/labs.rb | Azure::Labservices::Mgmt::V2018_10_15.Labs.register | def register(resource_group_name, lab_account_name, lab_name, custom_headers:nil)
response = register_async(resource_group_name, lab_account_name, lab_name, custom_headers:custom_headers).value!
nil
end | ruby | def register(resource_group_name, lab_account_name, lab_name, custom_headers:nil)
response = register_async(resource_group_name, lab_account_name, lab_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"register",
"(",
"resource_group_name",
",",
"lab_account_name",
",",
"lab_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"register_async",
"(",
"resource_group_name",
",",
"lab_account_name",
",",
"lab_name",
",",
"custom_headers",
":custom_he... | Register to managed lab.
@param resource_group_name [String] The name of the resource group.
@param lab_account_name [String] The name of the lab Account.
@param lab_name [String] The name of the lab.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Register",
"to",
"managed",
"lab",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/labs.rb#L612-L615 | train | Registers a new lab in the specified resource group. | [
30522,
13366,
4236,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
6845,
1035,
4070,
1035,
2171,
1010,
6845,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4236,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
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_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.unprovision_cluster | def unprovision_cluster(unprovision_fabric_description, timeout:60, custom_headers:nil)
response = unprovision_cluster_async(unprovision_fabric_description, timeout:timeout, custom_headers:custom_headers).value!
nil
end | ruby | def unprovision_cluster(unprovision_fabric_description, timeout:60, custom_headers:nil)
response = unprovision_cluster_async(unprovision_fabric_description, timeout:timeout, custom_headers:custom_headers).value!
nil
end | [
"def",
"unprovision_cluster",
"(",
"unprovision_fabric_description",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"unprovision_cluster_async",
"(",
"unprovision_fabric_description",
",",
"timeout",
":",
"timeout",
",",
"custom_head... | Unprovision the code or configuration packages of a Service Fabric cluster.
Unprovision the code or configuration packages of a Service Fabric cluster.
It is supported to unprovision code and configuration separately.
@param unprovision_fabric_description [UnprovisionFabricDescription]
Describes the parameters for unprovisioning a cluster.
@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. | [
"Unprovision",
"the",
"code",
"or",
"configuration",
"packages",
"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#L2466-L2469 | train | Unprovision the specified fabric description. | [
30522,
13366,
4895,
21572,
17084,
1035,
9324,
1006,
4895,
21572,
17084,
1035,
8313,
1035,
6412,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4895,
21572,
17084,
1035,
9324,
1035,
2004,
603... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.add_custom_prebuilt_intent | def add_custom_prebuilt_intent(app_id, version_id, prebuilt_domain_model_create_object, custom_headers:nil)
response = add_custom_prebuilt_intent_async(app_id, version_id, prebuilt_domain_model_create_object, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def add_custom_prebuilt_intent(app_id, version_id, prebuilt_domain_model_create_object, custom_headers:nil)
response = add_custom_prebuilt_intent_async(app_id, version_id, prebuilt_domain_model_create_object, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"add_custom_prebuilt_intent",
"(",
"app_id",
",",
"version_id",
",",
"prebuilt_domain_model_create_object",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"add_custom_prebuilt_intent_async",
"(",
"app_id",
",",
"version_id",
",",
"prebuilt_domain_model_crea... | Adds a customizable prebuilt intent model to a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param prebuilt_domain_model_create_object [PrebuiltDomainModelCreateObject]
A model object containing the name of the customizable prebuilt intent and
the name of the domain to which this model belongs.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Uuid] operation results. | [
"Adds",
"a",
"customizable",
"prebuilt",
"intent",
"model",
"to",
"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#L4335-L4338 | train | Adds a prebuilt intent to a version of the application. | [
30522,
13366,
5587,
1035,
7661,
1035,
3653,
8569,
4014,
2102,
1035,
7848,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
3653,
8569,
4014,
2102,
1035,
5884,
1035,
2944,
1035,
3443,
1035,
4874,
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_relay/lib/2016-07-01/generated/azure_mgmt_relay/hybrid_connections.rb | Azure::Relay::Mgmt::V2016_07_01.HybridConnections.list_post_authorization_rules | def list_post_authorization_rules(resource_group_name, namespace_name, hybrid_connection_name, custom_headers:nil)
first_page = list_post_authorization_rules_as_lazy(resource_group_name, namespace_name, hybrid_connection_name, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_post_authorization_rules(resource_group_name, namespace_name, hybrid_connection_name, custom_headers:nil)
first_page = list_post_authorization_rules_as_lazy(resource_group_name, namespace_name, hybrid_connection_name, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_post_authorization_rules",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"hybrid_connection_name",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_post_authorization_rules_as_lazy",
"(",
"resource_group_name",
",",
"namespace_name",
","... | Authorization rules for a HybridConnection.
@param resource_group_name [String] Name of the Resource group within the
Azure subscription.
@param namespace_name [String] The Namespace Name
@param hybrid_connection_name [String] The hybrid connection name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<AuthorizationRule>] operation results. | [
"Authorization",
"rules",
"for",
"a",
"HybridConnection",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_relay/lib/2016-07-01/generated/azure_mgmt_relay/hybrid_connections.rb#L559-L562 | train | Gets all the authorization rules for a HybridConnection. | [
30522,
13366,
2862,
1035,
2695,
1035,
20104,
1035,
3513,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3415,
15327,
1035,
2171,
1010,
8893,
1035,
4434,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
projectcypress/health-data-standards | lib/hqmf-parser/1.0/utilities.rb | HQMF1.Utilities.check_nil_conjunction_on_child | def check_nil_conjunction_on_child
if (@preconditions.length == 1 && @preconditions.first.conjunction.nil?)
bad_precondition = @preconditions.first
if (bad_precondition.restrictions.empty? && bad_precondition.subset.nil? && bad_precondition.expression.nil?)
@preconditions = @preconditions.first.preconditions
#puts "\t FIXED PRECONDITION WITHOUT CONJUNCTION"
else
puts "\t PRECONDITION WITHOUT CONJUNCTION: Cannot be fixed"
end
end
end | ruby | def check_nil_conjunction_on_child
if (@preconditions.length == 1 && @preconditions.first.conjunction.nil?)
bad_precondition = @preconditions.first
if (bad_precondition.restrictions.empty? && bad_precondition.subset.nil? && bad_precondition.expression.nil?)
@preconditions = @preconditions.first.preconditions
#puts "\t FIXED PRECONDITION WITHOUT CONJUNCTION"
else
puts "\t PRECONDITION WITHOUT CONJUNCTION: Cannot be fixed"
end
end
end | [
"def",
"check_nil_conjunction_on_child",
"if",
"(",
"@preconditions",
".",
"length",
"==",
"1",
"&&",
"@preconditions",
".",
"first",
".",
"conjunction",
".",
"nil?",
")",
"bad_precondition",
"=",
"@preconditions",
".",
"first",
"if",
"(",
"bad_precondition",
".",... | Preconditions can have nil conjunctions as part of a DATEDIFF, we want to remove these and warn | [
"Preconditions",
"can",
"have",
"nil",
"conjunctions",
"as",
"part",
"of",
"a",
"DATEDIFF",
"we",
"want",
"to",
"remove",
"these",
"and",
"warn"
] | 252d4f0927c513eacde6b9ea41b76faa1423c34b | https://github.com/projectcypress/health-data-standards/blob/252d4f0927c513eacde6b9ea41b76faa1423c34b/lib/hqmf-parser/1.0/utilities.rb#L41-L51 | train | Check that the nil conjunction on the child node is a nil conjunction. | [
30522,
13366,
4638,
1035,
9152,
2140,
1035,
9595,
1035,
2006,
1035,
2775,
2065,
1006,
1030,
3653,
8663,
20562,
2015,
1012,
3091,
1027,
1027,
1015,
1004,
1004,
1030,
3653,
8663,
20562,
2015,
1012,
2034,
1012,
9595,
1012,
9152,
2140,
1029,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jekyll/jekyll | lib/jekyll/liquid_extensions.rb | Jekyll.LiquidExtensions.lookup_variable | def lookup_variable(context, variable)
lookup = context
variable.split(".").each do |value|
lookup = lookup[value]
end
lookup || variable
end | ruby | def lookup_variable(context, variable)
lookup = context
variable.split(".").each do |value|
lookup = lookup[value]
end
lookup || variable
end | [
"def",
"lookup_variable",
"(",
"context",
",",
"variable",
")",
"lookup",
"=",
"context",
"variable",
".",
"split",
"(",
"\".\"",
")",
".",
"each",
"do",
"|",
"value",
"|",
"lookup",
"=",
"lookup",
"[",
"value",
"]",
"end",
"lookup",
"||",
"variable",
... | Lookup a Liquid variable in the given context.
context - the Liquid context in question.
variable - the variable name, as a string.
Returns the value of the variable in the context
or the variable name if not found. | [
"Lookup",
"a",
"Liquid",
"variable",
"in",
"the",
"given",
"context",
"."
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/liquid_extensions.rb#L12-L20 | train | Lookup a variable in a context | [
30522,
13366,
2298,
6279,
1035,
8023,
1006,
6123,
1010,
8023,
1007,
2298,
6279,
1027,
6123,
8023,
1012,
3975,
1006,
1000,
1012,
1000,
1007,
1012,
2169,
2079,
1064,
3643,
1064,
2298,
6279,
1027,
2298,
6279,
1031,
3643,
1033,
2203,
2298,
62... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
decidim/decidim | decidim-core/app/models/decidim/action_log.rb | Decidim.ActionLog.participatory_space_lazy | def participatory_space_lazy(cache: true)
return if participatory_space_id.blank? || participatory_space_type.blank?
return resouce_lazy if participatory_space_id == resource_id && participatory_space_type == resource_type
self.class.lazy_relation(participatory_space_id, participatory_space_type, cache)
end | ruby | def participatory_space_lazy(cache: true)
return if participatory_space_id.blank? || participatory_space_type.blank?
return resouce_lazy if participatory_space_id == resource_id && participatory_space_type == resource_type
self.class.lazy_relation(participatory_space_id, participatory_space_type, cache)
end | [
"def",
"participatory_space_lazy",
"(",
"cache",
":",
"true",
")",
"return",
"if",
"participatory_space_id",
".",
"blank?",
"||",
"participatory_space_type",
".",
"blank?",
"return",
"resouce_lazy",
"if",
"participatory_space_id",
"==",
"resource_id",
"&&",
"participato... | Lazy loads the `participatory_space` association through BatchLoader, can be used
as a regular object. | [
"Lazy",
"loads",
"the",
"participatory_space",
"association",
"through",
"BatchLoader",
"can",
"be",
"used",
"as",
"a",
"regular",
"object",
"."
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/app/models/decidim/action_log.rb#L79-L84 | train | Returns the participatory space object for this resource. | [
30522,
13366,
2112,
28775,
4502,
7062,
1035,
2686,
1035,
13971,
1006,
17053,
1024,
2995,
1007,
2709,
2065,
2112,
28775,
4502,
7062,
1035,
2686,
1035,
8909,
1012,
8744,
1029,
1064,
1064,
2112,
28775,
4502,
7062,
1035,
2686,
1035,
2828,
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... |
sds/scss-lint | lib/scss_lint/linter/bang_format.rb | SCSSLint.Linter::BangFormat.find_bang_offset | def find_bang_offset(range)
offset = 0
offset -= 1 until STOPPING_CHARACTERS.include?(character_at(range.end_pos, offset))
offset
end | ruby | def find_bang_offset(range)
offset = 0
offset -= 1 until STOPPING_CHARACTERS.include?(character_at(range.end_pos, offset))
offset
end | [
"def",
"find_bang_offset",
"(",
"range",
")",
"offset",
"=",
"0",
"offset",
"-=",
"1",
"until",
"STOPPING_CHARACTERS",
".",
"include?",
"(",
"character_at",
"(",
"range",
".",
"end_pos",
",",
"offset",
")",
")",
"offset",
"end"
] | Start from the back and move towards the front so that any !important or
!default !'s will be found *before* quotation marks. Then we can
stop at quotation marks to protect against linting !'s within strings
(e.g. `content`) | [
"Start",
"from",
"the",
"back",
"and",
"move",
"towards",
"the",
"front",
"so",
"that",
"any",
"!important",
"or",
"!default",
"!",
"s",
"will",
"be",
"found",
"*",
"before",
"*",
"quotation",
"marks",
".",
"Then",
"we",
"can",
"stop",
"at",
"quotation",... | e99afe4ede041a431a06e585c12ce82f6ad50116 | https://github.com/sds/scss-lint/blob/e99afe4ede041a431a06e585c12ce82f6ad50116/lib/scss_lint/linter/bang_format.rb#L42-L46 | train | Find the first bang offset in the range | [
30522,
13366,
2424,
1035,
9748,
1035,
16396,
1006,
2846,
1007,
16396,
1027,
1014,
16396,
1011,
1027,
1015,
2127,
7458,
1035,
3494,
1012,
2421,
1029,
1006,
2839,
1035,
2012,
1006,
2846,
1012,
2203,
1035,
13433,
2015,
1010,
16396,
1007,
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... |
sinatra/sinatra | lib/sinatra/base.rb | Sinatra.Helpers.send_file | def send_file(path, opts = {})
if opts[:type] or not response['Content-Type']
content_type opts[:type] || File.extname(path), :default => 'application/octet-stream'
end
disposition = opts[:disposition]
filename = opts[:filename]
disposition = :attachment if disposition.nil? and filename
filename = path if filename.nil?
attachment(filename, disposition) if disposition
last_modified opts[:last_modified] if opts[:last_modified]
file = Rack::File.new(File.dirname(settings.app_file))
result = file.serving(request, path)
result[1].each { |k,v| headers[k] ||= v }
headers['Content-Length'] = result[1]['Content-Length']
opts[:status] &&= Integer(opts[:status])
halt (opts[:status] || result[0]), result[2]
rescue Errno::ENOENT
not_found
end | ruby | def send_file(path, opts = {})
if opts[:type] or not response['Content-Type']
content_type opts[:type] || File.extname(path), :default => 'application/octet-stream'
end
disposition = opts[:disposition]
filename = opts[:filename]
disposition = :attachment if disposition.nil? and filename
filename = path if filename.nil?
attachment(filename, disposition) if disposition
last_modified opts[:last_modified] if opts[:last_modified]
file = Rack::File.new(File.dirname(settings.app_file))
result = file.serving(request, path)
result[1].each { |k,v| headers[k] ||= v }
headers['Content-Length'] = result[1]['Content-Length']
opts[:status] &&= Integer(opts[:status])
halt (opts[:status] || result[0]), result[2]
rescue Errno::ENOENT
not_found
end | [
"def",
"send_file",
"(",
"path",
",",
"opts",
"=",
"{",
"}",
")",
"if",
"opts",
"[",
":type",
"]",
"or",
"not",
"response",
"[",
"'Content-Type'",
"]",
"content_type",
"opts",
"[",
":type",
"]",
"||",
"File",
".",
"extname",
"(",
"path",
")",
",",
... | Use the contents of the file at +path+ as the response body. | [
"Use",
"the",
"contents",
"of",
"the",
"file",
"at",
"+",
"path",
"+",
"as",
"the",
"response",
"body",
"."
] | 1aa64f9858edc3f93cc8d46e26f724c1ae103b1c | https://github.com/sinatra/sinatra/blob/1aa64f9858edc3f93cc8d46e26f724c1ae103b1c/lib/sinatra/base.rb#L373-L395 | train | Sends a file to the client. | [
30522,
13366,
4604,
1035,
5371,
1006,
4130,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2065,
23569,
2015,
1031,
1024,
2828,
1033,
2030,
2025,
3433,
1031,
1005,
4180,
1011,
2828,
1005,
1033,
4180,
1035,
2828,
23569,
2015,
1031,
1024,
2828,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_batch/lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb | Azure::Batch::Mgmt::V2017_09_01.CertificateOperations.list_by_batch_account_with_http_info | def list_by_batch_account_with_http_info(resource_group_name, account_name, maxresults:nil, select:nil, filter:nil, custom_headers:nil)
list_by_batch_account_async(resource_group_name, account_name, maxresults:maxresults, select:select, filter:filter, custom_headers:custom_headers).value!
end | ruby | def list_by_batch_account_with_http_info(resource_group_name, account_name, maxresults:nil, select:nil, filter:nil, custom_headers:nil)
list_by_batch_account_async(resource_group_name, account_name, maxresults:maxresults, select:select, filter:filter, custom_headers:custom_headers).value!
end | [
"def",
"list_by_batch_account_with_http_info",
"(",
"resource_group_name",
",",
"account_name",
",",
"maxresults",
":",
"nil",
",",
"select",
":",
"nil",
",",
"filter",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"list_by_batch_account_async",
"(",
"resource... | Lists all of the certificates in the specified account.
@param resource_group_name [String] The name of the resource group that
contains the Batch account.
@param account_name [String] The name of the Batch account.
@param maxresults [Integer] The maximum number of items to return in the
response.
@param select [String] Comma separated list of properties that should be
returned. e.g. "properties/provisioningState". Only top level properties
under properties/ are valid for selection.
@param filter [String] OData filter expression. Valid properties for
filtering are "properties/provisioningState",
"properties/provisioningStateTransitionTime", "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. | [
"Lists",
"all",
"of",
"the",
"certificates",
"in",
"the",
"specified",
"account",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_batch/lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb#L67-L69 | train | Gets the list of all the documents in the specified Data Lake Store account. | [
30522,
13366,
2862,
1035,
2011,
1035,
14108,
1035,
4070,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
4098,
6072,
11314,
2015,
1024,
9152,
2140,
1010,
7276,
1024,
9152,
2140,
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... |
rmagick/rmagick | lib/rmagick_internal.rb | Magick.Image.resize_to_fit | def resize_to_fit(cols, rows = nil)
rows ||= cols
change_geometry(Geometry.new(cols, rows)) do |ncols, nrows|
resize(ncols, nrows)
end
end | ruby | def resize_to_fit(cols, rows = nil)
rows ||= cols
change_geometry(Geometry.new(cols, rows)) do |ncols, nrows|
resize(ncols, nrows)
end
end | [
"def",
"resize_to_fit",
"(",
"cols",
",",
"rows",
"=",
"nil",
")",
"rows",
"||=",
"cols",
"change_geometry",
"(",
"Geometry",
".",
"new",
"(",
"cols",
",",
"rows",
")",
")",
"do",
"|",
"ncols",
",",
"nrows",
"|",
"resize",
"(",
"ncols",
",",
"nrows",... | Convenience method to resize retaining the aspect ratio.
(Thanks to Robert Manni!) | [
"Convenience",
"method",
"to",
"resize",
"retaining",
"the",
"aspect",
"ratio",
".",
"(",
"Thanks",
"to",
"Robert",
"Manni!",
")"
] | ef6688ed9d76bf123c2ea1a483eff8635051adb7 | https://github.com/rmagick/rmagick/blob/ef6688ed9d76bf123c2ea1a483eff8635051adb7/lib/rmagick_internal.rb#L970-L975 | train | Resize the image to fit the image. | [
30522,
13366,
24501,
4697,
1035,
2000,
1035,
4906,
1006,
8902,
2015,
1010,
10281,
1027,
9152,
2140,
1007,
10281,
1064,
1064,
1027,
8902,
2015,
2689,
1035,
10988,
1006,
10988,
1012,
2047,
1006,
8902,
2015,
1010,
10281,
1007,
1007,
2079,
1064... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
haml/haml | lib/haml/helpers.rb | Haml.Helpers.capture_haml | def capture_haml(*args, &block)
buffer = eval('if defined? _hamlout then _hamlout else nil end', block.binding) || haml_buffer
with_haml_buffer(buffer) do
position = haml_buffer.buffer.length
haml_buffer.capture_position = position
value = block.call(*args)
captured = haml_buffer.buffer.slice!(position..-1)
if captured == '' and value != haml_buffer.buffer
captured = (value.is_a?(String) ? value : nil)
end
captured
end
ensure
haml_buffer.capture_position = nil
end | ruby | def capture_haml(*args, &block)
buffer = eval('if defined? _hamlout then _hamlout else nil end', block.binding) || haml_buffer
with_haml_buffer(buffer) do
position = haml_buffer.buffer.length
haml_buffer.capture_position = position
value = block.call(*args)
captured = haml_buffer.buffer.slice!(position..-1)
if captured == '' and value != haml_buffer.buffer
captured = (value.is_a?(String) ? value : nil)
end
captured
end
ensure
haml_buffer.capture_position = nil
end | [
"def",
"capture_haml",
"(",
"*",
"args",
",",
"&",
"block",
")",
"buffer",
"=",
"eval",
"(",
"'if defined? _hamlout then _hamlout else nil end'",
",",
"block",
".",
"binding",
")",
"||",
"haml_buffer",
"with_haml_buffer",
"(",
"buffer",
")",
"do",
"position",
"=... | Captures the result of a block of Haml code,
gets rid of the excess indentation,
and returns it as a string.
For example, after the following,
.foo
- foo = capture_haml(13) do |a|
%p= a
the local variable `foo` would be assigned to `"<p>13</p>\n"`.
@param args [Array] Arguments to pass into the block
@yield [args] A block of Haml code that will be converted to a string
@yieldparam args [Array] `args` | [
"Captures",
"the",
"result",
"of",
"a",
"block",
"of",
"Haml",
"code",
"gets",
"rid",
"of",
"the",
"excess",
"indentation",
"and",
"returns",
"it",
"as",
"a",
"string",
".",
"For",
"example",
"after",
"the",
"following"
] | 9aa0fbe4a91b999978927be569d2ad0cd39076f1 | https://github.com/haml/haml/blob/9aa0fbe4a91b999978927be569d2ad0cd39076f1/lib/haml/helpers.rb#L372-L390 | train | Capture haml code | [
30522,
13366,
5425,
1035,
10654,
2140,
1006,
1008,
12098,
5620,
1010,
1004,
3796,
1007,
17698,
1027,
9345,
2140,
1006,
1005,
2065,
4225,
1029,
1035,
10654,
23743,
2102,
2059,
1035,
10654,
23743,
2102,
2842,
9152,
2140,
2203,
1005,
1010,
379... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-09-01/generated/azure_mgmt_container_registry/runs.rb | Azure::ContainerRegistry::Mgmt::V2018_09_01.Runs.get_log_sas_url_with_http_info | def get_log_sas_url_with_http_info(resource_group_name, registry_name, run_id, custom_headers:nil)
get_log_sas_url_async(resource_group_name, registry_name, run_id, custom_headers:custom_headers).value!
end | ruby | def get_log_sas_url_with_http_info(resource_group_name, registry_name, run_id, custom_headers:nil)
get_log_sas_url_async(resource_group_name, registry_name, run_id, custom_headers:custom_headers).value!
end | [
"def",
"get_log_sas_url_with_http_info",
"(",
"resource_group_name",
",",
"registry_name",
",",
"run_id",
",",
"custom_headers",
":",
"nil",
")",
"get_log_sas_url_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"run_id",
",",
"custom_headers",
":custom_head... | Gets a link to download the run logs.
@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 run_id [String] The run ID.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"a",
"link",
"to",
"download",
"the",
"run",
"logs",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_registry/lib/2018-09-01/generated/azure_mgmt_container_registry/runs.rb#L318-L320 | train | Gets the SAS URL for the specified run. | [
30522,
13366,
2131,
1035,
8833,
1035,
21871,
1035,
24471,
2140,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
2448,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
CanCanCommunity/cancancan | lib/cancan/conditions_matcher.rb | CanCan.ConditionsMatcher.matches_conditions? | def matches_conditions?(action, subject, attribute = nil, *extra_args)
return call_block_with_all(action, subject, extra_args) if @match_all
return matches_block_conditions(subject, attribute, *extra_args) if @block
return matches_non_block_conditions(subject) unless conditions_empty?
true
end | ruby | def matches_conditions?(action, subject, attribute = nil, *extra_args)
return call_block_with_all(action, subject, extra_args) if @match_all
return matches_block_conditions(subject, attribute, *extra_args) if @block
return matches_non_block_conditions(subject) unless conditions_empty?
true
end | [
"def",
"matches_conditions?",
"(",
"action",
",",
"subject",
",",
"attribute",
"=",
"nil",
",",
"*",
"extra_args",
")",
"return",
"call_block_with_all",
"(",
"action",
",",
"subject",
",",
"extra_args",
")",
"if",
"@match_all",
"return",
"matches_block_conditions"... | Matches the block or conditions hash | [
"Matches",
"the",
"block",
"or",
"conditions",
"hash"
] | b2e5660c6b9b683fc45b8f425b90c4d06e2f24bf | https://github.com/CanCanCommunity/cancancan/blob/b2e5660c6b9b683fc45b8f425b90c4d06e2f24bf/lib/cancan/conditions_matcher.rb#L6-L12 | train | Returns true if the subject matches the conditions. | [
30522,
13366,
3503,
1035,
3785,
1029,
1006,
2895,
1010,
3395,
1010,
17961,
1027,
9152,
2140,
1010,
1008,
4469,
1035,
12098,
5620,
1007,
2709,
2655,
1035,
3796,
1035,
2007,
1035,
2035,
1006,
2895,
1010,
3395,
1010,
4469,
1035,
12098,
5620,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/diagnostics.rb | Azure::Web::Mgmt::V2018_02_01.Diagnostics.list_site_detector_responses_slot | def list_site_detector_responses_slot(resource_group_name, site_name, slot, custom_headers:nil)
first_page = list_site_detector_responses_slot_as_lazy(resource_group_name, site_name, slot, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_site_detector_responses_slot(resource_group_name, site_name, slot, custom_headers:nil)
first_page = list_site_detector_responses_slot_as_lazy(resource_group_name, site_name, slot, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_site_detector_responses_slot",
"(",
"resource_group_name",
",",
"site_name",
",",
"slot",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_site_detector_responses_slot_as_lazy",
"(",
"resource_group_name",
",",
"site_name",
",",
"slot",
",",
... | List Site Detector Responses
List Site Detector Responses
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param site_name [String] Site Name
@param slot [String] Slot Name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<DetectorResponse>] operation results. | [
"List",
"Site",
"Detector",
"Responses"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/diagnostics.rb#L1378-L1381 | train | Gets all the detector responses for a site. | [
30522,
13366,
2862,
1035,
2609,
1035,
19034,
1035,
10960,
1035,
10453,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2609,
1035,
2171,
1010,
10453,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2862,
1035,
2609,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
DataDog/dogstatsd-ruby | lib/datadog/statsd.rb | Datadog.Statsd.timing | def timing(stat, ms, opts=EMPTY_OPTIONS)
opts = {:sample_rate => opts} if opts.is_a? Numeric
send_stats stat, ms, TIMING_TYPE, opts
end | ruby | def timing(stat, ms, opts=EMPTY_OPTIONS)
opts = {:sample_rate => opts} if opts.is_a? Numeric
send_stats stat, ms, TIMING_TYPE, opts
end | [
"def",
"timing",
"(",
"stat",
",",
"ms",
",",
"opts",
"=",
"EMPTY_OPTIONS",
")",
"opts",
"=",
"{",
":sample_rate",
"=>",
"opts",
"}",
"if",
"opts",
".",
"is_a?",
"Numeric",
"send_stats",
"stat",
",",
"ms",
",",
"TIMING_TYPE",
",",
"opts",
"end"
] | Sends a timing (in ms) for the given stat to the statsd server. The
sample_rate determines what percentage of the time this report is sent. The
statsd server then uses the sample_rate to correctly track the average
timing for the stat.
@param [String] stat stat name
@param [Integer] ms timing in milliseconds
@param [Hash] opts the options to create the metric with
@option opts [Numeric] :sample_rate sample rate, 1 for always
@option opts [Array<String>] :tags An array of tags | [
"Sends",
"a",
"timing",
"(",
"in",
"ms",
")",
"for",
"the",
"given",
"stat",
"to",
"the",
"statsd",
"server",
".",
"The",
"sample_rate",
"determines",
"what",
"percentage",
"of",
"the",
"time",
"this",
"report",
"is",
"sent",
".",
"The",
"statsd",
"serve... | 0ea2a4d011958ad0d092654cae950e64b6475077 | https://github.com/DataDog/dogstatsd-ruby/blob/0ea2a4d011958ad0d092654cae950e64b6475077/lib/datadog/statsd.rb#L338-L341 | train | Send a timing stat to the server | [
30522,
13366,
10984,
1006,
28093,
1010,
5796,
1010,
23569,
2015,
1027,
4064,
1035,
7047,
1007,
23569,
2015,
1027,
1063,
1024,
7099,
1035,
3446,
1027,
1028,
23569,
2015,
1065,
2065,
23569,
2015,
1012,
2003,
1035,
1037,
1029,
16371,
25531,
46... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
castwide/solargraph | lib/solargraph/api_map.rb | Solargraph.ApiMap.clip_at | def clip_at filename, position
position = Position.normalize(position)
SourceMap::Clip.new(self, cursor_at(filename, position))
end | ruby | def clip_at filename, position
position = Position.normalize(position)
SourceMap::Clip.new(self, cursor_at(filename, position))
end | [
"def",
"clip_at",
"filename",
",",
"position",
"position",
"=",
"Position",
".",
"normalize",
"(",
"position",
")",
"SourceMap",
"::",
"Clip",
".",
"new",
"(",
"self",
",",
"cursor_at",
"(",
"filename",
",",
"position",
")",
")",
"end"
] | Get a clip by filename and position.
@param filename [String]
@param position [Position, Array(Integer, Integer)]
@return [SourceMap::Clip] | [
"Get",
"a",
"clip",
"by",
"filename",
"and",
"position",
"."
] | 47badb5d151aca775ccbe6c470236089eae7839d | https://github.com/castwide/solargraph/blob/47badb5d151aca775ccbe6c470236089eae7839d/lib/solargraph/api_map.rb#L139-L142 | train | clip the source map at the given position | [
30522,
13366,
12528,
1035,
2012,
5371,
18442,
1010,
2597,
2597,
1027,
2597,
1012,
3671,
4697,
1006,
2597,
1007,
3120,
2863,
2361,
1024,
1024,
12528,
1012,
2047,
1006,
2969,
1010,
12731,
25301,
2099,
1035,
2012,
1006,
5371,
18442,
1010,
2597... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/network_watchers.rb | Azure::Network::Mgmt::V2018_08_01.NetworkWatchers.get_network_configuration_diagnostic | def get_network_configuration_diagnostic(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
response = get_network_configuration_diagnostic_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_network_configuration_diagnostic(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
response = get_network_configuration_diagnostic_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_network_configuration_diagnostic",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_network_configuration_diagnostic_async",
"(",
"resource_group_name",
",",
"network_watcher_na... | Get network configuration diagnostic.
@param resource_group_name [String] The name of the resource group.
@param network_watcher_name [String] The name of the network watcher.
@param parameters [NetworkConfigurationDiagnosticParameters] Parameters to
get network configuration diagnostic.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [NetworkConfigurationDiagnosticResponse] operation results. | [
"Get",
"network",
"configuration",
"diagnostic",
"."
] | 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#L1156-L1159 | train | Gets the network configuration diagnostic. | [
30522,
13366,
2131,
1035,
2897,
1035,
9563,
1035,
16474,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2897,
1035,
3422,
2121,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
2897,
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_images.rb | Azure::Compute::Mgmt::V2018_04_01.VirtualMachineImages.list_skus | def list_skus(location, publisher_name, offer, custom_headers:nil)
response = list_skus_async(location, publisher_name, offer, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_skus(location, publisher_name, offer, custom_headers:nil)
response = list_skus_async(location, publisher_name, offer, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_skus",
"(",
"location",
",",
"publisher_name",
",",
"offer",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_skus_async",
"(",
"location",
",",
"publisher_name",
",",
"offer",
",",
"custom_headers",
":custom_headers",
")",
".",
"value... | Gets a list of virtual machine image SKUs for the specified location,
publisher, and offer.
@param location [String] The name of a supported Azure region.
@param publisher_name [String] A valid image publisher.
@param offer [String] A valid image publisher offer.
@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",
"SKUs",
"for",
"the",
"specified",
"location",
"publisher",
"and",
"offer",
"."
] | 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#L486-L489 | train | Gets the list of skus available for the specified location. | [
30522,
13366,
2862,
1035,
15315,
2271,
1006,
3295,
1010,
6674,
1035,
2171,
1010,
3749,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
15315,
2271,
1035,
2004,
6038,
2278,
1006,
3295,
1010,
6674,
1035,
2171,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mojombo/chronic | lib/chronic/handlers.rb | Chronic.Handlers.handle_generic | def handle_generic(tokens, options)
t = Chronic.time_class.parse(options[:text])
Span.new(t, t + 1)
rescue ArgumentError => e
raise e unless e.message =~ /out of range/
end | ruby | def handle_generic(tokens, options)
t = Chronic.time_class.parse(options[:text])
Span.new(t, t + 1)
rescue ArgumentError => e
raise e unless e.message =~ /out of range/
end | [
"def",
"handle_generic",
"(",
"tokens",
",",
"options",
")",
"t",
"=",
"Chronic",
".",
"time_class",
".",
"parse",
"(",
"options",
"[",
":text",
"]",
")",
"Span",
".",
"new",
"(",
"t",
",",
"t",
"+",
"1",
")",
"rescue",
"ArgumentError",
"=>",
"e",
... | Handle generic timestamp (ruby 1.8) | [
"Handle",
"generic",
"timestamp",
"(",
"ruby",
"1",
".",
"8",
")"
] | 2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c | https://github.com/mojombo/chronic/blob/2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c/lib/chronic/handlers.rb#L148-L153 | train | Handle generic tokens | [
30522,
13366,
5047,
1035,
12391,
1006,
19204,
2015,
1010,
7047,
1007,
1056,
1027,
11888,
1012,
2051,
1035,
2465,
1012,
11968,
3366,
1006,
7047,
1031,
1024,
3793,
1033,
1007,
8487,
1012,
2047,
1006,
1056,
1010,
1056,
1009,
1015,
1007,
5343,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/internet_gateway.rb | Aws::EC2.InternetGateway.detach_from_vpc | def detach_from_vpc(options = {})
options = options.merge(internet_gateway_id: @id)
resp = @client.detach_internet_gateway(options)
resp.data
end | ruby | def detach_from_vpc(options = {})
options = options.merge(internet_gateway_id: @id)
resp = @client.detach_internet_gateway(options)
resp.data
end | [
"def",
"detach_from_vpc",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"internet_gateway_id",
":",
"@id",
")",
"resp",
"=",
"@client",
".",
"detach_internet_gateway",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
internet_gateway.detach_from_vpc({
dry_run: false,
vpc_id: "String", # required
})
@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 [required, String] :vpc_id
The ID of the VPC.
@return [EmptyStructure] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/internet_gateway.rb#L275-L279 | train | Detach the internet gateway from the VPC | [
30522,
13366,
20010,
6776,
1035,
2013,
1035,
21210,
2278,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
4274,
1035,
11909,
1035,
8909,
1024,
1030,
8909,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
20010,
6776,
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... |
zendesk/ruby-kafka | lib/kafka/async_producer.rb | Kafka.AsyncProducer.produce | def produce(value, topic:, **options)
ensure_threads_running!
if @queue.size >= @max_queue_size
buffer_overflow topic,
"Cannot produce to #{topic}, max queue size (#{@max_queue_size} messages) reached"
end
args = [value, **options.merge(topic: topic)]
@queue << [:produce, args]
@instrumenter.instrument("enqueue_message.async_producer", {
topic: topic,
queue_size: @queue.size,
max_queue_size: @max_queue_size,
})
nil
end | ruby | def produce(value, topic:, **options)
ensure_threads_running!
if @queue.size >= @max_queue_size
buffer_overflow topic,
"Cannot produce to #{topic}, max queue size (#{@max_queue_size} messages) reached"
end
args = [value, **options.merge(topic: topic)]
@queue << [:produce, args]
@instrumenter.instrument("enqueue_message.async_producer", {
topic: topic,
queue_size: @queue.size,
max_queue_size: @max_queue_size,
})
nil
end | [
"def",
"produce",
"(",
"value",
",",
"topic",
":",
",",
"**",
"options",
")",
"ensure_threads_running!",
"if",
"@queue",
".",
"size",
">=",
"@max_queue_size",
"buffer_overflow",
"topic",
",",
"\"Cannot produce to #{topic}, max queue size (#{@max_queue_size} messages) reache... | Initializes a new AsyncProducer.
@param sync_producer [Kafka::Producer] the synchronous producer that should
be used in the background.
@param max_queue_size [Integer] the maximum number of messages allowed in
the queue.
@param delivery_threshold [Integer] if greater than zero, the number of
buffered messages that will automatically trigger a delivery.
@param delivery_interval [Integer] if greater than zero, the number of
seconds between automatic message deliveries.
Produces a message to the specified topic.
@see Kafka::Producer#produce
@param (see Kafka::Producer#produce)
@raise [BufferOverflow] if the message queue is full.
@return [nil] | [
"Initializes",
"a",
"new",
"AsyncProducer",
"."
] | 2a73471b6a607a52dc85c79301ba522acb4566b5 | https://github.com/zendesk/ruby-kafka/blob/2a73471b6a607a52dc85c79301ba522acb4566b5/lib/kafka/async_producer.rb#L105-L123 | train | Creates a new MessageProducer. | [
30522,
13366,
3965,
1006,
3643,
1010,
8476,
1024,
1010,
1008,
1008,
7047,
1007,
5676,
1035,
16457,
1035,
2770,
999,
2065,
1030,
24240,
1012,
2946,
1028,
1027,
1030,
4098,
1035,
24240,
1035,
2946,
17698,
1035,
2058,
12314,
8476,
1010,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ruby/rake | lib/rake/file_utils_ext.rb | Rake.FileUtilsExt.rake_check_options | def rake_check_options(options, *optdecl)
h = options.dup
optdecl.each do |name|
h.delete name
end
raise ArgumentError, "no such option: #{h.keys.join(' ')}" unless
h.empty?
end | ruby | def rake_check_options(options, *optdecl)
h = options.dup
optdecl.each do |name|
h.delete name
end
raise ArgumentError, "no such option: #{h.keys.join(' ')}" unless
h.empty?
end | [
"def",
"rake_check_options",
"(",
"options",
",",
"*",
"optdecl",
")",
"h",
"=",
"options",
".",
"dup",
"optdecl",
".",
"each",
"do",
"|",
"name",
"|",
"h",
".",
"delete",
"name",
"end",
"raise",
"ArgumentError",
",",
"\"no such option: #{h.keys.join(' ')}\"",... | Check that the options do not contain options not listed in
+optdecl+. An ArgumentError exception is thrown if non-declared
options are found. | [
"Check",
"that",
"the",
"options",
"do",
"not",
"contain",
"options",
"not",
"listed",
"in",
"+",
"optdecl",
"+",
".",
"An",
"ArgumentError",
"exception",
"is",
"thrown",
"if",
"non",
"-",
"declared",
"options",
"are",
"found",
"."
] | 1c22b490ee6cb8bd614fa8d0d6145f671466206b | https://github.com/ruby/rake/blob/1c22b490ee6cb8bd614fa8d0d6145f671466206b/lib/rake/file_utils_ext.rb#L134-L141 | train | Check the options for rake | [
30522,
13366,
26008,
1035,
4638,
1035,
7047,
1006,
7047,
1010,
1008,
23569,
3207,
20464,
1007,
1044,
1027,
7047,
1012,
4241,
2361,
23569,
3207,
20464,
1012,
2169,
2079,
1064,
2171,
1064,
1044,
1012,
3972,
12870,
2171,
2203,
5333,
6685,
2121... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_media_services/lib/2018-07-01/generated/azure_mgmt_media_services/content_key_policies.rb | Azure::MediaServices::Mgmt::V2018_07_01.ContentKeyPolicies.get_policy_properties_with_secrets_with_http_info | def get_policy_properties_with_secrets_with_http_info(resource_group_name, account_name, content_key_policy_name, custom_headers:nil)
get_policy_properties_with_secrets_async(resource_group_name, account_name, content_key_policy_name, custom_headers:custom_headers).value!
end | ruby | def get_policy_properties_with_secrets_with_http_info(resource_group_name, account_name, content_key_policy_name, custom_headers:nil)
get_policy_properties_with_secrets_async(resource_group_name, account_name, content_key_policy_name, custom_headers:custom_headers).value!
end | [
"def",
"get_policy_properties_with_secrets_with_http_info",
"(",
"resource_group_name",
",",
"account_name",
",",
"content_key_policy_name",
",",
"custom_headers",
":",
"nil",
")",
"get_policy_properties_with_secrets_async",
"(",
"resource_group_name",
",",
"account_name",
",",
... | Get a Content Key Policy with secrets
Get a Content Key Policy including secret values
@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 content_key_policy_name [String] The Content Key Policy 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. | [
"Get",
"a",
"Content",
"Key",
"Policy",
"with",
"secrets"
] | 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/content_key_policies.rb#L617-L619 | train | Gets the policy properties with the specified secret. | [
30522,
13366,
2131,
1035,
3343,
1035,
5144,
1035,
2007,
1035,
7800,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
4180,
1035,
3145,
1035,
3343,
1035,
2171,
1010,
7661,
1035,
20346,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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_image_store_upload_session_by_id | def get_image_store_upload_session_by_id(session_id, timeout:60, custom_headers:nil)
response = get_image_store_upload_session_by_id_async(session_id, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_image_store_upload_session_by_id(session_id, timeout:60, custom_headers:nil)
response = get_image_store_upload_session_by_id_async(session_id, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_image_store_upload_session_by_id",
"(",
"session_id",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_image_store_upload_session_by_id_async",
"(",
"session_id",
",",
"timeout",
":",
"timeout",
",",
"custom_headers",
... | Get the image store upload session by ID.
Gets the image store upload session identified by the given ID. User can
query the upload session at any time during uploading.
@param session_id A GUID generated by the user for a file uploading. It
identifies an image store upload session which keeps track of all file chunks
until it is committed.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [UploadSession] operation results. | [
"Get",
"the",
"image",
"store",
"upload",
"session",
"by",
"ID",
"."
] | 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#L19946-L19949 | train | Gets the image store upload session. | [
30522,
13366,
2131,
1035,
3746,
1035,
3573,
1035,
2039,
11066,
1035,
5219,
1035,
2011,
1035,
8909,
1006,
5219,
1035,
8909,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
3746,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jekyll/jekyll | lib/jekyll/filters.rb | Jekyll.Filters.parse_condition | def parse_condition(exp)
parser = Liquid::Parser.new(exp)
condition = parse_binary_comparison(parser)
parser.consume(:end_of_string)
condition
end | ruby | def parse_condition(exp)
parser = Liquid::Parser.new(exp)
condition = parse_binary_comparison(parser)
parser.consume(:end_of_string)
condition
end | [
"def",
"parse_condition",
"(",
"exp",
")",
"parser",
"=",
"Liquid",
"::",
"Parser",
".",
"new",
"(",
"exp",
")",
"condition",
"=",
"parse_binary_comparison",
"(",
"parser",
")",
"parser",
".",
"consume",
"(",
":end_of_string",
")",
"condition",
"end"
] | ----------- The following set of code was *adapted* from Liquid::If
----------- ref: https://git.io/vp6K6
Parse a string to a Liquid Condition | [
"-----------",
"The",
"following",
"set",
"of",
"code",
"was",
"*",
"adapted",
"*",
"from",
"Liquid",
"::",
"If",
"-----------",
"ref",
":",
"https",
":",
"//",
"git",
".",
"io",
"/",
"vp6K6",
"Parse",
"a",
"string",
"to",
"a",
"Liquid",
"Condition"
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/filters.rb#L394-L400 | train | Parse the condition | [
30522,
13366,
11968,
3366,
1035,
4650,
1006,
4654,
2361,
1007,
11968,
8043,
1027,
6381,
1024,
1024,
11968,
8043,
1012,
2047,
1006,
4654,
2361,
1007,
4650,
1027,
11968,
3366,
1035,
12441,
1035,
7831,
1006,
11968,
8043,
1007,
11968,
8043,
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... |
ruby/rake | lib/rake/task_manager.rb | Rake.TaskManager.resolve_args | def resolve_args(args)
if args.last.is_a?(Hash)
deps = args.pop
resolve_args_with_dependencies(args, deps)
else
resolve_args_without_dependencies(args)
end
end | ruby | def resolve_args(args)
if args.last.is_a?(Hash)
deps = args.pop
resolve_args_with_dependencies(args, deps)
else
resolve_args_without_dependencies(args)
end
end | [
"def",
"resolve_args",
"(",
"args",
")",
"if",
"args",
".",
"last",
".",
"is_a?",
"(",
"Hash",
")",
"deps",
"=",
"args",
".",
"pop",
"resolve_args_with_dependencies",
"(",
"args",
",",
"deps",
")",
"else",
"resolve_args_without_dependencies",
"(",
"args",
")... | Resolve the arguments for a task/rule. Returns a triplet of
[task_name, arg_name_list, prerequisites]. | [
"Resolve",
"the",
"arguments",
"for",
"a",
"task",
"/",
"rule",
".",
"Returns",
"a",
"triplet",
"of",
"[",
"task_name",
"arg_name_list",
"prerequisites",
"]",
"."
] | 1c22b490ee6cb8bd614fa8d0d6145f671466206b | https://github.com/ruby/rake/blob/1c22b490ee6cb8bd614fa8d0d6145f671466206b/lib/rake/task_manager.rb#L88-L95 | train | Resolve the arguments | [
30522,
13366,
10663,
1035,
12098,
5620,
1006,
12098,
5620,
1007,
2065,
12098,
5620,
1012,
2197,
1012,
2003,
1035,
1037,
1029,
1006,
23325,
1007,
2139,
4523,
1027,
12098,
30524,
1035,
12530,
15266,
1006,
12098,
5620,
1010,
2139,
4523,
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... |
puppetlabs/bolt | acceptance/lib/acceptance/bolt_command_helper.rb | Acceptance.BoltCommandHelper.bolt_command_on | def bolt_command_on(host, command, flags = {}, opts = {})
bolt_command = command.dup
flags.each { |k, v| bolt_command << " #{k} #{v}" }
case host['platform']
when /windows/
execute_powershell_script_on(host, bolt_command, opts)
when /osx/
# Ensure Bolt runs with UTF-8 under macOS. Otherwise we get issues with
# UTF-8 content in task results.
env = 'source /etc/profile ~/.bash_profile ~/.bash_login ~/.profile && env LANG=en_US.UTF-8'
on(host, env + ' ' + bolt_command)
else
on(host, bolt_command, opts)
end
end | ruby | def bolt_command_on(host, command, flags = {}, opts = {})
bolt_command = command.dup
flags.each { |k, v| bolt_command << " #{k} #{v}" }
case host['platform']
when /windows/
execute_powershell_script_on(host, bolt_command, opts)
when /osx/
# Ensure Bolt runs with UTF-8 under macOS. Otherwise we get issues with
# UTF-8 content in task results.
env = 'source /etc/profile ~/.bash_profile ~/.bash_login ~/.profile && env LANG=en_US.UTF-8'
on(host, env + ' ' + bolt_command)
else
on(host, bolt_command, opts)
end
end | [
"def",
"bolt_command_on",
"(",
"host",
",",
"command",
",",
"flags",
"=",
"{",
"}",
",",
"opts",
"=",
"{",
"}",
")",
"bolt_command",
"=",
"command",
".",
"dup",
"flags",
".",
"each",
"{",
"|",
"k",
",",
"v",
"|",
"bolt_command",
"<<",
"\" #{k} #{v}\"... | A helper to build a bolt command used in acceptance testing
@param [Beaker::Host] host the host to execute the command on
@param [String] command the command to execute on the bolt SUT
@param [Hash] flags the command flags to append to the command
@option flags [String] '--nodes' the nodes to run on
@option flags [String] '--user' the user to run the command as
@option flags [String] '--password' the password for the user
@option flags [nil] '--no-host-key-check' specify nil to use
@option flags [nil] '--no-ssl' specify nil to use
@param [Hash] opts the options hash for this method | [
"A",
"helper",
"to",
"build",
"a",
"bolt",
"command",
"used",
"in",
"acceptance",
"testing"
] | 50689a33699939d262ea7c822a4b24fd8c4f8d8a | https://github.com/puppetlabs/bolt/blob/50689a33699939d262ea7c822a4b24fd8c4f8d8a/acceptance/lib/acceptance/bolt_command_helper.rb#L15-L30 | train | Execute a bolt command on the given host. | [
30522,
13366,
10053,
1035,
3094,
1035,
2006,
1006,
3677,
1010,
3094,
1010,
9245,
1027,
1063,
1065,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
10053,
1035,
3094,
1027,
3094,
1012,
4241,
2361,
9245,
1012,
2169,
1063,
1064,
1047,
1010,
1058,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/2017-12-01/generated/azure_mgmt_compute/virtual_machine_scale_set_vms.rb | Azure::Compute::Mgmt::V2017_12_01.VirtualMachineScaleSetVMs.get_with_http_info | def get_with_http_info(resource_group_name, vm_scale_set_name, instance_id, custom_headers:nil)
get_async(resource_group_name, vm_scale_set_name, instance_id, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, vm_scale_set_name, instance_id, custom_headers:nil)
get_async(resource_group_name, vm_scale_set_name, instance_id, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"instance_id",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"instance_id",
",",
"custom_headers",
":custom_headers",
... | Gets a virtual machine from a VM scale set.
@param resource_group_name [String] The name of the resource group.
@param vm_scale_set_name [String] The name of the VM scale set.
@param instance_id [String] The instance ID of the virtual machine.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"a",
"virtual",
"machine",
"from",
"a",
"VM",
"scale",
"set",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2017-12-01/generated/azure_mgmt_compute/virtual_machine_scale_set_vms.rb#L282-L284 | train | Gets the specified virtual machine from the specified VM scale set. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
4094,
1035,
2275,
1035,
2171,
1010,
6013,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_api_management/lib/2016-07-07/generated/azure_mgmt_api_management/user_identities.rb | Azure::ApiManagement::Mgmt::V2016_07_07.UserIdentities.list_by_user | def list_by_user(resource_group_name, service_name, uid, custom_headers:nil)
response = list_by_user_async(resource_group_name, service_name, uid, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_user(resource_group_name, service_name, uid, custom_headers:nil)
response = list_by_user_async(resource_group_name, service_name, uid, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_user",
"(",
"resource_group_name",
",",
"service_name",
",",
"uid",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_user_async",
"(",
"resource_group_name",
",",
"service_name",
",",
"uid",
",",
"custom_headers",
":custom_headers",
... | Lists all user identities.
@param resource_group_name [String] The name of the resource group.
@param service_name [String] The name of the API Management service.
@param uid [String] User identifier. Must be unique in the current API
Management service instance.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array] operation results. | [
"Lists",
"all",
"user",
"identities",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2016-07-07/generated/azure_mgmt_api_management/user_identities.rb#L36-L39 | train | Gets the list of the elastic advisors. | [
30522,
13366,
2862,
1035,
2011,
1035,
5310,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
21318,
2094,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
5310,
1035,
2004,
6038,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
lostisland/faraday | lib/faraday/connection.rb | Faraday.Connection.with_uri_credentials | def with_uri_credentials(uri)
return unless uri.user && uri.password
yield(Utils.unescape(uri.user), Utils.unescape(uri.password))
end | ruby | def with_uri_credentials(uri)
return unless uri.user && uri.password
yield(Utils.unescape(uri.user), Utils.unescape(uri.password))
end | [
"def",
"with_uri_credentials",
"(",
"uri",
")",
"return",
"unless",
"uri",
".",
"user",
"&&",
"uri",
".",
"password",
"yield",
"(",
"Utils",
".",
"unescape",
"(",
"uri",
".",
"user",
")",
",",
"Utils",
".",
"unescape",
"(",
"uri",
".",
"password",
")",... | Creates a duplicate of this Faraday::Connection.
@api private
@return [Faraday::Connection]
Yields username and password extracted from a URI if they both exist.
@param uri [URI]
@yield [username, password] any username and password
@yieldparam username [String] any username from URI
@yieldparam password [String] any password from URI
@return [void]
@api private | [
"Creates",
"a",
"duplicate",
"of",
"this",
"Faraday",
"::",
"Connection",
"."
] | 3abe9d1eea4bdf61cdf7b76ff9f1ae7e09482e70 | https://github.com/lostisland/faraday/blob/3abe9d1eea4bdf61cdf7b76ff9f1ae7e09482e70/lib/faraday/connection.rb#L569-L573 | train | Pass a URI object with credentials | [
30522,
13366,
2007,
1035,
24471,
2072,
1035,
22496,
1006,
24471,
2072,
1007,
2709,
4983,
24471,
2072,
1012,
5310,
1004,
1004,
24471,
2072,
1012,
20786,
10750,
1006,
21183,
12146,
1012,
16655,
15782,
5051,
1006,
24471,
2072,
1012,
5310,
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_logic/lib/2016-06-01/generated/azure_mgmt_logic/partners.rb | Azure::Logic::Mgmt::V2016_06_01.Partners.delete_with_http_info | def delete_with_http_info(resource_group_name, integration_account_name, partner_name, custom_headers:nil)
delete_async(resource_group_name, integration_account_name, partner_name, custom_headers:custom_headers).value!
end | ruby | def delete_with_http_info(resource_group_name, integration_account_name, partner_name, custom_headers:nil)
delete_async(resource_group_name, integration_account_name, partner_name, custom_headers:custom_headers).value!
end | [
"def",
"delete_with_http_info",
"(",
"resource_group_name",
",",
"integration_account_name",
",",
"partner_name",
",",
"custom_headers",
":",
"nil",
")",
"delete_async",
"(",
"resource_group_name",
",",
"integration_account_name",
",",
"partner_name",
",",
"custom_headers",... | Deletes an integration account partner.
@param resource_group_name [String] The resource group name.
@param integration_account_name [String] The integration account name.
@param partner_name [String] The integration account partner name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Deletes",
"an",
"integration",
"account",
"partner",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/partners.rb#L364-L366 | train | Deletes an integration account partner. | [
30522,
13366,
3972,
12870,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8346,
1035,
4070,
1035,
2171,
1010,
4256,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3972,
12870,
1035,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-04-01/generated/azure_mgmt_network/express_route_cross_connections.rb | Azure::Network::Mgmt::V2018_04_01.ExpressRouteCrossConnections.list_routes_table_summary | def list_routes_table_summary(resource_group_name, cross_connection_name, peering_name, device_path, custom_headers:nil)
response = list_routes_table_summary_async(resource_group_name, cross_connection_name, peering_name, device_path, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_routes_table_summary(resource_group_name, cross_connection_name, peering_name, device_path, custom_headers:nil)
response = list_routes_table_summary_async(resource_group_name, cross_connection_name, peering_name, device_path, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_routes_table_summary",
"(",
"resource_group_name",
",",
"cross_connection_name",
",",
"peering_name",
",",
"device_path",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_routes_table_summary_async",
"(",
"resource_group_name",
",",
"cross_connect... | Gets the route table summary associated with the express route cross
connection in a resource group.
@param resource_group_name [String] The name of the resource group.
@param cross_connection_name [String] The name of the
ExpressRouteCrossConnection.
@param peering_name [String] The name of the peering.
@param device_path [String] The path of the device.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ExpressRouteCrossConnectionsRoutesTableSummaryListResult] operation
results. | [
"Gets",
"the",
"route",
"table",
"summary",
"associated",
"with",
"the",
"express",
"route",
"cross",
"connection",
"in",
"a",
"resource",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-04-01/generated/azure_mgmt_network/express_route_cross_connections.rb#L452-L455 | train | Gets the routes table summary for the specified ExpressRouteCrossConnection. | [
30522,
13366,
2862,
1035,
5847,
1035,
2795,
1035,
12654,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2892,
1035,
4434,
1035,
2171,
1010,
16740,
1035,
2171,
1010,
5080,
1035,
4130,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_graph_rbac/lib/1.6/generated/azure_graph_rbac/groups.rb | Azure::GraphRbac::V1_6.Groups.get_group_members_next | def get_group_members_next(next_link, custom_headers:nil)
response = get_group_members_next_async(next_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_group_members_next(next_link, custom_headers:nil)
response = get_group_members_next_async(next_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_group_members_next",
"(",
"next_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_group_members_next_async",
"(",
"next_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"response",
... | Gets the members of a group.
@param next_link [String] Next link for the list operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<AADObject>] operation results. | [
"Gets",
"the",
"members",
"of",
"a",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_graph_rbac/lib/1.6/generated/azure_graph_rbac/groups.rb#L956-L959 | train | Gets the group members of the current subscription. | [
30522,
13366,
2131,
1035,
2177,
1035,
2372,
1035,
2279,
1006,
2279,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
2177,
1035,
2372,
1035,
2279,
1035,
2004,
6038,
2278,
1006,
2279,
1035,
4957,
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_storagesync/lib/2018-07-01/generated/azure_mgmt_storagesync/cloud_endpoints.rb | Azure::StorageSync::Mgmt::V2018_07_01.CloudEndpoints.post_backup_async | def post_backup_async(resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers:nil)
# Send request
promise = begin_post_backup_async(resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::StorageSync::Mgmt::V2018_07_01::Models::PostBackupResponse.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 post_backup_async(resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers:nil)
# Send request
promise = begin_post_backup_async(resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::StorageSync::Mgmt::V2018_07_01::Models::PostBackupResponse.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",
"post_backup_async",
"(",
"resource_group_name",
",",
"storage_sync_service_name",
",",
"sync_group_name",
",",
"cloud_endpoint_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_post_backup_async",
"(",
"reso... | @param resource_group_name [String] The name of the resource group. The name
is case insensitive.
@param storage_sync_service_name [String] Name of Storage Sync Service
resource.
@param sync_group_name [String] Name of Sync Group resource.
@param cloud_endpoint_name [String] Name of Cloud Endpoint object.
@param parameters [BackupRequest] Body of Backup request.
@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",
".",
"The",
"name",
"is",
"case",
"insensitive",
".",
"@param",
"storage_sync_service_name",
"[",
"String",
"]",
"Name",
"of",
"Storage",
"Sync",
"Service",
"... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_storagesync/lib/2018-07-01/generated/azure_mgmt_storagesync/cloud_endpoints.rb#L424-L440 | train | Post a backup of a specified cloud endpoint. | [
30522,
13366,
2695,
1035,
10200,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
5527,
1035,
26351,
1035,
2326,
1035,
2171,
1010,
26351,
1035,
2177,
1035,
2171,
1010,
6112,
1035,
2203,
8400,
1035,
2171,
1010,
11709,
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... |
ruby2d/ruby2d | lib/ruby2d/window.rb | Ruby2D.Window.controller_callback | def controller_callback(which, type, axis, value, button)
# All controller events
@events[:controller].each do |id, e|
e.call(ControllerEvent.new(which, type, axis, value, button))
end
case type
# When controller axis motion, like analog sticks
when :axis
@events[:controller_axis].each do |id, e|
e.call(ControllerAxisEvent.new(which, axis, value))
end
# When controller button is pressed
when :button_down
@events[:controller_button_down].each do |id, e|
e.call(ControllerButtonEvent.new(which, button))
end
# When controller button is released
when :button_up
@events[:controller_button_up].each do |id, e|
e.call(ControllerButtonEvent.new(which, button))
end
end
end | ruby | def controller_callback(which, type, axis, value, button)
# All controller events
@events[:controller].each do |id, e|
e.call(ControllerEvent.new(which, type, axis, value, button))
end
case type
# When controller axis motion, like analog sticks
when :axis
@events[:controller_axis].each do |id, e|
e.call(ControllerAxisEvent.new(which, axis, value))
end
# When controller button is pressed
when :button_down
@events[:controller_button_down].each do |id, e|
e.call(ControllerButtonEvent.new(which, button))
end
# When controller button is released
when :button_up
@events[:controller_button_up].each do |id, e|
e.call(ControllerButtonEvent.new(which, button))
end
end
end | [
"def",
"controller_callback",
"(",
"which",
",",
"type",
",",
"axis",
",",
"value",
",",
"button",
")",
"# All controller events",
"@events",
"[",
":controller",
"]",
".",
"each",
"do",
"|",
"id",
",",
"e",
"|",
"e",
".",
"call",
"(",
"ControllerEvent",
... | Controller callback method, called by the native and web extentions | [
"Controller",
"callback",
"method",
"called",
"by",
"the",
"native",
"and",
"web",
"extentions"
] | 43ce9805a7ae8b82b7ab8c50bf6d4c845d395dc4 | https://github.com/ruby2d/ruby2d/blob/43ce9805a7ae8b82b7ab8c50bf6d4c845d395dc4/lib/ruby2d/window.rb#L341-L364 | train | This method is called by the controller event handler. | [
30522,
13366,
11486,
1035,
2655,
5963,
1006,
2029,
1010,
30524,
1012,
2169,
2079,
1064,
8909,
1010,
1041,
1064,
1041,
1012,
2655,
1006,
11486,
18697,
3372,
1012,
2047,
1006,
2029,
1010,
2828,
1010,
8123,
1010,
3643,
1010,
6462,
1007,
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... |
sunspot/sunspot | sunspot/lib/sunspot/schema.rb | Sunspot.Schema.to_xml | def to_xml
template_path = File.join(File.dirname(__FILE__), '..', '..', 'templates', 'schema.xml.erb')
template_text = File.read(template_path)
erb = if RUBY_VERSION >= '2.6'
ERB.new(template_text, trim_mode: '-')
else
ERB.new(template_text, nil, '-')
end
erb.result(binding)
end | ruby | def to_xml
template_path = File.join(File.dirname(__FILE__), '..', '..', 'templates', 'schema.xml.erb')
template_text = File.read(template_path)
erb = if RUBY_VERSION >= '2.6'
ERB.new(template_text, trim_mode: '-')
else
ERB.new(template_text, nil, '-')
end
erb.result(binding)
end | [
"def",
"to_xml",
"template_path",
"=",
"File",
".",
"join",
"(",
"File",
".",
"dirname",
"(",
"__FILE__",
")",
",",
"'..'",
",",
"'..'",
",",
"'templates'",
",",
"'schema.xml.erb'",
")",
"template_text",
"=",
"File",
".",
"read",
"(",
"template_path",
")",... | Return an XML representation of this schema using the ERB template | [
"Return",
"an",
"XML",
"representation",
"of",
"this",
"schema",
"using",
"the",
"ERB",
"template"
] | 31dd76cd7a14a4ef7bd541de97483d8cd72ff685 | https://github.com/sunspot/sunspot/blob/31dd76cd7a14a4ef7bd541de97483d8cd72ff685/sunspot/lib/sunspot/schema.rb#L90-L101 | train | Convert the schema to an XML object. | [
30522,
13366,
2000,
1035,
20950,
23561,
1035,
4130,
1027,
5371,
1012,
3693,
1006,
5371,
1012,
16101,
18442,
1006,
1035,
1035,
5371,
1035,
1035,
1007,
1010,
1005,
1012,
1012,
1005,
1010,
1005,
1012,
1012,
1005,
1010,
1005,
23561,
2015,
1005,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rollbar/rollbar-gem | lib/rollbar/exception_reporter.rb | Rollbar.ExceptionReporter.report_exception_to_rollbar | def report_exception_to_rollbar(env, exception)
return unless capture_uncaught?
log_exception_message(exception)
exception_data = exception_data(exception)
if exception_data.is_a?(Hash)
env['rollbar.exception_uuid'] = exception_data[:uuid]
Rollbar.log_debug "[Rollbar] Exception uuid saved in env: #{exception_data[:uuid]}"
elsif exception_data == 'disabled'
Rollbar.log_debug '[Rollbar] Exception not reported because Rollbar is disabled'
elsif exception_data == 'ignored'
Rollbar.log_debug '[Rollbar] Exception not reported because it was ignored'
end
rescue StandardError => e
Rollbar.log_warning "[Rollbar] Exception while reporting exception to Rollbar: #{e.message}"
end | ruby | def report_exception_to_rollbar(env, exception)
return unless capture_uncaught?
log_exception_message(exception)
exception_data = exception_data(exception)
if exception_data.is_a?(Hash)
env['rollbar.exception_uuid'] = exception_data[:uuid]
Rollbar.log_debug "[Rollbar] Exception uuid saved in env: #{exception_data[:uuid]}"
elsif exception_data == 'disabled'
Rollbar.log_debug '[Rollbar] Exception not reported because Rollbar is disabled'
elsif exception_data == 'ignored'
Rollbar.log_debug '[Rollbar] Exception not reported because it was ignored'
end
rescue StandardError => e
Rollbar.log_warning "[Rollbar] Exception while reporting exception to Rollbar: #{e.message}"
end | [
"def",
"report_exception_to_rollbar",
"(",
"env",
",",
"exception",
")",
"return",
"unless",
"capture_uncaught?",
"log_exception_message",
"(",
"exception",
")",
"exception_data",
"=",
"exception_data",
"(",
"exception",
")",
"if",
"exception_data",
".",
"is_a?",
"(",... | :nodoc: | [
":",
"nodoc",
":"
] | 83ef1acca2b0b1d1b74ff8ef29435ca82e8ca1d6 | https://github.com/rollbar/rollbar-gem/blob/83ef1acca2b0b1d1b74ff8ef29435ca82e8ca1d6/lib/rollbar/exception_reporter.rb#L3-L20 | train | Report uncaught exception to Rollbar | [
30522,
13366,
3189,
1035,
6453,
1035,
2000,
1035,
4897,
8237,
1006,
4372,
2615,
1010,
6453,
1007,
2709,
4983,
5425,
1035,
4895,
3540,
18533,
1029,
8833,
1035,
6453,
1035,
4471,
1006,
6453,
1007,
6453,
1035,
2951,
1027,
6453,
1035,
2951,
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_event_hub/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/namespaces.rb | Azure::EventHub::Mgmt::V2018_01_01_preview.Namespaces.get_network_rule_set | def get_network_rule_set(resource_group_name, namespace_name, custom_headers:nil)
response = get_network_rule_set_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_network_rule_set(resource_group_name, namespace_name, custom_headers:nil)
response = get_network_rule_set_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_network_rule_set",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_network_rule_set_async",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"custom_headers",
":custom_headers",
")",
".",
... | Gets NetworkRuleSet for a Namespace.
@param resource_group_name [String] Name of the resource group within the
Azure subscription.
@param namespace_name [String] The Namespace name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [NetworkRuleSet] operation results. | [
"Gets",
"NetworkRuleSet",
"for",
"a",
"Namespace",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_event_hub/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/namespaces.rb#L1468-L1471 | train | Gets the network rule set for a namespace. | [
30522,
13366,
2131,
1035,
2897,
1035,
3627,
1035,
2275,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3415,
15327,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
2897,
1035,
3627,
1035,
2275,
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_container_registry/lib/2016-06-27-preview/generated/azure_mgmt_container_registry/registries.rb | Azure::ContainerRegistry::Mgmt::V2016_06_27_preview.Registries.create_or_update | def create_or_update(resource_group_name, registry_name, registry, custom_headers:nil)
response = create_or_update_async(resource_group_name, registry_name, registry, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_or_update(resource_group_name, registry_name, registry, custom_headers:nil)
response = create_or_update_async(resource_group_name, registry_name, registry, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_or_update",
"(",
"resource_group_name",
",",
"registry_name",
",",
"registry",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_or_update_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"registry",
",",
"custom_headers",
"... | Creates or updates a container registry with the specified parameters.
@param resource_group_name [String] The name of the resource group to which
the container registry belongs.
@param registry_name [String] The name of the container registry.
@param registry [Registry] The parameters for creating or updating a
container registry.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Registry] operation results. | [
"Creates",
"or",
"updates",
"a",
"container",
"registry",
"with",
"the",
"specified",
"parameters",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_registry/lib/2016-06-27-preview/generated/azure_mgmt_container_registry/registries.rb#L236-L239 | train | Creates or updates a container registry. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
15584,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3443,
1035,
2030,
1035,
10651,
1035,
2004,
6038,
2278,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rmagick/rmagick | lib/rmagick_internal.rb | Magick.Image.each_pixel | def each_pixel
get_pixels(0, 0, columns, rows).each_with_index do |p, n|
yield(p, n % columns, n / columns)
end
self
end | ruby | def each_pixel
get_pixels(0, 0, columns, rows).each_with_index do |p, n|
yield(p, n % columns, n / columns)
end
self
end | [
"def",
"each_pixel",
"get_pixels",
"(",
"0",
",",
"0",
",",
"columns",
",",
"rows",
")",
".",
"each_with_index",
"do",
"|",
"p",
",",
"n",
"|",
"yield",
"(",
"p",
",",
"n",
"%",
"columns",
",",
"n",
"/",
"columns",
")",
"end",
"self",
"end"
] | Thanks to Russell Norris! | [
"Thanks",
"to",
"Russell",
"Norris!"
] | ef6688ed9d76bf123c2ea1a483eff8635051adb7 | https://github.com/rmagick/rmagick/blob/ef6688ed9d76bf123c2ea1a483eff8635051adb7/lib/rmagick_internal.rb#L804-L809 | train | Yields the pixel data in the image. | [
30522,
13366,
2169,
1035,
22138,
2131,
1035,
27725,
1006,
1014,
1010,
1014,
1010,
7753,
1010,
10281,
1007,
1012,
2169,
1035,
2007,
1035,
5950,
2079,
1064,
1052,
1010,
1050,
1064,
10750,
1006,
1052,
1010,
1050,
1003,
7753,
1010,
1050,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_event_grid/lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb | Azure::EventGrid::Mgmt::V2017_06_15_preview.EventSubscriptions.create_async | def create_async(scope, event_subscription_name, event_subscription_info, custom_headers:nil)
# Send request
promise = begin_create_async(scope, event_subscription_name, event_subscription_info, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::EventGrid::Mgmt::V2017_06_15_preview::Models::EventSubscription.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_async(scope, event_subscription_name, event_subscription_info, custom_headers:nil)
# Send request
promise = begin_create_async(scope, event_subscription_name, event_subscription_info, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::EventGrid::Mgmt::V2017_06_15_preview::Models::EventSubscription.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_async",
"(",
"scope",
",",
"event_subscription_name",
",",
"event_subscription_info",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_create_async",
"(",
"scope",
",",
"event_subscription_name",
",",
"event_subscription_info... | @param scope [String] The scope of the resource to which the event
subscription needs to be created. The scope can be a subscription, or a
resource group, or a top level resource belonging to a resource provider
namespace, or an EventGrid topic. For example, use
'/subscriptions/{subscriptionId}/' for a subscription,
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
resource group, and
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
for a resource, and
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
for an EventGrid topic.
@param event_subscription_name [String] Name of the event subscription to be
created. Event subscription names must be between 3 and 64 characters in
length and use alphanumeric letters only.
@param event_subscription_info [EventSubscription] Event subscription
properties containing the destination and filter information
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"scope",
"[",
"String",
"]",
"The",
"scope",
"of",
"the",
"resource",
"to",
"which",
"the",
"event",
"subscription",
"needs",
"to",
"be",
"created",
".",
"The",
"scope",
"can",
"be",
"a",
"subscription",
"or",
"a",
"resource",
"group",
"or",
"a... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_event_grid/lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb#L205-L221 | train | Creates an event subscription in the specified subscription. | [
30522,
13366,
3443,
1035,
2004,
6038,
2278,
1006,
9531,
1010,
2724,
1035,
15002,
1035,
2171,
1010,
2724,
1035,
15002,
1035,
18558,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,
4088,
1035,
3443,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
decidim/decidim | decidim-core/app/commands/decidim/invite_user_again.rb | Decidim.InviteUserAgain.call | def call
return broadcast(:invalid) unless user&.invited_to_sign_up?
user.invite!(user.invited_by, invitation_instructions: instructions)
broadcast(:ok)
end | ruby | def call
return broadcast(:invalid) unless user&.invited_to_sign_up?
user.invite!(user.invited_by, invitation_instructions: instructions)
broadcast(:ok)
end | [
"def",
"call",
"return",
"broadcast",
"(",
":invalid",
")",
"unless",
"user",
"&.",
"invited_to_sign_up?",
"user",
".",
"invite!",
"(",
"user",
".",
"invited_by",
",",
"invitation_instructions",
":",
"instructions",
")",
"broadcast",
"(",
":ok",
")",
"end"
] | Public: Initializes the command.
form - A form object with the params. | [
"Public",
":",
"Initializes",
"the",
"command",
"."
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/app/commands/decidim/invite_user_again.rb#L14-L20 | train | invites the user to sign up and returns the result of the call | [
30522,
13366,
2655,
2709,
3743,
1006,
1024,
19528,
1007,
4983,
5310,
1004,
1012,
4778,
1035,
2000,
1035,
3696,
1035,
2039,
1029,
5310,
1012,
13260,
999,
1006,
5310,
1012,
4778,
1035,
2011,
1010,
8468,
1035,
8128,
1024,
8128,
1007,
3743,
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... |
square/connect-ruby-sdk | lib/square_connect/api/labor_api.rb | SquareConnect.LaborApi.search_shifts | def search_shifts(body, opts = {})
data, _status_code, _headers = search_shifts_with_http_info(body, opts)
return data
end | ruby | def search_shifts(body, opts = {})
data, _status_code, _headers = search_shifts_with_http_info(body, opts)
return data
end | [
"def",
"search_shifts",
"(",
"body",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"search_shifts_with_http_info",
"(",
"body",
",",
"opts",
")",
"return",
"data",
"end"
] | SearchShifts
Returns a paginated list of `Shift` records for a business. The list to be returned can be filtered by: - Location IDs **and** - employee IDs **and** - shift status (`OPEN`, `CLOSED`) **and** - shift start **and** - shift end **and** - work day details The list can be sorted by: - `start_at` - `end_at` - `created_at` - `updated_at`
@param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
@param [Hash] opts the optional parameters
@return [SearchShiftsResponse] | [
"SearchShifts",
"Returns",
"a",
"paginated",
"list",
"of",
"Shift",
"records",
"for",
"a",
"business",
".",
"The",
"list",
"to",
"be",
"returned",
"can",
"be",
"filtered",
"by",
":",
"-",
"Location",
"IDs",
"**",
"and",
"**",
"-",
"employee",
"IDs",
"**"... | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/labor_api.rb#L587-L590 | train | Search Shifts Returns a list of Shifts | [
30522,
13366,
3945,
1035,
12363,
1006,
2303,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
3945,
1035,
12363,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2303,
1010,
23569,
2015... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2015-08-01/generated/azure_mgmt_web/app_service_certificate_orders.rb | Azure::Web::Mgmt::V2015_08_01.AppServiceCertificateOrders.renew | def renew(resource_group_name, certificate_order_name, renew_certificate_order_request, custom_headers:nil)
response = renew_async(resource_group_name, certificate_order_name, renew_certificate_order_request, custom_headers:custom_headers).value!
nil
end | ruby | def renew(resource_group_name, certificate_order_name, renew_certificate_order_request, custom_headers:nil)
response = renew_async(resource_group_name, certificate_order_name, renew_certificate_order_request, custom_headers:custom_headers).value!
nil
end | [
"def",
"renew",
"(",
"resource_group_name",
",",
"certificate_order_name",
",",
"renew_certificate_order_request",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"renew_async",
"(",
"resource_group_name",
",",
"certificate_order_name",
",",
"renew_certificate_orde... | Renew an existing certificate order.
Renew an existing certificate 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 renew_certificate_order_request [RenewCertificateOrderRequest] Renew
parameters
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Renew",
"an",
"existing",
"certificate",
"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#L1299-L1302 | train | Renews a certificate order. | [
30522,
13366,
20687,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8196,
1035,
2344,
1035,
2171,
1010,
20687,
1035,
8196,
1035,
2344,
1035,
5227,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
20687,
1035,
2004,
6038,
2278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | fastlane/lib/fastlane/fast_file.rb | Fastlane.FastFile.is_platform_block? | def is_platform_block?(key)
UI.crash!('No key given') unless key
return false if self.runner.lanes.fetch(nil, {}).fetch(key.to_sym, nil)
return true if self.runner.lanes[key.to_sym].kind_of?(Hash)
if key.to_sym == :update
# The user ran `fastlane update`, instead of `fastlane update_fastlane`
# We're gonna be nice and understand what the user is trying to do
require 'fastlane/one_off'
Fastlane::OneOff.run(action: "update_fastlane", parameters: {})
else
UI.user_error!("Could not find '#{key}'. Available lanes: #{self.runner.available_lanes.join(', ')}")
end
end | ruby | def is_platform_block?(key)
UI.crash!('No key given') unless key
return false if self.runner.lanes.fetch(nil, {}).fetch(key.to_sym, nil)
return true if self.runner.lanes[key.to_sym].kind_of?(Hash)
if key.to_sym == :update
# The user ran `fastlane update`, instead of `fastlane update_fastlane`
# We're gonna be nice and understand what the user is trying to do
require 'fastlane/one_off'
Fastlane::OneOff.run(action: "update_fastlane", parameters: {})
else
UI.user_error!("Could not find '#{key}'. Available lanes: #{self.runner.available_lanes.join(', ')}")
end
end | [
"def",
"is_platform_block?",
"(",
"key",
")",
"UI",
".",
"crash!",
"(",
"'No key given'",
")",
"unless",
"key",
"return",
"false",
"if",
"self",
".",
"runner",
".",
"lanes",
".",
"fetch",
"(",
"nil",
",",
"{",
"}",
")",
".",
"fetch",
"(",
"key",
".",... | @!group Other things
Is the given key a platform block or a lane? | [
"@!group",
"Other",
"things"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/fastlane/lib/fastlane/fast_file.rb#L162-L176 | train | Returns true if the given key is a platform block. | [
30522,
13366,
2003,
1035,
4132,
1035,
3796,
1029,
1006,
3145,
1007,
21318,
1012,
5823,
999,
1006,
1005,
2053,
3145,
2445,
1005,
1007,
4983,
3145,
2709,
6270,
2065,
2969,
1012,
5479,
1012,
10914,
1012,
18584,
1006,
9152,
2140,
1010,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
decidim/decidim | decidim-core/app/commands/decidim/reject_user_group_join_request.rb | Decidim.RejectUserGroupJoinRequest.call | def call
return broadcast(:invalid) unless membership
return broadcast(:invalid) if membership.role.to_s != "requested"
transaction do
send_notification
reject_membership
end
broadcast(:ok, @user_group)
end | ruby | def call
return broadcast(:invalid) unless membership
return broadcast(:invalid) if membership.role.to_s != "requested"
transaction do
send_notification
reject_membership
end
broadcast(:ok, @user_group)
end | [
"def",
"call",
"return",
"broadcast",
"(",
":invalid",
")",
"unless",
"membership",
"return",
"broadcast",
"(",
":invalid",
")",
"if",
"membership",
".",
"role",
".",
"to_s",
"!=",
"\"requested\"",
"transaction",
"do",
"send_notification",
"reject_membership",
"en... | Public: Initializes the command.
membership - the UserGroupMembership to be accepted.
Executes the command. Broadcasts these events:
- :ok when everything is valid.
- :invalid if we couldn't proceed.
Returns nothing. | [
"Public",
":",
"Initializes",
"the",
"command",
"."
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/app/commands/decidim/reject_user_group_join_request.rb#L20-L30 | train | Call the user group and the user group. | [
30522,
13366,
2655,
2709,
3743,
1006,
1024,
19528,
1007,
4983,
5779,
2709,
3743,
1006,
1024,
19528,
1007,
2065,
5779,
1012,
2535,
1012,
2000,
1035,
1055,
999,
1027,
1000,
7303,
1000,
12598,
2079,
4604,
1035,
26828,
15454,
1035,
5779,
2203,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb | Azure::Compute::Mgmt::V2016_04_30_preview.VirtualMachineScaleSets.begin_restart_with_http_info | def begin_restart_with_http_info(resource_group_name, vm_scale_set_name, vm_instance_ids:nil, custom_headers:nil)
begin_restart_async(resource_group_name, vm_scale_set_name, vm_instance_ids:vm_instance_ids, custom_headers:custom_headers).value!
end | ruby | def begin_restart_with_http_info(resource_group_name, vm_scale_set_name, vm_instance_ids:nil, custom_headers:nil)
begin_restart_async(resource_group_name, vm_scale_set_name, vm_instance_ids:vm_instance_ids, custom_headers:custom_headers).value!
end | [
"def",
"begin_restart_with_http_info",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"vm_instance_ids",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"begin_restart_async",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"vm_instance_ids",
":... | Restarts one or more virtual machines in a VM scale set.
@param resource_group_name [String] The name of the resource group.
@param vm_scale_set_name [String] The name of the VM scale set.
@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 [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Restarts",
"one",
"or",
"more",
"virtual",
"machines",
"in",
"a",
"VM",
"scale",
"set",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb#L1499-L1501 | train | Restarts a virtual machine in a VM scale set. | [
30522,
13366,
4088,
1035,
23818,
1035,
2007,
1035,
8299,
1035,
18558,
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,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/voice/network.rb | Discordrb::Voice.VoiceWS.send_init | def send_init(server_id, bot_user_id, session_id, token)
@client.send({
op: 0,
d: {
server_id: server_id,
user_id: bot_user_id,
session_id: session_id,
token: token
}
}.to_json)
end | ruby | def send_init(server_id, bot_user_id, session_id, token)
@client.send({
op: 0,
d: {
server_id: server_id,
user_id: bot_user_id,
session_id: session_id,
token: token
}
}.to_json)
end | [
"def",
"send_init",
"(",
"server_id",
",",
"bot_user_id",
",",
"session_id",
",",
"token",
")",
"@client",
".",
"send",
"(",
"{",
"op",
":",
"0",
",",
"d",
":",
"{",
"server_id",
":",
"server_id",
",",
"user_id",
":",
"bot_user_id",
",",
"session_id",
... | Makes a new voice websocket client, but doesn't connect it (see {#connect} for that)
@param channel [Channel] The voice channel to connect to
@param bot [Bot] The regular bot to which this vWS is bound
@param token [String] The authentication token which is also used for REST requests
@param session [String] The voice session ID Discord sends over the regular websocket
@param endpoint [String] The endpoint URL to connect to
Send a connection init packet (op 0)
@param server_id [Integer] The ID of the server to connect to
@param bot_user_id [Integer] The ID of the bot that is connecting
@param session_id [String] The voice session ID
@param token [String] The Discord authentication token | [
"Makes",
"a",
"new",
"voice",
"websocket",
"client",
"but",
"doesn",
"t",
"connect",
"it",
"(",
"see",
"{",
"#connect",
"}",
"for",
"that",
")"
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/voice/network.rb#L148-L158 | train | Send init message to the server | [
30522,
13366,
4604,
1035,
1999,
4183,
1006,
8241,
1035,
8909,
1010,
28516,
1035,
5310,
1035,
8909,
1010,
5219,
1035,
8909,
1010,
19204,
1007,
1030,
7396,
1012,
4604,
1006,
1063,
6728,
1024,
1014,
1010,
1040,
1024,
1063,
8241,
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... |
tongueroo/jets | lib/jets/commands/url.rb | Jets::Commands.Url.stack_status | def stack_status
resp = cfn.describe_stacks(stack_name: @parent_stack_name)
status = resp.stacks[0].stack_status
[resp, status]
end | ruby | def stack_status
resp = cfn.describe_stacks(stack_name: @parent_stack_name)
status = resp.stacks[0].stack_status
[resp, status]
end | [
"def",
"stack_status",
"resp",
"=",
"cfn",
".",
"describe_stacks",
"(",
"stack_name",
":",
"@parent_stack_name",
")",
"status",
"=",
"resp",
".",
"stacks",
"[",
"0",
"]",
".",
"stack_status",
"[",
"resp",
",",
"status",
"]",
"end"
] | All CloudFormation states listed here:
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-describing-stacks.html | [
"All",
"CloudFormation",
"states",
"listed",
"here",
":",
"http",
":",
"//",
"docs",
".",
"aws",
".",
"amazon",
".",
"com",
"/",
"AWSCloudFormation",
"/",
"latest",
"/",
"UserGuide",
"/",
"using",
"-",
"cfn",
"-",
"describing",
"-",
"stacks",
".",
"html"... | 46943a519224067e58aa3e2d5656e3ca083150f9 | https://github.com/tongueroo/jets/blob/46943a519224067e58aa3e2d5656e3ca083150f9/lib/jets/commands/url.rb#L61-L65 | train | Returns the stack status and the stack_name of the parent stack. | [
30522,
13366,
9991,
1035,
3570,
24501,
2361,
1027,
12935,
2078,
1012,
6235,
1035,
20829,
1006,
9991,
1035,
2171,
1024,
1030,
6687,
1035,
9991,
1035,
2171,
1007,
3570,
1027,
24501,
2361,
30524,
3570,
1031,
24501,
2361,
1010,
3570,
1033,
2203... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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_container_logs_deployed_on_node | def get_container_logs_deployed_on_node(node_name, application_id, service_manifest_name, code_package_name, tail:nil, previous:false, timeout:60, custom_headers:nil)
response = get_container_logs_deployed_on_node_async(node_name, application_id, service_manifest_name, code_package_name, tail:tail, previous:previous, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_container_logs_deployed_on_node(node_name, application_id, service_manifest_name, code_package_name, tail:nil, previous:false, timeout:60, custom_headers:nil)
response = get_container_logs_deployed_on_node_async(node_name, application_id, service_manifest_name, code_package_name, tail:tail, previous:previous, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_container_logs_deployed_on_node",
"(",
"node_name",
",",
"application_id",
",",
"service_manifest_name",
",",
"code_package_name",
",",
"tail",
":",
"nil",
",",
"previous",
":",
"false",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")"... | Gets the container logs for container deployed on a Service Fabric node.
Gets the container logs for container deployed on a Service Fabric node for
the given code package.
@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 service_manifest_name [String] The name of a service manifest
registered as part of an application type in a Service Fabric cluster.
@param code_package_name [String] The name of code package specified in
service manifest registered as part of an application type in a Service
Fabric cluster.
@param tail [String] Number of lines to show from the end of the logs.
Default is 100. 'all' to show the complete logs.
@param previous [Boolean] Specifies whether to get container logs from
exited/dead containers of the code package instance.
@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 [ContainerLogs] operation results. | [
"Gets",
"the",
"container",
"logs",
"for",
"container",
"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#L17396-L17399 | train | Gets the logs deployed on a node. | [
30522,
13366,
2131,
1035,
11661,
1035,
15664,
1035,
7333,
1035,
2006,
1035,
13045,
1006,
13045,
1035,
2171,
1010,
4646,
1035,
8909,
1010,
2326,
1035,
19676,
1035,
2171,
1010,
3642,
1035,
7427,
1035,
2171,
1010,
5725,
1024,
9152,
2140,
1010,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb | Aws::AutoScaling.AutoScalingGroup.lifecycle_hooks | def lifecycle_hooks(options = {})
batches = Enumerator.new do |y|
batch = []
options = options.merge(auto_scaling_group_name: @name)
resp = @client.describe_lifecycle_hooks(options)
resp.data.lifecycle_hooks.each do |l|
batch << LifecycleHook.new(
group_name: l.auto_scaling_group_name,
name: l.lifecycle_hook_name,
data: l,
client: @client
)
end
y.yield(batch)
end
LifecycleHook::Collection.new(batches)
end | ruby | def lifecycle_hooks(options = {})
batches = Enumerator.new do |y|
batch = []
options = options.merge(auto_scaling_group_name: @name)
resp = @client.describe_lifecycle_hooks(options)
resp.data.lifecycle_hooks.each do |l|
batch << LifecycleHook.new(
group_name: l.auto_scaling_group_name,
name: l.lifecycle_hook_name,
data: l,
client: @client
)
end
y.yield(batch)
end
LifecycleHook::Collection.new(batches)
end | [
"def",
"lifecycle_hooks",
"(",
"options",
"=",
"{",
"}",
")",
"batches",
"=",
"Enumerator",
".",
"new",
"do",
"|",
"y",
"|",
"batch",
"=",
"[",
"]",
"options",
"=",
"options",
".",
"merge",
"(",
"auto_scaling_group_name",
":",
"@name",
")",
"resp",
"="... | @example Request syntax with placeholder values
lifecycle_hooks = auto_scaling_group.lifecycle_hooks({
lifecycle_hook_names: ["AsciiStringMaxLen255"],
})
@param [Hash] options ({})
@option options [Array<String>] :lifecycle_hook_names
The names of one or more lifecycle hooks. If you omit this parameter,
all lifecycle hooks are described.
@return [LifecycleHook::Collection] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/auto_scaling_group.rb#L1012-L1028 | train | Returns an Enumerator of lifecycle hooks | [
30522,
13366,
2166,
23490,
1035,
18008,
1006,
7047,
1027,
1063,
1065,
1007,
14108,
2229,
1027,
4372,
17897,
16259,
1012,
2047,
2079,
1064,
1061,
1064,
14108,
1027,
1031,
1033,
7047,
1027,
7047,
1012,
13590,
1006,
8285,
1035,
25169,
1035,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/helpers.rb | Haml.Helpers.with_haml_buffer | def with_haml_buffer(buffer)
@haml_buffer, old_buffer = buffer, @haml_buffer
old_buffer.active, old_was_active = false, old_buffer.active? if old_buffer
@haml_buffer.active, was_active = true, @haml_buffer.active?
yield
ensure
@haml_buffer.active = was_active
old_buffer.active = old_was_active if old_buffer
@haml_buffer = old_buffer
end | ruby | def with_haml_buffer(buffer)
@haml_buffer, old_buffer = buffer, @haml_buffer
old_buffer.active, old_was_active = false, old_buffer.active? if old_buffer
@haml_buffer.active, was_active = true, @haml_buffer.active?
yield
ensure
@haml_buffer.active = was_active
old_buffer.active = old_was_active if old_buffer
@haml_buffer = old_buffer
end | [
"def",
"with_haml_buffer",
"(",
"buffer",
")",
"@haml_buffer",
",",
"old_buffer",
"=",
"buffer",
",",
"@haml_buffer",
"old_buffer",
".",
"active",
",",
"old_was_active",
"=",
"false",
",",
"old_buffer",
".",
"active?",
"if",
"old_buffer",
"@haml_buffer",
".",
"a... | Runs a block of code with the given buffer as the currently active buffer.
@param buffer [Haml::Buffer] The Haml buffer to use temporarily
@yield A block in which the given buffer should be used | [
"Runs",
"a",
"block",
"of",
"code",
"with",
"the",
"given",
"buffer",
"as",
"the",
"currently",
"active",
"buffer",
"."
] | 9aa0fbe4a91b999978927be569d2ad0cd39076f1 | https://github.com/haml/haml/blob/9aa0fbe4a91b999978927be569d2ad0cd39076f1/lib/haml/helpers.rb#L659-L668 | train | Yields the given block with the given Haml buffer. | [
30522,
13366,
2007,
1035,
10654,
2140,
1035,
17698,
1006,
17698,
1007,
1030,
10654,
2140,
1035,
17698,
1010,
2214,
1035,
17698,
1027,
17698,
1010,
1030,
10654,
2140,
1035,
17698,
2214,
1035,
17698,
1012,
3161,
1010,
2214,
1035,
2001,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_scheduler/lib/2016-03-01/generated/azure_mgmt_scheduler/job_collections.rb | Azure::Scheduler::Mgmt::V2016_03_01.JobCollections.patch | def patch(resource_group_name, job_collection_name, job_collection, custom_headers:nil)
response = patch_async(resource_group_name, job_collection_name, job_collection, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def patch(resource_group_name, job_collection_name, job_collection, custom_headers:nil)
response = patch_async(resource_group_name, job_collection_name, job_collection, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"patch",
"(",
"resource_group_name",
",",
"job_collection_name",
",",
"job_collection",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"patch_async",
"(",
"resource_group_name",
",",
"job_collection_name",
",",
"job_collection",
",",
"custom_headers",
... | Patches an existing job collection.
@param resource_group_name [String] The resource group name.
@param job_collection_name [String] The job collection name.
@param job_collection [JobCollectionDefinition] The job collection
definition.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [JobCollectionDefinition] operation results. | [
"Patches",
"an",
"existing",
"job",
"collection",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_scheduler/lib/2016-03-01/generated/azure_mgmt_scheduler/job_collections.rb#L416-L419 | train | Patch a job collection. | [
30522,
13366,
8983,
1006,
30524,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
20346,
2015,
1007,
1012,
3643,
999,
3433,
1012,
2303,
4983,
3433,
1012,
9152,
2140,
1029,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/cache.rb | Discordrb.Cache.ensure_server | def ensure_server(data)
if @servers.include?(data['id'].to_i)
@servers[data['id'].to_i]
else
@servers[data['id'].to_i] = Server.new(data, self)
end
end | ruby | def ensure_server(data)
if @servers.include?(data['id'].to_i)
@servers[data['id'].to_i]
else
@servers[data['id'].to_i] = Server.new(data, self)
end
end | [
"def",
"ensure_server",
"(",
"data",
")",
"if",
"@servers",
".",
"include?",
"(",
"data",
"[",
"'id'",
"]",
".",
"to_i",
")",
"@servers",
"[",
"data",
"[",
"'id'",
"]",
".",
"to_i",
"]",
"else",
"@servers",
"[",
"data",
"[",
"'id'",
"]",
".",
"to_i... | Ensures a given server object is cached and if not, cache it from the given data hash.
@param data [Hash] A data hash representing a server.
@return [Server] the server represented by the data hash. | [
"Ensures",
"a",
"given",
"server",
"object",
"is",
"cached",
"and",
"if",
"not",
"cache",
"it",
"from",
"the",
"given",
"data",
"hash",
"."
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/cache.rb#L160-L166 | train | Ensure a server exists | [
30522,
13366,
5676,
1035,
8241,
1006,
2951,
1007,
2065,
1030,
14903,
1012,
2421,
1029,
1006,
2951,
1031,
1005,
8909,
1005,
1033,
1012,
2000,
1035,
1045,
1007,
1030,
14903,
1031,
2951,
1031,
1005,
8909,
1005,
1033,
1012,
2000,
1035,
1045,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.update_composite_entity_with_http_info | def update_composite_entity_with_http_info(app_id, version_id, c_entity_id, composite_model_update_object, custom_headers:nil)
update_composite_entity_async(app_id, version_id, c_entity_id, composite_model_update_object, custom_headers:custom_headers).value!
end | ruby | def update_composite_entity_with_http_info(app_id, version_id, c_entity_id, composite_model_update_object, custom_headers:nil)
update_composite_entity_async(app_id, version_id, c_entity_id, composite_model_update_object, custom_headers:custom_headers).value!
end | [
"def",
"update_composite_entity_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"c_entity_id",
",",
"composite_model_update_object",
",",
"custom_headers",
":",
"nil",
")",
"update_composite_entity_async",
"(",
"app_id",
",",
"version_id",
",",
"c_entity_id",
",",... | Updates a composite entity in a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param c_entity_id The composite entity extractor ID.
@param composite_model_update_object [CompositeEntityModel] A model object
containing the new entity extractor name and children.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Updates",
"a",
"composite",
"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#L2848-L2850 | train | Updates a composite entity. | [
30522,
13366,
10651,
1035,
12490,
1035,
9178,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
1039,
1035,
9178,
1035,
8909,
1010,
12490,
1035,
2944,
1035,
10651,
1035,
4874,
1010,
7661,
1035,
2034... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/2016-12-01/generated/azure_mgmt_network/virtual_network_gateways.rb | Azure::Network::Mgmt::V2016_12_01.VirtualNetworkGateways.begin_get_learned_routes | def begin_get_learned_routes(resource_group_name, virtual_network_gateway_name, custom_headers:nil)
response = begin_get_learned_routes_async(resource_group_name, virtual_network_gateway_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_get_learned_routes(resource_group_name, virtual_network_gateway_name, custom_headers:nil)
response = begin_get_learned_routes_async(resource_group_name, virtual_network_gateway_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_get_learned_routes",
"(",
"resource_group_name",
",",
"virtual_network_gateway_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_get_learned_routes_async",
"(",
"resource_group_name",
",",
"virtual_network_gateway_name",
",",
"custom_headers",... | This operation retrieves a list of routes the virtual network gateway has
learned, including routes learned from BGP peers.
@param resource_group_name [String] The name of the resource group.
@param virtual_network_gateway_name [String] The name of the virtual network
gateway.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [GatewayRouteListResult] operation results. | [
"This",
"operation",
"retrieves",
"a",
"list",
"of",
"routes",
"the",
"virtual",
"network",
"gateway",
"has",
"learned",
"including",
"routes",
"learned",
"from",
"BGP",
"peers",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2016-12-01/generated/azure_mgmt_network/virtual_network_gateways.rb#L1018-L1021 | train | Gets the number of routes learned by a virtual network gateway. | [
30522,
13366,
4088,
1035,
2131,
1035,
4342,
1035,
5847,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7484,
1035,
2897,
1035,
11909,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
2131,
1035,
4342,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jekyll/jekyll | lib/jekyll/reader.rb | Jekyll.Reader.read_directories | def read_directories(dir = "")
base = site.in_source_dir(dir)
return unless File.directory?(base)
dot_dirs = []
dot_pages = []
dot_static_files = []
dot = Dir.chdir(base) { filter_entries(Dir.entries("."), base) }
dot.each do |entry|
file_path = @site.in_source_dir(base, entry)
if File.directory?(file_path)
dot_dirs << entry
elsif Utils.has_yaml_header?(file_path)
dot_pages << entry
else
dot_static_files << entry
end
end
retrieve_posts(dir)
retrieve_dirs(base, dir, dot_dirs)
retrieve_pages(dir, dot_pages)
retrieve_static_files(dir, dot_static_files)
end | ruby | def read_directories(dir = "")
base = site.in_source_dir(dir)
return unless File.directory?(base)
dot_dirs = []
dot_pages = []
dot_static_files = []
dot = Dir.chdir(base) { filter_entries(Dir.entries("."), base) }
dot.each do |entry|
file_path = @site.in_source_dir(base, entry)
if File.directory?(file_path)
dot_dirs << entry
elsif Utils.has_yaml_header?(file_path)
dot_pages << entry
else
dot_static_files << entry
end
end
retrieve_posts(dir)
retrieve_dirs(base, dir, dot_dirs)
retrieve_pages(dir, dot_pages)
retrieve_static_files(dir, dot_static_files)
end | [
"def",
"read_directories",
"(",
"dir",
"=",
"\"\"",
")",
"base",
"=",
"site",
".",
"in_source_dir",
"(",
"dir",
")",
"return",
"unless",
"File",
".",
"directory?",
"(",
"base",
")",
"dot_dirs",
"=",
"[",
"]",
"dot_pages",
"=",
"[",
"]",
"dot_static_files... | Recursively traverse directories to find pages and static files
that will become part of the site according to the rules in
filter_entries.
dir - The String relative path of the directory to read. Default: ''.
Returns nothing. | [
"Recursively",
"traverse",
"directories",
"to",
"find",
"pages",
"and",
"static",
"files",
"that",
"will",
"become",
"part",
"of",
"the",
"site",
"according",
"to",
"the",
"rules",
"in",
"filter_entries",
"."
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/reader.rb#L38-L63 | train | Read all the directories in the given directory. | [
30522,
13366,
3191,
1035,
2472,
3111,
1006,
16101,
1027,
1000,
1000,
1007,
2918,
1027,
2609,
1012,
1999,
1035,
3120,
1035,
16101,
1006,
16101,
1007,
2709,
4983,
5371,
1012,
14176,
1029,
1006,
2918,
1007,
11089,
1035,
16101,
2015,
1027,
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... |
ankane/pgsync | lib/pgsync/table_sync.rb | PgSync.TableSync.rule_match? | def rule_match?(table, column, rule)
regex = Regexp.new('\A' + Regexp.escape(rule).gsub('\*','[^\.]*') + '\z')
regex.match(column) || regex.match("#{table.split(".", 2)[-1]}.#{column}") || regex.match("#{table}.#{column}")
end | ruby | def rule_match?(table, column, rule)
regex = Regexp.new('\A' + Regexp.escape(rule).gsub('\*','[^\.]*') + '\z')
regex.match(column) || regex.match("#{table.split(".", 2)[-1]}.#{column}") || regex.match("#{table}.#{column}")
end | [
"def",
"rule_match?",
"(",
"table",
",",
"column",
",",
"rule",
")",
"regex",
"=",
"Regexp",
".",
"new",
"(",
"'\\A'",
"+",
"Regexp",
".",
"escape",
"(",
"rule",
")",
".",
"gsub",
"(",
"'\\*'",
",",
"'[^\\.]*'",
")",
"+",
"'\\z'",
")",
"regex",
"."... | TODO better performance | [
"TODO",
"better",
"performance"
] | 2aa4741538ca09070efe86de6dd1281e13a1b5c5 | https://github.com/ankane/pgsync/blob/2aa4741538ca09070efe86de6dd1281e13a1b5c5/lib/pgsync/table_sync.rb#L162-L165 | train | Returns true if the rule matches the column | [
30522,
13366,
3627,
1035,
2674,
1029,
1006,
2795,
1010,
5930,
1010,
3627,
1007,
19723,
10288,
1027,
19723,
10288,
2361,
1012,
2047,
1006,
1005,
1032,
1037,
1005,
1009,
30524,
1032,
1062,
1005,
1007,
19723,
10288,
1012,
2674,
1006,
5930,
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... |
castwide/solargraph | lib/solargraph/api_map.rb | Solargraph.ApiMap.qualify | def qualify namespace, context = ''
# @todo The return for self might work better elsewhere
return nil if namespace.nil?
return qualify(context) if namespace == 'self'
cached = cache.get_qualified_namespace(namespace, context)
return cached.clone unless cached.nil?
result = if namespace.start_with?('::')
inner_qualify(namespace[2..-1], '', [])
else
inner_qualify(namespace, context, [])
end
cache.set_qualified_namespace(namespace, context, result)
result
end | ruby | def qualify namespace, context = ''
# @todo The return for self might work better elsewhere
return nil if namespace.nil?
return qualify(context) if namespace == 'self'
cached = cache.get_qualified_namespace(namespace, context)
return cached.clone unless cached.nil?
result = if namespace.start_with?('::')
inner_qualify(namespace[2..-1], '', [])
else
inner_qualify(namespace, context, [])
end
cache.set_qualified_namespace(namespace, context, result)
result
end | [
"def",
"qualify",
"namespace",
",",
"context",
"=",
"''",
"# @todo The return for self might work better elsewhere",
"return",
"nil",
"if",
"namespace",
".",
"nil?",
"return",
"qualify",
"(",
"context",
")",
"if",
"namespace",
"==",
"'self'",
"cached",
"=",
"cache",... | Get a fully qualified namespace name. This method will start the search
in the specified context until it finds a match for the name.
@param namespace [String, nil] The namespace to match
@param context [String] The context to search
@return [String] | [
"Get",
"a",
"fully",
"qualified",
"namespace",
"name",
".",
"This",
"method",
"will",
"start",
"the",
"search",
"in",
"the",
"specified",
"context",
"until",
"it",
"finds",
"a",
"match",
"for",
"the",
"name",
"."
] | 47badb5d151aca775ccbe6c470236089eae7839d | https://github.com/castwide/solargraph/blob/47badb5d151aca775ccbe6c470236089eae7839d/lib/solargraph/api_map.rb#L220-L233 | train | Returns the qualified namespace for the given context. | [
30522,
13366,
7515,
3415,
15327,
1010,
6123,
1027,
1005,
1005,
1001,
1030,
28681,
2080,
1996,
2709,
2005,
2969,
2453,
2147,
2488,
6974,
2709,
9152,
2140,
2065,
3415,
15327,
1012,
9152,
2140,
1029,
2709,
7515,
1006,
6123,
1007,
2065,
3415,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activerecord/lib/active_record/relation/finder_methods.rb | ActiveRecord.FinderMethods.raise_record_not_found_exception! | def raise_record_not_found_exception!(ids = nil, result_size = nil, expected_size = nil, key = primary_key, not_found_ids = nil) # :nodoc:
conditions = arel.where_sql(@klass)
conditions = " [#{conditions}]" if conditions
name = @klass.name
if ids.nil?
error = +"Couldn't find #{name}"
error << " with#{conditions}" if conditions
raise RecordNotFound.new(error, name, key)
elsif Array(ids).size == 1
error = "Couldn't find #{name} with '#{key}'=#{ids}#{conditions}"
raise RecordNotFound.new(error, name, key, ids)
else
error = +"Couldn't find all #{name.pluralize} with '#{key}': "
error << "(#{ids.join(", ")})#{conditions} (found #{result_size} results, but was looking for #{expected_size})."
error << " Couldn't find #{name.pluralize(not_found_ids.size)} with #{key.to_s.pluralize(not_found_ids.size)} #{not_found_ids.join(', ')}." if not_found_ids
raise RecordNotFound.new(error, name, key, ids)
end
end | ruby | def raise_record_not_found_exception!(ids = nil, result_size = nil, expected_size = nil, key = primary_key, not_found_ids = nil) # :nodoc:
conditions = arel.where_sql(@klass)
conditions = " [#{conditions}]" if conditions
name = @klass.name
if ids.nil?
error = +"Couldn't find #{name}"
error << " with#{conditions}" if conditions
raise RecordNotFound.new(error, name, key)
elsif Array(ids).size == 1
error = "Couldn't find #{name} with '#{key}'=#{ids}#{conditions}"
raise RecordNotFound.new(error, name, key, ids)
else
error = +"Couldn't find all #{name.pluralize} with '#{key}': "
error << "(#{ids.join(", ")})#{conditions} (found #{result_size} results, but was looking for #{expected_size})."
error << " Couldn't find #{name.pluralize(not_found_ids.size)} with #{key.to_s.pluralize(not_found_ids.size)} #{not_found_ids.join(', ')}." if not_found_ids
raise RecordNotFound.new(error, name, key, ids)
end
end | [
"def",
"raise_record_not_found_exception!",
"(",
"ids",
"=",
"nil",
",",
"result_size",
"=",
"nil",
",",
"expected_size",
"=",
"nil",
",",
"key",
"=",
"primary_key",
",",
"not_found_ids",
"=",
"nil",
")",
"# :nodoc:",
"conditions",
"=",
"arel",
".",
"where_sql... | This method is called whenever no records are found with either a single
id or multiple ids and raises an ActiveRecord::RecordNotFound exception.
The error message is different depending on whether a single id or
multiple ids are provided. If multiple ids are provided, then the number
of results obtained should be provided in the +result_size+ argument and
the expected number of results should be provided in the +expected_size+
argument. | [
"This",
"method",
"is",
"called",
"whenever",
"no",
"records",
"are",
"found",
"with",
"either",
"a",
"single",
"id",
"or",
"multiple",
"ids",
"and",
"raises",
"an",
"ActiveRecord",
"::",
"RecordNotFound",
"exception",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activerecord/lib/active_record/relation/finder_methods.rb#L328-L346 | train | Raises a record not found exception. | [
30522,
13366,
5333,
1035,
2501,
1035,
2025,
1035,
2179,
1035,
6453,
999,
1006,
8909,
2015,
1027,
9152,
2140,
1010,
2765,
1035,
2946,
1027,
9152,
2140,
1010,
3517,
1035,
2946,
1027,
9152,
2140,
1010,
3145,
1027,
3078,
1035,
3145,
1010,
202... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-cloudwatch/lib/aws-sdk-cloudwatch/metric.rb | Aws::CloudWatch.Metric.alarms | def alarms(options = {})
batches = Enumerator.new do |y|
batch = []
options = options.merge(
namespace: @namespace,
metric_name: @name
)
resp = @client.describe_alarms_for_metric(options)
resp.data.metric_alarms.each do |m|
batch << Alarm.new(
name: m.alarm_name,
data: m,
client: @client
)
end
y.yield(batch)
end
Alarm::Collection.new(batches)
end | ruby | def alarms(options = {})
batches = Enumerator.new do |y|
batch = []
options = options.merge(
namespace: @namespace,
metric_name: @name
)
resp = @client.describe_alarms_for_metric(options)
resp.data.metric_alarms.each do |m|
batch << Alarm.new(
name: m.alarm_name,
data: m,
client: @client
)
end
y.yield(batch)
end
Alarm::Collection.new(batches)
end | [
"def",
"alarms",
"(",
"options",
"=",
"{",
"}",
")",
"batches",
"=",
"Enumerator",
".",
"new",
"do",
"|",
"y",
"|",
"batch",
"=",
"[",
"]",
"options",
"=",
"options",
".",
"merge",
"(",
"namespace",
":",
"@namespace",
",",
"metric_name",
":",
"@name"... | @!group Associations
@example Request syntax with placeholder values
alarms = metric.alarms({
statistic: "SampleCount", # accepts SampleCount, Average, Sum, Minimum, Maximum
extended_statistic: "ExtendedStatistic",
dimensions: [
{
name: "DimensionName", # required
value: "DimensionValue", # required
},
],
period: 1,
unit: "Seconds", # accepts Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None
})
@param [Hash] options ({})
@option options [String] :statistic
The statistic for the metric, other than percentiles. For percentile
statistics, use `ExtendedStatistics`.
@option options [String] :extended_statistic
The percentile statistic for the metric. Specify a value between p0.0
and p100.
@option options [Array<Types::Dimension>] :dimensions
The dimensions associated with the metric. If the metric has any
associated dimensions, you must specify them in order for the call to
succeed.
@option options [Integer] :period
The period, in seconds, over which the statistic is applied.
@option options [String] :unit
The unit for the metric.
@return [Alarm::Collection] | [
"@!group",
"Associations",
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-cloudwatch/lib/aws-sdk-cloudwatch/metric.rb#L624-L642 | train | Returns an array of Alarms for this metric | [
30522,
13366,
29034,
1006,
7047,
1027,
1063,
1065,
1007,
14108,
2229,
1027,
4372,
17897,
16259,
1012,
2047,
2079,
1064,
1061,
1064,
14108,
1027,
1031,
1033,
7047,
1027,
7047,
1012,
13590,
1006,
3415,
15327,
1024,
1030,
3415,
15327,
1010,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
gollum/gollum | lib/gollum/app.rb | Precious.App.commit_message | def commit_message
msg = (params[:message].nil? or params[:message].empty?) ? "[no message]" : params[:message]
commit_message = { :message => msg }
author_parameters = session['gollum.author']
commit_message.merge! author_parameters unless author_parameters.nil?
commit_message
end | ruby | def commit_message
msg = (params[:message].nil? or params[:message].empty?) ? "[no message]" : params[:message]
commit_message = { :message => msg }
author_parameters = session['gollum.author']
commit_message.merge! author_parameters unless author_parameters.nil?
commit_message
end | [
"def",
"commit_message",
"msg",
"=",
"(",
"params",
"[",
":message",
"]",
".",
"nil?",
"or",
"params",
"[",
":message",
"]",
".",
"empty?",
")",
"?",
"\"[no message]\"",
":",
"params",
"[",
":message",
"]",
"commit_message",
"=",
"{",
":message",
"=>",
"... | Options parameter to Gollum::Committer#initialize
:message - The String commit message.
:name - The String author full name.
:email - The String email address.
message is sourced from the incoming request parameters
author details are sourced from the session, to be populated by rack middleware ahead of us | [
"Options",
"parameter",
"to",
"Gollum",
"::",
"Committer#initialize",
":",
"message",
"-",
"The",
"String",
"commit",
"message",
".",
":",
"name",
"-",
"The",
"String",
"author",
"full",
"name",
".",
":",
"email",
"-",
"The",
"String",
"email",
"address",
... | f44367c31baac5c154888a9e09b2833fa62e1c61 | https://github.com/gollum/gollum/blob/f44367c31baac5c154888a9e09b2833fa62e1c61/lib/gollum/app.rb#L577-L583 | train | commit message | [
30522,
13366,
10797,
1035,
4471,
5796,
2290,
1027,
1006,
11498,
5244,
1031,
1024,
4471,
1033,
1012,
9152,
2140,
1029,
2030,
11498,
5244,
1031,
1024,
4471,
1033,
1012,
4064,
1029,
1007,
1029,
1000,
1031,
2053,
4471,
1033,
1000,
1024,
11498,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/sprockets | lib/sprockets/uri_tar.rb | Sprockets.URITar.expand | def expand
if absolute_path?
# Stored path was absolute, don't add root
scheme + path
else
if scheme.empty?
File.join(root, path)
else
# We always want to return an absolute uri,
# make sure the path starts with a slash.
scheme + File.join("/".freeze, root, path)
end
end
end | ruby | def expand
if absolute_path?
# Stored path was absolute, don't add root
scheme + path
else
if scheme.empty?
File.join(root, path)
else
# We always want to return an absolute uri,
# make sure the path starts with a slash.
scheme + File.join("/".freeze, root, path)
end
end
end | [
"def",
"expand",
"if",
"absolute_path?",
"# Stored path was absolute, don't add root",
"scheme",
"+",
"path",
"else",
"if",
"scheme",
".",
"empty?",
"File",
".",
"join",
"(",
"root",
",",
"path",
")",
"else",
"# We always want to return an absolute uri,",
"# make sure t... | Internal: Convert a "compressed" uri to an absolute path
If a uri is inside of the environment's root it will not
start with a slash for example:
file://this/is/a/relative/path
If a uri is outside the root, it will start with a slash:
file:///This/is/an/absolute/path
Returns String | [
"Internal",
":",
"Convert",
"a",
"compressed",
"uri",
"to",
"an",
"absolute",
"path"
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/uri_tar.rb#L60-L73 | train | Expand the path to a valid URI | [
30522,
13366,
7818,
2065,
7619,
1035,
4130,
1029,
1001,
8250,
4130,
2001,
7619,
1010,
2123,
1005,
1056,
5587,
7117,
5679,
1009,
4130,
2842,
2065,
5679,
1012,
4064,
1029,
5371,
1012,
3693,
1006,
7117,
1010,
4130,
1007,
2842,
1001,
2057,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Shopify/liquid | lib/liquid/standardfilters.rb | Liquid.StandardFilters.where | def where(input, property, target_value = nil)
ary = InputIterator.new(input)
if ary.empty?
[]
elsif ary.first.respond_to?(:[]) && target_value.nil?
begin
ary.select { |item| item[property] }
rescue TypeError
raise_property_error(property)
end
elsif ary.first.respond_to?(:[])
begin
ary.select { |item| item[property] == target_value }
rescue TypeError
raise_property_error(property)
end
end
end | ruby | def where(input, property, target_value = nil)
ary = InputIterator.new(input)
if ary.empty?
[]
elsif ary.first.respond_to?(:[]) && target_value.nil?
begin
ary.select { |item| item[property] }
rescue TypeError
raise_property_error(property)
end
elsif ary.first.respond_to?(:[])
begin
ary.select { |item| item[property] == target_value }
rescue TypeError
raise_property_error(property)
end
end
end | [
"def",
"where",
"(",
"input",
",",
"property",
",",
"target_value",
"=",
"nil",
")",
"ary",
"=",
"InputIterator",
".",
"new",
"(",
"input",
")",
"if",
"ary",
".",
"empty?",
"[",
"]",
"elsif",
"ary",
".",
"first",
".",
"respond_to?",
"(",
":[]",
")",
... | Filter the elements of an array to those with a certain property value.
By default the target is any truthy value. | [
"Filter",
"the",
"elements",
"of",
"an",
"array",
"to",
"those",
"with",
"a",
"certain",
"property",
"value",
".",
"By",
"default",
"the",
"target",
"is",
"any",
"truthy",
"value",
"."
] | b3b63a683f6daaea7e70f1602ee829abdf970ef3 | https://github.com/Shopify/liquid/blob/b3b63a683f6daaea7e70f1602ee829abdf970ef3/lib/liquid/standardfilters.rb#L174-L192 | train | Returns an array of objects that match the given property. | [
30522,
13366,
2073,
1006,
7953,
1010,
3200,
1010,
4539,
1035,
3643,
1027,
9152,
2140,
1007,
12098,
2100,
1027,
7953,
21646,
8844,
1012,
2047,
1006,
7953,
1007,
2065,
12098,
2100,
1012,
4064,
1029,
1031,
1033,
3449,
5332,
2546,
12098,
2100,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mikker/passwordless | app/controllers/passwordless/sessions_controller.rb | Passwordless.SessionsController.show | def show
# Make it "slow" on purpose to make brute-force attacks more of a hassle
BCrypt::Password.create(params[:token])
session = find_session
session.claim! if Passwordless.restrict_token_reuse
raise SessionTimedOutError if session.timed_out?
sign_in session.authenticatable
redirect_enabled = Passwordless.redirect_back_after_sign_in
destination = reset_passwordless_redirect_location!(User)
if redirect_enabled && destination
redirect_to destination
else
redirect_to main_app.root_path
end
rescue Session::TokenAlreadyClaimedError
flash[:error] = I18n.t(".passwordless.sessions.create.token_claimed")
redirect_to main_app.root_path
rescue SessionTimedOutError
flash[:error] = I18n.t(".passwordless.sessions.create.session_expired")
redirect_to main_app.root_path
end | ruby | def show
# Make it "slow" on purpose to make brute-force attacks more of a hassle
BCrypt::Password.create(params[:token])
session = find_session
session.claim! if Passwordless.restrict_token_reuse
raise SessionTimedOutError if session.timed_out?
sign_in session.authenticatable
redirect_enabled = Passwordless.redirect_back_after_sign_in
destination = reset_passwordless_redirect_location!(User)
if redirect_enabled && destination
redirect_to destination
else
redirect_to main_app.root_path
end
rescue Session::TokenAlreadyClaimedError
flash[:error] = I18n.t(".passwordless.sessions.create.token_claimed")
redirect_to main_app.root_path
rescue SessionTimedOutError
flash[:error] = I18n.t(".passwordless.sessions.create.session_expired")
redirect_to main_app.root_path
end | [
"def",
"show",
"# Make it \"slow\" on purpose to make brute-force attacks more of a hassle",
"BCrypt",
"::",
"Password",
".",
"create",
"(",
"params",
"[",
":token",
"]",
")",
"session",
"=",
"find_session",
"session",
".",
"claim!",
"if",
"Passwordless",
".",
"restrict... | get '/sign_in/:token'
Looks up session record by provided token. Signs in user if a match
is found. Redirects to either the user's original destination
or _root_path_
@see ControllerHelpers#sign_in
@see ControllerHelpers#save_passwordless_redirect_location! | [
"get",
"/",
"sign_in",
"/",
":",
"token",
"Looks",
"up",
"session",
"record",
"by",
"provided",
"token",
".",
"Signs",
"in",
"user",
"if",
"a",
"match",
"is",
"found",
".",
"Redirects",
"to",
"either",
"the",
"user",
"s",
"original",
"destination",
"or",... | 80d3e00c78114aed01f336514a236dfc17d0a91a | https://github.com/mikker/passwordless/blob/80d3e00c78114aed01f336514a236dfc17d0a91a/app/controllers/passwordless/sessions_controller.rb#L41-L67 | train | This method is used to show the password in the app. | [
30522,
13366,
2265,
1001,
2191,
2009,
1000,
4030,
1000,
2006,
3800,
2000,
2191,
26128,
1011,
2486,
4491,
2062,
1997,
1037,
2038,
25016,
4647,
2854,
13876,
1024,
1024,
20786,
1012,
3443,
1006,
11498,
5244,
1031,
1024,
19204,
1033,
1007,
5219... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
meew0/discordrb | lib/discordrb/gateway.rb | Discordrb.Gateway.handle_hello | def handle_hello(packet)
LOGGER.debug('Hello!')
# The heartbeat interval is given in ms, so divide it by 1000 to get seconds
interval = packet['d']['heartbeat_interval'].to_f / 1000.0
setup_heartbeats(interval)
LOGGER.debug("Trace: #{packet['d']['_trace']}")
LOGGER.debug("Session: #{@session.inspect}")
if @session&.should_resume?
# Make sure we're sending heartbeats again
@session.resume
# Send the actual resume packet to get the missing events
resume
else
identify
end
end | ruby | def handle_hello(packet)
LOGGER.debug('Hello!')
# The heartbeat interval is given in ms, so divide it by 1000 to get seconds
interval = packet['d']['heartbeat_interval'].to_f / 1000.0
setup_heartbeats(interval)
LOGGER.debug("Trace: #{packet['d']['_trace']}")
LOGGER.debug("Session: #{@session.inspect}")
if @session&.should_resume?
# Make sure we're sending heartbeats again
@session.resume
# Send the actual resume packet to get the missing events
resume
else
identify
end
end | [
"def",
"handle_hello",
"(",
"packet",
")",
"LOGGER",
".",
"debug",
"(",
"'Hello!'",
")",
"# The heartbeat interval is given in ms, so divide it by 1000 to get seconds",
"interval",
"=",
"packet",
"[",
"'d'",
"]",
"[",
"'heartbeat_interval'",
"]",
".",
"to_f",
"/",
"10... | Op 10 | [
"Op",
"10"
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/gateway.rb#L741-L760 | train | Handle a hello packet | [
30522,
13366,
5047,
1035,
7592,
1006,
14771,
1007,
8833,
4590,
1012,
2139,
8569,
2290,
1006,
1005,
7592,
999,
1005,
1007,
1001,
1996,
12251,
13483,
2003,
2445,
1999,
5796,
1010,
2061,
11443,
2009,
2011,
6694,
2000,
2131,
3823,
13483,
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 | management/azure_mgmt_locks/lib/2015-01-01/generated/azure_mgmt_locks/management_locks.rb | Azure::Locks::Mgmt::V2015_01_01.ManagementLocks.list_at_subscription_level_as_lazy | def list_at_subscription_level_as_lazy(filter:nil, custom_headers:nil)
response = list_at_subscription_level_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_level_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_at_subscription_level_as_lazy(filter:nil, custom_headers:nil)
response = list_at_subscription_level_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_level_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_at_subscription_level_as_lazy",
"(",
"filter",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_at_subscription_level_async",
"(",
"filter",
":",
"filter",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"unless",
... | Gets all the management locks of a subscription.
@param filter [String] The filter to apply on the operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ManagementLockListResult] which provide lazy access to pages of the
response. | [
"Gets",
"all",
"the",
"management",
"locks",
"of",
"a",
"subscription",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_locks/lib/2015-01-01/generated/azure_mgmt_locks/management_locks.rb#L1451-L1460 | train | Gets the list of all the available Central App Service Environment. | [
30522,
13366,
2862,
1035,
2012,
1035,
15002,
1035,
2504,
1035,
2004,
1035,
13971,
1006,
11307,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2012,
1035,
15002,
1035,
2504,
1035,
2004,
6038,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb | Azure::Web::Mgmt::V2018_02_01.AppServiceEnvironments.begin_delete_with_http_info | def begin_delete_with_http_info(resource_group_name, name, force_delete:nil, custom_headers:nil)
begin_delete_async(resource_group_name, name, force_delete:force_delete, custom_headers:custom_headers).value!
end | ruby | def begin_delete_with_http_info(resource_group_name, name, force_delete:nil, custom_headers:nil)
begin_delete_async(resource_group_name, name, force_delete:force_delete, custom_headers:custom_headers).value!
end | [
"def",
"begin_delete_with_http_info",
"(",
"resource_group_name",
",",
"name",
",",
"force_delete",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"begin_delete_async",
"(",
"resource_group_name",
",",
"name",
",",
"force_delete",
":force_delete",
",",
"custom_he... | Delete an App Service Environment.
Delete 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 force_delete [Boolean] Specify <code>true</code> to force the deletion
even if the App Service Environment contains resources. The default is
<code>false</code>.
@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",
"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#L4303-L4305 | train | Deletes a virtual network resource. | [
30522,
13366,
4088,
1035,
3972,
12870,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
2486,
1035,
3972,
12870,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
seejohnrun/ice_cube | lib/ice_cube/schedule.rb | IceCube.Schedule.previous_occurrence | def previous_occurrence(from)
from = TimeUtil.match_zone(from, start_time) or raise ArgumentError, "Time required, got #{from.inspect}"
return nil if from <= start_time
enumerate_occurrences(start_time, from - 1).to_a.last
end | ruby | def previous_occurrence(from)
from = TimeUtil.match_zone(from, start_time) or raise ArgumentError, "Time required, got #{from.inspect}"
return nil if from <= start_time
enumerate_occurrences(start_time, from - 1).to_a.last
end | [
"def",
"previous_occurrence",
"(",
"from",
")",
"from",
"=",
"TimeUtil",
".",
"match_zone",
"(",
"from",
",",
"start_time",
")",
"or",
"raise",
"ArgumentError",
",",
"\"Time required, got #{from.inspect}\"",
"return",
"nil",
"if",
"from",
"<=",
"start_time",
"enum... | The previous occurrence from a given time | [
"The",
"previous",
"occurrence",
"from",
"a",
"given",
"time"
] | fb6c657bdc4f87dfda2bf83f15c5f487b78ccabd | https://github.com/seejohnrun/ice_cube/blob/fb6c657bdc4f87dfda2bf83f15c5f487b78ccabd/lib/ice_cube/schedule.rb#L185-L189 | train | Returns the last occurrence of the previous occurrence. | [
30522,
13366,
3025,
1035,
14404,
1006,
2013,
1007,
2013,
1027,
2051,
21823,
2140,
1012,
2674,
1035,
4224,
1006,
2013,
1010,
2707,
1035,
2051,
1007,
2030,
5333,
6685,
2121,
29165,
1010,
1000,
2051,
3223,
1010,
2288,
1001,
1063,
2013,
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... |
tongueroo/jets | lib/jets/resource/api_gateway/base_path/role.rb | Jets::Resource::ApiGateway::BasePath.Role.rest_api_id | def rest_api_id
stack_name = Jets::Naming.parent_stack_name
return "RestApi" unless stack_exists?(stack_name)
stack = cfn.describe_stacks(stack_name: stack_name).stacks.first
api_gateway_stack_arn = lookup(stack[:outputs], "ApiGateway")
# resources = cfn.describe_stack_resources(stack_name: api_gateway_stack_arn).stack_resources
stack = cfn.describe_stacks(stack_name: api_gateway_stack_arn).stacks.first
rest_api_id = lookup(stack[:outputs], "RestApi")
end | ruby | def rest_api_id
stack_name = Jets::Naming.parent_stack_name
return "RestApi" unless stack_exists?(stack_name)
stack = cfn.describe_stacks(stack_name: stack_name).stacks.first
api_gateway_stack_arn = lookup(stack[:outputs], "ApiGateway")
# resources = cfn.describe_stack_resources(stack_name: api_gateway_stack_arn).stack_resources
stack = cfn.describe_stacks(stack_name: api_gateway_stack_arn).stacks.first
rest_api_id = lookup(stack[:outputs], "RestApi")
end | [
"def",
"rest_api_id",
"stack_name",
"=",
"Jets",
"::",
"Naming",
".",
"parent_stack_name",
"return",
"\"RestApi\"",
"unless",
"stack_exists?",
"(",
"stack_name",
")",
"stack",
"=",
"cfn",
".",
"describe_stacks",
"(",
"stack_name",
":",
"stack_name",
")",
".",
"s... | Duplicated in rest_api/change_detection.rb, base_path/role.rb, rest_api/routes.rb | [
"Duplicated",
"in",
"rest_api",
"/",
"change_detection",
".",
"rb",
"base_path",
"/",
"role",
".",
"rb",
"rest_api",
"/",
"routes",
".",
"rb"
] | 46943a519224067e58aa3e2d5656e3ca083150f9 | https://github.com/tongueroo/jets/blob/46943a519224067e58aa3e2d5656e3ca083150f9/lib/jets/resource/api_gateway/base_path/role.rb#L56-L67 | train | Returns the rest_api_id of the current stack | [
30522,
13366,
2717,
1035,
17928,
1035,
8909,
9991,
1035,
2171,
1027,
9924,
1024,
1024,
10324,
1012,
6687,
1035,
9991,
1035,
2171,
2709,
1000,
2717,
9331,
2072,
1000,
4983,
9991,
1035,
6526,
1029,
1006,
9991,
1035,
2171,
1007,
9991,
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... |
samvera/hyrax | app/helpers/hyrax/hyrax_helper_behavior.rb | Hyrax.HyraxHelperBehavior.index_field_link | def index_field_link(options)
raise ArgumentError unless options[:config] && options[:config][:field_name]
name = options[:config][:field_name]
links = options[:value].map { |item| link_to_field(name, item, item) }
safe_join(links, ", ")
end | ruby | def index_field_link(options)
raise ArgumentError unless options[:config] && options[:config][:field_name]
name = options[:config][:field_name]
links = options[:value].map { |item| link_to_field(name, item, item) }
safe_join(links, ", ")
end | [
"def",
"index_field_link",
"(",
"options",
")",
"raise",
"ArgumentError",
"unless",
"options",
"[",
":config",
"]",
"&&",
"options",
"[",
":config",
"]",
"[",
":field_name",
"]",
"name",
"=",
"options",
"[",
":config",
"]",
"[",
":field_name",
"]",
"links",
... | A Blacklight helper_method
@param options [Hash{Symbol=>Object}] Blacklight sends :document, :field, :config, :value and whatever else was in options
@option options [Array{String}] :value
@option options [Hash] :config including {:field_name => "my_name"}
@option options [Hash] :document
@option options [Array{String}] :value the strings you might otherwise have passed to this method singly
@return [ActiveSupport::SafeBuffer] the html_safe link | [
"A",
"Blacklight",
"helper_method"
] | e2b4f56e829a53b1f11296324736e9d5b8c9ee5f | https://github.com/samvera/hyrax/blob/e2b4f56e829a53b1f11296324736e9d5b8c9ee5f/app/helpers/hyrax/hyrax_helper_behavior.rb#L127-L132 | train | Returns the link to the field | [
30522,
13366,
5950,
1035,
2492,
1035,
4957,
1006,
7047,
1007,
5333,
6685,
2121,
29165,
4983,
7047,
1031,
1024,
9530,
8873,
2290,
1033,
1004,
1004,
7047,
1031,
1024,
9530,
8873,
2290,
1033,
1031,
1024,
2492,
1035,
2171,
1033,
2171,
1027,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cheezy/page-object | lib/page-object/accessors.rb | PageObject.Accessors.element | def element(name, tag=:element, identifier={ :index => 0 }, &block)
#
# sets tag as element if not defined
#
if tag.is_a?(Hash)
identifier = tag
tag = :element
end
standard_methods(name, identifier, 'element_for', &block)
define_method("#{name}") do
element = self.send("#{name}_element")
%w(Button TextField Radio Hidden CheckBox FileField).each do |klass|
next unless element.element.class.to_s == "Watir::#{klass}"
self.class.send(klass.gsub(/(.)([A-Z])/,'\1_\2').downcase, name, identifier, &block)
return self.send name
end
element.text
end
define_method("#{name}_element") do
return call_block(&block) if block_given?
platform.element_for(tag, identifier.clone)
end
define_method("#{name}?") do
self.send("#{name}_element").exists?
end
define_method("#{name}=") do |value|
element = self.send("#{name}_element")
klass = case element.element
when Watir::TextField
'text_field'
when Watir::TextArea
'text_area'
when Watir::Select
'select_list'
when Watir::FileField
'file_field'
else
raise "Can not set a #{element.element} element with #="
end
self.class.send(klass, name, identifier, &block)
self.send("#{name}=", value)
end
end | ruby | def element(name, tag=:element, identifier={ :index => 0 }, &block)
#
# sets tag as element if not defined
#
if tag.is_a?(Hash)
identifier = tag
tag = :element
end
standard_methods(name, identifier, 'element_for', &block)
define_method("#{name}") do
element = self.send("#{name}_element")
%w(Button TextField Radio Hidden CheckBox FileField).each do |klass|
next unless element.element.class.to_s == "Watir::#{klass}"
self.class.send(klass.gsub(/(.)([A-Z])/,'\1_\2').downcase, name, identifier, &block)
return self.send name
end
element.text
end
define_method("#{name}_element") do
return call_block(&block) if block_given?
platform.element_for(tag, identifier.clone)
end
define_method("#{name}?") do
self.send("#{name}_element").exists?
end
define_method("#{name}=") do |value|
element = self.send("#{name}_element")
klass = case element.element
when Watir::TextField
'text_field'
when Watir::TextArea
'text_area'
when Watir::Select
'select_list'
when Watir::FileField
'file_field'
else
raise "Can not set a #{element.element} element with #="
end
self.class.send(klass, name, identifier, &block)
self.send("#{name}=", value)
end
end | [
"def",
"element",
"(",
"name",
",",
"tag",
"=",
":element",
",",
"identifier",
"=",
"{",
":index",
"=>",
"0",
"}",
",",
"&",
"block",
")",
"#",
"# sets tag as element if not defined",
"#",
"if",
"tag",
".",
"is_a?",
"(",
"Hash",
")",
"identifier",
"=",
... | adds three methods - one to retrieve the text of an element, another
to retrieve an element, and another to check the element's existence.
@example
element(:title, :header, :id => 'title')
# will generate 'title', 'title_element', and 'title?' methods
@param [Symbol] the name used for the generated methods
@param [Symbol] the name of the tag for the element
@param [Hash] identifier how we find an element.
@param optional block to be invoked when element method is called | [
"adds",
"three",
"methods",
"-",
"one",
"to",
"retrieve",
"the",
"text",
"of",
"an",
"element",
"another",
"to",
"retrieve",
"an",
"element",
"and",
"another",
"to",
"check",
"the",
"element",
"s",
"existence",
"."
] | 850d775bf63768fbb1551a34480195785fe8e193 | https://github.com/cheezy/page-object/blob/850d775bf63768fbb1551a34480195785fe8e193/lib/page-object/accessors.rb#L970-L1016 | train | Creates a new instance of the Watir class. | [
30522,
13366,
5783,
1006,
2171,
1010,
6415,
1027,
1024,
5783,
1010,
8909,
4765,
18095,
1027,
1063,
1024,
5950,
1027,
1028,
1014,
1065,
1010,
1004,
3796,
1007,
1001,
1001,
4520,
6415,
2004,
5783,
2065,
2025,
4225,
1001,
2065,
6415,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_policy_insights/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/remediations.rb | Azure::PolicyInsights::Mgmt::V2018_07_01_preview.Remediations.list_deployments_at_management_group_next | def list_deployments_at_management_group_next(next_page_link, custom_headers:nil)
response = list_deployments_at_management_group_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_deployments_at_management_group_next(next_page_link, custom_headers:nil)
response = list_deployments_at_management_group_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_deployments_at_management_group_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_deployments_at_management_group_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"respons... | Gets all deployments for a remediation at management group scope.
@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 [RemediationDeploymentsListResult] operation results. | [
"Gets",
"all",
"deployments",
"for",
"a",
"remediation",
"at",
"management",
"group",
"scope",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_policy_insights/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/remediations.rb#L2357-L2360 | train | Gets the list of deployments at management group level. | [
30522,
13366,
2862,
1035,
10813,
2015,
1035,
2012,
1035,
2968,
1035,
2177,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
10813,
2015,
1035,
2012,
1035,
2968,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/text_normalizer.rb | MetaTags.TextNormalizer.cleanup_string | def cleanup_string(string, strip: true)
return '' if string.nil?
raise ArgumentError, 'Expected a string or an object that implements #to_str' unless string.respond_to?(:to_str)
strip_tags(string.to_str).tap do |s|
s.gsub!(/\s+/, ' ')
s.strip! if strip
end
end | ruby | def cleanup_string(string, strip: true)
return '' if string.nil?
raise ArgumentError, 'Expected a string or an object that implements #to_str' unless string.respond_to?(:to_str)
strip_tags(string.to_str).tap do |s|
s.gsub!(/\s+/, ' ')
s.strip! if strip
end
end | [
"def",
"cleanup_string",
"(",
"string",
",",
"strip",
":",
"true",
")",
"return",
"''",
"if",
"string",
".",
"nil?",
"raise",
"ArgumentError",
",",
"'Expected a string or an object that implements #to_str'",
"unless",
"string",
".",
"respond_to?",
"(",
":to_str",
")... | Removes HTML tags and squashes down all the spaces.
@param [String] string input string.
@return [String] input string with no HTML tags and consequent white
space characters squashed into a single space. | [
"Removes",
"HTML",
"tags",
"and",
"squashes",
"down",
"all",
"the",
"spaces",
"."
] | 03585f95edf96cd17024c5c155ce46ec8bc47232 | https://github.com/kpumuk/meta-tags/blob/03585f95edf96cd17024c5c155ce46ec8bc47232/lib/meta_tags/text_normalizer.rb#L109-L117 | train | Removes all the tags from a string | [
30522,
13366,
27686,
1035,
5164,
1006,
5164,
1010,
6167,
1024,
2995,
1007,
2709,
1005,
1005,
2065,
5164,
1012,
9152,
2140,
1029,
5333,
6685,
2121,
29165,
1010,
1005,
3517,
1037,
5164,
2030,
2019,
4874,
2008,
22164,
1001,
2000,
1035,
2358,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/message.rb | Mail.Message.parse_message | def parse_message
header_part, body_part = raw_source.lstrip.split(HEADER_SEPARATOR, 2)
self.header = header_part
self.body = body_part
end | ruby | def parse_message
header_part, body_part = raw_source.lstrip.split(HEADER_SEPARATOR, 2)
self.header = header_part
self.body = body_part
end | [
"def",
"parse_message",
"header_part",
",",
"body_part",
"=",
"raw_source",
".",
"lstrip",
".",
"split",
"(",
"HEADER_SEPARATOR",
",",
"2",
")",
"self",
".",
"header",
"=",
"header_part",
"self",
".",
"body",
"=",
"body_part",
"end"
] | 2.1. General Description
A message consists of header fields (collectively called "the header
of the message") followed, optionally, by a body. The header is a
sequence of lines of characters with special syntax as defined in
this standard. The body is simply a sequence of characters that
follows the header and is separated from the header by an empty line
(i.e., a line with nothing preceding the CRLF). | [
"2",
".",
"1",
".",
"General",
"Description",
"A",
"message",
"consists",
"of",
"header",
"fields",
"(",
"collectively",
"called",
"the",
"header",
"of",
"the",
"message",
")",
"followed",
"optionally",
"by",
"a",
"body",
".",
"The",
"header",
"is",
"a",
... | fb53fb369eb2bf0494ac70675970c90cdcc3f495 | https://github.com/mikel/mail/blob/fb53fb369eb2bf0494ac70675970c90cdcc3f495/lib/mail/message.rb#L1977-L1981 | train | Parse message header and body parts | [
30522,
13366,
11968,
3366,
1035,
4471,
20346,
1035,
2112,
1010,
2303,
1035,
2112,
1027,
6315,
1035,
3120,
1012,
1048,
3367,
29443,
1012,
3975,
1006,
20346,
1035,
19802,
25879,
2953,
1010,
1016,
1007,
2969,
1012,
20346,
1027,
20346,
1035,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/reloadable.rb | Mongoid.Reloadable.reload_embedded_document | def reload_embedded_document
extract_embedded_attributes({}.merge(
collection(_root).find(_id: _root._id).read(mode: :primary).first
))
end | ruby | def reload_embedded_document
extract_embedded_attributes({}.merge(
collection(_root).find(_id: _root._id).read(mode: :primary).first
))
end | [
"def",
"reload_embedded_document",
"extract_embedded_attributes",
"(",
"{",
"}",
".",
"merge",
"(",
"collection",
"(",
"_root",
")",
".",
"find",
"(",
"_id",
":",
"_root",
".",
"_id",
")",
".",
"read",
"(",
"mode",
":",
":primary",
")",
".",
"first",
")"... | Reload the embedded document.
@example Reload the document.
document.reload_embedded_document
@return [ Hash ] The reloaded attributes.
@since 2.3.2 | [
"Reload",
"the",
"embedded",
"document",
"."
] | 56976e32610f4c2450882b0bfe14da099f0703f4 | https://github.com/mongodb/mongoid/blob/56976e32610f4c2450882b0bfe14da099f0703f4/lib/mongoid/reloadable.rb#L73-L77 | train | Reload the document from the database | [
30522,
13366,
2128,
11066,
1035,
11157,
1035,
6254,
14817,
1035,
11157,
1035,
12332,
1006,
1063,
1065,
1012,
13590,
1006,
3074,
1006,
1035,
7117,
1007,
1012,
2424,
1006,
1035,
8909,
1024,
1035,
7117,
1012,
1035,
8909,
1007,
1012,
3191,
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... |
decidim/decidim | decidim-core/app/helpers/decidim/amendments_helper.rb | Decidim.AmendmentsHelper.emendation_field_value | def emendation_field_value(form, original, key)
return params[:amendment][:emendation_params][key] if params[:amendment].present?
present(form.object.send(original)).send(key)
end | ruby | def emendation_field_value(form, original, key)
return params[:amendment][:emendation_params][key] if params[:amendment].present?
present(form.object.send(original)).send(key)
end | [
"def",
"emendation_field_value",
"(",
"form",
",",
"original",
",",
"key",
")",
"return",
"params",
"[",
":amendment",
"]",
"[",
":emendation_params",
"]",
"[",
"key",
"]",
"if",
"params",
"[",
":amendment",
"]",
".",
"present?",
"present",
"(",
"form",
".... | Return the edited field value or presents the original attribute value in a form. | [
"Return",
"the",
"edited",
"field",
"value",
"or",
"presents",
"the",
"original",
"attribute",
"value",
"in",
"a",
"form",
"."
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/app/helpers/decidim/amendments_helper.rb#L116-L120 | train | Returns the value of the emendation field | [
30522,
13366,
7861,
10497,
3370,
1035,
2492,
1035,
3643,
1006,
2433,
1010,
2434,
1010,
3145,
1007,
2709,
11498,
5244,
1031,
1024,
7450,
1033,
1031,
1024,
7861,
10497,
3370,
1035,
11498,
5244,
1033,
1031,
3145,
1033,
2065,
11498,
5244,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/haml-lint | lib/haml_lint/utils.rb | HamlLint.Utils.get_abs_and_rel_path | def get_abs_and_rel_path(path)
original_path = Pathname.new(path)
root_dir_path = Pathname.new(File.expand_path(Dir.pwd))
if original_path.absolute?
[path, original_path.relative_path_from(root_dir_path)]
else
[root_dir_path + original_path, path]
end
end | ruby | def get_abs_and_rel_path(path)
original_path = Pathname.new(path)
root_dir_path = Pathname.new(File.expand_path(Dir.pwd))
if original_path.absolute?
[path, original_path.relative_path_from(root_dir_path)]
else
[root_dir_path + original_path, path]
end
end | [
"def",
"get_abs_and_rel_path",
"(",
"path",
")",
"original_path",
"=",
"Pathname",
".",
"new",
"(",
"path",
")",
"root_dir_path",
"=",
"Pathname",
".",
"new",
"(",
"File",
".",
"expand_path",
"(",
"Dir",
".",
"pwd",
")",
")",
"if",
"original_path",
".",
... | Returns an array of two items, the first being the absolute path, the second
the relative path.
The relative path is relative to the current working dir. The path passed can
be either relative or absolute.
@param path [String] Path to get absolute and relative path of
@return [Array<String>] Absolute and relative path | [
"Returns",
"an",
"array",
"of",
"two",
"items",
"the",
"first",
"being",
"the",
"absolute",
"path",
"the",
"second",
"the",
"relative",
"path",
"."
] | 024c773667e54cf88db938c2b368977005d70ee8 | https://github.com/sds/haml-lint/blob/024c773667e54cf88db938c2b368977005d70ee8/lib/haml_lint/utils.rb#L37-L46 | train | Get absolute and relative path of a file | [
30522,
13366,
2131,
1035,
14689,
1035,
1998,
1035,
2128,
2140,
1035,
4130,
1006,
4130,
1007,
2434,
1035,
4130,
1027,
4130,
18442,
1012,
2047,
1006,
4130,
1007,
7117,
1035,
16101,
1035,
4130,
1027,
4130,
18442,
1012,
2047,
1006,
5371,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb | Azure::KeyVault::V2016_10_01.KeyVaultClient.get_sas_definitions_with_http_info | def get_sas_definitions_with_http_info(vault_base_url, storage_account_name, maxresults:nil, custom_headers:nil)
get_sas_definitions_async(vault_base_url, storage_account_name, maxresults:maxresults, custom_headers:custom_headers).value!
end | ruby | def get_sas_definitions_with_http_info(vault_base_url, storage_account_name, maxresults:nil, custom_headers:nil)
get_sas_definitions_async(vault_base_url, storage_account_name, maxresults:maxresults, custom_headers:custom_headers).value!
end | [
"def",
"get_sas_definitions_with_http_info",
"(",
"vault_base_url",
",",
"storage_account_name",
",",
"maxresults",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"get_sas_definitions_async",
"(",
"vault_base_url",
",",
"storage_account_name",
",",
"maxresults",
":",... | List storage SAS definitions for the given storage account. This operation
requires the storage/listsas permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param storage_account_name [String] The name of the storage account.
@param maxresults [Integer] Maximum number of results to return in a page. If
not specified the service will return up to 25 results.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"List",
"storage",
"SAS",
"definitions",
"for",
"the",
"given",
"storage",
"account",
".",
"This",
"operation",
"requires",
"the",
"storage",
"/",
"listsas",
"permission",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb#L7692-L7694 | train | Gets the SAS definitions for the specified storage account. | [
30522,
13366,
2131,
1035,
21871,
1035,
15182,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
5527,
1035,
4070,
1035,
2171,
1010,
4098,
6072,
11314,
2015,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
201... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.batch_read_file_in_stream | def batch_read_file_in_stream(image, mode, custom_headers:nil)
response = batch_read_file_in_stream_async(image, mode, custom_headers:custom_headers).value!
nil
end | ruby | def batch_read_file_in_stream(image, mode, custom_headers:nil)
response = batch_read_file_in_stream_async(image, mode, custom_headers:custom_headers).value!
nil
end | [
"def",
"batch_read_file_in_stream",
"(",
"image",
",",
"mode",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"batch_read_file_in_stream_async",
"(",
"image",
",",
"mode",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"nil",
"end"
] | Use this interface to get the result of a Read Document operation, employing
the state-of-the-art Optical Character Recognition (OCR) algorithms optimized
for text-heavy documents. When you use the Read Document interface, the
response contains a field called "Operation-Location". The
"Operation-Location" field contains the URL that you must use for your "Get
Read Result operation" to access OCR results.
@param image An image stream.
@param mode [TextRecognitionMode] Type of text to recognize. Possible values
include: 'Handwritten', 'Printed'
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Use",
"this",
"interface",
"to",
"get",
"the",
"result",
"of",
"a",
"Read",
"Document",
"operation",
"employing",
"the",
"state",
"-",
"of",
"-",
"the",
"-",
"art",
"Optical",
"Character",
"Recognition",
"(",
"OCR",
")",
"algorithms",
"optimized",
"for",
... | 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#L3080-L3083 | train | Read a file in a batch of VulnerabilityAssessment image. | [
30522,
13366,
14108,
1035,
3191,
1035,
5371,
1035,
1999,
1035,
5460,
1006,
3746,
1010,
5549,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
14108,
1035,
3191,
1035,
5371,
1035,
1999,
1035,
5460,
1035,
2004,
6038,
2278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_contentmoderator/lib/1.0/generated/azure_cognitiveservices_contentmoderator/reviews.rb | Azure::CognitiveServices::ContentModerator::V1_0.Reviews.create_job_with_http_info | def create_job_with_http_info(team_name, content_type, content_id, workflow_name, job_content_type, content, call_back_endpoint:nil, custom_headers:nil)
create_job_async(team_name, content_type, content_id, workflow_name, job_content_type, content, call_back_endpoint:call_back_endpoint, custom_headers:custom_headers).value!
end | ruby | def create_job_with_http_info(team_name, content_type, content_id, workflow_name, job_content_type, content, call_back_endpoint:nil, custom_headers:nil)
create_job_async(team_name, content_type, content_id, workflow_name, job_content_type, content, call_back_endpoint:call_back_endpoint, custom_headers:custom_headers).value!
end | [
"def",
"create_job_with_http_info",
"(",
"team_name",
",",
"content_type",
",",
"content_id",
",",
"workflow_name",
",",
"job_content_type",
",",
"content",
",",
"call_back_endpoint",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"create_job_async",
"(",
"team... | A job Id will be returned for the content posted on this endpoint.
Once the content is evaluated against the Workflow provided the review will
be created or ignored based on the workflow expression.
<h3>CallBack Schemas </h3>
<p>
<h4>Job Completion CallBack Sample</h4><br/>
{<br/>
"JobId": "<Job Id>,<br/>
"ReviewId": "<Review Id, if the Job resulted in a Review to be
created>",<br/>
"WorkFlowId": "default",<br/>
"Status": "<This will be one of Complete, InProgress, Error>",<br/>
"ContentType": "Image",<br/>
"ContentId": "<This is the ContentId that was specified on input>",<br/>
"CallBackType": "Job",<br/>
"Metadata": {<br/>
"adultscore": "0.xxx",<br/>
"a": "False",<br/>
"racyscore": "0.xxx",<br/>
"r": "True"<br/>
}<br/>
}<br/>
</p>
<p>
<h4>Review Completion CallBack Sample</h4><br/>
{
"ReviewId": "<Review Id>",<br/>
"ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
"ModifiedBy": "<Name of the Reviewer>",<br/>
"CallBackType": "Review",<br/>
"ContentId": "<The ContentId that was specified input>",<br/>
"Metadata": {<br/>
"adultscore": "0.xxx",
"a": "False",<br/>
"racyscore": "0.xxx",<br/>
"r": "True"<br/>
},<br/>
"ReviewerResultTags": {<br/>
"a": "False",<br/>
"r": "True"<br/>
}<br/>
}<br/>
</p>.
@param team_name [String] Your team name.
@param content_type [Enum] Image, Text or Video. Possible values include:
'Image', 'Text', 'Video'
@param content_id [String] Id/Name to identify the content submitted.
@param workflow_name [String] Workflow Name that you want to invoke.
@param job_content_type [Enum] The content type. Possible values include:
'application/json', 'image/jpeg'
@param content [Content] Content to evaluate.
@param call_back_endpoint [String] Callback endpoint for posting the create
job result.
@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. | [
"A",
"job",
"Id",
"will",
"be",
"returned",
"for",
"the",
"content",
"posted",
"on",
"this",
"endpoint",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_contentmoderator/lib/1.0/generated/azure_cognitiveservices_contentmoderator/reviews.rb#L574-L576 | train | Creates a job for the team. | [
30522,
13366,
3443,
1035,
3105,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2136,
1035,
2171,
1010,
4180,
1035,
2828,
1010,
4180,
1035,
8909,
1010,
2147,
12314,
1035,
2171,
1010,
3105,
1035,
4180,
1035,
2828,
1010,
4180,
1010,
2655,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.