repo stringclasses 235 values | path stringlengths 11 168 | func_name stringlengths 12 143 | original_string stringlengths 83 6.91k | language stringclasses 1 value | code stringlengths 83 6.91k | code_tokens listlengths 15 1.01k | docstring stringlengths 5 25.7k | docstring_tokens listlengths 1 427 | sha stringclasses 235 values | url stringlengths 99 268 | partition stringclasses 1 value | summary stringlengths 7 202 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_contentmoderator/lib/1.0/generated/azure_cognitiveservices_contentmoderator/reviews.rb | Azure::CognitiveServices::ContentModerator::V1_0.Reviews.create_job | def create_job(team_name, content_type, content_id, workflow_name, job_content_type, content, call_back_endpoint:nil, custom_headers:nil)
response = 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!
response.body unless response.nil?
end | ruby | def create_job(team_name, content_type, content_id, workflow_name, job_content_type, content, call_back_endpoint:nil, custom_headers:nil)
response = 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!
response.body unless response.nil?
end | [
"def",
"create_job",
"(",
"team_name",
",",
"content_type",
",",
"content_id",
",",
"workflow_name",
",",
"job_content_type",
",",
"content",
",",
"call_back_endpoint",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_job_async",
"(",
... | 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 [JobId] operation results. | [
"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#L502-L505 | train | Creates a job for the team. | [
30522,
13366,
3443,
1035,
3105,
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,
2067,
1035,
2203,
8400,
1024,
9152,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
samvera/hyrax | app/indexers/hyrax/deep_indexing_service.rb | Hyrax.DeepIndexingService.fetch_external | def fetch_external
object.controlled_properties.each do |property|
object[property].each do |value|
resource = value.respond_to?(:resource) ? value.resource : value
next unless resource.is_a?(ActiveTriples::Resource)
next if value.is_a?(ActiveFedora::Base)
fetch_with_persistence(resource)
end
end
end | ruby | def fetch_external
object.controlled_properties.each do |property|
object[property].each do |value|
resource = value.respond_to?(:resource) ? value.resource : value
next unless resource.is_a?(ActiveTriples::Resource)
next if value.is_a?(ActiveFedora::Base)
fetch_with_persistence(resource)
end
end
end | [
"def",
"fetch_external",
"object",
".",
"controlled_properties",
".",
"each",
"do",
"|",
"property",
"|",
"object",
"[",
"property",
"]",
".",
"each",
"do",
"|",
"value",
"|",
"resource",
"=",
"value",
".",
"respond_to?",
"(",
":resource",
")",
"?",
"value... | Grab the labels for controlled properties from the remote sources | [
"Grab",
"the",
"labels",
"for",
"controlled",
"properties",
"from",
"the",
"remote",
"sources"
] | e2b4f56e829a53b1f11296324736e9d5b8c9ee5f | https://github.com/samvera/hyrax/blob/e2b4f56e829a53b1f11296324736e9d5b8c9ee5f/app/indexers/hyrax/deep_indexing_service.rb#L30-L39 | train | Fetch external resources | [
30522,
13366,
18584,
1035,
6327,
4874,
1012,
4758,
1035,
5144,
1012,
2169,
2079,
1064,
3200,
1064,
4874,
1031,
3200,
1033,
1012,
2169,
2079,
1064,
3643,
1064,
7692,
1027,
3643,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
7692,
1007,
1029,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
boazsegev/combine_pdf | lib/combine_pdf/parser.rb | CombinePDF.PDFParser.serialize_objects_and_references | def serialize_objects_and_references
obj_dir = {}
objid_cache = {}
# create a dictionary for referenced objects (no value resolution at this point)
# at the same time, delete duplicates and old versions when objects have multiple versions
@parsed.uniq!
@parsed.length.times do |i|
o = @parsed[i]
objid_cache[o.object_id] = i
tmp_key = [o[:indirect_reference_id], o[:indirect_generation_number]]
if tmp_found = obj_dir[tmp_key]
tmp_found.clear
@parsed[objid_cache[tmp_found.object_id]] = nil
end
obj_dir[tmp_key] = o
end
@parsed.compact!
objid_cache.clear
should_resolve = [@parsed, @root_object]
while should_resolve.count > 0
obj = should_resolve.pop
if obj.is_a?(Hash)
obj.keys.each do |k|
o = obj[k]
if o.is_a?(Hash)
if o[:is_reference_only]
if o[:indirect_reference_id].nil?
o = nil
else
o[:referenced_object] = obj_dir[[o[:indirect_reference_id], o[:indirect_generation_number]]]
warn "Couldn't connect reference for #{o}" if o[:referenced_object].nil? && (o[:indirect_reference_id] + o[:indirect_generation_number] != 0)
o.delete :indirect_reference_id
o.delete :indirect_generation_number
o = (o[:referenced_object] && o[:referenced_object][:indirect_without_dictionary]) || o
end
obj[k] = o
else
should_resolve << o
end
elsif o.is_a?(Array)
should_resolve << o
end
end
elsif obj.is_a?(Array)
obj.map! do |o|
if o.is_a?(Hash)
if o[:is_reference_only]
if o[:indirect_reference_id].nil?
o = nil
else
o[:referenced_object] = obj_dir[[o[:indirect_reference_id], o[:indirect_generation_number]]]
warn "Couldn't connect reference for #{o}" if o[:referenced_object].nil?
o.delete :indirect_reference_id
o.delete :indirect_generation_number
o = (o[:referenced_object] && o[:referenced_object][:indirect_without_dictionary]) || o
end
else
should_resolve << o
end
elsif o.is_a?(Array)
should_resolve << o
end
o
end
end
end
end | ruby | def serialize_objects_and_references
obj_dir = {}
objid_cache = {}
# create a dictionary for referenced objects (no value resolution at this point)
# at the same time, delete duplicates and old versions when objects have multiple versions
@parsed.uniq!
@parsed.length.times do |i|
o = @parsed[i]
objid_cache[o.object_id] = i
tmp_key = [o[:indirect_reference_id], o[:indirect_generation_number]]
if tmp_found = obj_dir[tmp_key]
tmp_found.clear
@parsed[objid_cache[tmp_found.object_id]] = nil
end
obj_dir[tmp_key] = o
end
@parsed.compact!
objid_cache.clear
should_resolve = [@parsed, @root_object]
while should_resolve.count > 0
obj = should_resolve.pop
if obj.is_a?(Hash)
obj.keys.each do |k|
o = obj[k]
if o.is_a?(Hash)
if o[:is_reference_only]
if o[:indirect_reference_id].nil?
o = nil
else
o[:referenced_object] = obj_dir[[o[:indirect_reference_id], o[:indirect_generation_number]]]
warn "Couldn't connect reference for #{o}" if o[:referenced_object].nil? && (o[:indirect_reference_id] + o[:indirect_generation_number] != 0)
o.delete :indirect_reference_id
o.delete :indirect_generation_number
o = (o[:referenced_object] && o[:referenced_object][:indirect_without_dictionary]) || o
end
obj[k] = o
else
should_resolve << o
end
elsif o.is_a?(Array)
should_resolve << o
end
end
elsif obj.is_a?(Array)
obj.map! do |o|
if o.is_a?(Hash)
if o[:is_reference_only]
if o[:indirect_reference_id].nil?
o = nil
else
o[:referenced_object] = obj_dir[[o[:indirect_reference_id], o[:indirect_generation_number]]]
warn "Couldn't connect reference for #{o}" if o[:referenced_object].nil?
o.delete :indirect_reference_id
o.delete :indirect_generation_number
o = (o[:referenced_object] && o[:referenced_object][:indirect_without_dictionary]) || o
end
else
should_resolve << o
end
elsif o.is_a?(Array)
should_resolve << o
end
o
end
end
end
end | [
"def",
"serialize_objects_and_references",
"obj_dir",
"=",
"{",
"}",
"objid_cache",
"=",
"{",
"}",
"# create a dictionary for referenced objects (no value resolution at this point)",
"# at the same time, delete duplicates and old versions when objects have multiple versions",
"@parsed",
".... | @private
connects references and objects, according to their reference id's.
Also replaces :indirect_without_dictionary objects with their actual values. Strings, Hashes and Arrays still share memory space.
should be moved to the parser's workflow. | [
"@private",
"connects",
"references",
"and",
"objects",
"according",
"to",
"their",
"reference",
"id",
"s",
"."
] | 09054051019c069f551f3e60be789577c0f93900 | https://github.com/boazsegev/combine_pdf/blob/09054051019c069f551f3e60be789577c0f93900/lib/combine_pdf/parser.rb#L595-L662 | train | serialize objects and references | [
30522,
13366,
7642,
4697,
1035,
5200,
1035,
1998,
1035,
7604,
27885,
3501,
1035,
16101,
1027,
1063,
1065,
27885,
4478,
2094,
1035,
17053,
1027,
1063,
1065,
1001,
3443,
1037,
9206,
2005,
14964,
5200,
1006,
2053,
3643,
5813,
30524,
2051,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_api_management/lib/2016-07-07/generated/azure_mgmt_api_management/apis.rb | Azure::ApiManagement::Mgmt::V2016_07_07.Apis.export_with_http_info | def export_with_http_info(resource_group_name, service_name, api_id, custom_headers:nil)
export_async(resource_group_name, service_name, api_id, custom_headers:custom_headers).value!
end | ruby | def export_with_http_info(resource_group_name, service_name, api_id, custom_headers:nil)
export_async(resource_group_name, service_name, api_id, custom_headers:custom_headers).value!
end | [
"def",
"export_with_http_info",
"(",
"resource_group_name",
",",
"service_name",
",",
"api_id",
",",
"custom_headers",
":",
"nil",
")",
"export_async",
"(",
"resource_group_name",
",",
"service_name",
",",
"api_id",
",",
"custom_headers",
":custom_headers",
")",
".",
... | Gets the details of the API specified by its identifier.
@param resource_group_name [String] The name of the resource group.
@param service_name [String] The name of the API Management service.
@param api_id [String] API identifier. Must be unique in the current API
Management service instance.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"details",
"of",
"the",
"API",
"specified",
"by",
"its",
"identifier",
"."
] | 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/apis.rb#L624-L626 | train | Export the specified API. | [
30522,
13366,
9167,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
17928,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
9167,
1035,
2004,
6038,
2278,
1006,
7692,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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.set_sas_definition | def set_sas_definition(vault_base_url, storage_account_name, sas_definition_name, parameters, sas_definition_attributes:nil, tags:nil, custom_headers:nil)
response = set_sas_definition_async(vault_base_url, storage_account_name, sas_definition_name, parameters, sas_definition_attributes:sas_definition_attributes, tags:tags, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def set_sas_definition(vault_base_url, storage_account_name, sas_definition_name, parameters, sas_definition_attributes:nil, tags:nil, custom_headers:nil)
response = set_sas_definition_async(vault_base_url, storage_account_name, sas_definition_name, parameters, sas_definition_attributes:sas_definition_attributes, tags:tags, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"set_sas_definition",
"(",
"vault_base_url",
",",
"storage_account_name",
",",
"sas_definition_name",
",",
"parameters",
",",
"sas_definition_attributes",
":",
"nil",
",",
"tags",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"set_sas_d... | Creates or updates a new SAS definition for the specified storage account.
This operation requires the storage/setsas 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 sas_definition_name [String] The name of the SAS definition.
@param parameters [Hash{String => String}] Sas definition creation metadata
in the form of key-value pairs.
@param sas_definition_attributes [SasDefinitionAttributes] The attributes of
the SAS definition.
@param tags [Hash{String => String}] Application specific metadata in the
form of key-value pairs.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [SasDefinitionBundle] operation results. | [
"Creates",
"or",
"updates",
"a",
"new",
"SAS",
"definition",
"for",
"the",
"specified",
"storage",
"account",
".",
"This",
"operation",
"requires",
"the",
"storage",
"/",
"setsas",
"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#L7993-L7996 | train | Sets the SAS definition. | [
30522,
13366,
2275,
1035,
21871,
1035,
6210,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
5527,
1035,
4070,
1035,
2171,
1010,
21871,
1035,
6210,
1035,
2171,
1010,
11709,
1010,
21871,
1035,
6210,
1035,
12332,
1024,
9152,
2140,
1010,
220... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/node_reports.rb | Azure::Automation::Mgmt::V2015_10_31.NodeReports.get_content_with_http_info | def get_content_with_http_info(resource_group_name, automation_account_name, node_id, report_id, custom_headers:nil)
get_content_async(resource_group_name, automation_account_name, node_id, report_id, custom_headers:custom_headers).value!
end | ruby | def get_content_with_http_info(resource_group_name, automation_account_name, node_id, report_id, custom_headers:nil)
get_content_async(resource_group_name, automation_account_name, node_id, report_id, custom_headers:custom_headers).value!
end | [
"def",
"get_content_with_http_info",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"node_id",
",",
"report_id",
",",
"custom_headers",
":",
"nil",
")",
"get_content_async",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"node_id",
",",... | Retrieve the Dsc node reports by node id and report id.
@param resource_group_name [String] Name of an Azure Resource group.
@param automation_account_name [String] The name of the automation account.
@param node_id [String] The Dsc node id.
@param report_id [String] The report 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. | [
"Retrieve",
"the",
"Dsc",
"node",
"reports",
"by",
"node",
"id",
"and",
"report",
"id",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/node_reports.rb#L258-L260 | train | Gets the content of the node. | [
30522,
13366,
2131,
1035,
4180,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
19309,
1035,
4070,
1035,
2171,
1010,
13045,
1035,
8909,
1010,
3189,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb | Azure::KeyVault::V2016_10_01.KeyVaultClient.get_certificate_issuers_as_lazy | def get_certificate_issuers_as_lazy(vault_base_url, maxresults:nil, custom_headers:nil)
first_page = get_certificate_issuers_as_lazy_as_lazy(vault_base_url, maxresults:maxresults, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def get_certificate_issuers_as_lazy(vault_base_url, maxresults:nil, custom_headers:nil)
first_page = get_certificate_issuers_as_lazy_as_lazy(vault_base_url, maxresults:maxresults, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"get_certificate_issuers_as_lazy",
"(",
"vault_base_url",
",",
"maxresults",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"get_certificate_issuers_as_lazy_as_lazy",
"(",
"vault_base_url",
",",
"maxresults",
":",
"maxresults",
",",
"custo... | List certificate issuers for a specified key vault.
The GetCertificateIssuers operation returns the set of certificate issuer
resources in the specified key vault. This operation requires the
certificates/manageissuers/getissuers permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@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 [CertificateIssuerListResult] operation results. | [
"List",
"certificate",
"issuers",
"for",
"a",
"specified",
"key",
"vault",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb#L10227-L10230 | train | Gets the certificate issuers for a specified vault. | [
30522,
13366,
2131,
1035,
8196,
1035,
30524,
1035,
2004,
1035,
13971,
1035,
2004,
1035,
13971,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
4098,
6072,
11314,
2015,
1024,
4098,
6072,
11314,
2015,
1010,
7661,
1035,
20346,
2015,
1024,
76... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
zendesk/ruby-kafka | lib/kafka/offset_manager.rb | Kafka.OffsetManager.seek_to | def seek_to(topic, partition, offset)
@processed_offsets[topic] ||= {}
@processed_offsets[topic][partition] = offset
@fetcher.seek(topic, partition, offset)
end | ruby | def seek_to(topic, partition, offset)
@processed_offsets[topic] ||= {}
@processed_offsets[topic][partition] = offset
@fetcher.seek(topic, partition, offset)
end | [
"def",
"seek_to",
"(",
"topic",
",",
"partition",
",",
"offset",
")",
"@processed_offsets",
"[",
"topic",
"]",
"||=",
"{",
"}",
"@processed_offsets",
"[",
"topic",
"]",
"[",
"partition",
"]",
"=",
"offset",
"@fetcher",
".",
"seek",
"(",
"topic",
",",
"pa... | Move the consumer's position in the partition to the specified offset.
@param topic [String] the name of the topic.
@param partition [Integer] the partition number.
@param offset [Integer] the offset that the consumer position should be moved to.
@return [nil] | [
"Move",
"the",
"consumer",
"s",
"position",
"in",
"the",
"partition",
"to",
"the",
"specified",
"offset",
"."
] | 2a73471b6a607a52dc85c79301ba522acb4566b5 | https://github.com/zendesk/ruby-kafka/blob/2a73471b6a607a52dc85c79301ba522acb4566b5/lib/kafka/offset_manager.rb#L83-L88 | train | Seeks to the specified offset in the partition. | [
30522,
13366,
6148,
1035,
2000,
1006,
8476,
1010,
13571,
1010,
16396,
1007,
1030,
13995,
1035,
16396,
2015,
1031,
8476,
1033,
1064,
1064,
1027,
1063,
1065,
1030,
13995,
1035,
16396,
2015,
1031,
8476,
1033,
1031,
13571,
1033,
1027,
16396,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
projectcypress/health-data-standards | lib/hqmf-parser/2.0/data_criteria_helpers/dc_post_processing.rb | HQMF2.DataCriteriaPostProcessing.change_xproduct_to_intersection | def change_xproduct_to_intersection
# Need to handle grouper criteria that do not have template ids -- these will be union of and intersection
# criteria
return unless @template_ids.empty?
# Change the XPRODUCT to an INTERSECT otherwise leave it as a UNION
@derivation_operator = HQMF::DataCriteria::INTERSECT if @derivation_operator == HQMF::DataCriteria::XPRODUCT
@description ||= (@derivation_operator == HQMF::DataCriteria::INTERSECT) ? 'Intersect' : 'Union'
end | ruby | def change_xproduct_to_intersection
# Need to handle grouper criteria that do not have template ids -- these will be union of and intersection
# criteria
return unless @template_ids.empty?
# Change the XPRODUCT to an INTERSECT otherwise leave it as a UNION
@derivation_operator = HQMF::DataCriteria::INTERSECT if @derivation_operator == HQMF::DataCriteria::XPRODUCT
@description ||= (@derivation_operator == HQMF::DataCriteria::INTERSECT) ? 'Intersect' : 'Union'
end | [
"def",
"change_xproduct_to_intersection",
"# Need to handle grouper criteria that do not have template ids -- these will be union of and intersection",
"# criteria",
"return",
"unless",
"@template_ids",
".",
"empty?",
"# Change the XPRODUCT to an INTERSECT otherwise leave it as a UNION",
"@deriv... | Changes XPRODUCT data criteria that has an associated tempalte(s) to an INTERSETION criteria.
UNION is used for all other cases. | [
"Changes",
"XPRODUCT",
"data",
"criteria",
"that",
"has",
"an",
"associated",
"tempalte",
"(",
"s",
")",
"to",
"an",
"INTERSETION",
"criteria",
".",
"UNION",
"is",
"used",
"for",
"all",
"other",
"cases",
"."
] | 252d4f0927c513eacde6b9ea41b76faa1423c34b | https://github.com/projectcypress/health-data-standards/blob/252d4f0927c513eacde6b9ea41b76faa1423c34b/lib/hqmf-parser/2.0/data_criteria_helpers/dc_post_processing.rb#L52-L59 | train | Change the XPRODUCT to an INTERSECT | [
30522,
13366,
2689,
1035,
26726,
14127,
14194,
2102,
1035,
2000,
1035,
6840,
1001,
2342,
2000,
5047,
2177,
2121,
9181,
2008,
2079,
2025,
2031,
23561,
8909,
2015,
1011,
1011,
2122,
2097,
2022,
2586,
1997,
1998,
6840,
1001,
9181,
2709,
4983,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_chaos_schedule | def get_chaos_schedule(custom_headers:nil)
response = get_chaos_schedule_async(custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_chaos_schedule(custom_headers:nil)
response = get_chaos_schedule_async(custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_chaos_schedule",
"(",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_chaos_schedule_async",
"(",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"response",
".",
"nil?",
"end"
] | Get the Chaos Schedule defining when and how to run Chaos.
Gets the version of the Chaos Schedule in use and the Chaos Schedule that
defines when and how to run Chaos.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ChaosScheduleDescription] operation results. | [
"Get",
"the",
"Chaos",
"Schedule",
"defining",
"when",
"and",
"how",
"to",
"run",
"Chaos",
"."
] | 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#L18959-L18962 | train | Gets the current chaos schedule. | [
30522,
13366,
2131,
1035,
8488,
1035,
6134,
1006,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
8488,
1035,
6134,
1035,
2004,
6038,
2278,
1006,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
20346,
2015,
1007,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Katello/katello | app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb | Katello.Api::Rhsm::CandlepinProxiesController.regenerate_identity_certificates | def regenerate_identity_certificates
uuid = @host.subscription_facet.uuid
Candlepin::Consumer.new(uuid, @host.organization.label).regenerate_identity_certificates
render :json => Resources::Candlepin::Consumer.get(uuid)
end | ruby | def regenerate_identity_certificates
uuid = @host.subscription_facet.uuid
Candlepin::Consumer.new(uuid, @host.organization.label).regenerate_identity_certificates
render :json => Resources::Candlepin::Consumer.get(uuid)
end | [
"def",
"regenerate_identity_certificates",
"uuid",
"=",
"@host",
".",
"subscription_facet",
".",
"uuid",
"Candlepin",
"::",
"Consumer",
".",
"new",
"(",
"uuid",
",",
"@host",
".",
"organization",
".",
"label",
")",
".",
"regenerate_identity_certificates",
"render",
... | api :POST, "/consumers/:id", N_("Regenerate consumer identity")
param :id, String, :desc => N_("UUID of the consumer")
desc 'Schedules the consumer identity certificate regeneration' | [
"api",
":",
"POST",
"/",
"consumers",
"/",
":",
"id",
"N_",
"(",
"Regenerate",
"consumer",
"identity",
")",
"param",
":",
"id",
"String",
":",
"desc",
"=",
">",
"N_",
"(",
"UUID",
"of",
"the",
"consumer",
")",
"desc",
"Schedules",
"the",
"consumer",
... | a1c9280067607999cae43bab89b53ba870856b76 | https://github.com/Katello/katello/blob/a1c9280067607999cae43bab89b53ba870856b76/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb#L170-L174 | train | Regenerate identity certificates for the current user | [
30522,
13366,
19723,
24454,
3686,
1035,
4767,
1035,
17987,
1057,
21272,
1027,
1030,
3677,
1012,
15002,
1035,
2227,
2102,
1012,
1057,
21272,
13541,
8091,
1024,
1024,
7325,
1012,
2047,
1006,
1057,
21272,
1010,
1030,
3677,
1012,
3029,
1012,
38... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/pdk | lib/pdk/report.rb | PDK.Report.write_text | def write_text(target = self.class.default_target)
# Open a File Object for IO if target is a string containing a filename or path
target = File.open(target, 'w') if target.is_a? String
coverage_report = nil
events.each do |_tool, tool_events|
tool_events.each do |event|
if event.rspec_puppet_coverage?
coverage_report = event.to_text
else
target.puts(event.to_text) unless event.pass?
end
end
end
ensure
target.puts "\n#{coverage_report}" if coverage_report
target.close if target.is_a? File
end | ruby | def write_text(target = self.class.default_target)
# Open a File Object for IO if target is a string containing a filename or path
target = File.open(target, 'w') if target.is_a? String
coverage_report = nil
events.each do |_tool, tool_events|
tool_events.each do |event|
if event.rspec_puppet_coverage?
coverage_report = event.to_text
else
target.puts(event.to_text) unless event.pass?
end
end
end
ensure
target.puts "\n#{coverage_report}" if coverage_report
target.close if target.is_a? File
end | [
"def",
"write_text",
"(",
"target",
"=",
"self",
".",
"class",
".",
"default_target",
")",
"# Open a File Object for IO if target is a string containing a filename or path",
"target",
"=",
"File",
".",
"open",
"(",
"target",
",",
"'w'",
")",
"if",
"target",
".",
"is... | Renders the report as plain text.
This report is designed for interactive use by a human and so excludes
all passing events in order to be consise.
@param target [#write] an IO object that the report will be written to.
Defaults to PDK::Report.default_target. | [
"Renders",
"the",
"report",
"as",
"plain",
"text",
"."
] | 0d864aff62ffef04b5104addf399d0476afd71e7 | https://github.com/puppetlabs/pdk/blob/0d864aff62ffef04b5104addf399d0476afd71e7/lib/pdk/report.rb#L93-L110 | train | Write the text to the target file | [
30522,
13366,
4339,
1035,
3793,
1006,
4539,
1027,
2969,
1012,
2465,
1012,
12398,
1035,
4539,
1007,
1001,
2330,
1037,
5371,
4874,
2005,
22834,
2065,
4539,
2003,
1037,
5164,
4820,
1037,
5371,
18442,
2030,
4130,
4539,
1027,
5371,
1012,
2330,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.upload_file_chunk | def upload_file_chunk(content_path, session_id, content_range, timeout:60, custom_headers:nil)
response = upload_file_chunk_async(content_path, session_id, content_range, timeout:timeout, custom_headers:custom_headers).value!
nil
end | ruby | def upload_file_chunk(content_path, session_id, content_range, timeout:60, custom_headers:nil)
response = upload_file_chunk_async(content_path, session_id, content_range, timeout:timeout, custom_headers:custom_headers).value!
nil
end | [
"def",
"upload_file_chunk",
"(",
"content_path",
",",
"session_id",
",",
"content_range",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"upload_file_chunk_async",
"(",
"content_path",
",",
"session_id",
",",
"content_range",
"... | Uploads a file chunk to the image store relative path.
Uploads a file chunk to the image store with the specified upload session ID
and image store relative path. This API allows user to resume the file upload
operation. user doesn't have to restart the file upload from scratch whenever
there is a network interruption. Use this option if the file size is large.
To perform a resumable file upload, user need to break the file into multiple
chunks and upload these chunks to the image store one-by-one. Chunks don't
have to be uploaded in order. If the file represented by the image store
relative path already exists, it will be overwritten when the upload session
commits.
@param content_path [String] Relative path to file or folder in the image
store from its root.
@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 content_range [String] When uploading file chunks to the image store,
the Content-Range header field need to be configured and sent with a request.
The format should looks like "bytes
{First-Byte-Position}-{Last-Byte-Position}/{File-Length}". For example,
Content-Range:bytes 300-5000/20000 indicates that user is sending bytes 300
through 5,000 and the total file length is 20,000 bytes.
@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. | [
"Uploads",
"a",
"file",
"chunk",
"to",
"the",
"image",
"store",
"relative",
"path",
"."
] | 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#L20192-L20195 | train | Uploads a file chunk to a container. | [
30522,
13366,
2039,
30524,
2039,
11066,
1035,
5371,
1035,
20000,
1035,
2004,
6038,
2278,
1006,
4180,
1035,
4130,
1010,
5219,
1035,
8909,
1010,
4180,
1035,
2846,
1010,
2051,
5833,
1024,
2051,
5833,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sunspot/sunspot | sunspot/lib/sunspot/composite_setup.rb | Sunspot.CompositeSetup.text_fields_hash | def text_fields_hash
@text_fields_hash ||=
setups.inject({}) do |hash, setup|
setup.all_text_fields.each do |text_field|
(hash[text_field.name] ||= Set.new) << text_field
end
hash
end
end | ruby | def text_fields_hash
@text_fields_hash ||=
setups.inject({}) do |hash, setup|
setup.all_text_fields.each do |text_field|
(hash[text_field.name] ||= Set.new) << text_field
end
hash
end
end | [
"def",
"text_fields_hash",
"@text_fields_hash",
"||=",
"setups",
".",
"inject",
"(",
"{",
"}",
")",
"do",
"|",
"hash",
",",
"setup",
"|",
"setup",
".",
"all_text_fields",
".",
"each",
"do",
"|",
"text_field",
"|",
"(",
"hash",
"[",
"text_field",
".",
"na... | Return a hash of field names to text field objects, containing all fields
that are configured for any of the types enclosed.
==== Returns
Hash:: Hash of field names to text field objects. | [
"Return",
"a",
"hash",
"of",
"field",
"names",
"to",
"text",
"field",
"objects",
"containing",
"all",
"fields",
"that",
"are",
"configured",
"for",
"any",
"of",
"the",
"types",
"enclosed",
"."
] | 31dd76cd7a14a4ef7bd541de97483d8cd72ff685 | https://github.com/sunspot/sunspot/blob/31dd76cd7a14a4ef7bd541de97483d8cd72ff685/sunspot/lib/sunspot/composite_setup.rb#L129-L137 | train | Returns a hash of all text fields that are in the correct order. | [
30522,
13366,
3793,
1035,
4249,
1035,
23325,
1030,
3793,
1035,
4249,
1035,
23325,
1064,
1064,
1027,
16437,
2015,
1012,
1999,
20614,
1006,
1063,
1065,
1007,
2079,
1064,
23325,
1010,
16437,
1064,
16437,
1012,
2035,
1035,
3793,
1035,
4249,
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... |
puppetlabs/puppet | lib/puppet/type.rb | Puppet.Type.delete | def delete(attr)
attr = attr.intern
if @parameters.has_key?(attr)
@parameters.delete(attr)
else
raise Puppet::DevError.new(_("Undefined attribute '%{attribute}' in %{name}") % { attribute: attr, name: self})
end
end | ruby | def delete(attr)
attr = attr.intern
if @parameters.has_key?(attr)
@parameters.delete(attr)
else
raise Puppet::DevError.new(_("Undefined attribute '%{attribute}' in %{name}") % { attribute: attr, name: self})
end
end | [
"def",
"delete",
"(",
"attr",
")",
"attr",
"=",
"attr",
".",
"intern",
"if",
"@parameters",
".",
"has_key?",
"(",
"attr",
")",
"@parameters",
".",
"delete",
"(",
"attr",
")",
"else",
"raise",
"Puppet",
"::",
"DevError",
".",
"new",
"(",
"_",
"(",
"\"... | Removes an attribute from the object; useful in testing or in cleanup
when an error has been encountered
@todo Don't know what the attr is (name or Property/Parameter?). Guessing it is a String name...
@todo Is it possible to delete a meta-parameter?
@todo What does delete mean? Is it deleted from the type or is its value state 'is'/'should' deleted?
@param attr [String] the attribute to delete from this object. WHAT IS THE TYPE?
@raise [Puppet::DecError] when an attempt is made to delete an attribute that does not exists. | [
"Removes",
"an",
"attribute",
"from",
"the",
"object",
";",
"useful",
"in",
"testing",
"or",
"in",
"cleanup",
"when",
"an",
"error",
"has",
"been",
"encountered"
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/type.rb#L700-L707 | train | Delete an attribute from the parameters hash | [
30522,
13366,
3972,
12870,
1006,
2012,
16344,
1007,
2012,
16344,
1027,
2012,
16344,
1012,
25204,
2065,
1030,
11709,
1012,
2038,
1035,
3145,
1029,
1006,
2012,
16344,
1007,
1030,
11709,
1012,
3972,
12870,
1006,
2012,
16344,
1007,
2842,
5333,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
tongueroo/jets | lib/jets/controller/rack/adapter.rb | Jets::Controller::Rack.Adapter.convert_to_api_gateway | def convert_to_api_gateway(status, headers, body)
base64 = headers["x-jets-base64"] == 'yes'
body = body.respond_to?(:read) ? body.read : body
body = Base64.encode64(body) if base64
resp = {
"statusCode" => status,
"headers" => headers,
"body" => body,
"isBase64Encoded" => base64,
}
adjust_for_elb(resp)
resp
end | ruby | def convert_to_api_gateway(status, headers, body)
base64 = headers["x-jets-base64"] == 'yes'
body = body.respond_to?(:read) ? body.read : body
body = Base64.encode64(body) if base64
resp = {
"statusCode" => status,
"headers" => headers,
"body" => body,
"isBase64Encoded" => base64,
}
adjust_for_elb(resp)
resp
end | [
"def",
"convert_to_api_gateway",
"(",
"status",
",",
"headers",
",",
"body",
")",
"base64",
"=",
"headers",
"[",
"\"x-jets-base64\"",
"]",
"==",
"'yes'",
"body",
"=",
"body",
".",
"respond_to?",
"(",
":read",
")",
"?",
"body",
".",
"read",
":",
"body",
"... | Transform the structure to AWS_PROXY compatible structure
http://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-output-format | [
"Transform",
"the",
"structure",
"to",
"AWS_PROXY",
"compatible",
"structure",
"http",
":",
"//",
"docs",
".",
"aws",
".",
"amazon",
".",
"com",
"/",
"apigateway",
"/",
"latest",
"/",
"developerguide",
"/",
"set",
"-",
"up",
"-",
"lambda",
"-",
"proxy",
... | 46943a519224067e58aa3e2d5656e3ca083150f9 | https://github.com/tongueroo/jets/blob/46943a519224067e58aa3e2d5656e3ca083150f9/lib/jets/controller/rack/adapter.rb#L32-L45 | train | converts the response to an api gateway response | [
30522,
13366,
10463,
1035,
2000,
1035,
17928,
1035,
11909,
1006,
3570,
1010,
20346,
2015,
1010,
2303,
1007,
2918,
21084,
1027,
20346,
2015,
1031,
1000,
1060,
1011,
9924,
1011,
2918,
30524,
1000,
1027,
1028,
3570,
1010,
1000,
20346,
2015,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mikel/mail | lib/mail/elements/address.rb | Mail.Address.comments | def comments
parse unless @parsed
comments = get_comments
if comments.nil? || comments.none?
nil
else
comments.map { |c| c.squeeze(Constants::SPACE) }
end
end | ruby | def comments
parse unless @parsed
comments = get_comments
if comments.nil? || comments.none?
nil
else
comments.map { |c| c.squeeze(Constants::SPACE) }
end
end | [
"def",
"comments",
"parse",
"unless",
"@parsed",
"comments",
"=",
"get_comments",
"if",
"comments",
".",
"nil?",
"||",
"comments",
".",
"none?",
"nil",
"else",
"comments",
".",
"map",
"{",
"|",
"c",
"|",
"c",
".",
"squeeze",
"(",
"Constants",
"::",
"SPAC... | Returns an array of comments that are in the email, or nil if there
are no comments
a = Address.new('Mikel Lindsaar (My email address) <mikel@test.lindsaar.net>')
a.comments #=> ['My email address']
b = Address.new('Mikel Lindsaar <mikel@test.lindsaar.net>')
b.comments #=> nil | [
"Returns",
"an",
"array",
"of",
"comments",
"that",
"are",
"in",
"the",
"email",
"or",
"nil",
"if",
"there",
"are",
"no",
"comments"
] | fb53fb369eb2bf0494ac70675970c90cdcc3f495 | https://github.com/mikel/mail/blob/fb53fb369eb2bf0494ac70675970c90cdcc3f495/lib/mail/elements/address.rb#L132-L140 | train | Get the array of the comments of the current page. | [
30522,
13366,
7928,
11968,
3366,
4983,
1030,
11968,
6924,
7928,
1027,
2131,
1035,
7928,
2065,
7928,
1012,
9152,
2140,
1029,
1064,
1064,
7928,
1012,
3904,
1029,
9152,
2140,
2842,
7928,
1012,
4949,
1063,
1064,
1039,
1064,
1039,
1012,
11025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GeorgeKaraszi/ActiveRecordExtended | lib/active_record_extended/utilities.rb | ActiveRecordExtended.Utilities.flatten_to_sql | def flatten_to_sql(*values)
flatten_safely(values) do |value|
value = yield value if block_given?
to_arel_sql(value)
end
end | ruby | def flatten_to_sql(*values)
flatten_safely(values) do |value|
value = yield value if block_given?
to_arel_sql(value)
end
end | [
"def",
"flatten_to_sql",
"(",
"*",
"values",
")",
"flatten_safely",
"(",
"values",
")",
"do",
"|",
"value",
"|",
"value",
"=",
"yield",
"value",
"if",
"block_given?",
"to_arel_sql",
"(",
"value",
")",
"end",
"end"
] | We need to ensure we can flatten nested ActiveRecord::Relations
that might have been nested due to the (splat)*args parameters
Note: calling `Array.flatten[!]/1` will actually remove all AR relations from the array. | [
"We",
"need",
"to",
"ensure",
"we",
"can",
"flatten",
"nested",
"ActiveRecord",
"::",
"Relations",
"that",
"might",
"have",
"been",
"nested",
"due",
"to",
"the",
"(",
"splat",
")",
"*",
"args",
"parameters"
] | aca74eebb64b9957a2c8765bef6e43c7d5736fd8 | https://github.com/GeorgeKaraszi/ActiveRecordExtended/blob/aca74eebb64b9957a2c8765bef6e43c7d5736fd8/lib/active_record_extended/utilities.rb#L12-L17 | train | Convert the array of values to SQL. | [
30522,
13366,
4257,
6528,
1035,
2000,
1035,
29296,
1006,
1008,
5300,
1007,
4257,
6528,
1035,
9689,
1006,
5300,
1007,
2079,
1064,
3643,
1064,
3643,
1027,
10750,
3643,
2065,
3796,
1035,
2445,
1029,
2000,
1035,
2024,
2140,
1035,
29296,
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... |
jnunemaker/flipper | lib/flipper/adapter.rb | Flipper.Adapter.get_multi | def get_multi(features)
result = {}
features.each do |feature|
result[feature.key] = get(feature)
end
result
end | ruby | def get_multi(features)
result = {}
features.each do |feature|
result[feature.key] = get(feature)
end
result
end | [
"def",
"get_multi",
"(",
"features",
")",
"result",
"=",
"{",
"}",
"features",
".",
"each",
"do",
"|",
"feature",
"|",
"result",
"[",
"feature",
".",
"key",
"]",
"=",
"get",
"(",
"feature",
")",
"end",
"result",
"end"
] | Public: Get multiple features in one call. Defaults to one get per
feature. Feel free to override per adapter to make this more efficient and
reduce network calls. | [
"Public",
":",
"Get",
"multiple",
"features",
"in",
"one",
"call",
".",
"Defaults",
"to",
"one",
"get",
"per",
"feature",
".",
"Feel",
"free",
"to",
"override",
"per",
"adapter",
"to",
"make",
"this",
"more",
"efficient",
"and",
"reduce",
"network",
"calls... | df0352b663ad3ed45d68710f10a8170249ff9d78 | https://github.com/jnunemaker/flipper/blob/df0352b663ad3ed45d68710f10a8170249ff9d78/lib/flipper/adapter.rb#L36-L42 | train | Get a multi - feature list | [
30522,
13366,
2131,
1035,
4800,
1006,
2838,
1007,
2765,
1027,
1063,
1065,
2838,
1012,
2169,
2079,
1064,
3444,
1064,
2765,
1031,
3444,
1012,
3145,
1033,
1027,
2131,
1006,
3444,
1007,
2203,
2765,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/queries/decidim/participatory_processes_with_user_role.rb | Decidim.ParticipatoryProcessesWithUserRole.query | def query
# Admin users have all role privileges for all organization processes
return ParticipatoryProcesses::OrganizationParticipatoryProcesses.new(user.organization).query if user.admin?
ParticipatoryProcess.where(id: process_ids)
end | ruby | def query
# Admin users have all role privileges for all organization processes
return ParticipatoryProcesses::OrganizationParticipatoryProcesses.new(user.organization).query if user.admin?
ParticipatoryProcess.where(id: process_ids)
end | [
"def",
"query",
"# Admin users have all role privileges for all organization processes",
"return",
"ParticipatoryProcesses",
"::",
"OrganizationParticipatoryProcesses",
".",
"new",
"(",
"user",
".",
"organization",
")",
".",
"query",
"if",
"user",
".",
"admin?",
"Participator... | Initializes the class.
user - a User that needs to find which processes can manage
role - (optional) a Symbol to specify the role privilege
Finds the ParticipatoryProcesses that the given user has role privileges.
If the special role ':any' is provided it returns all processes where
the user has some kind of role privilege.
Returns an ActiveRecord::Relation. | [
"Initializes",
"the",
"class",
"."
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/app/queries/decidim/participatory_processes_with_user_role.rb#L29-L34 | train | Returns the number of process ids for the process | [
30522,
13366,
23032,
1001,
4748,
10020,
5198,
2031,
2035,
2535,
14310,
2005,
2035,
3029,
6194,
2709,
2112,
28775,
4502,
7062,
21572,
9623,
8583,
1024,
1024,
3029,
19362,
4588,
11514,
14049,
21572,
9623,
8583,
1012,
2047,
1006,
5310,
1012,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activerecord/lib/active_record/relation/query_methods.rb | ActiveRecord.QueryMethods.validate_order_args | def validate_order_args(args)
args.each do |arg|
next unless arg.is_a?(Hash)
arg.each do |_key, value|
unless VALID_DIRECTIONS.include?(value)
raise ArgumentError,
"Direction \"#{value}\" is invalid. Valid directions are: #{VALID_DIRECTIONS.to_a.inspect}"
end
end
end
end | ruby | def validate_order_args(args)
args.each do |arg|
next unless arg.is_a?(Hash)
arg.each do |_key, value|
unless VALID_DIRECTIONS.include?(value)
raise ArgumentError,
"Direction \"#{value}\" is invalid. Valid directions are: #{VALID_DIRECTIONS.to_a.inspect}"
end
end
end
end | [
"def",
"validate_order_args",
"(",
"args",
")",
"args",
".",
"each",
"do",
"|",
"arg",
"|",
"next",
"unless",
"arg",
".",
"is_a?",
"(",
"Hash",
")",
"arg",
".",
"each",
"do",
"|",
"_key",
",",
"value",
"|",
"unless",
"VALID_DIRECTIONS",
".",
"include?"... | :nodoc: | [
":",
"nodoc",
":"
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activerecord/lib/active_record/relation/query_methods.rb#L1243-L1253 | train | Validate order arguments | [
30522,
13366,
9398,
3686,
1035,
2344,
1035,
12098,
5620,
1006,
12098,
5620,
1007,
12098,
5620,
1012,
2169,
2079,
1064,
12098,
2290,
1064,
2279,
4983,
12098,
2290,
1012,
2003,
1035,
1037,
1029,
1006,
23325,
1007,
12098,
2290,
1012,
2169,
207... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/2019-03-01/generated/azure_mgmt_compute/virtual_machine_scale_set_extensions.rb | Azure::Compute::Mgmt::V2019_03_01.VirtualMachineScaleSetExtensions.create_or_update | def create_or_update(resource_group_name, vm_scale_set_name, vmss_extension_name, extension_parameters, custom_headers:nil)
response = create_or_update_async(resource_group_name, vm_scale_set_name, vmss_extension_name, extension_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_or_update(resource_group_name, vm_scale_set_name, vmss_extension_name, extension_parameters, custom_headers:nil)
response = create_or_update_async(resource_group_name, vm_scale_set_name, vmss_extension_name, extension_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_or_update",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"vmss_extension_name",
",",
"extension_parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_or_update_async",
"(",
"resource_group_name",
",",
"vm_scale_set_name",... | The operation to create or update an extension.
@param resource_group_name [String] The name of the resource group.
@param vm_scale_set_name [String] The name of the VM scale set where the
extension should be create or updated.
@param vmss_extension_name [String] The name of the VM scale set extension.
@param extension_parameters [VirtualMachineScaleSetExtension] Parameters
supplied to the Create VM scale set Extension operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [VirtualMachineScaleSetExtension] operation results. | [
"The",
"operation",
"to",
"create",
"or",
"update",
"an",
"extension",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2019-03-01/generated/azure_mgmt_compute/virtual_machine_scale_set_extensions.rb#L38-L41 | train | Creates or updates an extension. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
4094,
1035,
2275,
1035,
2171,
1010,
1058,
5244,
2015,
1035,
5331,
1035,
2171,
1010,
5331,
1035,
11709,
1010,
7661,
1035,
20346,
2015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
meew0/discordrb | lib/discordrb/container.rb | Discordrb.EventContainer.include_events | def include_events(container)
handlers = container.instance_variable_get '@event_handlers'
return unless handlers
@event_handlers ||= {}
@event_handlers.merge!(handlers) { |_, old, new| old + new }
end | ruby | def include_events(container)
handlers = container.instance_variable_get '@event_handlers'
return unless handlers
@event_handlers ||= {}
@event_handlers.merge!(handlers) { |_, old, new| old + new }
end | [
"def",
"include_events",
"(",
"container",
")",
"handlers",
"=",
"container",
".",
"instance_variable_get",
"'@event_handlers'",
"return",
"unless",
"handlers",
"@event_handlers",
"||=",
"{",
"}",
"@event_handlers",
".",
"merge!",
"(",
"handlers",
")",
"{",
"|",
"... | Adds all event handlers from another container into this one. Existing event handlers will be overwritten.
@param container [Module] A module that `extend`s {EventContainer} from which the handlers will be added. | [
"Adds",
"all",
"event",
"handlers",
"from",
"another",
"container",
"into",
"this",
"one",
".",
"Existing",
"event",
"handlers",
"will",
"be",
"overwritten",
"."
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/container.rb#L526-L532 | train | Include the event handlers for the given container. | [
30522,
13366,
2421,
1035,
2824,
1006,
11661,
1007,
28213,
2015,
1027,
11661,
1012,
6013,
1035,
8023,
1035,
2131,
1005,
1030,
2724,
1035,
28213,
2015,
1005,
2709,
4983,
28213,
2015,
1030,
2724,
1035,
28213,
2015,
1064,
1064,
1027,
1063,
1065... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.list_intent_suggestions | def list_intent_suggestions(app_id, version_id, intent_id, take:100, custom_headers:nil)
response = list_intent_suggestions_async(app_id, version_id, intent_id, take:take, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_intent_suggestions(app_id, version_id, intent_id, take:100, custom_headers:nil)
response = list_intent_suggestions_async(app_id, version_id, intent_id, take:take, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_intent_suggestions",
"(",
"app_id",
",",
"version_id",
",",
"intent_id",
",",
"take",
":",
"100",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_intent_suggestions_async",
"(",
"app_id",
",",
"version_id",
",",
"intent_id",
",",
"tak... | Suggests example utterances that would improve the accuracy of the intent
model in a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param intent_id The intent classifier ID.
@param take [Integer] The number of entries to return. Maximum page size is
500. Default is 100.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array] operation results. | [
"Suggests",
"example",
"utterances",
"that",
"would",
"improve",
"the",
"accuracy",
"of",
"the",
"intent",
"model",
"in",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L3854-L3857 | train | Gets a list of suggestions for an intent. | [
30522,
13366,
2862,
1035,
7848,
1035,
15690,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
7848,
1035,
8909,
1010,
2202,
1024,
2531,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
7848,
1035,
15690,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
watir/watir | lib/watir/radio_set.rb | Watir.RadioSet.select | def select(str_or_rx)
%i[value label].each do |key|
radio = radio(key => str_or_rx)
next unless radio.exist?
radio.click unless radio.selected?
return key == :value ? radio.value : radio.text
end
raise UnknownObjectException, "Unable to locate radio matching #{str_or_rx.inspect}"
end | ruby | def select(str_or_rx)
%i[value label].each do |key|
radio = radio(key => str_or_rx)
next unless radio.exist?
radio.click unless radio.selected?
return key == :value ? radio.value : radio.text
end
raise UnknownObjectException, "Unable to locate radio matching #{str_or_rx.inspect}"
end | [
"def",
"select",
"(",
"str_or_rx",
")",
"%i[",
"value",
"label",
"]",
".",
"each",
"do",
"|",
"key",
"|",
"radio",
"=",
"radio",
"(",
"key",
"=>",
"str_or_rx",
")",
"next",
"unless",
"radio",
".",
"exist?",
"radio",
".",
"click",
"unless",
"radio",
"... | Select the radio button whose value or label matches the given string.
@param [String, Regexp] str_or_rx
@raise [Watir::Exception::UnknownObjectException] if the Radio does not exist.
@return [String] The value or text of the radio selected. | [
"Select",
"the",
"radio",
"button",
"whose",
"value",
"or",
"label",
"matches",
"the",
"given",
"string",
"."
] | 2d8db09811c6221ae401b85b2f61f5fa66e463a3 | https://github.com/watir/watir/blob/2d8db09811c6221ae401b85b2f61f5fa66e463a3/lib/watir/radio_set.rb#L132-L141 | train | Select a radio by its name or value or label | [
30522,
13366,
7276,
1006,
2358,
2099,
1035,
2030,
1035,
1054,
2595,
1007,
1003,
1045,
1031,
3643,
3830,
1033,
1012,
2169,
2079,
1064,
3145,
1064,
2557,
1027,
2557,
1006,
3145,
1027,
1028,
2358,
2099,
1035,
2030,
1035,
1054,
2595,
1007,
22... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mikel/mail | lib/mail/network/retriever_methods/pop3.rb | Mail.POP3.find | def find(options = nil, &block)
options = validate_options(options)
start do |pop3|
mails = pop3.mails
pop3.reset # Clears all "deleted" marks. This prevents non-explicit/accidental deletions due to server settings.
mails.sort! { |m1, m2| m2.number <=> m1.number } if options[:what] == :last
mails = mails.first(options[:count]) if options[:count].is_a? Integer
if options[:what].to_sym == :last && options[:order].to_sym == :desc ||
options[:what].to_sym == :first && options[:order].to_sym == :asc ||
mails.reverse!
end
if block_given?
mails.each do |mail|
new_message = Mail.new(mail.pop)
new_message.mark_for_delete = true if options[:delete_after_find]
yield new_message
mail.delete if options[:delete_after_find] && new_message.is_marked_for_delete? # Delete if still marked for delete
end
else
emails = []
mails.each do |mail|
emails << Mail.new(mail.pop)
mail.delete if options[:delete_after_find]
end
emails.size == 1 && options[:count] == 1 ? emails.first : emails
end
end
end | ruby | def find(options = nil, &block)
options = validate_options(options)
start do |pop3|
mails = pop3.mails
pop3.reset # Clears all "deleted" marks. This prevents non-explicit/accidental deletions due to server settings.
mails.sort! { |m1, m2| m2.number <=> m1.number } if options[:what] == :last
mails = mails.first(options[:count]) if options[:count].is_a? Integer
if options[:what].to_sym == :last && options[:order].to_sym == :desc ||
options[:what].to_sym == :first && options[:order].to_sym == :asc ||
mails.reverse!
end
if block_given?
mails.each do |mail|
new_message = Mail.new(mail.pop)
new_message.mark_for_delete = true if options[:delete_after_find]
yield new_message
mail.delete if options[:delete_after_find] && new_message.is_marked_for_delete? # Delete if still marked for delete
end
else
emails = []
mails.each do |mail|
emails << Mail.new(mail.pop)
mail.delete if options[:delete_after_find]
end
emails.size == 1 && options[:count] == 1 ? emails.first : emails
end
end
end | [
"def",
"find",
"(",
"options",
"=",
"nil",
",",
"&",
"block",
")",
"options",
"=",
"validate_options",
"(",
"options",
")",
"start",
"do",
"|",
"pop3",
"|",
"mails",
"=",
"pop3",
".",
"mails",
"pop3",
".",
"reset",
"# Clears all \"deleted\" marks. This preve... | Find emails in a POP3 mailbox. Without any options, the 5 last received emails are returned.
Possible options:
what: last or first emails. The default is :first.
order: order of emails returned. Possible values are :asc or :desc. Default value is :asc.
count: number of emails to retrieve. The default value is 10. A value of 1 returns an
instance of Message, not an array of Message instances.
delete_after_find: flag for whether to delete each retreived email after find. Default
is false. Use #find_and_delete if you would like this to default to true. | [
"Find",
"emails",
"in",
"a",
"POP3",
"mailbox",
".",
"Without",
"any",
"options",
"the",
"5",
"last",
"received",
"emails",
"are",
"returned",
"."
] | fb53fb369eb2bf0494ac70675970c90cdcc3f495 | https://github.com/mikel/mail/blob/fb53fb369eb2bf0494ac70675970c90cdcc3f495/lib/mail/network/retriever_methods/pop3.rb#L60-L91 | train | Find a message in the server | [
30522,
13366,
2424,
1006,
7047,
1027,
9152,
2140,
1010,
1004,
3796,
1007,
7047,
1027,
9398,
3686,
1035,
7047,
1006,
7047,
1007,
2707,
2079,
1064,
3769,
2509,
1064,
5653,
2015,
1027,
3769,
2509,
1012,
5653,
2015,
3769,
2509,
1012,
25141,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
samvera/hyrax | app/controllers/concerns/hyrax/works_controller_behavior.rb | Hyrax.WorksControllerBehavior.show | def show
@user_collections = user_collections
respond_to do |wants|
wants.html { presenter && parent_presenter }
wants.json do
# load and authorize @curation_concern manually because it's skipped for html
@curation_concern = _curation_concern_type.find(params[:id]) unless curation_concern
authorize! :show, @curation_concern
render :show, status: :ok
end
additional_response_formats(wants)
wants.ttl do
render body: presenter.export_as_ttl, content_type: 'text/turtle'
end
wants.jsonld do
render body: presenter.export_as_jsonld, content_type: 'application/ld+json'
end
wants.nt do
render body: presenter.export_as_nt, content_type: 'application/n-triples'
end
end
end | ruby | def show
@user_collections = user_collections
respond_to do |wants|
wants.html { presenter && parent_presenter }
wants.json do
# load and authorize @curation_concern manually because it's skipped for html
@curation_concern = _curation_concern_type.find(params[:id]) unless curation_concern
authorize! :show, @curation_concern
render :show, status: :ok
end
additional_response_formats(wants)
wants.ttl do
render body: presenter.export_as_ttl, content_type: 'text/turtle'
end
wants.jsonld do
render body: presenter.export_as_jsonld, content_type: 'application/ld+json'
end
wants.nt do
render body: presenter.export_as_nt, content_type: 'application/n-triples'
end
end
end | [
"def",
"show",
"@user_collections",
"=",
"user_collections",
"respond_to",
"do",
"|",
"wants",
"|",
"wants",
".",
"html",
"{",
"presenter",
"&&",
"parent_presenter",
"}",
"wants",
".",
"json",
"do",
"# load and authorize @curation_concern manually because it's skipped for... | Finds a solr document matching the id and sets @presenter
@raise CanCan::AccessDenied if the document is not found or the user doesn't have access to it. | [
"Finds",
"a",
"solr",
"document",
"matching",
"the",
"id",
"and",
"sets"
] | e2b4f56e829a53b1f11296324736e9d5b8c9ee5f | https://github.com/samvera/hyrax/blob/e2b4f56e829a53b1f11296324736e9d5b8c9ee5f/app/controllers/concerns/hyrax/works_controller_behavior.rb#L69-L91 | train | This method is called when a user is logged in as a curation concern | [
30522,
13366,
2265,
1030,
5310,
1035,
6407,
1027,
5310,
1035,
6407,
6869,
1035,
2000,
2079,
1064,
4122,
1064,
4122,
1012,
16129,
1063,
10044,
1004,
1004,
6687,
1035,
10044,
1065,
4122,
1012,
1046,
3385,
2079,
1001,
7170,
1998,
3166,
4697,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
meew0/discordrb | lib/discordrb/data/member.rb | Discordrb.Member.add_role | def add_role(role, reason = nil)
role_ids = role_id_array(role)
if role_ids.count == 1
API::Server.add_member_role(@bot.token, @server.id, @user.id, role_ids[0], reason)
else
old_role_ids = @roles.map(&:id)
new_role_ids = (old_role_ids + role_ids).uniq
API::Server.update_member(@bot.token, @server.id, @user.id, roles: new_role_ids, reason: reason)
end
end | ruby | def add_role(role, reason = nil)
role_ids = role_id_array(role)
if role_ids.count == 1
API::Server.add_member_role(@bot.token, @server.id, @user.id, role_ids[0], reason)
else
old_role_ids = @roles.map(&:id)
new_role_ids = (old_role_ids + role_ids).uniq
API::Server.update_member(@bot.token, @server.id, @user.id, roles: new_role_ids, reason: reason)
end
end | [
"def",
"add_role",
"(",
"role",
",",
"reason",
"=",
"nil",
")",
"role_ids",
"=",
"role_id_array",
"(",
"role",
")",
"if",
"role_ids",
".",
"count",
"==",
"1",
"API",
"::",
"Server",
".",
"add_member_role",
"(",
"@bot",
".",
"token",
",",
"@server",
"."... | Adds one or more roles to this member.
@param role [Role, Array<Role, #resolve_id>, #resolve_id] The role(s) to add.
@param reason [String] The reason the user's roles are being changed. | [
"Adds",
"one",
"or",
"more",
"roles",
"to",
"this",
"member",
"."
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/data/member.rb#L119-L129 | train | Add a role to the member | [
30522,
13366,
5587,
1035,
2535,
1006,
2535,
1010,
3114,
1027,
9152,
2140,
1007,
2535,
1035,
8909,
2015,
1027,
2535,
1035,
8909,
1035,
9140,
1006,
2535,
1007,
2065,
2535,
1035,
8909,
2015,
1012,
4175,
1027,
1027,
1015,
17928,
1024,
1024,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/haml-lint | lib/haml_lint/file_finder.rb | HamlLint.FileFinder.extract_files_from | def extract_files_from(patterns) # rubocop:disable MethodLength
files = []
patterns.each do |pattern|
if File.file?(pattern)
files << pattern
else
begin
::Find.find(pattern) do |file|
files << file if haml_file?(file)
end
rescue ::Errno::ENOENT
# File didn't exist; it might be a file glob pattern
matches = ::Dir.glob(pattern)
if matches.any?
files += matches
else
# One of the paths specified does not exist; raise a more
# descriptive exception so we know which one
raise HamlLint::Exceptions::InvalidFilePath,
"File path '#{pattern}' does not exist"
end
end
end
end
files.uniq.sort.map { |file| normalize_path(file) }
end | ruby | def extract_files_from(patterns) # rubocop:disable MethodLength
files = []
patterns.each do |pattern|
if File.file?(pattern)
files << pattern
else
begin
::Find.find(pattern) do |file|
files << file if haml_file?(file)
end
rescue ::Errno::ENOENT
# File didn't exist; it might be a file glob pattern
matches = ::Dir.glob(pattern)
if matches.any?
files += matches
else
# One of the paths specified does not exist; raise a more
# descriptive exception so we know which one
raise HamlLint::Exceptions::InvalidFilePath,
"File path '#{pattern}' does not exist"
end
end
end
end
files.uniq.sort.map { |file| normalize_path(file) }
end | [
"def",
"extract_files_from",
"(",
"patterns",
")",
"# rubocop:disable MethodLength",
"files",
"=",
"[",
"]",
"patterns",
".",
"each",
"do",
"|",
"pattern",
"|",
"if",
"File",
".",
"file?",
"(",
"pattern",
")",
"files",
"<<",
"pattern",
"else",
"begin",
"::",... | Extract the list of matching files given the list of glob patterns, file
paths, and directories.
@param patterns [Array<String>]
@return [Array<String>] | [
"Extract",
"the",
"list",
"of",
"matching",
"files",
"given",
"the",
"list",
"of",
"glob",
"patterns",
"file",
"paths",
"and",
"directories",
"."
] | 024c773667e54cf88db938c2b368977005d70ee8 | https://github.com/sds/haml-lint/blob/024c773667e54cf88db938c2b368977005d70ee8/lib/haml_lint/file_finder.rb#L43-L70 | train | Extract the files from the given list of patterns | [
30522,
13366,
14817,
1035,
6764,
1035,
2013,
1006,
7060,
1007,
1001,
14548,
24163,
2361,
1024,
4487,
19150,
4118,
7770,
13512,
2232,
6764,
1027,
1031,
1033,
7060,
1012,
2169,
2079,
1064,
5418,
1064,
2065,
5371,
1012,
5371,
1029,
1006,
5418,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/generator/entry.rb | GitHubChangelogGenerator.Entry.generate_header | def generate_header(newer_tag_name, newer_tag_link, newer_tag_time, older_tag_name, project_url)
header = ""
# Generate date string:
time_string = newer_tag_time.strftime(@options[:date_format])
# Generate tag name and link
release_url = if @options[:release_url]
format(@options[:release_url], newer_tag_link)
else
"#{project_url}/tree/#{newer_tag_link}"
end
header += if newer_tag_name.equal?(@options[:unreleased_label])
"## [#{newer_tag_name}](#{release_url})\n\n"
else
"## [#{newer_tag_name}](#{release_url}) (#{time_string})\n\n"
end
if @options[:compare_link] && older_tag_name
# Generate compare link
header += "[Full Changelog](#{project_url}/compare/#{older_tag_name}...#{newer_tag_link})\n\n"
end
header
end | ruby | def generate_header(newer_tag_name, newer_tag_link, newer_tag_time, older_tag_name, project_url)
header = ""
# Generate date string:
time_string = newer_tag_time.strftime(@options[:date_format])
# Generate tag name and link
release_url = if @options[:release_url]
format(@options[:release_url], newer_tag_link)
else
"#{project_url}/tree/#{newer_tag_link}"
end
header += if newer_tag_name.equal?(@options[:unreleased_label])
"## [#{newer_tag_name}](#{release_url})\n\n"
else
"## [#{newer_tag_name}](#{release_url}) (#{time_string})\n\n"
end
if @options[:compare_link] && older_tag_name
# Generate compare link
header += "[Full Changelog](#{project_url}/compare/#{older_tag_name}...#{newer_tag_link})\n\n"
end
header
end | [
"def",
"generate_header",
"(",
"newer_tag_name",
",",
"newer_tag_link",
",",
"newer_tag_time",
",",
"older_tag_name",
",",
"project_url",
")",
"header",
"=",
"\"\"",
"# Generate date string:",
"time_string",
"=",
"newer_tag_time",
".",
"strftime",
"(",
"@options",
"["... | Generates header text for an entry.
@param [String] newer_tag_name The name of a newer tag
@param [String] newer_tag_link Used for URL generation. Could be same as #newer_tag_name or some specific value, like HEAD
@param [Time] newer_tag_time Time when the newer tag was created
@param [String] older_tag_name The name of an older tag; used for URLs.
@param [String] project_url URL for the current project.
@return [String] Header text content. | [
"Generates",
"header",
"text",
"for",
"an",
"entry",
"."
] | f18c64b5cc0d7473b059275b88385ac11ca8b564 | https://github.com/github-changelog-generator/github-changelog-generator/blob/f18c64b5cc0d7473b059275b88385ac11ca8b564/lib/github_changelog_generator/generator/entry.rb#L87-L111 | train | Generate the header for the tag | [
30522,
13366,
9699,
1035,
20346,
1006,
10947,
1035,
6415,
1035,
2171,
1010,
10947,
1035,
6415,
1035,
4957,
1010,
10947,
1035,
6415,
1035,
2051,
1010,
3080,
1035,
6415,
1035,
2171,
1010,
2622,
1035,
24471,
2140,
1007,
20346,
1027,
1000,
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... |
rails/rails | activemodel/lib/active_model/errors.rb | ActiveModel.Errors.delete | def delete(attribute, type = nil, **options)
attribute, type, options = normalize_arguments(attribute, type, options)
matches = where(attribute, type, options)
matches.each do |error|
@errors.delete(error)
end
matches.map(&:message)
end | ruby | def delete(attribute, type = nil, **options)
attribute, type, options = normalize_arguments(attribute, type, options)
matches = where(attribute, type, options)
matches.each do |error|
@errors.delete(error)
end
matches.map(&:message)
end | [
"def",
"delete",
"(",
"attribute",
",",
"type",
"=",
"nil",
",",
"**",
"options",
")",
"attribute",
",",
"type",
",",
"options",
"=",
"normalize_arguments",
"(",
"attribute",
",",
"type",
",",
"options",
")",
"matches",
"=",
"where",
"(",
"attribute",
",... | Delete messages for +key+. Returns the deleted messages.
person.errors[:name] # => ["cannot be nil"]
person.errors.delete(:name) # => ["cannot be nil"]
person.errors[:name] # => [] | [
"Delete",
"messages",
"for",
"+",
"key",
"+",
".",
"Returns",
"the",
"deleted",
"messages",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activemodel/lib/active_model/errors.rb#L196-L203 | train | Delete an error from the database | [
30522,
13366,
3972,
12870,
1006,
17961,
1010,
2828,
1027,
9152,
2140,
1010,
1008,
1008,
7047,
1007,
17961,
1010,
2828,
1010,
7047,
1027,
3671,
4697,
1035,
9918,
1006,
17961,
1010,
2828,
1010,
7047,
1007,
3503,
1027,
2073,
1006,
17961,
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... |
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.create_or_update_at_resource_group_with_http_info | def create_or_update_at_resource_group_with_http_info(resource_group_name, remediation_name, parameters, custom_headers:nil)
create_or_update_at_resource_group_async(resource_group_name, remediation_name, parameters, custom_headers:custom_headers).value!
end | ruby | def create_or_update_at_resource_group_with_http_info(resource_group_name, remediation_name, parameters, custom_headers:nil)
create_or_update_at_resource_group_async(resource_group_name, remediation_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"create_or_update_at_resource_group_with_http_info",
"(",
"resource_group_name",
",",
"remediation_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"create_or_update_at_resource_group_async",
"(",
"resource_group_name",
",",
"remediation_name",
",",
"par... | Creates or updates a remediation at resource group scope.
@param resource_group_name [String] Resource group name.
@param remediation_name [String] The name of the remediation.
@param parameters [Remediation] The remediation parameters.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Creates",
"or",
"updates",
"a",
"remediation",
"at",
"resource",
"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#L1491-L1493 | train | Creates or updates a remediation at resource group scope. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1035,
2012,
1035,
7692,
1035,
2177,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2128,
16969,
3508,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
libgit2/rugged | lib/rugged/commit.rb | Rugged.Commit.diff | def diff(*args)
args.unshift(parents.first) if args.size == 1 && args.first.is_a?(Hash)
self.tree.diff(*args)
end | ruby | def diff(*args)
args.unshift(parents.first) if args.size == 1 && args.first.is_a?(Hash)
self.tree.diff(*args)
end | [
"def",
"diff",
"(",
"*",
"args",
")",
"args",
".",
"unshift",
"(",
"parents",
".",
"first",
")",
"if",
"args",
".",
"size",
"==",
"1",
"&&",
"args",
".",
"first",
".",
"is_a?",
"(",
"Hash",
")",
"self",
".",
"tree",
".",
"diff",
"(",
"args",
")... | Return a diff between this commit and its first parent or another commit or tree.
See Rugged::Tree#diff for more details. | [
"Return",
"a",
"diff",
"between",
"this",
"commit",
"and",
"its",
"first",
"parent",
"or",
"another",
"commit",
"or",
"tree",
"."
] | 33873e5df2bd38501814182ff79609ed4bd88012 | https://github.com/libgit2/rugged/blob/33873e5df2bd38501814182ff79609ed4bd88012/lib/rugged/commit.rb#L24-L27 | train | Returns the diff of the current object and its parents. | [
30522,
13366,
4487,
4246,
1006,
1008,
12098,
5620,
1007,
12098,
5620,
1012,
4895,
6182,
6199,
1006,
3008,
1012,
2034,
1007,
2065,
12098,
5620,
1012,
2946,
1027,
1027,
1015,
1004,
1004,
12098,
5620,
1012,
2034,
1012,
2003,
1035,
1037,
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... |
collectiveidea/audited | lib/audited/audit.rb | Audited.Audit.undo | def undo
case action
when 'create'
# destroys a newly created record
auditable.destroy!
when 'destroy'
# creates a new record with the destroyed record attributes
auditable_type.constantize.create!(audited_changes)
when 'update'
# changes back attributes
auditable.update_attributes!(audited_changes.transform_values(&:first))
else
raise StandardError, "invalid action given #{action}"
end
end | ruby | def undo
case action
when 'create'
# destroys a newly created record
auditable.destroy!
when 'destroy'
# creates a new record with the destroyed record attributes
auditable_type.constantize.create!(audited_changes)
when 'update'
# changes back attributes
auditable.update_attributes!(audited_changes.transform_values(&:first))
else
raise StandardError, "invalid action given #{action}"
end
end | [
"def",
"undo",
"case",
"action",
"when",
"'create'",
"# destroys a newly created record",
"auditable",
".",
"destroy!",
"when",
"'destroy'",
"# creates a new record with the destroyed record attributes",
"auditable_type",
".",
"constantize",
".",
"create!",
"(",
"audited_change... | Allows user to undo changes | [
"Allows",
"user",
"to",
"undo",
"changes"
] | af5d51b45368eabb0e727d064faf29f4af6e1458 | https://github.com/collectiveidea/audited/blob/af5d51b45368eabb0e727d064faf29f4af6e1458/lib/audited/audit.rb#L90-L104 | train | undo the current record | [
30522,
13366,
25672,
2553,
2895,
2043,
1005,
3443,
1005,
1001,
20735,
1037,
4397,
2580,
2501,
15727,
3085,
1012,
6033,
999,
2043,
1005,
6033,
1005,
1001,
9005,
1037,
2047,
2501,
2007,
1996,
3908,
2501,
12332,
15727,
3085,
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... |
elastic/apm-agent-ruby | lib/elastic_apm/config.rb | ElasticAPM.Config.capture_body= | def capture_body=(value)
if value =~ /(all|transactions|errors|off)/
@capture_body = value
return
end
case value
when true
alert_logger.warn "Boolean value for option `capture_body' has " \
"been deprecated. Setting to 'all'"
@capture_body = 'all'
when false
alert_logger.warn "Boolean value for option `capture_body' has " \
"been deprecated. Setting to 'off'"
@capture_body = 'off'
else
default = DEFAULTS[:capture_body]
alert_logger.warn "Unknown value `#{value}' for option "\
"`capture_body'. Defaulting to `#{default}'"
@capture_body = default
end
end | ruby | def capture_body=(value)
if value =~ /(all|transactions|errors|off)/
@capture_body = value
return
end
case value
when true
alert_logger.warn "Boolean value for option `capture_body' has " \
"been deprecated. Setting to 'all'"
@capture_body = 'all'
when false
alert_logger.warn "Boolean value for option `capture_body' has " \
"been deprecated. Setting to 'off'"
@capture_body = 'off'
else
default = DEFAULTS[:capture_body]
alert_logger.warn "Unknown value `#{value}' for option "\
"`capture_body'. Defaulting to `#{default}'"
@capture_body = default
end
end | [
"def",
"capture_body",
"=",
"(",
"value",
")",
"if",
"value",
"=~",
"/",
"/",
"@capture_body",
"=",
"value",
"return",
"end",
"case",
"value",
"when",
"true",
"alert_logger",
".",
"warn",
"\"Boolean value for option `capture_body' has \"",
"\"been deprecated. Setting ... | rubocop:disable Metrics/MethodLength | [
"rubocop",
":",
"disable",
"Metrics",
"/",
"MethodLength"
] | 82190d1a9ba22af3b2c2c6fe6d23cc471f2e7ff6 | https://github.com/elastic/apm-agent-ruby/blob/82190d1a9ba22af3b2c2c6fe6d23cc471f2e7ff6/lib/elastic_apm/config.rb#L316-L337 | train | Sets the capture_body option to the given value. | [
30522,
13366,
5425,
1035,
2303,
1027,
1006,
3643,
1007,
2065,
3643,
1027,
1066,
1013,
1006,
2035,
1064,
11817,
1064,
10697,
1064,
2125,
1007,
1013,
1030,
5425,
1035,
2303,
1027,
3643,
2709,
2203,
2553,
3643,
2043,
2995,
9499,
1035,
8833,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_service_bus/lib/2015-08-01/generated/azure_mgmt_service_bus/subscriptions.rb | Azure::ServiceBus::Mgmt::V2015_08_01.Subscriptions.list_all | def list_all(resource_group_name, namespace_name, topic_name, custom_headers:nil)
first_page = list_all_as_lazy(resource_group_name, namespace_name, topic_name, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_all(resource_group_name, namespace_name, topic_name, custom_headers:nil)
first_page = list_all_as_lazy(resource_group_name, namespace_name, topic_name, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_all",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"topic_name",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_all_as_lazy",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"topic_name",
",",
"custom_headers",
":custo... | List all the subscriptions under a specified topic.
@param resource_group_name [String] Name of the Resource group within the
Azure subscription.
@param namespace_name [String] The namespace name
@param topic_name [String] The topic name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<SubscriptionResource>] operation results. | [
"List",
"all",
"the",
"subscriptions",
"under",
"a",
"specified",
"topic",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_service_bus/lib/2015-08-01/generated/azure_mgmt_service_bus/subscriptions.rb#L36-L39 | train | Gets all the items in a topic. | [
30522,
13366,
2862,
1035,
2035,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3415,
15327,
1035,
2171,
1010,
8476,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2862,
1035,
2035,
1035,
2004,
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... |
randym/axlsx | lib/axlsx/drawing/axis.rb | Axlsx.Axis.title= | def title=(v)
DataTypeValidator.validate "#{self.class}.title", [String, Cell], v
@title ||= Title.new
if v.is_a?(String)
@title.text = v
elsif v.is_a?(Cell)
@title.cell = v
end
end | ruby | def title=(v)
DataTypeValidator.validate "#{self.class}.title", [String, Cell], v
@title ||= Title.new
if v.is_a?(String)
@title.text = v
elsif v.is_a?(Cell)
@title.cell = v
end
end | [
"def",
"title",
"=",
"(",
"v",
")",
"DataTypeValidator",
".",
"validate",
"\"#{self.class}.title\"",
",",
"[",
"String",
",",
"Cell",
"]",
",",
"v",
"@title",
"||=",
"Title",
".",
"new",
"if",
"v",
".",
"is_a?",
"(",
"String",
")",
"@title",
".",
"text... | The title object for the chart.
@param [String, Cell] v
@return [Title] | [
"The",
"title",
"object",
"for",
"the",
"chart",
"."
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/drawing/axis.rb#L139-L147 | train | Set the title of the formula. | [
30522,
13366,
2516,
1027,
1006,
1058,
1007,
2951,
13874,
10175,
8524,
4263,
1012,
9398,
3686,
1000,
1001,
1063,
2969,
1012,
2465,
1065,
1012,
2516,
1000,
1010,
1031,
5164,
1010,
3526,
1033,
1010,
1058,
1030,
2516,
1064,
1064,
1027,
2516,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.matte_point | def matte_point(x, y)
f = copy
f.opacity = OpaqueOpacity unless f.alpha?
pixel = f.pixel_color(x, y)
pixel.opacity = TransparentOpacity
f.pixel_color(x, y, pixel)
f
end | ruby | def matte_point(x, y)
f = copy
f.opacity = OpaqueOpacity unless f.alpha?
pixel = f.pixel_color(x, y)
pixel.opacity = TransparentOpacity
f.pixel_color(x, y, pixel)
f
end | [
"def",
"matte_point",
"(",
"x",
",",
"y",
")",
"f",
"=",
"copy",
"f",
".",
"opacity",
"=",
"OpaqueOpacity",
"unless",
"f",
".",
"alpha?",
"pixel",
"=",
"f",
".",
"pixel_color",
"(",
"x",
",",
"y",
")",
"pixel",
".",
"opacity",
"=",
"TransparentOpacit... | These four methods are equivalent to the Draw#matte method
with the "Point", "Replace", "Floodfill", "FilltoBorder", and
"Replace" arguments, respectively.
Make the pixel at (x,y) transparent. | [
"These",
"four",
"methods",
"are",
"equivalent",
"to",
"the",
"Draw#matte",
"method",
"with",
"the",
"Point",
"Replace",
"Floodfill",
"FilltoBorder",
"and",
"Replace",
"arguments",
"respectively",
".",
"Make",
"the",
"pixel",
"at",
"(",
"x",
"y",
")",
"transpa... | ef6688ed9d76bf123c2ea1a483eff8635051adb7 | https://github.com/rmagick/rmagick/blob/ef6688ed9d76bf123c2ea1a483eff8635051adb7/lib/rmagick_internal.rb#L906-L913 | train | matte point | [
30522,
13366,
4717,
2063,
1035,
2391,
1006,
1060,
1010,
1061,
1007,
1042,
1027,
6100,
1042,
1012,
6728,
6305,
3012,
1027,
28670,
29477,
12972,
4983,
1042,
1012,
6541,
1029,
22138,
1027,
1042,
1012,
22138,
1035,
3609,
1006,
1060,
1010,
1061,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/overcommit | lib/overcommit/configuration_validator.rb | Overcommit.ConfigurationValidator.validate | def validate(config, hash, options)
@options = options.dup
@log = options[:logger]
hash = convert_nils_to_empty_hashes(hash)
ensure_hook_type_sections_exist(hash)
check_hook_name_format(hash)
check_hook_env(hash)
check_for_missing_enabled_option(hash) unless @options[:default]
check_for_too_many_processors(config, hash)
check_for_verify_plugin_signatures_option(hash)
hash
end | ruby | def validate(config, hash, options)
@options = options.dup
@log = options[:logger]
hash = convert_nils_to_empty_hashes(hash)
ensure_hook_type_sections_exist(hash)
check_hook_name_format(hash)
check_hook_env(hash)
check_for_missing_enabled_option(hash) unless @options[:default]
check_for_too_many_processors(config, hash)
check_for_verify_plugin_signatures_option(hash)
hash
end | [
"def",
"validate",
"(",
"config",
",",
"hash",
",",
"options",
")",
"@options",
"=",
"options",
".",
"dup",
"@log",
"=",
"options",
"[",
":logger",
"]",
"hash",
"=",
"convert_nils_to_empty_hashes",
"(",
"hash",
")",
"ensure_hook_type_sections_exist",
"(",
"has... | Validates hash for any invalid options, normalizing where possible.
@param config [Overcommit::Configuration]
@param hash [Hash] hash representation of YAML config
@param options[Hash]
@option default [Boolean] whether hash represents the default built-in config
@option logger [Overcommit::Logger] logger to output warnings to
@return [Hash] validated hash (potentially modified) | [
"Validates",
"hash",
"for",
"any",
"invalid",
"options",
"normalizing",
"where",
"possible",
"."
] | 35d60adb41da942178b789560968e3ad030b0ac7 | https://github.com/sds/overcommit/blob/35d60adb41da942178b789560968e3ad030b0ac7/lib/overcommit/configuration_validator.rb#L15-L28 | train | Validate the given hash | [
30522,
13366,
9398,
3686,
1006,
9530,
8873,
2290,
1010,
23325,
1010,
7047,
1007,
1030,
7047,
1027,
7047,
1012,
4241,
2361,
1030,
8833,
1027,
7047,
1031,
1024,
8833,
4590,
1033,
23325,
1027,
10463,
1035,
27282,
1035,
2000,
1035,
4064,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/options.rb | GitHubChangelogGenerator.Options.print_options | def print_options
return unless self[:verbose]
Helper.log.info "Using these options:"
# For ruby 2.5.0+
censored_values.each do |key, value|
print(key.inspect, "=>", value.inspect)
puts ""
end
puts ""
end | ruby | def print_options
return unless self[:verbose]
Helper.log.info "Using these options:"
# For ruby 2.5.0+
censored_values.each do |key, value|
print(key.inspect, "=>", value.inspect)
puts ""
end
puts ""
end | [
"def",
"print_options",
"return",
"unless",
"self",
"[",
":verbose",
"]",
"Helper",
".",
"log",
".",
"info",
"\"Using these options:\"",
"# For ruby 2.5.0+",
"censored_values",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"print",
"(",
"key",
".",
"inspec... | Pretty-prints a censored options hash, if :verbose. | [
"Pretty",
"-",
"prints",
"a",
"censored",
"options",
"hash",
"if",
":",
"verbose",
"."
] | f18c64b5cc0d7473b059275b88385ac11ca8b564 | https://github.com/github-changelog-generator/github-changelog-generator/blob/f18c64b5cc0d7473b059275b88385ac11ca8b564/lib/github_changelog_generator/options.rb#L107-L117 | train | Print the options for the
object. | [
30522,
13366,
6140,
1035,
7047,
2709,
4983,
2969,
1031,
1024,
12034,
9232,
1033,
2393,
2121,
1012,
8833,
1012,
18558,
1000,
2478,
2122,
7047,
1024,
1000,
1001,
2005,
10090,
1016,
1012,
1019,
1012,
1014,
1009,
8292,
29577,
2098,
1035,
5300,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hashicorp/vault-ruby | lib/vault/api/sys/audit.rb | Vault.Sys.enable_audit | def enable_audit(path, type, description, options = {})
client.put("/v1/sys/audit/#{encode_path(path)}", JSON.fast_generate(
type: type,
description: description,
options: options,
))
return true
end | ruby | def enable_audit(path, type, description, options = {})
client.put("/v1/sys/audit/#{encode_path(path)}", JSON.fast_generate(
type: type,
description: description,
options: options,
))
return true
end | [
"def",
"enable_audit",
"(",
"path",
",",
"type",
",",
"description",
",",
"options",
"=",
"{",
"}",
")",
"client",
".",
"put",
"(",
"\"/v1/sys/audit/#{encode_path(path)}\"",
",",
"JSON",
".",
"fast_generate",
"(",
"type",
":",
"type",
",",
"description",
":"... | Enable a particular audit. Note: the +options+ depend heavily on the
type of audit being enabled. Please refer to audit-specific documentation
for which need to be enabled.
@example
Vault.sys.enable_audit("/file-audit", "file", "File audit", path: "/path/on/disk") #=> true
@param [String] path
the path to mount the audit
@param [String] type
the type of audit to enable
@param [String] description
a human-friendly description of the audit backend
@param [Hash] options
audit-specific options
@return [true] | [
"Enable",
"a",
"particular",
"audit",
".",
"Note",
":",
"the",
"+",
"options",
"+",
"depend",
"heavily",
"on",
"the",
"type",
"of",
"audit",
"being",
"enabled",
".",
"Please",
"refer",
"to",
"audit",
"-",
"specific",
"documentation",
"for",
"which",
"need"... | 02f0532a802ba1a2a0d8703a4585dab76eb9d864 | https://github.com/hashicorp/vault-ruby/blob/02f0532a802ba1a2a0d8703a4585dab76eb9d864/lib/vault/api/sys/audit.rb#L53-L60 | train | Enable auditing for a given path | [
30522,
13366,
9585,
1035,
15727,
1006,
4130,
1010,
2828,
1010,
6412,
1010,
7047,
1027,
1063,
1065,
1007,
7396,
1012,
2404,
1006,
1000,
1013,
1058,
2487,
1013,
25353,
2015,
1013,
15727,
1013,
1001,
1063,
4372,
16044,
1035,
4130,
1006,
4130,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_sub_list | def update_sub_list(app_id, version_id, cl_entity_id, sub_list_id, word_list_base_update_object, custom_headers:nil)
response = update_sub_list_async(app_id, version_id, cl_entity_id, sub_list_id, word_list_base_update_object, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def update_sub_list(app_id, version_id, cl_entity_id, sub_list_id, word_list_base_update_object, custom_headers:nil)
response = update_sub_list_async(app_id, version_id, cl_entity_id, sub_list_id, word_list_base_update_object, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"update_sub_list",
"(",
"app_id",
",",
"version_id",
",",
"cl_entity_id",
",",
"sub_list_id",
",",
"word_list_base_update_object",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"update_sub_list_async",
"(",
"app_id",
",",
"version_id",
",",
"cl_ent... | Updates one of the list entity's sublists in a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param cl_entity_id The list entity extractor ID.
@param sub_list_id [Integer] The sublist ID.
@param word_list_base_update_object [WordListBaseUpdateObject] A sublist
update object containing the new canonical form and the list of words.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OperationStatus] operation results. | [
"Updates",
"one",
"of",
"the",
"list",
"entity",
"s",
"sublists",
"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#L3741-L3744 | train | Updates a list in a version of the application. | [
30522,
13366,
10651,
1035,
4942,
1035,
2862,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
18856,
1035,
9178,
1035,
8909,
1010,
4942,
1035,
2862,
1035,
8909,
1010,
2773,
1035,
2862,
1035,
2918,
1035,
10651,
1035,
4874,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_media_services/lib/2018-07-01/generated/azure_mgmt_media_services/jobs.rb | Azure::MediaServices::Mgmt::V2018_07_01.Jobs.get_with_http_info | def get_with_http_info(resource_group_name, account_name, transform_name, job_name, custom_headers:nil)
get_async(resource_group_name, account_name, transform_name, job_name, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, account_name, transform_name, job_name, custom_headers:nil)
get_async(resource_group_name, account_name, transform_name, job_name, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"account_name",
",",
"transform_name",
",",
"job_name",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"transform_name",
",",
"job_name",
",",
"... | Get Job
Gets a Job.
@param resource_group_name [String] The name of the resource group within the
Azure subscription.
@param account_name [String] The Media Services account name.
@param transform_name [String] The Transform name.
@param job_name [String] The Job name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Get",
"Job"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_media_services/lib/2018-07-01/generated/azure_mgmt_media_services/jobs.rb#L173-L175 | train | Gets the specified transform. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
10938,
1035,
2171,
1010,
3105,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/models/customer.rb | SquareConnect.Customer.valid? | def valid?
return false if @id.nil?
return false if @created_at.nil?
return false if @updated_at.nil?
creation_source_validator = EnumAttributeValidator.new('String', ["OTHER", "APPOINTMENTS", "COUPON", "DELETION_RECOVERY", "DIRECTORY", "EGIFTING", "EMAIL_COLLECTION", "FEEDBACK", "IMPORT", "INVOICES", "LOYALTY", "MARKETING", "MERGE", "ONLINE_STORE", "INSTANT_PROFILE", "TERMINAL", "THIRD_PARTY", "THIRD_PARTY_IMPORT", "UNMERGE_RECOVERY"])
return false unless creation_source_validator.valid?(@creation_source)
return true
end | ruby | def valid?
return false if @id.nil?
return false if @created_at.nil?
return false if @updated_at.nil?
creation_source_validator = EnumAttributeValidator.new('String', ["OTHER", "APPOINTMENTS", "COUPON", "DELETION_RECOVERY", "DIRECTORY", "EGIFTING", "EMAIL_COLLECTION", "FEEDBACK", "IMPORT", "INVOICES", "LOYALTY", "MARKETING", "MERGE", "ONLINE_STORE", "INSTANT_PROFILE", "TERMINAL", "THIRD_PARTY", "THIRD_PARTY_IMPORT", "UNMERGE_RECOVERY"])
return false unless creation_source_validator.valid?(@creation_source)
return true
end | [
"def",
"valid?",
"return",
"false",
"if",
"@id",
".",
"nil?",
"return",
"false",
"if",
"@created_at",
".",
"nil?",
"return",
"false",
"if",
"@updated_at",
".",
"nil?",
"creation_source_validator",
"=",
"EnumAttributeValidator",
".",
"new",
"(",
"'String'",
",",
... | Check to see if the all the properties in the model are valid
@return true if the model is valid | [
"Check",
"to",
"see",
"if",
"the",
"all",
"the",
"properties",
"in",
"the",
"model",
"are",
"valid"
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/models/customer.rb#L237-L244 | train | Returns true if the object is valid for the given index. | [
30522,
13366,
9398,
1029,
2709,
6270,
2065,
1030,
8909,
1012,
9152,
2140,
1029,
2709,
6270,
2065,
1030,
2580,
1035,
2012,
1012,
9152,
2140,
1029,
2709,
6270,
2065,
1030,
7172,
1035,
2012,
1012,
9152,
2140,
1029,
4325,
1035,
3120,
1035,
93... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/route_filters.rb | Azure::Network::Mgmt::V2018_07_01.RouteFilters.update_async | def update_async(resource_group_name, route_filter_name, route_filter_parameters, custom_headers:nil)
# Send request
promise = begin_update_async(resource_group_name, route_filter_name, route_filter_parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Network::Mgmt::V2018_07_01::Models::RouteFilter.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | ruby | def update_async(resource_group_name, route_filter_name, route_filter_parameters, custom_headers:nil)
# Send request
promise = begin_update_async(resource_group_name, route_filter_name, route_filter_parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Network::Mgmt::V2018_07_01::Models::RouteFilter.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | [
"def",
"update_async",
"(",
"resource_group_name",
",",
"route_filter_name",
",",
"route_filter_parameters",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_update_async",
"(",
"resource_group_name",
",",
"route_filter_name",
",",
"route_f... | @param resource_group_name [String] The name of the resource group.
@param route_filter_name [String] The name of the route filter.
@param route_filter_parameters [PatchRouteFilter] Parameters supplied to the
update route filter operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"resource_group_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"resource",
"group",
".",
"@param",
"route_filter_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"route",
"filter",
".",
"@param",
"route_filter_parameters",
"[",
"PatchRout... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/route_filters.rb#L234-L250 | train | Updates a route filter. | [
30522,
13366,
10651,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2799,
1035,
11307,
1035,
2171,
1010,
2799,
1035,
11307,
1035,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/notification_configuration.rb | Aws::AutoScaling.NotificationConfiguration.put | def put(options = {})
options = Aws::Util.deep_merge(options,
auto_scaling_group_name: @name,
topic_arn: @topic_arn,
notification_types: [@notification_type]
)
resp = @client.put_notification_configuration(options)
resp.data
end | ruby | def put(options = {})
options = Aws::Util.deep_merge(options,
auto_scaling_group_name: @name,
topic_arn: @topic_arn,
notification_types: [@notification_type]
)
resp = @client.put_notification_configuration(options)
resp.data
end | [
"def",
"put",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"Aws",
"::",
"Util",
".",
"deep_merge",
"(",
"options",
",",
"auto_scaling_group_name",
":",
"@name",
",",
"topic_arn",
":",
"@topic_arn",
",",
"notification_types",
":",
"[",
"@notification_t... | @example Request syntax with placeholder values
notification_configuration.put()
@param [Hash] options ({})
@return [EmptyStructure] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/notification_configuration.rb#L197-L205 | train | Put the notification configuration | [
30522,
13366,
2404,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
22091,
2015,
1024,
1024,
21183,
4014,
1012,
2784,
1035,
13590,
1006,
7047,
1010,
8285,
1035,
25169,
1035,
2177,
1035,
2171,
1024,
1030,
2171,
1010,
8476,
1035,
12098,
2078,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | spaceship/lib/spaceship/du/utilities.rb | Spaceship.Utilities.video_resolution | def video_resolution(video_path)
command = "ffmpeg -i \"#{video_path}\" 2>&1"
# puts "COMMAND: #{command}"
output = `#{command}`
# Note: ffmpeg exits with 1 if no output specified
# raise "Failed to find video information from #{video_path} (using #{command})" unless $CHILD_STATUS.to_i == 0
output = output.force_encoding("BINARY")
video_infos = output.split("\n").select { |l| l =~ /Stream.*Video/ }
raise "Unable to find Stream Video information from ffmpeg output of #{command}" if video_infos.count == 0
video_info = video_infos[0]
res = video_info.match(/.* ([0-9]+)x([0-9]+).*/)
raise "Unable to parse resolution information from #{video_info}" if res.size < 3
[res[1].to_i, res[2].to_i]
end | ruby | def video_resolution(video_path)
command = "ffmpeg -i \"#{video_path}\" 2>&1"
# puts "COMMAND: #{command}"
output = `#{command}`
# Note: ffmpeg exits with 1 if no output specified
# raise "Failed to find video information from #{video_path} (using #{command})" unless $CHILD_STATUS.to_i == 0
output = output.force_encoding("BINARY")
video_infos = output.split("\n").select { |l| l =~ /Stream.*Video/ }
raise "Unable to find Stream Video information from ffmpeg output of #{command}" if video_infos.count == 0
video_info = video_infos[0]
res = video_info.match(/.* ([0-9]+)x([0-9]+).*/)
raise "Unable to parse resolution information from #{video_info}" if res.size < 3
[res[1].to_i, res[2].to_i]
end | [
"def",
"video_resolution",
"(",
"video_path",
")",
"command",
"=",
"\"ffmpeg -i \\\"#{video_path}\\\" 2>&1\"",
"# puts \"COMMAND: #{command}\"",
"output",
"=",
"`",
"#{",
"command",
"}",
"`",
"# Note: ffmpeg exits with 1 if no output specified",
"# raise \"Failed to find video info... | identifies the resolution of a video using `ffmpeg`
@param video_path (String) the path to the video file
@return [Array] the resolution of the video | [
"identifies",
"the",
"resolution",
"of",
"a",
"video",
"using",
"ffmpeg"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/spaceship/lib/spaceship/du/utilities.rb#L59-L72 | train | Find the resolution of a video | [
30522,
13366,
2678,
1035,
5813,
1006,
2678,
1035,
4130,
1007,
3094,
1027,
1000,
21461,
8737,
13910,
1011,
1045,
1032,
1000,
1001,
1063,
2678,
1035,
4130,
1065,
1032,
1000,
1016,
1028,
1004,
1015,
1000,
1001,
8509,
1000,
3094,
1024,
1001,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
appsignal/rdkafka-ruby | lib/rdkafka/consumer.rb | Rdkafka.Consumer.lag | def lag(topic_partition_list, watermark_timeout_ms=100)
out = {}
topic_partition_list.to_h.each do |topic, partitions|
# Query high watermarks for this topic's partitions
# and compare to the offset in the list.
topic_out = {}
partitions.each do |p|
next if p.offset.nil?
low, high = query_watermark_offsets(
topic,
p.partition,
watermark_timeout_ms
)
topic_out[p.partition] = high - p.offset
end
out[topic] = topic_out
end
out
end | ruby | def lag(topic_partition_list, watermark_timeout_ms=100)
out = {}
topic_partition_list.to_h.each do |topic, partitions|
# Query high watermarks for this topic's partitions
# and compare to the offset in the list.
topic_out = {}
partitions.each do |p|
next if p.offset.nil?
low, high = query_watermark_offsets(
topic,
p.partition,
watermark_timeout_ms
)
topic_out[p.partition] = high - p.offset
end
out[topic] = topic_out
end
out
end | [
"def",
"lag",
"(",
"topic_partition_list",
",",
"watermark_timeout_ms",
"=",
"100",
")",
"out",
"=",
"{",
"}",
"topic_partition_list",
".",
"to_h",
".",
"each",
"do",
"|",
"topic",
",",
"partitions",
"|",
"# Query high watermarks for this topic's partitions",
"# and... | Calculate the consumer lag per partition for the provided topic partition list.
You can get a suitable list by calling {committed} or {position} (TODO). It is also
possible to create one yourself, in this case you have to provide a list that
already contains all the partitions you need the lag for.
@param topic_partition_list [TopicPartitionList] The list to calculate lag for.
@param watermark_timeout_ms [Integer] The timeout for each query watermark call.
@raise [RdkafkaError] When querying the broker fails.
@return [Hash<String, Hash<Integer, Integer>>] A hash containing all topics with the lag per partition | [
"Calculate",
"the",
"consumer",
"lag",
"per",
"partition",
"for",
"the",
"provided",
"topic",
"partition",
"list",
".",
"You",
"can",
"get",
"a",
"suitable",
"list",
"by",
"calling",
"{",
"committed",
"}",
"or",
"{",
"position",
"}",
"(",
"TODO",
")",
".... | 87b3e0ddae5ea576847cb67228fcea06ec2a24d6 | https://github.com/appsignal/rdkafka-ruby/blob/87b3e0ddae5ea576847cb67228fcea06ec2a24d6/lib/rdkafka/consumer.rb#L218-L236 | train | Returns a hash of the lag values for a topic partition list. | [
30522,
13366,
2474,
2290,
1006,
8476,
1035,
13571,
1035,
2862,
1010,
2300,
10665,
1035,
2051,
5833,
1035,
5796,
1027,
2531,
1007,
2041,
1027,
1063,
1065,
8476,
1035,
13571,
1035,
2862,
1012,
2000,
1035,
1044,
1012,
2169,
2079,
1064,
8476,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
norman/friendly_id | lib/friendly_id/slugged.rb | FriendlyId.Slugged.resolve_friendly_id_conflict | def resolve_friendly_id_conflict(candidates)
uuid = SecureRandom.uuid
[
apply_slug_limit(candidates.first, uuid),
uuid
].compact.join(friendly_id_config.sequence_separator)
end | ruby | def resolve_friendly_id_conflict(candidates)
uuid = SecureRandom.uuid
[
apply_slug_limit(candidates.first, uuid),
uuid
].compact.join(friendly_id_config.sequence_separator)
end | [
"def",
"resolve_friendly_id_conflict",
"(",
"candidates",
")",
"uuid",
"=",
"SecureRandom",
".",
"uuid",
"[",
"apply_slug_limit",
"(",
"candidates",
".",
"first",
",",
"uuid",
")",
",",
"uuid",
"]",
".",
"compact",
".",
"join",
"(",
"friendly_id_config",
".",
... | Public: Resolve conflicts.
This method adds UUID to first candidate and truncates (if `slug_limit` is set).
Examples:
resolve_friendly_id_conflict(['12345'])
# => '12345-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
FriendlyId.defaults { |config| config.slug_limit = 40 }
resolve_friendly_id_conflict(['12345'])
# => '123-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
candidates - the Array with candidates.
Returns the String with new slug. | [
"Public",
":",
"Resolve",
"conflicts",
"."
] | 67422c04e1bfed4207b2a04826bc67ec0e231ce7 | https://github.com/norman/friendly_id/blob/67422c04e1bfed4207b2a04826bc67ec0e231ce7/lib/friendly_id/slugged.rb#L320-L326 | train | Resolve the unique id conflicts with the existing one | [
30522,
13366,
10663,
1035,
5379,
1035,
8909,
1035,
4736,
1006,
5347,
1007,
1057,
21272,
1027,
5851,
13033,
5358,
1012,
1057,
21272,
1031,
6611,
1035,
23667,
1035,
5787,
1006,
5347,
1012,
2034,
1010,
1057,
21272,
1007,
1010,
1057,
21272,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cheezy/page-object | lib/page-object/accessors.rb | PageObject.Accessors.paragraph | def paragraph(name, identifier={:index => 0}, &block)
standard_methods(name, identifier, 'paragraph_for', &block)
define_method(name) do
return platform.paragraph_text_for identifier.clone unless block_given?
self.send("#{name}_element").text
end
end | ruby | def paragraph(name, identifier={:index => 0}, &block)
standard_methods(name, identifier, 'paragraph_for', &block)
define_method(name) do
return platform.paragraph_text_for identifier.clone unless block_given?
self.send("#{name}_element").text
end
end | [
"def",
"paragraph",
"(",
"name",
",",
"identifier",
"=",
"{",
":index",
"=>",
"0",
"}",
",",
"&",
"block",
")",
"standard_methods",
"(",
"name",
",",
"identifier",
",",
"'paragraph_for'",
",",
"block",
")",
"define_method",
"(",
"name",
")",
"do",
"retur... | adds three methods - one to retrieve the text of a paragraph, another
to retrieve a paragraph element, and another to check the paragraph's existence.
@example
paragraph(:title, :id => 'title')
# will generate 'title', 'title_element', and 'title?' methods
@param [Symbol] the name used for the generated methods
@param [Hash] identifier how we find a paragraph.
@param optional block to be invoked when element method is called | [
"adds",
"three",
"methods",
"-",
"one",
"to",
"retrieve",
"the",
"text",
"of",
"a",
"paragraph",
"another",
"to",
"retrieve",
"a",
"paragraph",
"element",
"and",
"another",
"to",
"check",
"the",
"paragraph",
"s",
"existence",
"."
] | 850d775bf63768fbb1551a34480195785fe8e193 | https://github.com/cheezy/page-object/blob/850d775bf63768fbb1551a34480195785fe8e193/lib/page-object/accessors.rb#L782-L788 | train | Creates a new instance of the Paragraph class. | [
30522,
13366,
20423,
1006,
2171,
1010,
8909,
4765,
18095,
1027,
1063,
1024,
5950,
1027,
1028,
1014,
1065,
1010,
1004,
3796,
1007,
3115,
1035,
4725,
1006,
2171,
1010,
8909,
4765,
18095,
1010,
1005,
20423,
1035,
2005,
1005,
1010,
1004,
3796,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
projectcypress/health-data-standards | lib/hqmf-parser/2.0/types.rb | HQMF2.Range.generate_value? | def generate_value?(lm, hm)
!lm.nil? && lm.try(:value) == hm.try(:value) && lm.try(:unit).nil? && hm.try(:unit).nil?
end | ruby | def generate_value?(lm, hm)
!lm.nil? && lm.try(:value) == hm.try(:value) && lm.try(:unit).nil? && hm.try(:unit).nil?
end | [
"def",
"generate_value?",
"(",
"lm",
",",
"hm",
")",
"!",
"lm",
".",
"nil?",
"&&",
"lm",
".",
"try",
"(",
":value",
")",
"==",
"hm",
".",
"try",
"(",
":value",
")",
"&&",
"lm",
".",
"try",
"(",
":unit",
")",
".",
"nil?",
"&&",
"hm",
".",
"try... | Check if the value for the range should actually produce a single value instead of a range (if low and high are
the same) | [
"Check",
"if",
"the",
"value",
"for",
"the",
"range",
"should",
"actually",
"produce",
"a",
"single",
"value",
"instead",
"of",
"a",
"range",
"(",
"if",
"low",
"and",
"high",
"are",
"the",
"same",
")"
] | 252d4f0927c513eacde6b9ea41b76faa1423c34b | https://github.com/projectcypress/health-data-standards/blob/252d4f0927c513eacde6b9ea41b76faa1423c34b/lib/hqmf-parser/2.0/types.rb#L159-L161 | train | Returns true if lm and hm are equal | [
30522,
13366,
9699,
1035,
3643,
1029,
1006,
1048,
2213,
1010,
20287,
1007,
999,
1048,
2213,
1012,
9152,
2140,
1029,
1004,
1004,
1048,
2213,
1012,
3046,
1006,
1024,
3643,
1007,
1027,
1027,
20287,
1012,
3046,
1006,
1024,
3643,
1007,
1004,
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_recovery_services_site_recovery/lib/2016-08-10/generated/azure_mgmt_recovery_services_site_recovery/replication_storage_classification_mappings.rb | Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10.ReplicationStorageClassificationMappings.begin_delete | def begin_delete(fabric_name, storage_classification_name, storage_classification_mapping_name, custom_headers:nil)
response = begin_delete_async(fabric_name, storage_classification_name, storage_classification_mapping_name, custom_headers:custom_headers).value!
nil
end | ruby | def begin_delete(fabric_name, storage_classification_name, storage_classification_mapping_name, custom_headers:nil)
response = begin_delete_async(fabric_name, storage_classification_name, storage_classification_mapping_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_delete",
"(",
"fabric_name",
",",
"storage_classification_name",
",",
"storage_classification_mapping_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_delete_async",
"(",
"fabric_name",
",",
"storage_classification_name",
",",
"storage_cl... | Delete a storage classification mapping.
The operation to delete a storage classification mapping.
@param fabric_name [String] Fabric name.
@param storage_classification_name [String] Storage classification name.
@param storage_classification_mapping_name [String] Storage classification
mapping name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Delete",
"a",
"storage",
"classification",
"mapping",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_recovery_services_site_recovery/lib/2016-08-10/generated/azure_mgmt_recovery_services_site_recovery/replication_storage_classification_mappings.rb#L548-L551 | train | Deletes a storage classification mapping. | [
30522,
13366,
4088,
1035,
3972,
12870,
1006,
8313,
1035,
2171,
1010,
5527,
1035,
5579,
1035,
2171,
1010,
5527,
1035,
5579,
1035,
12375,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
3972,
12870,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/sprockets | lib/sprockets/source_map_utils.rb | Sprockets.SourceMapUtils.format_source_map | def format_source_map(map, input)
filename = input[:filename]
load_path = input[:load_path]
load_paths = input[:environment].config[:paths]
mime_exts = input[:environment].config[:mime_exts]
pipeline_exts = input[:environment].config[:pipeline_exts]
file = PathUtils.split_subpath(load_path, filename)
{
"version" => 3,
"file" => file,
"mappings" => map["mappings"],
"sources" => map["sources"].map do |source|
source = URIUtils.split_file_uri(source)[2] if source.start_with? "file://"
source = PathUtils.join(File.dirname(filename), source) unless PathUtils.absolute_path?(source)
_, source = PathUtils.paths_split(load_paths, source)
source = PathUtils.relative_path_from(file, source)
PathUtils.set_pipeline(source, mime_exts, pipeline_exts, :source)
end,
"names" => map["names"]
}
end | ruby | def format_source_map(map, input)
filename = input[:filename]
load_path = input[:load_path]
load_paths = input[:environment].config[:paths]
mime_exts = input[:environment].config[:mime_exts]
pipeline_exts = input[:environment].config[:pipeline_exts]
file = PathUtils.split_subpath(load_path, filename)
{
"version" => 3,
"file" => file,
"mappings" => map["mappings"],
"sources" => map["sources"].map do |source|
source = URIUtils.split_file_uri(source)[2] if source.start_with? "file://"
source = PathUtils.join(File.dirname(filename), source) unless PathUtils.absolute_path?(source)
_, source = PathUtils.paths_split(load_paths, source)
source = PathUtils.relative_path_from(file, source)
PathUtils.set_pipeline(source, mime_exts, pipeline_exts, :source)
end,
"names" => map["names"]
}
end | [
"def",
"format_source_map",
"(",
"map",
",",
"input",
")",
"filename",
"=",
"input",
"[",
":filename",
"]",
"load_path",
"=",
"input",
"[",
":load_path",
"]",
"load_paths",
"=",
"input",
"[",
":environment",
"]",
".",
"config",
"[",
":paths",
"]",
"mime_ex... | Public: Transpose source maps into a standard format
NOTE: Does not support index maps
version => 3
file => logical path
sources => relative from filename
Unnecessary attributes are removed
Example
map
#=> {
# "version" => 3,
# "file" => "stdin",
# "sourceRoot" => "",
# "sourceContents" => "blah blah blah",
# "sources" => [/root/logical/path.js],
# "names" => [..],
#}
format_source_map(map, input)
#=> {
# "version" => 3,
# "file" => "logical/path.js",
# "sources" => ["path.js"],
# "names" => [..],
#} | [
"Public",
":",
"Transpose",
"source",
"maps",
"into",
"a",
"standard",
"format"
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/source_map_utils.rb#L37-L57 | train | Format the source map | [
30522,
13366,
4289,
1035,
3120,
1035,
4949,
1006,
4949,
1010,
7953,
1007,
5371,
18442,
1027,
7953,
1031,
1024,
5371,
18442,
1033,
7170,
1035,
4130,
1027,
7953,
1031,
1024,
7170,
1035,
4130,
1033,
7170,
1035,
10425,
1027,
7953,
1031,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | deliver/lib/deliver/upload_metadata.rb | Deliver.UploadMetadata.verify_available_languages! | def verify_available_languages!(options)
return if options[:skip_metadata]
# Collect all languages we need
# We only care about languages from user provided values
# as the other languages are on iTC already anyway
v = options[:app].edit_version(platform: options[:platform])
UI.user_error!("Could not find a version to edit for app '#{options[:app].name}', the app metadata is read-only currently") unless v
enabled_languages = options[:languages] || []
LOCALISED_VERSION_VALUES.each do |key|
current = options[key]
next unless current && current.kind_of?(Hash)
current.each do |language, value|
language = language.to_s
enabled_languages << language unless enabled_languages.include?(language)
end
end
# Reject "default" language from getting enabled
# because "default" is not an iTC language
enabled_languages = enabled_languages.reject do |lang|
lang == "default"
end.uniq
if enabled_languages.count > 0
v.create_languages(enabled_languages)
lng_text = "language"
lng_text += "s" if enabled_languages.count != 1
Helper.show_loading_indicator("Activating #{lng_text} #{enabled_languages.join(', ')}...")
v.save!
Helper.hide_loading_indicator
end
true
end | ruby | def verify_available_languages!(options)
return if options[:skip_metadata]
# Collect all languages we need
# We only care about languages from user provided values
# as the other languages are on iTC already anyway
v = options[:app].edit_version(platform: options[:platform])
UI.user_error!("Could not find a version to edit for app '#{options[:app].name}', the app metadata is read-only currently") unless v
enabled_languages = options[:languages] || []
LOCALISED_VERSION_VALUES.each do |key|
current = options[key]
next unless current && current.kind_of?(Hash)
current.each do |language, value|
language = language.to_s
enabled_languages << language unless enabled_languages.include?(language)
end
end
# Reject "default" language from getting enabled
# because "default" is not an iTC language
enabled_languages = enabled_languages.reject do |lang|
lang == "default"
end.uniq
if enabled_languages.count > 0
v.create_languages(enabled_languages)
lng_text = "language"
lng_text += "s" if enabled_languages.count != 1
Helper.show_loading_indicator("Activating #{lng_text} #{enabled_languages.join(', ')}...")
v.save!
Helper.hide_loading_indicator
end
true
end | [
"def",
"verify_available_languages!",
"(",
"options",
")",
"return",
"if",
"options",
"[",
":skip_metadata",
"]",
"# Collect all languages we need",
"# We only care about languages from user provided values",
"# as the other languages are on iTC already anyway",
"v",
"=",
"options",
... | Makes sure all languages we need are actually created | [
"Makes",
"sure",
"all",
"languages",
"we",
"need",
"are",
"actually",
"created"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/deliver/lib/deliver/upload_metadata.rb#L247-L281 | train | This method is called when the user has requested the languages to be enabled. | [
30522,
13366,
20410,
1035,
2800,
1035,
4155,
999,
1006,
7047,
1007,
2709,
2065,
7047,
1031,
1024,
13558,
1035,
27425,
1033,
1001,
8145,
2035,
4155,
2057,
2342,
1001,
2057,
2069,
2729,
2055,
4155,
2013,
5310,
3024,
5300,
1001,
2004,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-sqs/lib/aws-sdk-sqs/queue.rb | Aws::SQS.Queue.remove_permission | def remove_permission(options = {})
options = options.merge(queue_url: @url)
resp = @client.remove_permission(options)
resp.data
end | ruby | def remove_permission(options = {})
options = options.merge(queue_url: @url)
resp = @client.remove_permission(options)
resp.data
end | [
"def",
"remove_permission",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"queue_url",
":",
"@url",
")",
"resp",
"=",
"@client",
".",
"remove_permission",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
queue.remove_permission({
label: "String", # required
})
@param [Hash] options ({})
@option options [required, String] :label
The identification of the permission to remove. This is the label
added using the ` AddPermission ` action.
@return [EmptyStructure] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-sqs/lib/aws-sdk-sqs/queue.rb#L362-L366 | train | Remove a permission from the queue | [
30522,
13366,
6366,
1035,
6656,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
24240,
1035,
24471,
2140,
1024,
1030,
24471,
2140,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
6366,
1035,
6656,
1006,
7047,
1007,
24501... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-cloudformation/lib/aws-sdk-cloudformation/stack.rb | Aws::CloudFormation.Stack.resource_summaries | def resource_summaries(options = {})
batches = Enumerator.new do |y|
options = options.merge(stack_name: @name)
resp = @client.list_stack_resources(options)
resp.each_page do |page|
batch = []
page.data.stack_resource_summaries.each do |s|
batch << StackResourceSummary.new(
logical_id: s.logical_resource_id,
stack_name: options[:stack_name],
data: s,
client: @client
)
end
y.yield(batch)
end
end
StackResourceSummary::Collection.new(batches)
end | ruby | def resource_summaries(options = {})
batches = Enumerator.new do |y|
options = options.merge(stack_name: @name)
resp = @client.list_stack_resources(options)
resp.each_page do |page|
batch = []
page.data.stack_resource_summaries.each do |s|
batch << StackResourceSummary.new(
logical_id: s.logical_resource_id,
stack_name: options[:stack_name],
data: s,
client: @client
)
end
y.yield(batch)
end
end
StackResourceSummary::Collection.new(batches)
end | [
"def",
"resource_summaries",
"(",
"options",
"=",
"{",
"}",
")",
"batches",
"=",
"Enumerator",
".",
"new",
"do",
"|",
"y",
"|",
"options",
"=",
"options",
".",
"merge",
"(",
"stack_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"list_stack_resour... | @example Request syntax with placeholder values
stack.resource_summaries()
@param [Hash] options ({})
@return [StackResourceSummary::Collection] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-cloudformation/lib/aws-sdk-cloudformation/stack.rb#L1037-L1055 | train | Returns a collection of StackResourceSummary objects for the stack. | [
30522,
13366,
7692,
1035,
7680,
7849,
3111,
1006,
7047,
1027,
1063,
1065,
1007,
14108,
2229,
1027,
4372,
17897,
16259,
1012,
2047,
2079,
1064,
1061,
1064,
7047,
1027,
7047,
1012,
13590,
1006,
9991,
1035,
2171,
1024,
1030,
2171,
1007,
24501,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/generator/entry.rb | GitHubChangelogGenerator.Entry.parse_sections | def parse_sections(sections_desc)
require "json"
sections_desc = sections_desc.to_json if sections_desc.class == Hash
begin
sections_json = JSON.parse(sections_desc)
rescue JSON::ParserError => e
raise "There was a problem parsing your JSON string for sections: #{e}"
end
sections_json.collect do |name, v|
Section.new(name: name.to_s, prefix: v["prefix"], labels: v["labels"], options: @options)
end
end | ruby | def parse_sections(sections_desc)
require "json"
sections_desc = sections_desc.to_json if sections_desc.class == Hash
begin
sections_json = JSON.parse(sections_desc)
rescue JSON::ParserError => e
raise "There was a problem parsing your JSON string for sections: #{e}"
end
sections_json.collect do |name, v|
Section.new(name: name.to_s, prefix: v["prefix"], labels: v["labels"], options: @options)
end
end | [
"def",
"parse_sections",
"(",
"sections_desc",
")",
"require",
"\"json\"",
"sections_desc",
"=",
"sections_desc",
".",
"to_json",
"if",
"sections_desc",
".",
"class",
"==",
"Hash",
"begin",
"sections_json",
"=",
"JSON",
".",
"parse",
"(",
"sections_desc",
")",
"... | Turns the argument from the commandline of --configure-sections or
--add-sections into an array of Section objects.
@param [String, Hash] sections_desc Either string or hash describing sections
@return [Array] Parsed section objects. | [
"Turns",
"the",
"argument",
"from",
"the",
"commandline",
"of",
"--",
"configure",
"-",
"sections",
"or",
"--",
"add",
"-",
"sections",
"into",
"an",
"array",
"of",
"Section",
"objects",
"."
] | f18c64b5cc0d7473b059275b88385ac11ca8b564 | https://github.com/github-changelog-generator/github-changelog-generator/blob/f18c64b5cc0d7473b059275b88385ac11ca8b564/lib/github_changelog_generator/generator/entry.rb#L63-L77 | train | Parse the sections_desc string into a Hash of Section objects | [
30522,
13366,
11968,
3366,
1035,
5433,
1006,
5433,
1035,
4078,
2278,
1007,
5478,
1000,
1046,
3385,
1000,
5433,
1035,
4078,
2278,
1027,
5433,
1035,
4078,
2278,
1012,
2000,
1035,
1046,
3385,
2065,
5433,
1035,
4078,
2278,
1012,
2465,
1027,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | railties/lib/rails/application.rb | Rails.Application.ordered_railties | def ordered_railties #:nodoc:
@ordered_railties ||= begin
order = config.railties_order.map do |railtie|
if railtie == :main_app
self
elsif railtie.respond_to?(:instance)
railtie.instance
else
railtie
end
end
all = (railties - order)
all.push(self) unless (all + order).include?(self)
order.push(:all) unless order.include?(:all)
index = order.index(:all)
order[index] = all
order
end
end | ruby | def ordered_railties #:nodoc:
@ordered_railties ||= begin
order = config.railties_order.map do |railtie|
if railtie == :main_app
self
elsif railtie.respond_to?(:instance)
railtie.instance
else
railtie
end
end
all = (railties - order)
all.push(self) unless (all + order).include?(self)
order.push(:all) unless order.include?(:all)
index = order.index(:all)
order[index] = all
order
end
end | [
"def",
"ordered_railties",
"#:nodoc:",
"@ordered_railties",
"||=",
"begin",
"order",
"=",
"config",
".",
"railties_order",
".",
"map",
"do",
"|",
"railtie",
"|",
"if",
"railtie",
"==",
":main_app",
"self",
"elsif",
"railtie",
".",
"respond_to?",
"(",
":instance"... | Returns the ordered railties for this application considering railties_order. | [
"Returns",
"the",
"ordered",
"railties",
"for",
"this",
"application",
"considering",
"railties_order",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/railties/lib/rails/application.rb#L534-L554 | train | Returns the order of the railties in the order of the railties. | [
30522,
13366,
3641,
1035,
4334,
7368,
1001,
1024,
7293,
10085,
1024,
1030,
3641,
1035,
4334,
7368,
1064,
1064,
1027,
4088,
2344,
1027,
9530,
8873,
2290,
1012,
4334,
7368,
1035,
2344,
1012,
4949,
2079,
1064,
4334,
9515,
1064,
2065,
4334,
9... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sensu/sensu | lib/sensu/utilities.rb | Sensu.Utilities.find_attribute_value | def find_attribute_value(tree, path, default)
attribute = tree[path.shift]
if attribute.is_a?(Hash)
find_attribute_value(attribute, path, default)
else
attribute.nil? ? default : attribute
end
end | ruby | def find_attribute_value(tree, path, default)
attribute = tree[path.shift]
if attribute.is_a?(Hash)
find_attribute_value(attribute, path, default)
else
attribute.nil? ? default : attribute
end
end | [
"def",
"find_attribute_value",
"(",
"tree",
",",
"path",
",",
"default",
")",
"attribute",
"=",
"tree",
"[",
"path",
".",
"shift",
"]",
"if",
"attribute",
".",
"is_a?",
"(",
"Hash",
")",
"find_attribute_value",
"(",
"attribute",
",",
"path",
",",
"default"... | Traverse a hash for an attribute value, with a fallback default
value if nil.
@param tree [Hash] to traverse.
@param path [Array] of attribute keys.
@param default [Object] value if attribute value is nil.
@return [Object] attribute or fallback default value. | [
"Traverse",
"a",
"hash",
"for",
"an",
"attribute",
"value",
"with",
"a",
"fallback",
"default",
"value",
"if",
"nil",
"."
] | 51319e4b58c8d9986f101ad71ff729aa3e51e951 | https://github.com/sensu/sensu/blob/51319e4b58c8d9986f101ad71ff729aa3e51e951/lib/sensu/utilities.rb#L168-L175 | train | Find the value of an attribute in the given tree | [
30522,
13366,
2424,
1035,
17961,
1035,
3643,
1006,
3392,
1010,
4130,
1010,
12398,
1007,
17961,
1027,
3392,
1031,
4130,
1012,
5670,
1033,
2065,
17961,
1012,
2003,
1035,
1037,
1029,
1006,
23325,
1007,
2424,
1035,
30524,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/config.rb | Mongoid.Config.register_model | def register_model(klass)
LOCK.synchronize do
models.push(klass) unless models.include?(klass)
end
end | ruby | def register_model(klass)
LOCK.synchronize do
models.push(klass) unless models.include?(klass)
end
end | [
"def",
"register_model",
"(",
"klass",
")",
"LOCK",
".",
"synchronize",
"do",
"models",
".",
"push",
"(",
"klass",
")",
"unless",
"models",
".",
"include?",
"(",
"klass",
")",
"end",
"end"
] | Register a model in the application with Mongoid.
@example Register a model.
config.register_model(Band)
@param [ Class ] klass The model to register.
@since 3.1.0 | [
"Register",
"a",
"model",
"in",
"the",
"application",
"with",
"Mongoid",
"."
] | 56976e32610f4c2450882b0bfe14da099f0703f4 | https://github.com/mongodb/mongoid/blob/56976e32610f4c2450882b0bfe14da099f0703f4/lib/mongoid/config.rb#L129-L133 | train | Register a model to be used by the model_registry | [
30522,
13366,
4236,
1035,
2944,
1006,
1047,
27102,
1007,
5843,
1012,
26351,
8093,
10698,
4371,
2079,
4275,
1012,
5245,
1006,
1047,
27102,
1007,
4983,
4275,
1012,
2421,
1029,
1006,
1047,
27102,
1007,
2203,
2203,
102,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.3.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_3_0_9.ServiceFabricClientAPIs.get_volume_resource | def get_volume_resource(volume_resource_name, custom_headers:nil)
response = get_volume_resource_async(volume_resource_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_volume_resource(volume_resource_name, custom_headers:nil)
response = get_volume_resource_async(volume_resource_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_volume_resource",
"(",
"volume_resource_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_volume_resource_async",
"(",
"volume_resource_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",... | Gets the volume resource.
Gets the information about the volume resource with a given name. This
information includes the volume description and other runtime information.
@param volume_resource_name [String] Service Fabric volume resource name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [VolumeResourceDescription] operation results. | [
"Gets",
"the",
"volume",
"resource",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.3.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L30143-L30146 | train | Gets the specified volume resource. | [
30522,
13366,
2131,
1035,
3872,
1035,
7692,
1006,
3872,
1035,
7692,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
3872,
1035,
7692,
1035,
2004,
6038,
2278,
1006,
3872,
1035,
7692,
1035,
2171,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/transparent_data_encryption_activities.rb | Azure::SQL::Mgmt::V2014_04_01.TransparentDataEncryptionActivities.list_by_configuration_with_http_info | def list_by_configuration_with_http_info(resource_group_name, server_name, database_name, custom_headers:nil)
list_by_configuration_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
end | ruby | def list_by_configuration_with_http_info(resource_group_name, server_name, database_name, custom_headers:nil)
list_by_configuration_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
end | [
"def",
"list_by_configuration_with_http_info",
"(",
"resource_group_name",
",",
"server_name",
",",
"database_name",
",",
"custom_headers",
":",
"nil",
")",
"list_by_configuration_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"database_name",
",",
"custom_hea... | Returns a database's transparent data encryption operation result.
@param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param server_name [String] The name of the server.
@param database_name [String] The name of the database for which the
transparent data encryption applies.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Returns",
"a",
"database",
"s",
"transparent",
"data",
"encryption",
"operation",
"result",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/transparent_data_encryption_activities.rb#L60-L62 | train | Gets the list of documents in a database. | [
30522,
13366,
2862,
1035,
2011,
1035,
9563,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
7809,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2862,
1035,
2011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dry-rb/dry-struct | lib/dry/struct.rb | Dry.Struct.to_hash | def to_hash
self.class.schema.each_with_object({}) do |key, result|
result[key.name] = Hashify[self[key.name]] if attributes.key?(key.name)
end
end | ruby | def to_hash
self.class.schema.each_with_object({}) do |key, result|
result[key.name] = Hashify[self[key.name]] if attributes.key?(key.name)
end
end | [
"def",
"to_hash",
"self",
".",
"class",
".",
"schema",
".",
"each_with_object",
"(",
"{",
"}",
")",
"do",
"|",
"key",
",",
"result",
"|",
"result",
"[",
"key",
".",
"name",
"]",
"=",
"Hashify",
"[",
"self",
"[",
"key",
".",
"name",
"]",
"]",
"if"... | Converts the {Dry::Struct} to a hash with keys representing
each attribute (as symbols) and their corresponding values
@return [Hash{Symbol => Object}]
@example
class Book < Dry::Struct
attribute :title, Types::Strict::String
attribute :subtitle, Types::Strict::String.optional
end
rom_n_roda = Book.new(
title: 'Web Development with ROM and Roda',
subtitle: nil
)
rom_n_roda.to_hash
#=> {title: 'Web Development with ROM and Roda', subtitle: nil} | [
"Converts",
"the",
"{",
"Dry",
"::",
"Struct",
"}",
"to",
"a",
"hash",
"with",
"keys",
"representing",
"each",
"attribute",
"(",
"as",
"symbols",
")",
"and",
"their",
"corresponding",
"values"
] | d8af8b933f7ae313ef1475fa328fa4c5371296f3 | https://github.com/dry-rb/dry-struct/blob/d8af8b933f7ae313ef1475fa328fa4c5371296f3/lib/dry/struct.rb#L145-L149 | train | Returns a hash of the attributes that are not present in the schema. | [
30522,
13366,
30524,
1006,
3145,
1012,
2171,
1007,
2203,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_deleted_secret | def get_deleted_secret(vault_base_url, secret_name, custom_headers:nil)
response = get_deleted_secret_async(vault_base_url, secret_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_deleted_secret(vault_base_url, secret_name, custom_headers:nil)
response = get_deleted_secret_async(vault_base_url, secret_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_deleted_secret",
"(",
"vault_base_url",
",",
"secret_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_deleted_secret_async",
"(",
"vault_base_url",
",",
"secret_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"respo... | Gets the specified deleted secret.
The Get Deleted Secret operation returns the specified deleted secret along
with its attributes. This operation requires the secrets/get permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param secret_name [String] The name of the secret.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [DeletedSecretBundle] operation results. | [
"Gets",
"the",
"specified",
"deleted",
"secret",
"."
] | 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#L3492-L3495 | train | Gets the deleted secret. | [
30522,
13366,
2131,
1035,
17159,
1035,
3595,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
3595,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
30524,
2140,
1010,
3595,
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... |
samvera/hyrax | app/helpers/hyrax/collections_helper.rb | Hyrax.CollectionsHelper.present_terms | def present_terms(presenter, terms = :all, &block)
terms = presenter.terms if terms == :all
Hyrax::PresenterRenderer.new(presenter, self).fields(terms, &block)
end | ruby | def present_terms(presenter, terms = :all, &block)
terms = presenter.terms if terms == :all
Hyrax::PresenterRenderer.new(presenter, self).fields(terms, &block)
end | [
"def",
"present_terms",
"(",
"presenter",
",",
"terms",
"=",
":all",
",",
"&",
"block",
")",
"terms",
"=",
"presenter",
".",
"terms",
"if",
"terms",
"==",
":all",
"Hyrax",
"::",
"PresenterRenderer",
".",
"new",
"(",
"presenter",
",",
"self",
")",
".",
... | TODO: we could move this to CollectionPresenter if it had a view_context
@param presenter [Hyrax::CollectionPresenter]
@param terms [Array<Symbol>,:all] the list of terms to draw | [
"TODO",
":",
"we",
"could",
"move",
"this",
"to",
"CollectionPresenter",
"if",
"it",
"had",
"a",
"view_context"
] | e2b4f56e829a53b1f11296324736e9d5b8c9ee5f | https://github.com/samvera/hyrax/blob/e2b4f56e829a53b1f11296324736e9d5b8c9ee5f/app/helpers/hyrax/collections_helper.rb#L6-L9 | train | Returns the terms of the given presenter. | [
30522,
13366,
2556,
1035,
3408,
1006,
10044,
1010,
3408,
1027,
1024,
2035,
1010,
1004,
3796,
1007,
3408,
1027,
10044,
1012,
3408,
2065,
3408,
1027,
1027,
1024,
2035,
1044,
19563,
2595,
1024,
1024,
10044,
7389,
4063,
2121,
1012,
2047,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
grpc/grpc | src/ruby/lib/grpc/generic/client_stub.rb | GRPC.ClientStub.new_active_call | def new_active_call(method, marshal, unmarshal,
deadline: nil,
parent: nil,
credentials: nil)
deadline = from_relative_time(@timeout) if deadline.nil?
# Provide each new client call with its own completion queue
call = @ch.create_call(parent, # parent call
@propagate_mask, # propagation options
method,
nil, # host use nil,
deadline)
call.set_credentials! credentials unless credentials.nil?
ActiveCall.new(call, marshal, unmarshal, deadline,
started: false)
end | ruby | def new_active_call(method, marshal, unmarshal,
deadline: nil,
parent: nil,
credentials: nil)
deadline = from_relative_time(@timeout) if deadline.nil?
# Provide each new client call with its own completion queue
call = @ch.create_call(parent, # parent call
@propagate_mask, # propagation options
method,
nil, # host use nil,
deadline)
call.set_credentials! credentials unless credentials.nil?
ActiveCall.new(call, marshal, unmarshal, deadline,
started: false)
end | [
"def",
"new_active_call",
"(",
"method",
",",
"marshal",
",",
"unmarshal",
",",
"deadline",
":",
"nil",
",",
"parent",
":",
"nil",
",",
"credentials",
":",
"nil",
")",
"deadline",
"=",
"from_relative_time",
"(",
"@timeout",
")",
"if",
"deadline",
".",
"nil... | Creates a new active stub
@param method [string] the method being called.
@param marshal [Function] f(obj)->string that marshals requests
@param unmarshal [Function] f(string)->obj that unmarshals responses
@param parent [Grpc::Call] a parent call, available when calls are
made from server
@param credentials [Core::CallCredentials] credentials to use when making
the call | [
"Creates",
"a",
"new",
"active",
"stub"
] | f3937f0e55227a4ef3a23f895d3b204a947610f8 | https://github.com/grpc/grpc/blob/f3937f0e55227a4ef3a23f895d3b204a947610f8/src/ruby/lib/grpc/generic/client_stub.rb#L485-L499 | train | Creates a new active call | [
30522,
13366,
2047,
1035,
3161,
1035,
2655,
1006,
4118,
1010,
8610,
1010,
4895,
7849,
7377,
2140,
1010,
15117,
1024,
9152,
2140,
1010,
6687,
1024,
9152,
2140,
1010,
22496,
1024,
9152,
2140,
1007,
15117,
1027,
2013,
1035,
5816,
1035,
2051,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_service_backup_configuration_info_with_http_info | def get_service_backup_configuration_info_with_http_info(service_id, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
get_service_backup_configuration_info_async(service_id, continuation_token:continuation_token, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def get_service_backup_configuration_info_with_http_info(service_id, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
get_service_backup_configuration_info_async(service_id, continuation_token:continuation_token, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"get_service_backup_configuration_info_with_http_info",
"(",
"service_id",
",",
"continuation_token",
":",
"nil",
",",
"max_results",
":",
"0",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"get_service_backup_configuration_info_async",
"(",
... | Gets the Service Fabric service backup configuration information.
Gets the Service Fabric backup configuration information for the service and
the partitions under this service.
@param service_id [String] The identity of the service. This is typically the
full name of the service without the 'fabric:' URI scheme.
Starting from version 6.0, hierarchical names are delimited with the "~"
character.
For example, if the service name is "fabric:/myapp/app1/svc1", the service
identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
versions.
@param continuation_token [String] The continuation token parameter is used
to obtain next set of results. A continuation token with a non empty value is
included in the response of the API when the results from the system do not
fit in a single response. When this value is passed to the next API call, the
API returns next set of results. If there are no further results then the
continuation token does not contain a value. The value of this parameter
should not be URL encoded.
@param max_results [Integer] The maximum number of results to be returned as
part of the paged queries. This parameter defines the upper bound on the
number of results returned. The results returned can be less than the
specified maximum results if they do not fit in the message as per the max
message size restrictions defined in the configuration. If this parameter is
zero or not specified, the paged queries includes as many results as possible
that fit in the return message.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"Service",
"Fabric",
"service",
"backup",
"configuration",
"information",
"."
] | 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#L24159-L24161 | train | Gets backup configuration information for the specified service. | [
30522,
13366,
2131,
1035,
2326,
1035,
10200,
1035,
9563,
1035,
18558,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2326,
1035,
8909,
1010,
13633,
1035,
19204,
1024,
9152,
2140,
1010,
4098,
1035,
3463,
1024,
1014,
1010,
2051,
5833,
1024,
3438,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/service_endpoint_policy_definitions.rb | Azure::Network::Mgmt::V2018_08_01.ServiceEndpointPolicyDefinitions.create_or_update_async | def create_or_update_async(resource_group_name, service_endpoint_policy_name, service_endpoint_policy_definition_name, service_endpoint_policy_definitions, custom_headers:nil)
# Send request
promise = begin_create_or_update_async(resource_group_name, service_endpoint_policy_name, service_endpoint_policy_definition_name, service_endpoint_policy_definitions, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Network::Mgmt::V2018_08_01::Models::ServiceEndpointPolicyDefinition.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | ruby | def create_or_update_async(resource_group_name, service_endpoint_policy_name, service_endpoint_policy_definition_name, service_endpoint_policy_definitions, custom_headers:nil)
# Send request
promise = begin_create_or_update_async(resource_group_name, service_endpoint_policy_name, service_endpoint_policy_definition_name, service_endpoint_policy_definitions, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Network::Mgmt::V2018_08_01::Models::ServiceEndpointPolicyDefinition.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | [
"def",
"create_or_update_async",
"(",
"resource_group_name",
",",
"service_endpoint_policy_name",
",",
"service_endpoint_policy_definition_name",
",",
"service_endpoint_policy_definitions",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_create_or... | @param resource_group_name [String] The name of the resource group.
@param service_endpoint_policy_name [String] The name of the service endpoint
policy.
@param service_endpoint_policy_definition_name [String] The name of the
service endpoint policy definition name.
@param service_endpoint_policy_definitions [ServiceEndpointPolicyDefinition]
Parameters supplied to the create or update service endpoint policy
operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"resource_group_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"resource",
"group",
".",
"@param",
"service_endpoint_policy_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"service",
"endpoint",
"policy",
".",
"@param",
"service_endpoint_p... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/service_endpoint_policy_definitions.rb#L210-L226 | train | Creates or updates a service endpoint policy definition. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2203,
8400,
1035,
3343,
1035,
2171,
1010,
2326,
1035,
2203,
8400,
1035,
3343,
1035,
6210,
1035,
2171,
1010,
2326,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
decidim/decidim | decidim-core/app/commands/decidim/promote_membership.rb | Decidim.PromoteMembership.call | def call
return broadcast(:invalid) if membership.blank?
return broadcast(:invalid) if membership.role != "member"
return broadcast(:invalid) if membership.user_group != user_group
transaction do
promote_membership
send_notification
end
broadcast(:ok)
end | ruby | def call
return broadcast(:invalid) if membership.blank?
return broadcast(:invalid) if membership.role != "member"
return broadcast(:invalid) if membership.user_group != user_group
transaction do
promote_membership
send_notification
end
broadcast(:ok)
end | [
"def",
"call",
"return",
"broadcast",
"(",
":invalid",
")",
"if",
"membership",
".",
"blank?",
"return",
"broadcast",
"(",
":invalid",
")",
"if",
"membership",
".",
"role",
"!=",
"\"member\"",
"return",
"broadcast",
"(",
":invalid",
")",
"if",
"membership",
... | Public: Initializes the command.
membership - the UserGroupMembership to be promoted.
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/promote_membership.rb#L20-L31 | train | Calls the notification of the current user group and the current user group. | [
30522,
13366,
2655,
2709,
3743,
1006,
1024,
19528,
1007,
2065,
5779,
1012,
8744,
1029,
2709,
3743,
1006,
1024,
19528,
1007,
2065,
5779,
1012,
2535,
999,
1027,
1000,
2266,
1000,
2709,
3743,
1006,
1024,
19528,
1007,
2065,
5779,
1012,
5310,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/api/v1_items_api.rb | SquareConnect.V1ItemsApi.delete_item | def delete_item(location_id, item_id, opts = {})
data, _status_code, _headers = delete_item_with_http_info(location_id, item_id, opts)
return data
end | ruby | def delete_item(location_id, item_id, opts = {})
data, _status_code, _headers = delete_item_with_http_info(location_id, item_id, opts)
return data
end | [
"def",
"delete_item",
"(",
"location_id",
",",
"item_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"delete_item_with_http_info",
"(",
"location_id",
",",
"item_id",
",",
"opts",
")",
"return",
"data",
"end"
] | DeleteItem
Deletes an existing item and all item variations associated with it. *Note**: DeleteItem returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteItemRequest` object as documented below.
@param location_id The ID of the item's associated location.
@param item_id The ID of the item to modify.
@param [Hash] opts the optional parameters
@return [V1Item] | [
"DeleteItem",
"Deletes",
"an",
"existing",
"item",
"and",
"all",
"item",
"variations",
"associated",
"with",
"it",
".",
"*",
"Note",
"**",
":",
"DeleteItem",
"returns",
"nothing",
"on",
"success",
"but",
"Connect",
"SDKs",
"map",
"the",
"empty",
"response",
... | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/v1_items_api.rb#L872-L875 | train | Delete an item | [
30522,
13366,
3972,
12870,
1035,
8875,
1006,
3295,
1035,
8909,
1010,
8875,
1035,
8909,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
3972,
12870,
1035,
8875,
1035,
2007,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
awesome-print/awesome_print | lib/awesome_print/formatter.rb | AwesomePrint.Formatter.format | def format(object, type = nil)
core_class = cast(object, type)
awesome = if core_class != :self
send(:"awesome_#{core_class}", object) # Core formatters.
else
awesome_self(object, type) # Catch all that falls back to object.inspect.
end
awesome
end | ruby | def format(object, type = nil)
core_class = cast(object, type)
awesome = if core_class != :self
send(:"awesome_#{core_class}", object) # Core formatters.
else
awesome_self(object, type) # Catch all that falls back to object.inspect.
end
awesome
end | [
"def",
"format",
"(",
"object",
",",
"type",
"=",
"nil",
")",
"core_class",
"=",
"cast",
"(",
"object",
",",
"type",
")",
"awesome",
"=",
"if",
"core_class",
"!=",
":self",
"send",
"(",
":\"",
"#{",
"core_class",
"}",
"\"",
",",
"object",
")",
"# Cor... | Main entry point to format an object.
------------------------------------------------------------------------------ | [
"Main",
"entry",
"point",
"to",
"format",
"an",
"object",
".",
"------------------------------------------------------------------------------"
] | 4564fd74721562cbef2443f7d97109bf9192343d | https://github.com/awesome-print/awesome_print/blob/4564fd74721562cbef2443f7d97109bf9192343d/lib/awesome_print/formatter.rb#L23-L31 | train | Returns the index of the object in the index. | [
30522,
13366,
4289,
1006,
4874,
1010,
2828,
1027,
9152,
2140,
1007,
4563,
1035,
2465,
1027,
3459,
1006,
4874,
1010,
2828,
1007,
12476,
1027,
2065,
4563,
1035,
2465,
999,
1027,
1024,
2969,
4604,
1006,
1024,
1000,
12476,
1035,
1001,
1063,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hashicorp/vagrant | lib/vagrant/machine_index.rb | Vagrant.MachineIndex.with_index_lock | def with_index_lock
lock_path = "#{@index_file}.lock"
File.open(lock_path, "w+") do |f|
f.flock(File::LOCK_EX)
yield
end
end | ruby | def with_index_lock
lock_path = "#{@index_file}.lock"
File.open(lock_path, "w+") do |f|
f.flock(File::LOCK_EX)
yield
end
end | [
"def",
"with_index_lock",
"lock_path",
"=",
"\"#{@index_file}.lock\"",
"File",
".",
"open",
"(",
"lock_path",
",",
"\"w+\"",
")",
"do",
"|",
"f",
"|",
"f",
".",
"flock",
"(",
"File",
"::",
"LOCK_EX",
")",
"yield",
"end",
"end"
] | This will hold a lock to the index so it can be read or updated. | [
"This",
"will",
"hold",
"a",
"lock",
"to",
"the",
"index",
"so",
"it",
"can",
"be",
"read",
"or",
"updated",
"."
] | c22a145c59790c098f95d50141d9afb48e1ef55f | https://github.com/hashicorp/vagrant/blob/c22a145c59790c098f95d50141d9afb48e1ef55f/lib/vagrant/machine_index.rb#L319-L325 | train | Create a new index file with the current index file. | [
30522,
13366,
2007,
1035,
5950,
1035,
5843,
5843,
1035,
4130,
1027,
1000,
1001,
1063,
1030,
5950,
1035,
5371,
1065,
1012,
5843,
1000,
5371,
1012,
2330,
1006,
5843,
1035,
4130,
1010,
1000,
1059,
1009,
1000,
1007,
2079,
1064,
1042,
1064,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/express_route_circuits.rb | Azure::Network::Mgmt::V2019_02_01.ExpressRouteCircuits.begin_list_arp_table_with_http_info | def begin_list_arp_table_with_http_info(resource_group_name, circuit_name, peering_name, device_path, custom_headers:nil)
begin_list_arp_table_async(resource_group_name, circuit_name, peering_name, device_path, custom_headers:custom_headers).value!
end | ruby | def begin_list_arp_table_with_http_info(resource_group_name, circuit_name, peering_name, device_path, custom_headers:nil)
begin_list_arp_table_async(resource_group_name, circuit_name, peering_name, device_path, custom_headers:custom_headers).value!
end | [
"def",
"begin_list_arp_table_with_http_info",
"(",
"resource_group_name",
",",
"circuit_name",
",",
"peering_name",
",",
"device_path",
",",
"custom_headers",
":",
"nil",
")",
"begin_list_arp_table_async",
"(",
"resource_group_name",
",",
"circuit_name",
",",
"peering_name"... | Gets the currently advertised ARP table associated with the express route
circuit in a resource group.
@param resource_group_name [String] The name of the resource group.
@param circuit_name [String] The name of the express route circuit.
@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 [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"currently",
"advertised",
"ARP",
"table",
"associated",
"with",
"the",
"express",
"route",
"circuit",
"in",
"a",
"resource",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/express_route_circuits.rb#L1081-L1083 | train | Gets the ARP table associated with the express route circuit. | [
30522,
13366,
4088,
1035,
2862,
1035,
12098,
2361,
1035,
2795,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4984,
1035,
2171,
1010,
16740,
1035,
2171,
1010,
5080,
1035,
4130,
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... |
github/linguist | lib/linguist/classifier.rb | Linguist.Classifier.tokens_probability | def tokens_probability(tokens, language)
tokens.inject(0.0) do |sum, token|
sum += Math.log(token_probability(token, language))
end
end | ruby | def tokens_probability(tokens, language)
tokens.inject(0.0) do |sum, token|
sum += Math.log(token_probability(token, language))
end
end | [
"def",
"tokens_probability",
"(",
"tokens",
",",
"language",
")",
"tokens",
".",
"inject",
"(",
"0.0",
")",
"do",
"|",
"sum",
",",
"token",
"|",
"sum",
"+=",
"Math",
".",
"log",
"(",
"token_probability",
"(",
"token",
",",
"language",
")",
")",
"end",
... | Internal: Probably of set of tokens in a language occurring - P(D | C)
tokens - Array of String tokens.
language - Language to check.
Returns Float between 0.0 and 1.0. | [
"Internal",
":",
"Probably",
"of",
"set",
"of",
"tokens",
"in",
"a",
"language",
"occurring",
"-",
"P",
"(",
"D",
"|",
"C",
")"
] | 9116c90fcbb82ac03b4b33c58cfbde1fcf745e99 | https://github.com/github/linguist/blob/9116c90fcbb82ac03b4b33c58cfbde1fcf745e99/lib/linguist/classifier.rb#L120-L124 | train | Returns the probability of the tokens in the given language. | [
30522,
13366,
19204,
2015,
1035,
9723,
1006,
19204,
2015,
1010,
2653,
1007,
19204,
2015,
1012,
1999,
20614,
1006,
1014,
1012,
1014,
1007,
2079,
1064,
7680,
1010,
19204,
1064,
7680,
1009,
1027,
8785,
1012,
8833,
1006,
19204,
1035,
9723,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_face/lib/1.0/generated/azure_cognitiveservices_face/person_group_person.rb | Azure::CognitiveServices::Face::V1_0.PersonGroupPerson.get_face_with_http_info | def get_face_with_http_info(person_group_id, person_id, persisted_face_id, custom_headers:nil)
get_face_async(person_group_id, person_id, persisted_face_id, custom_headers:custom_headers).value!
end | ruby | def get_face_with_http_info(person_group_id, person_id, persisted_face_id, custom_headers:nil)
get_face_async(person_group_id, person_id, persisted_face_id, custom_headers:custom_headers).value!
end | [
"def",
"get_face_with_http_info",
"(",
"person_group_id",
",",
"person_id",
",",
"persisted_face_id",
",",
"custom_headers",
":",
"nil",
")",
"get_face_async",
"(",
"person_group_id",
",",
"person_id",
",",
"persisted_face_id",
",",
"custom_headers",
":custom_headers",
... | Retrieve information about a persisted face (specified by persistedFaceId,
personId and its belonging personGroupId).
@param person_group_id [String] Id referencing a particular person group.
@param person_id Id referencing a particular person.
@param persisted_face_id Id referencing a particular persistedFaceId of an
existing face.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Retrieve",
"information",
"about",
"a",
"persisted",
"face",
"(",
"specified",
"by",
"persistedFaceId",
"personId",
"and",
"its",
"belonging",
"personGroupId",
")",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_face/lib/1.0/generated/azure_cognitiveservices_face/person_group_person.rb#L665-L667 | train | Gets the persisted face. | [
30522,
13366,
2131,
1035,
2227,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2711,
1035,
2177,
1035,
8909,
1010,
2711,
1035,
8909,
1010,
19035,
1035,
2227,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
2227,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_by_namespace_next | def list_by_namespace_next(next_page_link, custom_headers:nil)
response = list_by_namespace_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_namespace_next(next_page_link, custom_headers:nil)
response = list_by_namespace_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_namespace_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_namespace_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"re... | Lists the HybridConnection within the namespace.
@param next_page_link [String] The NextLink from the previous successful call
to List operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [HybridConnectionListResult] operation results. | [
"Lists",
"the",
"HybridConnection",
"within",
"the",
"namespace",
"."
] | 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#L1345-L1348 | train | Gets the list of all the managed managed | [
30522,
13366,
2862,
1035,
2011,
1035,
3415,
15327,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
3415,
15327,
1035,
2279,
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 | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/diagnostics.rb | Azure::Web::Mgmt::V2018_02_01.Diagnostics.get_site_detector_response_slot | def get_site_detector_response_slot(resource_group_name, site_name, detector_name, slot, start_time:nil, end_time:nil, time_grain:nil, custom_headers:nil)
response = get_site_detector_response_slot_async(resource_group_name, site_name, detector_name, slot, start_time:start_time, end_time:end_time, time_grain:time_grain, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_site_detector_response_slot(resource_group_name, site_name, detector_name, slot, start_time:nil, end_time:nil, time_grain:nil, custom_headers:nil)
response = get_site_detector_response_slot_async(resource_group_name, site_name, detector_name, slot, start_time:start_time, end_time:end_time, time_grain:time_grain, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_site_detector_response_slot",
"(",
"resource_group_name",
",",
"site_name",
",",
"detector_name",
",",
"slot",
",",
"start_time",
":",
"nil",
",",
"end_time",
":",
"nil",
",",
"time_grain",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"respons... | Get site detector response
Get site detector response
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param site_name [String] Site Name
@param detector_name [String] Detector Resource Name
@param slot [String] Slot Name
@param start_time [DateTime] Start Time
@param end_time [DateTime] End Time
@param time_grain [String] Time Grain
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [DetectorResponse] operation results. | [
"Get",
"site",
"detector",
"response"
] | 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#L1490-L1493 | train | Gets the response of a site detector. | [
30522,
13366,
2131,
1035,
2609,
1035,
19034,
1035,
3433,
1035,
10453,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2609,
1035,
2171,
1010,
19034,
1035,
2171,
1010,
10453,
1010,
2707,
1035,
2051,
1024,
9152,
2140,
1010,
2203,
1035,
2051,
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... |
CocoaPods/Xcodeproj | lib/xcodeproj/project.rb | Xcodeproj.Project.save | def save(save_path = nil)
save_path ||= path
@dirty = false if save_path == path
FileUtils.mkdir_p(save_path)
file = File.join(save_path, 'project.pbxproj')
Atomos.atomic_write(file) do |f|
Nanaimo::Writer::PBXProjWriter.new(to_ascii_plist, :pretty => true, :output => f, :strict => false).write
end
end | ruby | def save(save_path = nil)
save_path ||= path
@dirty = false if save_path == path
FileUtils.mkdir_p(save_path)
file = File.join(save_path, 'project.pbxproj')
Atomos.atomic_write(file) do |f|
Nanaimo::Writer::PBXProjWriter.new(to_ascii_plist, :pretty => true, :output => f, :strict => false).write
end
end | [
"def",
"save",
"(",
"save_path",
"=",
"nil",
")",
"save_path",
"||=",
"path",
"@dirty",
"=",
"false",
"if",
"save_path",
"==",
"path",
"FileUtils",
".",
"mkdir_p",
"(",
"save_path",
")",
"file",
"=",
"File",
".",
"join",
"(",
"save_path",
",",
"'project.... | Serializes the project in the xcodeproj format using the path provided
during initialization or the given path (`xcodeproj` file). If a path is
provided file references depending on the root of the project are not
updated automatically, thus clients are responsible to perform any needed
modification before saving.
@param [String, Pathname] path
The optional path where the project should be saved.
@example Saving a project
project.save
project.save
@return [void] | [
"Serializes",
"the",
"project",
"in",
"the",
"xcodeproj",
"format",
"using",
"the",
"path",
"provided",
"during",
"initialization",
"or",
"the",
"given",
"path",
"(",
"xcodeproj",
"file",
")",
".",
"If",
"a",
"path",
"is",
"provided",
"file",
"references",
"... | 3be1684437a6f8e69c7836ad4c85a2b78663272f | https://github.com/CocoaPods/Xcodeproj/blob/3be1684437a6f8e69c7836ad4c85a2b78663272f/lib/xcodeproj/project.rb#L358-L366 | train | Save the project to a file | [
30522,
13366,
3828,
1006,
3828,
1035,
4130,
1027,
9152,
2140,
1007,
3828,
1035,
4130,
1064,
1064,
1027,
4130,
1030,
6530,
1027,
6270,
2065,
3828,
1035,
4130,
1027,
1027,
4130,
5371,
21823,
4877,
1012,
12395,
4305,
2099,
1035,
1052,
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... |
meew0/discordrb | lib/discordrb/data/server.rb | Discordrb.Server.update_voice_state | def update_voice_state(data)
user_id = data['user_id'].to_i
if data['channel_id']
unless @voice_states[user_id]
# Create a new voice state for the user
@voice_states[user_id] = VoiceState.new(user_id)
end
# Update the existing voice state (or the one we just created)
channel = @channels_by_id[data['channel_id'].to_i]
@voice_states[user_id].update(
channel,
data['mute'],
data['deaf'],
data['self_mute'],
data['self_deaf']
)
else
# The user is not in a voice channel anymore, so delete its voice state
@voice_states.delete(user_id)
end
end | ruby | def update_voice_state(data)
user_id = data['user_id'].to_i
if data['channel_id']
unless @voice_states[user_id]
# Create a new voice state for the user
@voice_states[user_id] = VoiceState.new(user_id)
end
# Update the existing voice state (or the one we just created)
channel = @channels_by_id[data['channel_id'].to_i]
@voice_states[user_id].update(
channel,
data['mute'],
data['deaf'],
data['self_mute'],
data['self_deaf']
)
else
# The user is not in a voice channel anymore, so delete its voice state
@voice_states.delete(user_id)
end
end | [
"def",
"update_voice_state",
"(",
"data",
")",
"user_id",
"=",
"data",
"[",
"'user_id'",
"]",
".",
"to_i",
"if",
"data",
"[",
"'channel_id'",
"]",
"unless",
"@voice_states",
"[",
"user_id",
"]",
"# Create a new voice state for the user",
"@voice_states",
"[",
"use... | Updates a member's voice state
@note For internal use only
@!visibility private | [
"Updates",
"a",
"member",
"s",
"voice",
"state"
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/data/server.rb#L421-L443 | train | Updates the voice state for a user | [
30522,
13366,
10651,
1035,
2376,
1035,
2110,
1006,
2951,
1007,
5310,
1035,
8909,
1027,
2951,
1031,
1005,
5310,
1035,
8909,
1005,
1033,
1012,
2000,
1035,
1045,
2065,
2951,
1031,
1005,
30524,
2376,
2110,
2005,
1996,
5310,
1030,
2376,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-s3/lib/aws-sdk-s3/multipart_upload_part.rb | Aws::S3.MultipartUploadPart.copy_from | def copy_from(options = {})
options = options.merge(
bucket: @bucket_name,
key: @object_key,
upload_id: @multipart_upload_id,
part_number: @part_number
)
resp = @client.upload_part_copy(options)
resp.data
end | ruby | def copy_from(options = {})
options = options.merge(
bucket: @bucket_name,
key: @object_key,
upload_id: @multipart_upload_id,
part_number: @part_number
)
resp = @client.upload_part_copy(options)
resp.data
end | [
"def",
"copy_from",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"bucket",
":",
"@bucket_name",
",",
"key",
":",
"@object_key",
",",
"upload_id",
":",
"@multipart_upload_id",
",",
"part_number",
":",
"@part_number",
")",
... | @!group Actions
@example Request syntax with placeholder values
multipart_upload_part.copy_from({
copy_source: "CopySource", # required
copy_source_if_match: "CopySourceIfMatch",
copy_source_if_modified_since: Time.now,
copy_source_if_none_match: "CopySourceIfNoneMatch",
copy_source_if_unmodified_since: Time.now,
copy_source_range: "CopySourceRange",
sse_customer_algorithm: "SSECustomerAlgorithm",
sse_customer_key: "SSECustomerKey",
sse_customer_key_md5: "SSECustomerKeyMD5",
copy_source_sse_customer_algorithm: "CopySourceSSECustomerAlgorithm",
copy_source_sse_customer_key: "CopySourceSSECustomerKey",
copy_source_sse_customer_key_md5: "CopySourceSSECustomerKeyMD5",
request_payer: "requester", # accepts requester
})
@param [Hash] options ({})
@option options [required, String] :copy_source
The name of the source bucket and key name of the source object,
separated by a slash (/). Must be URL-encoded.
@option options [String] :copy_source_if_match
Copies the object if its entity tag (ETag) matches the specified tag.
@option options [Time,DateTime,Date,Integer,String] :copy_source_if_modified_since
Copies the object if it has been modified since the specified time.
@option options [String] :copy_source_if_none_match
Copies the object if its entity tag (ETag) is different than the
specified ETag.
@option options [Time,DateTime,Date,Integer,String] :copy_source_if_unmodified_since
Copies the object if it hasn't been modified since the specified
time.
@option options [String] :copy_source_range
The range of bytes to copy from the source object. The range value
must use the form bytes=first-last, where the first and last are the
zero-based byte offsets to copy. For example, bytes=0-9 indicates that
you want to copy the first ten bytes of the source. You can copy a
range only if the source object is greater than 5 MB.
@option options [String] :sse_customer_algorithm
Specifies the algorithm to use to when encrypting the object (e.g.,
AES256).
@option options [String] :sse_customer_key
Specifies the customer-provided encryption key for Amazon S3 to use in
encrypting data. This value is used to store the object and then it is
discarded; Amazon does not store the encryption key. The key must be
appropriate for use with the algorithm specified in the
x-amz-server-side-encryption-customer-algorithm header. This must be
the same encryption key specified in the initiate multipart upload
request.
@option options [String] :sse_customer_key_md5
Specifies the 128-bit MD5 digest of the encryption key according to
RFC 1321. Amazon S3 uses this header for a message integrity check to
ensure the encryption key was transmitted without error.
@option options [String] :copy_source_sse_customer_algorithm
Specifies the algorithm to use when decrypting the source object
(e.g., AES256).
@option options [String] :copy_source_sse_customer_key
Specifies the customer-provided encryption key for Amazon S3 to use to
decrypt the source object. The encryption key provided in this header
must be one that was used when the source object was created.
@option options [String] :copy_source_sse_customer_key_md5
Specifies the 128-bit MD5 digest of the encryption key according to
RFC 1321. Amazon S3 uses this header for a message integrity check to
ensure the encryption key was transmitted without error.
@option options [String] :request_payer
Confirms that the requester knows that she or he will be charged for
the request. Bucket owners need not specify this parameter in their
requests. Documentation on downloading objects from requester pays
buckets can be found at
http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
@return [Types::UploadPartCopyOutput] | [
"@!group",
"Actions",
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-s3/lib/aws-sdk-s3/multipart_upload_part.rb#L272-L281 | train | Copy the object from the multipart upload to the bucket. | [
30522,
13366,
6100,
1035,
2013,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
13610,
1024,
1030,
13610,
1035,
2171,
1010,
3145,
1024,
1030,
4874,
1035,
3145,
1010,
2039,
11066,
1035,
8909,
1024,
1030,
4800,
19362,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-rds/lib/aws-sdk-rds/db_parameter_group.rb | Aws::RDS.DBParameterGroup.modify | def modify(options = {})
options = options.merge(db_parameter_group_name: @name)
resp = @client.modify_db_parameter_group(options)
DBParameterGroup.new(
name: resp.data.db_parameter_group_name,
client: @client
)
end | ruby | def modify(options = {})
options = options.merge(db_parameter_group_name: @name)
resp = @client.modify_db_parameter_group(options)
DBParameterGroup.new(
name: resp.data.db_parameter_group_name,
client: @client
)
end | [
"def",
"modify",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"db_parameter_group_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"modify_db_parameter_group",
"(",
"options",
")",
"DBParameterGroup",
".",
"new",
"(... | @example Request syntax with placeholder values
dbparametergroup = db_parameter_group.modify({
parameters: [ # required
{
parameter_name: "String",
parameter_value: "String",
description: "String",
source: "String",
apply_type: "String",
data_type: "String",
allowed_values: "String",
is_modifiable: false,
minimum_engine_version: "String",
apply_method: "immediate", # accepts immediate, pending-reboot
supported_engine_modes: ["String"],
},
],
})
@param [Hash] options ({})
@option options [required, Array<Types::Parameter>] :parameters
An array of parameter names, values, and the apply method for the
parameter update. At least one parameter name, value, and apply method
must be supplied; subsequent arguments are optional. A maximum of 20
parameters can be modified in a single request.
Valid Values (for the application method): `immediate |
pending-reboot`
<note markdown="1"> You can use the immediate value with dynamic parameters only. You can
use the pending-reboot value for both dynamic and static parameters,
and changes are applied when you reboot the DB instance without
failover.
</note>
@return [DBParameterGroup] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-rds/lib/aws-sdk-rds/db_parameter_group.rb#L328-L335 | train | Modify the DB Parameter Group | [
30522,
13366,
19933,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
16962,
1035,
16381,
1035,
2177,
1035,
2171,
1024,
1030,
2171,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
19933,
1035,
16962,
1035,
16381,
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... |
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.begin_delete_if_exists | def begin_delete_if_exists(profile_name, resource_group_name, custom_headers:nil)
response = begin_delete_if_exists_async(profile_name, resource_group_name, custom_headers:custom_headers).value!
nil
end | ruby | def begin_delete_if_exists(profile_name, resource_group_name, custom_headers:nil)
response = begin_delete_if_exists_async(profile_name, resource_group_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_delete_if_exists",
"(",
"profile_name",
",",
"resource_group_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_delete_if_exists_async",
"(",
"profile_name",
",",
"resource_group_name",
",",
"custom_headers",
":custom_headers",
")",
".",
... | Deletes an existing CDN profile with the specified parameters. Deleting a
profile will result in the deletion of all subresources including endpoints,
origins and custom domains.
@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. | [
"Deletes",
"an",
"existing",
"CDN",
"profile",
"with",
"the",
"specified",
"parameters",
".",
"Deleting",
"a",
"profile",
"will",
"result",
"in",
"the",
"deletion",
"of",
"all",
"subresources",
"including",
"endpoints",
"origins",
"and",
"custom",
"domains",
"."... | 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#L818-L821 | train | Deletes the specified managed network interface. | [
30522,
13366,
4088,
1035,
3972,
12870,
1035,
2065,
1035,
6526,
1006,
6337,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
3972,
12870,
1035,
2065,
1035,
6526,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
daddyz/phonelib | lib/phonelib/phone_analyzer.rb | Phonelib.PhoneAnalyzer.all_number_types | def all_number_types(phone, data, not_valid = false)
response = { valid: [], possible: [] }
types_for_check(data).each do |type|
possible, valid = get_patterns(data, type)
valid_and_possible, possible_result =
number_valid_and_possible?(phone, possible, valid, not_valid)
response[:possible] << type if possible_result
response[:valid] << type if valid_and_possible
end
sanitize_fixed_mobile(response)
end | ruby | def all_number_types(phone, data, not_valid = false)
response = { valid: [], possible: [] }
types_for_check(data).each do |type|
possible, valid = get_patterns(data, type)
valid_and_possible, possible_result =
number_valid_and_possible?(phone, possible, valid, not_valid)
response[:possible] << type if possible_result
response[:valid] << type if valid_and_possible
end
sanitize_fixed_mobile(response)
end | [
"def",
"all_number_types",
"(",
"phone",
",",
"data",
",",
"not_valid",
"=",
"false",
")",
"response",
"=",
"{",
"valid",
":",
"[",
"]",
",",
"possible",
":",
"[",
"]",
"}",
"types_for_check",
"(",
"data",
")",
".",
"each",
"do",
"|",
"type",
"|",
... | Returns all valid and possible phone number types for currently parsed
phone for provided data hash.
==== Attributes
* +phone+ - phone number for parsing
* +data+ - country data
* +not_valid+ - specifies that number is not valid by general desc pattern | [
"Returns",
"all",
"valid",
"and",
"possible",
"phone",
"number",
"types",
"for",
"currently",
"parsed",
"phone",
"for",
"provided",
"data",
"hash",
"."
] | aa0023eab7c896b71275bf342bc7f49735cbdbbf | https://github.com/daddyz/phonelib/blob/aa0023eab7c896b71275bf342bc7f49735cbdbbf/lib/phonelib/phone_analyzer.rb#L163-L176 | train | Returns a hash of all number types for a phone | [
30522,
13366,
2035,
1035,
2193,
1035,
4127,
1006,
3042,
1010,
2951,
1010,
2025,
1035,
9398,
1027,
6270,
1007,
3433,
1027,
1063,
9398,
1024,
1031,
1033,
1010,
2825,
1024,
1031,
1033,
1065,
4127,
1035,
2005,
1035,
4638,
1006,
2951,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activerecord/lib/active_record/nested_attributes.rb | ActiveRecord.NestedAttributes.assign_nested_attributes_for_collection_association | def assign_nested_attributes_for_collection_association(association_name, attributes_collection)
options = nested_attributes_options[association_name]
if attributes_collection.respond_to?(:permitted?)
attributes_collection = attributes_collection.to_h
end
unless attributes_collection.is_a?(Hash) || attributes_collection.is_a?(Array)
raise ArgumentError, "Hash or Array expected for attribute `#{association_name}`, got #{attributes_collection.class.name} (#{attributes_collection.inspect})"
end
check_record_limit!(options[:limit], attributes_collection)
if attributes_collection.is_a? Hash
keys = attributes_collection.keys
attributes_collection = if keys.include?("id") || keys.include?(:id)
[attributes_collection]
else
attributes_collection.values
end
end
association = association(association_name)
existing_records = if association.loaded?
association.target
else
attribute_ids = attributes_collection.map { |a| a["id"] || a[:id] }.compact
attribute_ids.empty? ? [] : association.scope.where(association.klass.primary_key => attribute_ids)
end
attributes_collection.each do |attributes|
if attributes.respond_to?(:permitted?)
attributes = attributes.to_h
end
attributes = attributes.with_indifferent_access
if attributes["id"].blank?
unless reject_new_record?(association_name, attributes)
association.reader.build(attributes.except(*UNASSIGNABLE_KEYS))
end
elsif existing_record = existing_records.detect { |record| record.id.to_s == attributes["id"].to_s }
unless call_reject_if(association_name, attributes)
# Make sure we are operating on the actual object which is in the association's
# proxy_target array (either by finding it, or adding it if not found)
# Take into account that the proxy_target may have changed due to callbacks
target_record = association.target.detect { |record| record.id.to_s == attributes["id"].to_s }
if target_record
existing_record = target_record
else
association.add_to_target(existing_record, :skip_callbacks)
end
assign_to_or_mark_for_destruction(existing_record, attributes, options[:allow_destroy])
end
else
raise_nested_attributes_record_not_found!(association_name, attributes["id"])
end
end
end | ruby | def assign_nested_attributes_for_collection_association(association_name, attributes_collection)
options = nested_attributes_options[association_name]
if attributes_collection.respond_to?(:permitted?)
attributes_collection = attributes_collection.to_h
end
unless attributes_collection.is_a?(Hash) || attributes_collection.is_a?(Array)
raise ArgumentError, "Hash or Array expected for attribute `#{association_name}`, got #{attributes_collection.class.name} (#{attributes_collection.inspect})"
end
check_record_limit!(options[:limit], attributes_collection)
if attributes_collection.is_a? Hash
keys = attributes_collection.keys
attributes_collection = if keys.include?("id") || keys.include?(:id)
[attributes_collection]
else
attributes_collection.values
end
end
association = association(association_name)
existing_records = if association.loaded?
association.target
else
attribute_ids = attributes_collection.map { |a| a["id"] || a[:id] }.compact
attribute_ids.empty? ? [] : association.scope.where(association.klass.primary_key => attribute_ids)
end
attributes_collection.each do |attributes|
if attributes.respond_to?(:permitted?)
attributes = attributes.to_h
end
attributes = attributes.with_indifferent_access
if attributes["id"].blank?
unless reject_new_record?(association_name, attributes)
association.reader.build(attributes.except(*UNASSIGNABLE_KEYS))
end
elsif existing_record = existing_records.detect { |record| record.id.to_s == attributes["id"].to_s }
unless call_reject_if(association_name, attributes)
# Make sure we are operating on the actual object which is in the association's
# proxy_target array (either by finding it, or adding it if not found)
# Take into account that the proxy_target may have changed due to callbacks
target_record = association.target.detect { |record| record.id.to_s == attributes["id"].to_s }
if target_record
existing_record = target_record
else
association.add_to_target(existing_record, :skip_callbacks)
end
assign_to_or_mark_for_destruction(existing_record, attributes, options[:allow_destroy])
end
else
raise_nested_attributes_record_not_found!(association_name, attributes["id"])
end
end
end | [
"def",
"assign_nested_attributes_for_collection_association",
"(",
"association_name",
",",
"attributes_collection",
")",
"options",
"=",
"nested_attributes_options",
"[",
"association_name",
"]",
"if",
"attributes_collection",
".",
"respond_to?",
"(",
":permitted?",
")",
"at... | Assigns the given attributes to the collection association.
Hashes with an <tt>:id</tt> value matching an existing associated record
will update that record. Hashes without an <tt>:id</tt> value will build
a new record for the association. Hashes with a matching <tt>:id</tt>
value and a <tt>:_destroy</tt> key set to a truthy value will mark the
matched record for destruction.
For example:
assign_nested_attributes_for_collection_association(:people, {
'1' => { id: '1', name: 'Peter' },
'2' => { name: 'John' },
'3' => { id: '2', _destroy: true }
})
Will update the name of the Person with ID 1, build a new associated
person with the name 'John', and mark the associated Person with ID 2
for destruction.
Also accepts an Array of attribute hashes:
assign_nested_attributes_for_collection_association(:people, [
{ id: '1', name: 'Peter' },
{ name: 'John' },
{ id: '2', _destroy: true }
]) | [
"Assigns",
"the",
"given",
"attributes",
"to",
"the",
"collection",
"association",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activerecord/lib/active_record/nested_attributes.rb#L466-L524 | train | Assign nested attributes for a collection of objects | [
30522,
13366,
23911,
1035,
9089,
2098,
1035,
12332,
1035,
2005,
1035,
3074,
1035,
30524,
7047,
1031,
2523,
1035,
2171,
1033,
2065,
12332,
1035,
3074,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
7936,
1029,
1007,
12332,
1035,
3074,
1027,
12332... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mongodb/mongo-ruby-driver | lib/mongo/cluster.rb | Mongo.Cluster.disconnect! | def disconnect!(wait=false)
unless @connecting || @connected
return true
end
@periodic_executor.stop!
@servers.each do |server|
if server.connected?
server.disconnect!(wait)
publish_sdam_event(
Monitoring::SERVER_CLOSED,
Monitoring::Event::ServerClosed.new(server.address, topology)
)
end
end
publish_sdam_event(
Monitoring::TOPOLOGY_CLOSED,
Monitoring::Event::TopologyClosed.new(topology)
)
@connecting = @connected = false
true
end | ruby | def disconnect!(wait=false)
unless @connecting || @connected
return true
end
@periodic_executor.stop!
@servers.each do |server|
if server.connected?
server.disconnect!(wait)
publish_sdam_event(
Monitoring::SERVER_CLOSED,
Monitoring::Event::ServerClosed.new(server.address, topology)
)
end
end
publish_sdam_event(
Monitoring::TOPOLOGY_CLOSED,
Monitoring::Event::TopologyClosed.new(topology)
)
@connecting = @connected = false
true
end | [
"def",
"disconnect!",
"(",
"wait",
"=",
"false",
")",
"unless",
"@connecting",
"||",
"@connected",
"return",
"true",
"end",
"@periodic_executor",
".",
"stop!",
"@servers",
".",
"each",
"do",
"|",
"server",
"|",
"if",
"server",
".",
"connected?",
"server",
".... | Disconnect all servers.
@note Applications should call Client#close to disconnect from
the cluster rather than calling this method. This method is for
internal driver use only.
@example Disconnect the cluster's servers.
cluster.disconnect!
@param [ Boolean ] wait Whether to wait for background threads to
finish running.
@return [ true ] Always true.
@since 2.1.0 | [
"Disconnect",
"all",
"servers",
"."
] | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/cluster.rb#L392-L412 | train | Disconnects the server and all its servers. | [
30522,
13366,
12532,
10087,
6593,
999,
1006,
3524,
1027,
6270,
1007,
4983,
1030,
7176,
1064,
1064,
1030,
4198,
2709,
2995,
2203,
1030,
15861,
1035,
4654,
8586,
16161,
2099,
1012,
2644,
999,
1030,
14903,
1012,
2169,
2079,
1064,
8241,
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... |
daddyz/phonelib | lib/phonelib/data_importer_helper.rb | Phonelib.DataImporterHelper.parse_raw_file | def parse_raw_file(file)
data = {}
File.readlines(file).each do |line|
line = str_clean line, false
next if line.empty? || line[0] == '#'
prefix, line_data = line.split('|')
data[prefix] = line_data && line_data.strip.split('&')
end
data
end | ruby | def parse_raw_file(file)
data = {}
File.readlines(file).each do |line|
line = str_clean line, false
next if line.empty? || line[0] == '#'
prefix, line_data = line.split('|')
data[prefix] = line_data && line_data.strip.split('&')
end
data
end | [
"def",
"parse_raw_file",
"(",
"file",
")",
"data",
"=",
"{",
"}",
"File",
".",
"readlines",
"(",
"file",
")",
".",
"each",
"do",
"|",
"line",
"|",
"line",
"=",
"str_clean",
"line",
",",
"false",
"next",
"if",
"line",
".",
"empty?",
"||",
"line",
"[... | method parses raw data file | [
"method",
"parses",
"raw",
"data",
"file"
] | aa0023eab7c896b71275bf342bc7f49735cbdbbf | https://github.com/daddyz/phonelib/blob/aa0023eab7c896b71275bf342bc7f49735cbdbbf/lib/phonelib/data_importer_helper.rb#L98-L107 | train | Parse raw file | [
30522,
13366,
11968,
3366,
1035,
6315,
1035,
5371,
1006,
5371,
1007,
2951,
1027,
1063,
1065,
5371,
1012,
3191,
12735,
1006,
5371,
1007,
1012,
2169,
2079,
1064,
2240,
1064,
2240,
1027,
2358,
2099,
1035,
4550,
2240,
1010,
6270,
2279,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/models/workweek_config.rb | SquareConnect.WorkweekConfig.start_of_day_local_time= | def start_of_day_local_time=(start_of_day_local_time)
if start_of_day_local_time.nil?
fail ArgumentError, "start_of_day_local_time cannot be nil"
end
if start_of_day_local_time.to_s.length < 1
fail ArgumentError, "invalid value for 'start_of_day_local_time', the character length must be great than or equal to 1."
end
@start_of_day_local_time = start_of_day_local_time
end | ruby | def start_of_day_local_time=(start_of_day_local_time)
if start_of_day_local_time.nil?
fail ArgumentError, "start_of_day_local_time cannot be nil"
end
if start_of_day_local_time.to_s.length < 1
fail ArgumentError, "invalid value for 'start_of_day_local_time', the character length must be great than or equal to 1."
end
@start_of_day_local_time = start_of_day_local_time
end | [
"def",
"start_of_day_local_time",
"=",
"(",
"start_of_day_local_time",
")",
"if",
"start_of_day_local_time",
".",
"nil?",
"fail",
"ArgumentError",
",",
"\"start_of_day_local_time cannot be nil\"",
"end",
"if",
"start_of_day_local_time",
".",
"to_s",
".",
"length",
"<",
"1... | Custom attribute writer method with validation
@param [Object] start_of_day_local_time Value to be assigned | [
"Custom",
"attribute",
"writer",
"method",
"with",
"validation"
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/models/workweek_config.rb#L155-L165 | train | Sets the start_of_day_local_time attribute for this date. | [
30522,
13366,
2707,
1035,
1997,
1035,
2154,
1035,
2334,
1035,
2051,
1027,
1006,
2707,
30524,
2140,
1000,
2203,
2065,
2707,
1035,
1997,
1035,
2154,
1035,
2334,
1035,
2051,
1012,
2000,
1035,
1055,
1012,
3091,
1026,
1015,
8246,
6685,
2121,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
randym/axlsx | lib/axlsx/drawing/series_title.rb | Axlsx.SeriesTitle.to_xml_string | def to_xml_string(str = '')
str << '<c:tx>'
str << '<c:strRef>'
str << ('<c:f>' << Axlsx::cell_range([@cell]) << '</c:f>')
str << '<c:strCache>'
str << '<c:ptCount val="1"/>'
str << '<c:pt idx="0">'
str << ('<c:v>' << @text << '</c:v>')
str << '</c:pt>'
str << '</c:strCache>'
str << '</c:strRef>'
str << '</c:tx>'
end | ruby | def to_xml_string(str = '')
str << '<c:tx>'
str << '<c:strRef>'
str << ('<c:f>' << Axlsx::cell_range([@cell]) << '</c:f>')
str << '<c:strCache>'
str << '<c:ptCount val="1"/>'
str << '<c:pt idx="0">'
str << ('<c:v>' << @text << '</c:v>')
str << '</c:pt>'
str << '</c:strCache>'
str << '</c:strRef>'
str << '</c:tx>'
end | [
"def",
"to_xml_string",
"(",
"str",
"=",
"''",
")",
"str",
"<<",
"'<c:tx>'",
"str",
"<<",
"'<c:strRef>'",
"str",
"<<",
"(",
"'<c:f>'",
"<<",
"Axlsx",
"::",
"cell_range",
"(",
"[",
"@cell",
"]",
")",
"<<",
"'</c:f>'",
")",
"str",
"<<",
"'<c:strCache>'",
... | Serializes the object
@param [String] str
@return [String] | [
"Serializes",
"the",
"object"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/drawing/series_title.rb#L9-L21 | train | Convert the cell to XML string | [
30522,
13366,
2000,
1035,
20950,
1035,
5164,
1006,
2358,
2099,
1027,
1005,
1005,
1007,
2358,
2099,
1026,
1026,
1005,
1026,
1039,
1024,
19067,
1028,
1005,
2358,
2099,
1026,
1026,
1005,
1026,
1039,
1024,
2358,
14343,
2546,
1028,
1005,
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... |
cheezy/page-object | lib/page-object/accessors.rb | PageObject.Accessors.h5 | def h5(name, identifier={:index => 0}, &block)
standard_methods(name, identifier, 'h5_for', &block)
define_method(name) do
return platform.h5_text_for identifier.clone unless block_given?
self.send("#{name}_element").text
end
end | ruby | def h5(name, identifier={:index => 0}, &block)
standard_methods(name, identifier, 'h5_for', &block)
define_method(name) do
return platform.h5_text_for identifier.clone unless block_given?
self.send("#{name}_element").text
end
end | [
"def",
"h5",
"(",
"name",
",",
"identifier",
"=",
"{",
":index",
"=>",
"0",
"}",
",",
"&",
"block",
")",
"standard_methods",
"(",
"name",
",",
"identifier",
",",
"'h5_for'",
",",
"block",
")",
"define_method",
"(",
"name",
")",
"do",
"return",
"platfor... | adds three methods - one to retrieve the text of a h5 element,
another to return a h5 element, and another to check for it's existence.
@example
h5(:title, :id => 'title')
# will generate 'title', 'title_element', and 'title?' methods
@param [Symbol] the name used for the generated methods
@param [Hash] identifier how we find a H5.
@param optional block to be invoked when element method is called | [
"adds",
"three",
"methods",
"-",
"one",
"to",
"retrieve",
"the",
"text",
"of",
"a",
"h5",
"element",
"another",
"to",
"return",
"a",
"h5",
"element",
"and",
"another",
"to",
"check",
"for",
"it",
"s",
"existence",
"."
] | 850d775bf63768fbb1551a34480195785fe8e193 | https://github.com/cheezy/page-object/blob/850d775bf63768fbb1551a34480195785fe8e193/lib/page-object/accessors.rb#L742-L748 | train | Creates a new H5 object. | [
30522,
13366,
1044,
2629,
1006,
2171,
1010,
8909,
4765,
18095,
1027,
1063,
1024,
5950,
1027,
1028,
1014,
1065,
1010,
1004,
3796,
1007,
3115,
1035,
4725,
1006,
2171,
1010,
8909,
4765,
18095,
1010,
1005,
1044,
2629,
1035,
2005,
1005,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2019-03-01/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb | Azure::Compute::Mgmt::V2019_03_01.VirtualMachineScaleSets.reimage | def reimage(resource_group_name, vm_scale_set_name, vm_scale_set_reimage_input:nil, custom_headers:nil)
response = reimage_async(resource_group_name, vm_scale_set_name, vm_scale_set_reimage_input:vm_scale_set_reimage_input, custom_headers:custom_headers).value!
nil
end | ruby | def reimage(resource_group_name, vm_scale_set_name, vm_scale_set_reimage_input:nil, custom_headers:nil)
response = reimage_async(resource_group_name, vm_scale_set_name, vm_scale_set_reimage_input:vm_scale_set_reimage_input, custom_headers:custom_headers).value!
nil
end | [
"def",
"reimage",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"vm_scale_set_reimage_input",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"reimage_async",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"vm_scale_set_reim... | Reimages (upgrade the operating system) one or more virtual machines in a VM
scale set which don't have a ephemeral OS disk, for virtual machines who have
a ephemeral OS disk the virtual machine is reset to initial state.
@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_scale_set_reimage_input [VirtualMachineScaleSetReimageParameters]
Parameters for Reimaging VM ScaleSet.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Reimages",
"(",
"upgrade",
"the",
"operating",
"system",
")",
"one",
"or",
"more",
"virtual",
"machines",
"in",
"a",
"VM",
"scale",
"set",
"which",
"don",
"t",
"have",
"a",
"ephemeral",
"OS",
"disk",
"for",
"virtual",
"machines",
"who",
"have",
"a",
"ep... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2019-03-01/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb#L1070-L1073 | train | Reimage a virtual machine scale set. | [
30522,
13366,
24964,
26860,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
4094,
1035,
2275,
1035,
2171,
1010,
1058,
2213,
1035,
4094,
1035,
2275,
1035,
24964,
26860,
1035,
7953,
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... |
stripe/stripe-ruby | lib/stripe/list_object.rb | Stripe.ListObject.auto_paging_each | def auto_paging_each(&blk)
return enum_for(:auto_paging_each) unless block_given?
page = self
loop do
page.each(&blk)
page = page.next_page
break if page.empty?
end
end | ruby | def auto_paging_each(&blk)
return enum_for(:auto_paging_each) unless block_given?
page = self
loop do
page.each(&blk)
page = page.next_page
break if page.empty?
end
end | [
"def",
"auto_paging_each",
"(",
"&",
"blk",
")",
"return",
"enum_for",
"(",
":auto_paging_each",
")",
"unless",
"block_given?",
"page",
"=",
"self",
"loop",
"do",
"page",
".",
"each",
"(",
"blk",
")",
"page",
"=",
"page",
".",
"next_page",
"break",
"if",
... | Iterates through each resource in all pages, making additional fetches to
the API as necessary.
Note that this method will make as many API calls as necessary to fetch
all resources. For more granular control, please see +each+ and
+next_page+. | [
"Iterates",
"through",
"each",
"resource",
"in",
"all",
"pages",
"making",
"additional",
"fetches",
"to",
"the",
"API",
"as",
"necessary",
"."
] | 322a8c60be8a9b9ac8aad8857864680a32176935 | https://github.com/stripe/stripe-ruby/blob/322a8c60be8a9b9ac8aad8857864680a32176935/lib/stripe/list_object.rb#L53-L62 | train | Iterates over the page and returns the result of the block. | [
30522,
13366,
8285,
1035,
6643,
4726,
1035,
2169,
1006,
1004,
1038,
13687,
1007,
2709,
4372,
2819,
1035,
2005,
1006,
1024,
8285,
1035,
6643,
4726,
1035,
2169,
1007,
4983,
3796,
1035,
2445,
1029,
3931,
1027,
2969,
7077,
2079,
30524,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.begin_get_vmsecurity_rules_with_http_info | def begin_get_vmsecurity_rules_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
begin_get_vmsecurity_rules_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
end | ruby | def begin_get_vmsecurity_rules_with_http_info(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
begin_get_vmsecurity_rules_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_get_vmsecurity_rules_with_http_info",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_get_vmsecurity_rules_async",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"parameters"... | Gets the configured and effective security group rules on the specified VM.
@param resource_group_name [String] The name of the resource group.
@param network_watcher_name [String] The name of the network watcher.
@param parameters [SecurityGroupViewParameters] Parameters that define the VM
to check security groups for.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"configured",
"and",
"effective",
"security",
"group",
"rules",
"on",
"the",
"specified",
"VM",
"."
] | 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#L1535-L1537 | train | Gets the security rules for a virtual machine. | [
30522,
13366,
4088,
1035,
2131,
1035,
1058,
5244,
8586,
25137,
1035,
3513,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2897,
1035,
3422,
2121,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_container_registry/lib/2017-06-01-preview/generated/azure_mgmt_container_registry/webhooks.rb | Azure::ContainerRegistry::Mgmt::V2017_06_01_preview.Webhooks.update | def update(resource_group_name, registry_name, webhook_name, webhook_update_parameters, custom_headers:nil)
response = update_async(resource_group_name, registry_name, webhook_name, webhook_update_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def update(resource_group_name, registry_name, webhook_name, webhook_update_parameters, custom_headers:nil)
response = update_async(resource_group_name, registry_name, webhook_name, webhook_update_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"update",
"(",
"resource_group_name",
",",
"registry_name",
",",
"webhook_name",
",",
"webhook_update_parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"update_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"webhook_name",
",... | Updates a webhook 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 webhook_name [String] The name of the webhook.
@param webhook_update_parameters [WebhookUpdateParameters] The parameters for
updating a webhook.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Webhook] operation results. | [
"Updates",
"a",
"webhook",
"with",
"the",
"specified",
"parameters",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_registry/lib/2017-06-01-preview/generated/azure_mgmt_container_registry/webhooks.rb#L235-L238 | train | Updates a webhook. | [
30522,
13366,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
4773,
6806,
6559,
1035,
2171,
1010,
4773,
6806,
6559,
1035,
10651,
1035,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
10651... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
puppetlabs/puppet | lib/puppet/type.rb | Puppet.Type.to_resource | def to_resource
resource = self.retrieve_resource
resource.merge_tags_from(self)
@parameters.each do |name, param|
# Avoid adding each instance name twice
next if param.class.isnamevar? and param.value == self.title
# We've already got property values
next if param.is_a?(Puppet::Property)
resource[name] = param.value
end
resource
end | ruby | def to_resource
resource = self.retrieve_resource
resource.merge_tags_from(self)
@parameters.each do |name, param|
# Avoid adding each instance name twice
next if param.class.isnamevar? and param.value == self.title
# We've already got property values
next if param.is_a?(Puppet::Property)
resource[name] = param.value
end
resource
end | [
"def",
"to_resource",
"resource",
"=",
"self",
".",
"retrieve_resource",
"resource",
".",
"merge_tags_from",
"(",
"self",
")",
"@parameters",
".",
"each",
"do",
"|",
"name",
",",
"param",
"|",
"# Avoid adding each instance name twice",
"next",
"if",
"param",
".",
... | Convert this resource type instance to a Puppet::Resource.
@return [Puppet::Resource] Returns a serializable representation of this resource | [
"Convert",
"this",
"resource",
"type",
"instance",
"to",
"a",
"Puppet",
"::",
"Resource",
"."
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/type.rb#L2643-L2657 | train | Returns a resource object containing the parameters | [
30522,
13366,
2000,
1035,
7692,
7692,
1027,
2969,
1012,
12850,
1035,
7692,
7692,
1012,
13590,
1035,
22073,
1035,
2013,
1006,
2969,
1007,
1030,
11709,
1012,
2169,
2079,
1064,
2171,
1010,
11498,
2213,
1064,
1001,
4468,
5815,
2169,
6013,
2171,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2016-03-01/generated/azure_mgmt_web/web_site_management_client.rb | Azure::Web::Mgmt::V2016_03_01.WebSiteManagementClient.check_name_availability | def check_name_availability(name, type, is_fqdn:nil, custom_headers:nil)
response = check_name_availability_async(name, type, is_fqdn:is_fqdn, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def check_name_availability(name, type, is_fqdn:nil, custom_headers:nil)
response = check_name_availability_async(name, type, is_fqdn:is_fqdn, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"check_name_availability",
"(",
"name",
",",
"type",
",",
"is_fqdn",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"check_name_availability_async",
"(",
"name",
",",
"type",
",",
"is_fqdn",
":is_fqdn",
",",
"custom_headers",
":custo... | Check if a resource name is available.
Check if a resource name is available.
@param name [String] Resource name to verify.
@param type [CheckNameResourceTypes] Resource type used for verification.
Possible values include: 'Site', 'Slot', 'HostingEnvironment',
'PublishingUser', 'Microsoft.Web/sites', 'Microsoft.Web/sites/slots',
'Microsoft.Web/hostingEnvironments', 'Microsoft.Web/publishingUsers'
@param is_fqdn [Boolean] Is fully qualified domain name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ResourceNameAvailability] operation results. | [
"Check",
"if",
"a",
"resource",
"name",
"is",
"available",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2016-03-01/generated/azure_mgmt_web/web_site_management_client.rb#L634-L637 | train | Checks whether the name is available for the specified App Service Environment. | [
30522,
13366,
4638,
1035,
2171,
1035,
11343,
1006,
2171,
1010,
2828,
1010,
2003,
1035,
1042,
4160,
2094,
2078,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4638,
1035,
2171,
1035,
11343,
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... |
floere/phony | lib/phony/country.rb | Phony.Country.plausible? | def plausible? rest, hints = {}
local, _, ndc, *rest = internal_split rest
# Element based checking.
#
# Note: ndc == false means the country has none.
#
return false if ndc.nil?
return false if ndc && ndc.empty?
return false if @invalid_ndcs && @invalid_ndcs === ndc
# # A valid range for the rest is 0 or 3+ total digits.
# #
# return false if (1..2) === rest_size
# National destination code plausible?
#
ndc_needed = hints[:ndc]
return false if ndc_needed && !(ndc_needed === ndc)
# If there is no local part, we can assume it's not a plausible number.
# (Or, not defined correctly in Phony yet)
return false unless local
# Local code specific checks.
#
return local.plausible? rest, hints
end | ruby | def plausible? rest, hints = {}
local, _, ndc, *rest = internal_split rest
# Element based checking.
#
# Note: ndc == false means the country has none.
#
return false if ndc.nil?
return false if ndc && ndc.empty?
return false if @invalid_ndcs && @invalid_ndcs === ndc
# # A valid range for the rest is 0 or 3+ total digits.
# #
# return false if (1..2) === rest_size
# National destination code plausible?
#
ndc_needed = hints[:ndc]
return false if ndc_needed && !(ndc_needed === ndc)
# If there is no local part, we can assume it's not a plausible number.
# (Or, not defined correctly in Phony yet)
return false unless local
# Local code specific checks.
#
return local.plausible? rest, hints
end | [
"def",
"plausible?",
"rest",
",",
"hints",
"=",
"{",
"}",
"local",
",",
"_",
",",
"ndc",
",",
"*",
"rest",
"=",
"internal_split",
"rest",
"# Element based checking.",
"#",
"# Note: ndc == false means the country has none.",
"#",
"return",
"false",
"if",
"ndc",
"... | Tests for plausibility of this national number. | [
"Tests",
"for",
"plausibility",
"of",
"this",
"national",
"number",
"."
] | 9ca50743499cf478a25fdb927bcdacd29d2c90c7 | https://github.com/floere/phony/blob/9ca50743499cf478a25fdb927bcdacd29d2c90c7/lib/phony/country.rb#L171-L198 | train | Returns true if the rest is plausible. | [
30522,
13366,
24286,
1029,
2717,
1010,
20385,
1027,
1063,
1065,
2334,
1010,
1035,
1010,
1050,
16409,
1010,
1008,
2717,
1027,
4722,
1035,
3975,
2717,
1001,
5783,
2241,
9361,
1012,
1001,
1001,
3602,
1024,
1050,
16409,
1027,
1027,
6270,
2965,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_marketplace_ordering/lib/2015-06-01/generated/azure_mgmt_marketplace_ordering/marketplace_agreements.rb | Azure::MarketplaceOrdering::Mgmt::V2015_06_01.MarketplaceAgreements.create_with_http_info | def create_with_http_info(publisher_id, offer_id, plan_id, parameters, custom_headers:nil)
create_async(publisher_id, offer_id, plan_id, parameters, custom_headers:custom_headers).value!
end | ruby | def create_with_http_info(publisher_id, offer_id, plan_id, parameters, custom_headers:nil)
create_async(publisher_id, offer_id, plan_id, parameters, custom_headers:custom_headers).value!
end | [
"def",
"create_with_http_info",
"(",
"publisher_id",
",",
"offer_id",
",",
"plan_id",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"create_async",
"(",
"publisher_id",
",",
"offer_id",
",",
"plan_id",
",",
"parameters",
",",
"custom_headers",
":custo... | Save marketplace terms.
@param publisher_id [String] Publisher identifier string of image being
deployed.
@param offer_id [String] Offer identifier string of image being deployed.
@param plan_id [String] Plan identifier string of image being deployed.
@param parameters [AgreementTerms] Parameters supplied to the Create
Marketplace Terms 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. | [
"Save",
"marketplace",
"terms",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_marketplace_ordering/lib/2015-06-01/generated/azure_mgmt_marketplace_ordering/marketplace_agreements.rb#L157-L159 | train | Creates a new chunk of a chunk of a chunk of data. | [
30522,
13366,
3443,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
6674,
1035,
8909,
1010,
3749,
1035,
8909,
1010,
2933,
1035,
8909,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3443,
1035,
2004,
6038,
2278,
1006,
6674,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
github/linguist | lib/linguist/classifier.rb | Linguist.Classifier.classify | def classify(tokens, languages)
return [] if tokens.nil? || languages.empty?
tokens = Tokenizer.tokenize(tokens) if tokens.is_a?(String)
scores = {}
debug_dump_all_tokens(tokens, languages) if verbosity >= 2
languages.each do |language|
scores[language] = tokens_probability(tokens, language) + language_probability(language)
debug_dump_probabilities(tokens, language, scores[language]) if verbosity >= 1
end
scores.sort { |a, b| b[1] <=> a[1] }.map { |score| [score[0], score[1]] }
end | ruby | def classify(tokens, languages)
return [] if tokens.nil? || languages.empty?
tokens = Tokenizer.tokenize(tokens) if tokens.is_a?(String)
scores = {}
debug_dump_all_tokens(tokens, languages) if verbosity >= 2
languages.each do |language|
scores[language] = tokens_probability(tokens, language) + language_probability(language)
debug_dump_probabilities(tokens, language, scores[language]) if verbosity >= 1
end
scores.sort { |a, b| b[1] <=> a[1] }.map { |score| [score[0], score[1]] }
end | [
"def",
"classify",
"(",
"tokens",
",",
"languages",
")",
"return",
"[",
"]",
"if",
"tokens",
".",
"nil?",
"||",
"languages",
".",
"empty?",
"tokens",
"=",
"Tokenizer",
".",
"tokenize",
"(",
"tokens",
")",
"if",
"tokens",
".",
"is_a?",
"(",
"String",
")... | Internal: Initialize a Classifier.
Internal: Guess language of data
data - Array of tokens or String data to analyze.
languages - Array of language name Strings to restrict to.
Returns sorted Array of result pairs. Each pair contains the
String language name and a Float score. | [
"Internal",
":",
"Initialize",
"a",
"Classifier",
".",
"Internal",
":",
"Guess",
"language",
"of",
"data"
] | 9116c90fcbb82ac03b4b33c58cfbde1fcf745e99 | https://github.com/github/linguist/blob/9116c90fcbb82ac03b4b33c58cfbde1fcf745e99/lib/linguist/classifier.rb#L99-L112 | train | Returns the probability of the given tokens and languages. | [
30522,
13366,
26268,
1006,
19204,
2015,
1010,
4155,
1007,
2709,
1031,
1033,
2065,
19204,
2015,
1012,
9152,
2140,
1029,
1064,
1064,
4155,
1012,
4064,
1029,
19204,
2015,
1027,
19204,
17629,
1012,
19204,
4697,
1006,
19204,
2015,
1007,
2065,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/workflows.rb | Azure::Logic::Mgmt::V2016_06_01.Workflows.create_or_update_with_http_info | def create_or_update_with_http_info(resource_group_name, workflow_name, workflow, custom_headers:nil)
create_or_update_async(resource_group_name, workflow_name, workflow, custom_headers:custom_headers).value!
end | ruby | def create_or_update_with_http_info(resource_group_name, workflow_name, workflow, custom_headers:nil)
create_or_update_async(resource_group_name, workflow_name, workflow, custom_headers:custom_headers).value!
end | [
"def",
"create_or_update_with_http_info",
"(",
"resource_group_name",
",",
"workflow_name",
",",
"workflow",
",",
"custom_headers",
":",
"nil",
")",
"create_or_update_async",
"(",
"resource_group_name",
",",
"workflow_name",
",",
"workflow",
",",
"custom_headers",
":custo... | Creates or updates a workflow.
@param resource_group_name [String] The resource group name.
@param workflow_name [String] The workflow name.
@param workflow [Workflow] The workflow.
@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",
"workflow",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/workflows.rb#L333-L335 | train | Creates or updates a workflow. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2147,
12314,
1035,
2171,
1010,
2147,
12314,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3443,
1035,
2030,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-01-01/generated/azure_mgmt_network/inbound_nat_rules.rb | Azure::Network::Mgmt::V2018_01_01.InboundNatRules.get_with_http_info | def get_with_http_info(resource_group_name, load_balancer_name, inbound_nat_rule_name, expand:nil, custom_headers:nil)
get_async(resource_group_name, load_balancer_name, inbound_nat_rule_name, expand:expand, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, load_balancer_name, inbound_nat_rule_name, expand:nil, custom_headers:nil)
get_async(resource_group_name, load_balancer_name, inbound_nat_rule_name, expand:expand, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"load_balancer_name",
",",
"inbound_nat_rule_name",
",",
"expand",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"load_balancer_name",
",",
"inbound_nat_rul... | Gets the specified load balancer inbound nat rule.
@param resource_group_name [String] The name of the resource group.
@param load_balancer_name [String] The name of the load balancer.
@param inbound_nat_rule_name [String] The name of the inbound nat rule.
@param expand [String] Expands referenced resources.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"specified",
"load",
"balancer",
"inbound",
"nat",
"rule",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-01-01/generated/azure_mgmt_network/inbound_nat_rules.rb#L185-L187 | train | Gets the specified load balancer inbound nat rule. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7170,
1035,
5703,
2099,
1035,
2171,
1010,
1999,
15494,
1035,
14085,
1035,
3627,
1035,
2171,
1010,
7818,
1024,
9152,
2140,
1010,
7661,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.