repo stringclasses 237 values | path stringlengths 11 168 | func_name stringlengths 10 147 | original_string stringlengths 79 124k | language stringclasses 1 value | code stringlengths 79 124k | code_tokens listlengths 16 45.3k | docstring stringlengths 4 23.5k | docstring_tokens listlengths 1 452 | sha stringclasses 237 values | url stringlengths 95 268 | partition stringclasses 1 value | summary stringlengths 8 229 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
castwide/solargraph | lib/solargraph/source.rb | Solargraph.Source.start_synchronize | def start_synchronize updater
raise 'Invalid synchronization' unless updater.filename == filename
real_code = updater.write(@code)
src = Source.allocate
src.filename = filename
src.code = real_code
src.version = updater.version
src.parsed = parsed?
src.repaired = updater.repair(@repaired)
src.synchronized = false
src.node = @node
src.comments = @comments
src.error_ranges = error_ranges
src.last_updater = updater
return src.finish_synchronize unless real_code.lines.length == @code.lines.length
src
end | ruby | def start_synchronize updater
raise 'Invalid synchronization' unless updater.filename == filename
real_code = updater.write(@code)
src = Source.allocate
src.filename = filename
src.code = real_code
src.version = updater.version
src.parsed = parsed?
src.repaired = updater.repair(@repaired)
src.synchronized = false
src.node = @node
src.comments = @comments
src.error_ranges = error_ranges
src.last_updater = updater
return src.finish_synchronize unless real_code.lines.length == @code.lines.length
src
end | [
"def",
"start_synchronize",
"updater",
"raise",
"'Invalid synchronization'",
"unless",
"updater",
".",
"filename",
"==",
"filename",
"real_code",
"=",
"updater",
".",
"write",
"(",
"@code",
")",
"src",
"=",
"Source",
".",
"allocate",
"src",
".",
"filename",
"=",... | Start synchronizing the source. This method updates the code without
parsing a new AST. The resulting Source object will be marked not
synchronized (#synchronized? == false).
@param updater [Source::Updater]
@return [Source] | [
"Start",
"synchronizing",
"the",
"source",
".",
"This",
"method",
"updates",
"the",
"code",
"without",
"parsing",
"a",
"new",
"AST",
".",
"The",
"resulting",
"Source",
"object",
"will",
"be",
"marked",
"not",
"synchronized",
"(",
"#synchronized?",
"==",
"false... | 47badb5d151aca775ccbe6c470236089eae7839d | https://github.com/castwide/solargraph/blob/47badb5d151aca775ccbe6c470236089eae7839d/lib/solargraph/source.rb#L113-L129 | train | Start synchronization of the source. | [
30522,
13366,
2707,
1035,
26351,
8093,
10698,
4371,
10651,
2099,
5333,
1005,
19528,
26351,
8093,
10698,
9276,
1005,
4983,
10651,
2099,
1012,
5371,
18442,
1027,
1027,
5371,
18442,
2613,
1035,
3642,
1027,
10651,
2099,
1012,
4339,
1006,
1030,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.create_regex_entity_model_with_http_info | def create_regex_entity_model_with_http_info(app_id, version_id, regex_entity_extractor_create_obj, custom_headers:nil)
create_regex_entity_model_async(app_id, version_id, regex_entity_extractor_create_obj, custom_headers:custom_headers).value!
end | ruby | def create_regex_entity_model_with_http_info(app_id, version_id, regex_entity_extractor_create_obj, custom_headers:nil)
create_regex_entity_model_async(app_id, version_id, regex_entity_extractor_create_obj, custom_headers:custom_headers).value!
end | [
"def",
"create_regex_entity_model_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"regex_entity_extractor_create_obj",
",",
"custom_headers",
":",
"nil",
")",
"create_regex_entity_model_async",
"(",
"app_id",
",",
"version_id",
",",
"regex_entity_extractor_create_obj",
... | Adds a regular expression entity model to a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param regex_entity_extractor_create_obj [RegexModelCreateObject] A model
object containing the name and regex pattern for the new regular expression
entity extractor.
@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. | [
"Adds",
"a",
"regular",
"expression",
"entity",
"model",
"to",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L5791-L5793 | train | Creates a regex entity model in a version of the application. | [
30522,
13366,
3443,
1035,
19723,
10288,
1035,
9178,
1035,
2944,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
19723,
10288,
1035,
9178,
1035,
14817,
2953,
1035,
3443,
1035,
27885,
3501,
1010,
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... |
collectiveidea/audited | lib/audited/audit.rb | Audited.Audit.new_attributes | def new_attributes
(audited_changes || {}).inject({}.with_indifferent_access) do |attrs, (attr, values)|
attrs[attr] = values.is_a?(Array) ? values.last : values
attrs
end
end | ruby | def new_attributes
(audited_changes || {}).inject({}.with_indifferent_access) do |attrs, (attr, values)|
attrs[attr] = values.is_a?(Array) ? values.last : values
attrs
end
end | [
"def",
"new_attributes",
"(",
"audited_changes",
"||",
"{",
"}",
")",
".",
"inject",
"(",
"{",
"}",
".",
"with_indifferent_access",
")",
"do",
"|",
"attrs",
",",
"(",
"attr",
",",
"values",
")",
"|",
"attrs",
"[",
"attr",
"]",
"=",
"values",
".",
"is... | Returns a hash of the changed attributes with the new values | [
"Returns",
"a",
"hash",
"of",
"the",
"changed",
"attributes",
"with",
"the",
"new",
"values"
] | af5d51b45368eabb0e727d064faf29f4af6e1458 | https://github.com/collectiveidea/audited/blob/af5d51b45368eabb0e727d064faf29f4af6e1458/lib/audited/audit.rb#L73-L78 | train | Returns a new hash of attributes with the new attributes. | [
30522,
13366,
2047,
1035,
12332,
1006,
15727,
2098,
1035,
3431,
1064,
1064,
1063,
1065,
1007,
1012,
1999,
20614,
1006,
1063,
1065,
1012,
2007,
1035,
24436,
1035,
3229,
1007,
2079,
1064,
2012,
16344,
2015,
1010,
1006,
2012,
16344,
1010,
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... |
meew0/discordrb | lib/discordrb/data/message.rb | Discordrb.Message.create_reaction | def create_reaction(reaction)
reaction = reaction.to_reaction if reaction.respond_to?(:to_reaction)
API::Channel.create_reaction(@bot.token, @channel.id, @id, reaction)
nil
end | ruby | def create_reaction(reaction)
reaction = reaction.to_reaction if reaction.respond_to?(:to_reaction)
API::Channel.create_reaction(@bot.token, @channel.id, @id, reaction)
nil
end | [
"def",
"create_reaction",
"(",
"reaction",
")",
"reaction",
"=",
"reaction",
".",
"to_reaction",
"if",
"reaction",
".",
"respond_to?",
"(",
":to_reaction",
")",
"API",
"::",
"Channel",
".",
"create_reaction",
"(",
"@bot",
".",
"token",
",",
"@channel",
".",
... | Reacts to a message.
@param reaction [String, #to_reaction] the unicode emoji or {Emoji} | [
"Reacts",
"to",
"a",
"message",
"."
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/data/message.rb#L243-L247 | train | Create a reaction | [
30522,
13366,
3443,
1035,
4668,
1006,
4668,
1007,
4668,
1027,
4668,
1012,
2000,
1035,
4668,
2065,
4668,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
2000,
1035,
4668,
1007,
17928,
1024,
1024,
3149,
1012,
3443,
1035,
4668,
1006,
1030,
28516,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | runtime/ms_rest_azure/lib/ms_rest_azure/azure_service_client.rb | MsRestAzure.AzureServiceClient.get_async_common | def get_async_common(request)
fail ValidationError, 'Request cannot be nil' if request.nil?
request.middlewares = [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]]
request.headers.merge!({'x-ms-client-request-id' => SecureRandom.uuid}) unless request.headers.key?('x-ms-client-request-id')
request.headers.merge!({'Content-Type' => 'application/json'}) unless request.headers.key?('Content-Type')
# Send Request
http_response = request.run_promise do |req|
@credentials.sign_request(req) unless @credentials.nil?
end.execute.value!
status_code = http_response.status
if status_code != 200 && status_code != 201 && status_code != 202 && status_code != 204
json_error_data = JSON.load(http_response.body)
error_data = CloudErrorData.deserialize_object(json_error_data)
fail AzureOperationError.new request, http_response, error_data, "Long running operation failed with status #{status_code}"
end
result = MsRest::HttpOperationResponse.new(request, http_response, http_response.body)
begin
result.body = JSON.load(http_response.body) unless http_response.body.to_s.empty?
rescue Exception => e
fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, result)
end
result
end | ruby | def get_async_common(request)
fail ValidationError, 'Request cannot be nil' if request.nil?
request.middlewares = [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]]
request.headers.merge!({'x-ms-client-request-id' => SecureRandom.uuid}) unless request.headers.key?('x-ms-client-request-id')
request.headers.merge!({'Content-Type' => 'application/json'}) unless request.headers.key?('Content-Type')
# Send Request
http_response = request.run_promise do |req|
@credentials.sign_request(req) unless @credentials.nil?
end.execute.value!
status_code = http_response.status
if status_code != 200 && status_code != 201 && status_code != 202 && status_code != 204
json_error_data = JSON.load(http_response.body)
error_data = CloudErrorData.deserialize_object(json_error_data)
fail AzureOperationError.new request, http_response, error_data, "Long running operation failed with status #{status_code}"
end
result = MsRest::HttpOperationResponse.new(request, http_response, http_response.body)
begin
result.body = JSON.load(http_response.body) unless http_response.body.to_s.empty?
rescue Exception => e
fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, result)
end
result
end | [
"def",
"get_async_common",
"(",
"request",
")",
"fail",
"ValidationError",
",",
"'Request cannot be nil'",
"if",
"request",
".",
"nil?",
"request",
".",
"middlewares",
"=",
"[",
"[",
"MsRest",
"::",
"RetryPolicyMiddleware",
",",
"times",
":",
"3",
",",
"retry",
... | Retrieves data by given URL.
@param request [MsRest::HttpOperationRequest] the URL.
@return [MsRest::HttpOperationResponse] the response. | [
"Retrieves",
"data",
"by",
"given",
"URL",
".",
"@param",
"request",
"[",
"MsRest",
"::",
"HttpOperationRequest",
"]",
"the",
"URL",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/runtime/ms_rest_azure/lib/ms_rest_azure/azure_service_client.rb#L259-L289 | train | Get the async common response from the server | [
30522,
13366,
2131,
1035,
2004,
6038,
2278,
1035,
2691,
1006,
5227,
1007,
8246,
27354,
2121,
29165,
1010,
1005,
5227,
3685,
2022,
9152,
2140,
1005,
2065,
5227,
1012,
9152,
2140,
1029,
5227,
1012,
2690,
8059,
2015,
1027,
1031,
1031,
5796,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.each | def each(reload=false)
if reload
@lock.synchronize do
with_index_lock do
unlocked_reload
end
end
end
@machines.each do |uuid, data|
yield Entry.new(uuid, data.merge("id" => uuid))
end
end | ruby | def each(reload=false)
if reload
@lock.synchronize do
with_index_lock do
unlocked_reload
end
end
end
@machines.each do |uuid, data|
yield Entry.new(uuid, data.merge("id" => uuid))
end
end | [
"def",
"each",
"(",
"reload",
"=",
"false",
")",
"if",
"reload",
"@lock",
".",
"synchronize",
"do",
"with_index_lock",
"do",
"unlocked_reload",
"end",
"end",
"end",
"@machines",
".",
"each",
"do",
"|",
"uuid",
",",
"data",
"|",
"yield",
"Entry",
".",
"ne... | Iterate over every machine in the index. The yielded {Entry} objects
will NOT be locked, so you'll have to call {#get} manually to acquire
the lock on them. | [
"Iterate",
"over",
"every",
"machine",
"in",
"the",
"index",
".",
"The",
"yielded",
"{",
"Entry",
"}",
"objects",
"will",
"NOT",
"be",
"locked",
"so",
"you",
"ll",
"have",
"to",
"call",
"{",
"#get",
"}",
"manually",
"to",
"acquire",
"the",
"lock",
"on"... | c22a145c59790c098f95d50141d9afb48e1ef55f | https://github.com/hashicorp/vagrant/blob/c22a145c59790c098f95d50141d9afb48e1ef55f/lib/vagrant/machine_index.rb#L92-L104 | train | Yields each entry in the collection. | [
30522,
13366,
2169,
1006,
2128,
11066,
1027,
6270,
1007,
2065,
2128,
11066,
1030,
5843,
1012,
26351,
8093,
10698,
4371,
2079,
2007,
1035,
5950,
1035,
5843,
2079,
14058,
1035,
2128,
11066,
2203,
2203,
2203,
1030,
6681,
1012,
2169,
2079,
1064... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-core/lib/aws-sdk-core/deprecations.rb | Aws.Deprecations.deprecated | def deprecated(method_name, options = {})
deprecation_msg = options[:message] || begin
msg = "DEPRECATION WARNING: called deprecated method `#{method_name}' "
msg << "of an #{self}"
msg << ", use #{options[:use]} instead" if options[:use]
msg
end
alias_method(:"deprecated_#{method_name}", method_name)
warned = false # we only want to issue this warning once
define_method(method_name) do |*args,&block|
unless warned
warned = true
warn(deprecation_msg + "\n" + caller.join("\n"))
end
send("deprecated_#{method_name}", *args, &block)
end
end | ruby | def deprecated(method_name, options = {})
deprecation_msg = options[:message] || begin
msg = "DEPRECATION WARNING: called deprecated method `#{method_name}' "
msg << "of an #{self}"
msg << ", use #{options[:use]} instead" if options[:use]
msg
end
alias_method(:"deprecated_#{method_name}", method_name)
warned = false # we only want to issue this warning once
define_method(method_name) do |*args,&block|
unless warned
warned = true
warn(deprecation_msg + "\n" + caller.join("\n"))
end
send("deprecated_#{method_name}", *args, &block)
end
end | [
"def",
"deprecated",
"(",
"method_name",
",",
"options",
"=",
"{",
"}",
")",
"deprecation_msg",
"=",
"options",
"[",
":message",
"]",
"||",
"begin",
"msg",
"=",
"\"DEPRECATION WARNING: called deprecated method `#{method_name}' \"",
"msg",
"<<",
"\"of an #{self}\"",
"m... | @param [Symbol] method_name The name of the deprecated method.
@option options [String] :message The warning message to issue
when the deprecated method is called.
@option options [Symbol] :use The name of an use
method that should be used. | [
"@param",
"[",
"Symbol",
"]",
"method_name",
"The",
"name",
"of",
"the",
"deprecated",
"method",
"."
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-core/lib/aws-sdk-core/deprecations.rb#L46-L66 | train | Used to create a deprecated method | [
30522,
13366,
2139,
28139,
12921,
1006,
4118,
1035,
2171,
1010,
7047,
1027,
1063,
1065,
1007,
2139,
28139,
10719,
1035,
5796,
2290,
1027,
7047,
1031,
1024,
4471,
1033,
1064,
1064,
4088,
5796,
2290,
1027,
1000,
2139,
28139,
10719,
5432,
1024... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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_key | def get_deleted_key(vault_base_url, key_name, custom_headers:nil)
response = get_deleted_key_async(vault_base_url, key_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_deleted_key(vault_base_url, key_name, custom_headers:nil)
response = get_deleted_key_async(vault_base_url, key_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_deleted_key",
"(",
"vault_base_url",
",",
"key_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_deleted_key_async",
"(",
"vault_base_url",
",",
"key_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",... | Gets the public part of a deleted key.
The Get Deleted Key operation is applicable for soft-delete enabled vaults.
While the operation can be invoked on any vault, it will return an error if
invoked on a non soft-delete enabled vault. This operation requires the
keys/get permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param key_name [String] The name of the key.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [DeletedKeyBundle] operation results. | [
"Gets",
"the",
"public",
"part",
"of",
"a",
"deleted",
"key",
"."
] | 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#L2339-L2342 | train | Gets the deleted key. | [
30522,
13366,
2131,
1035,
17159,
1035,
3145,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
3145,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
17159,
1035,
3145,
1035,
2004,
6038,
2278,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | actionpack/lib/action_controller/metal/rendering.rb | ActionController.Rendering._process_options | def _process_options(options)
status, content_type, location = options.values_at(:status, :content_type, :location)
self.status = status if status
self.content_type = content_type if content_type
headers["Location"] = url_for(location) if location
super
end | ruby | def _process_options(options)
status, content_type, location = options.values_at(:status, :content_type, :location)
self.status = status if status
self.content_type = content_type if content_type
headers["Location"] = url_for(location) if location
super
end | [
"def",
"_process_options",
"(",
"options",
")",
"status",
",",
"content_type",
",",
"location",
"=",
"options",
".",
"values_at",
"(",
":status",
",",
":content_type",
",",
":location",
")",
"self",
".",
"status",
"=",
"status",
"if",
"status",
"self",
".",
... | Process controller specific options, as status, content-type and location. | [
"Process",
"controller",
"specific",
"options",
"as",
"status",
"content",
"-",
"type",
"and",
"location",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/actionpack/lib/action_controller/metal/rendering.rb#L112-L120 | train | Process the options | [
30522,
13366,
1035,
2832,
1035,
7047,
1006,
7047,
1007,
3570,
1010,
4180,
1035,
2828,
1010,
3295,
1027,
7047,
1012,
5300,
1035,
2012,
1006,
1024,
3570,
1010,
1024,
4180,
1035,
2828,
1010,
1024,
3295,
1007,
2969,
1012,
3570,
1027,
3570,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
palkan/logidze | lib/logidze/model.rb | Logidze.Model.at | def at(ts = nil, time: nil, version: nil)
Deprecations.show_ts_deprecation_for("#at") if ts
return at_version(version) if version
time ||= ts
time = parse_time(time)
return nil unless log_data.exists_ts?(time)
if log_data.current_ts?(time)
self.logidze_requested_ts = time
return self
end
log_entry = log_data.find_by_time(time)
build_dup(log_entry, time)
end | ruby | def at(ts = nil, time: nil, version: nil)
Deprecations.show_ts_deprecation_for("#at") if ts
return at_version(version) if version
time ||= ts
time = parse_time(time)
return nil unless log_data.exists_ts?(time)
if log_data.current_ts?(time)
self.logidze_requested_ts = time
return self
end
log_entry = log_data.find_by_time(time)
build_dup(log_entry, time)
end | [
"def",
"at",
"(",
"ts",
"=",
"nil",
",",
"time",
":",
"nil",
",",
"version",
":",
"nil",
")",
"Deprecations",
".",
"show_ts_deprecation_for",
"(",
"\"#at\"",
")",
"if",
"ts",
"return",
"at_version",
"(",
"version",
")",
"if",
"version",
"time",
"||=",
... | Return a dirty copy of record at specified time
If time/version is less then the first version, then return nil.
If time/version is greater then the last version, then return self.
rubocop: disable Metrics/MethodLength | [
"Return",
"a",
"dirty",
"copy",
"of",
"record",
"at",
"specified",
"time",
"If",
"time",
"/",
"version",
"is",
"less",
"then",
"the",
"first",
"version",
"then",
"return",
"nil",
".",
"If",
"time",
"/",
"version",
"is",
"greater",
"then",
"the",
"last",
... | ffa0f793cb9c6fab96fa67a285341ca9aaa7ded8 | https://github.com/palkan/logidze/blob/ffa0f793cb9c6fab96fa67a285341ca9aaa7ded8/lib/logidze/model.rb#L72-L90 | train | Returns the log entry at the given timestamp. | [
30522,
13366,
2012,
1006,
24529,
1027,
9152,
2140,
1010,
2051,
1024,
9152,
2140,
1010,
2544,
1024,
9152,
2140,
1007,
2139,
28139,
10719,
2015,
1012,
2265,
1035,
24529,
1035,
2139,
28139,
10719,
1035,
2005,
1006,
1000,
1001,
2012,
1000,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/api/reporting_api.rb | SquareConnect.ReportingApi.list_additional_recipient_receivable_refunds | def list_additional_recipient_receivable_refunds(location_id, opts = {})
data, _status_code, _headers = list_additional_recipient_receivable_refunds_with_http_info(location_id, opts)
return data
end | ruby | def list_additional_recipient_receivable_refunds(location_id, opts = {})
data, _status_code, _headers = list_additional_recipient_receivable_refunds_with_http_info(location_id, opts)
return data
end | [
"def",
"list_additional_recipient_receivable_refunds",
"(",
"location_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"list_additional_recipient_receivable_refunds_with_http_info",
"(",
"location_id",
",",
"opts",
")",
"return",
... | ListAdditionalRecipientReceivableRefunds
Returns a list of refunded transactions (across all possible originating locations) relating to monies credited to the provided location ID by another Square account using the `additional_recipients` field in a transaction. Max results per [page](#paginatingresults): 50
@param location_id The ID of the location to list AdditionalRecipientReceivableRefunds for.
@param [Hash] opts the optional parameters
@option opts [String] :begin_time The beginning of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time minus one year.
@option opts [String] :end_time The end of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time.
@option opts [String] :sort_order The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC`
@option opts [String] :cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. See [Pagination](/basics/api101/pagination) for more information.
@return [ListAdditionalRecipientReceivableRefundsResponse] | [
"ListAdditionalRecipientReceivableRefunds",
"Returns",
"a",
"list",
"of",
"refunded",
"transactions",
"(",
"across",
"all",
"possible",
"originating",
"locations",
")",
"relating",
"to",
"monies",
"credited",
"to",
"the",
"provided",
"location",
"ID",
"by",
"another",... | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/reporting_api.rb#L29-L32 | train | Returns the additional recipient receiptable refunds for a location | [
30522,
13366,
2862,
1035,
3176,
1035,
7799,
1035,
28667,
7416,
12423,
1035,
25416,
26698,
1006,
3295,
1035,
8909,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
2862,
1035,
3176... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/vagrantfile.rb | Vagrant.Vagrantfile.primary_machine_name | def primary_machine_name
# If it is a single machine environment, then return the name
return machine_names.first if machine_names.length == 1
# If it is a multi-machine environment, then return the primary
@config.vm.defined_vms.each do |name, subvm|
return name if subvm.options[:primary]
end
# If no primary was specified, nil it is
nil
end | ruby | def primary_machine_name
# If it is a single machine environment, then return the name
return machine_names.first if machine_names.length == 1
# If it is a multi-machine environment, then return the primary
@config.vm.defined_vms.each do |name, subvm|
return name if subvm.options[:primary]
end
# If no primary was specified, nil it is
nil
end | [
"def",
"primary_machine_name",
"# If it is a single machine environment, then return the name",
"return",
"machine_names",
".",
"first",
"if",
"machine_names",
".",
"length",
"==",
"1",
"# If it is a multi-machine environment, then return the primary",
"@config",
".",
"vm",
".",
... | Returns the name of the machine that is designated as the
"primary."
In the case of a single-machine environment, this is just the
single machine name. In the case of a multi-machine environment,
then this is the machine that is marked as primary, or nil if
no primary machine was specified.
@return [Symbol] | [
"Returns",
"the",
"name",
"of",
"the",
"machine",
"that",
"is",
"designated",
"as",
"the",
"primary",
"."
] | c22a145c59790c098f95d50141d9afb48e1ef55f | https://github.com/hashicorp/vagrant/blob/c22a145c59790c098f95d50141d9afb48e1ef55f/lib/vagrant/vagrantfile.rb#L290-L301 | train | Returns the primary machine name | [
30522,
13366,
3078,
1035,
3698,
1035,
2171,
1001,
2065,
2009,
2003,
1037,
2309,
3698,
4044,
1010,
2059,
2709,
1996,
2171,
2709,
3698,
1035,
3415,
1012,
2034,
2065,
3698,
1035,
3415,
1012,
3091,
1027,
1027,
1015,
1001,
2065,
2009,
2003,
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 | data/azure_cognitiveservices_face/lib/1.0/generated/azure_cognitiveservices_face/large_person_group_person.rb | Azure::CognitiveServices::Face::V1_0.LargePersonGroupPerson.get_face_with_http_info | def get_face_with_http_info(large_person_group_id, person_id, persisted_face_id, custom_headers:nil)
get_face_async(large_person_group_id, person_id, persisted_face_id, custom_headers:custom_headers).value!
end | ruby | def get_face_with_http_info(large_person_group_id, person_id, persisted_face_id, custom_headers:nil)
get_face_async(large_person_group_id, person_id, persisted_face_id, custom_headers:custom_headers).value!
end | [
"def",
"get_face_with_http_info",
"(",
"large_person_group_id",
",",
"person_id",
",",
"persisted_face_id",
",",
"custom_headers",
":",
"nil",
")",
"get_face_async",
"(",
"large_person_group_id",
",",
"person_id",
",",
"persisted_face_id",
",",
"custom_headers",
":custom_... | Retrieve information about a persisted face (specified by persistedFaceId,
personId and its belonging largePersonGroupId).
@param large_person_group_id [String] Id referencing a particular large
person group.
@param person_id Id referencing a particular person.
@param persisted_face_id Id referencing a particular persistedFaceId of an
existing face.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Retrieve",
"information",
"about",
"a",
"persisted",
"face",
"(",
"specified",
"by",
"persistedFaceId",
"personId",
"and",
"its",
"belonging",
"largePersonGroupId",
")",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_face/lib/1.0/generated/azure_cognitiveservices_face/large_person_group_person.rb#L685-L687 | train | Gets the persisted face for a person. | [
30522,
13366,
2131,
1035,
2227,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2312,
1035,
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,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ruby/rake | lib/rake/task_manager.rb | Rake.TaskManager.lookup_in_scope | def lookup_in_scope(name, scope)
loop do
tn = scope.path_with_task_name(name)
task = @tasks[tn]
return task if task
break if scope.empty?
scope = scope.tail
end
nil
end | ruby | def lookup_in_scope(name, scope)
loop do
tn = scope.path_with_task_name(name)
task = @tasks[tn]
return task if task
break if scope.empty?
scope = scope.tail
end
nil
end | [
"def",
"lookup_in_scope",
"(",
"name",
",",
"scope",
")",
"loop",
"do",
"tn",
"=",
"scope",
".",
"path_with_task_name",
"(",
"name",
")",
"task",
"=",
"@tasks",
"[",
"tn",
"]",
"return",
"task",
"if",
"task",
"break",
"if",
"scope",
".",
"empty?",
"sco... | Lookup the task name | [
"Lookup",
"the",
"task",
"name"
] | 1c22b490ee6cb8bd614fa8d0d6145f671466206b | https://github.com/ruby/rake/blob/1c22b490ee6cb8bd614fa8d0d6145f671466206b/lib/rake/task_manager.rb#L201-L210 | train | Lookup a task in a given scope | [
30522,
13366,
2298,
6279,
1035,
1999,
1035,
9531,
1006,
2171,
1010,
9531,
1007,
7077,
2079,
28286,
1027,
9531,
1012,
4130,
1035,
2007,
1035,
4708,
1035,
2171,
1006,
2171,
1007,
4708,
1027,
1030,
8518,
1031,
28286,
1033,
2709,
4708,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/virtual_networks.rb | Azure::Network::Mgmt::V2018_07_01.VirtualNetworks.check_ipaddress_availability | def check_ipaddress_availability(resource_group_name, virtual_network_name, ip_address:nil, custom_headers:nil)
response = check_ipaddress_availability_async(resource_group_name, virtual_network_name, ip_address:ip_address, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def check_ipaddress_availability(resource_group_name, virtual_network_name, ip_address:nil, custom_headers:nil)
response = check_ipaddress_availability_async(resource_group_name, virtual_network_name, ip_address:ip_address, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"check_ipaddress_availability",
"(",
"resource_group_name",
",",
"virtual_network_name",
",",
"ip_address",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"check_ipaddress_availability_async",
"(",
"resource_group_name",
",",
"virtual_network_na... | Checks whether a private IP address is available for use.
@param resource_group_name [String] The name of the resource group.
@param virtual_network_name [String] The name of the virtual network.
@param ip_address [String] The private IP address to be verified.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [IPAddressAvailabilityResult] operation results. | [
"Checks",
"whether",
"a",
"private",
"IP",
"address",
"is",
"available",
"for",
"use",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/virtual_networks.rb#L432-L435 | train | Checks whether the specified virtual network ip address is available for use. | [
30522,
13366,
4638,
1035,
25249,
16200,
4757,
1035,
11343,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7484,
1035,
2897,
1035,
2171,
1010,
12997,
1035,
4769,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-iam/lib/aws-sdk-iam/policy.rb | Aws::IAM.Policy.detach_role | def detach_role(options = {})
options = options.merge(policy_arn: @arn)
resp = @client.detach_role_policy(options)
resp.data
end | ruby | def detach_role(options = {})
options = options.merge(policy_arn: @arn)
resp = @client.detach_role_policy(options)
resp.data
end | [
"def",
"detach_role",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"policy_arn",
":",
"@arn",
")",
"resp",
"=",
"@client",
".",
"detach_role_policy",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
policy.detach_role({
role_name: "roleNameType", # required
})
@param [Hash] options ({})
@option options [required, String] :role_name
The name (friendly name, not ARN) of the IAM role to detach the policy
from.
This parameter allows (through its [regex pattern][1]) a string of
characters consisting of upper and lowercase alphanumeric characters
with no spaces. You can also include any of the following characters:
\_+=,.@-
[1]: http://wikipedia.org/wiki/regex
@return [EmptyStructure] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-iam/lib/aws-sdk-iam/policy.rb#L448-L452 | train | Detaches the role from the policy | [
30522,
13366,
20010,
6776,
1035,
2535,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
3343,
1035,
12098,
2078,
1024,
1030,
12098,
2078,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
20010,
6776,
1035,
2535,
1035,
3343... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_redis/lib/2017-02-01/generated/azure_mgmt_redis/redis.rb | Azure::Redis::Mgmt::V2017_02_01.Redis.force_reboot_with_http_info | def force_reboot_with_http_info(resource_group_name, name, parameters, custom_headers:nil)
force_reboot_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
end | ruby | def force_reboot_with_http_info(resource_group_name, name, parameters, custom_headers:nil)
force_reboot_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"force_reboot_with_http_info",
"(",
"resource_group_name",
",",
"name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"force_reboot_async",
"(",
"resource_group_name",
",",
"name",
",",
"parameters",
",",
"custom_headers",
":custom_headers",
")",
"... | Reboot specified Redis node(s). This operation requires write permission to
the cache resource. There can be potential data loss.
@param resource_group_name [String] The name of the resource group.
@param name [String] The name of the Redis cache.
@param parameters [RedisRebootParameters] Specifies which Redis node(s) to
reboot.
@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. | [
"Reboot",
"specified",
"Redis",
"node",
"(",
"s",
")",
".",
"This",
"operation",
"requires",
"write",
"permission",
"to",
"the",
"cache",
"resource",
".",
"There",
"can",
"be",
"potential",
"data",
"loss",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_redis/lib/2017-02-01/generated/azure_mgmt_redis/redis.rb#L714-L716 | train | Force a reboot of the specified virtual machine. | [
30522,
13366,
2486,
1035,
2128,
27927,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2486,
1035,
2128,
27927,
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... |
appsignal/rdkafka-ruby | lib/rdkafka/config.rb | Rdkafka.Config.producer | def producer
# Create opaque
opaque = Opaque.new
# Create Kafka config
config = native_config(opaque)
# Set callback to receive delivery reports on config
Rdkafka::Bindings.rd_kafka_conf_set_dr_msg_cb(config, Rdkafka::Bindings::DeliveryCallback)
# Return producer with Kafka client
Rdkafka::Producer.new(native_kafka(config, :rd_kafka_producer)).tap do |producer|
opaque.producer = producer
end
end | ruby | def producer
# Create opaque
opaque = Opaque.new
# Create Kafka config
config = native_config(opaque)
# Set callback to receive delivery reports on config
Rdkafka::Bindings.rd_kafka_conf_set_dr_msg_cb(config, Rdkafka::Bindings::DeliveryCallback)
# Return producer with Kafka client
Rdkafka::Producer.new(native_kafka(config, :rd_kafka_producer)).tap do |producer|
opaque.producer = producer
end
end | [
"def",
"producer",
"# Create opaque",
"opaque",
"=",
"Opaque",
".",
"new",
"# Create Kafka config",
"config",
"=",
"native_config",
"(",
"opaque",
")",
"# Set callback to receive delivery reports on config",
"Rdkafka",
"::",
"Bindings",
".",
"rd_kafka_conf_set_dr_msg_cb",
"... | Create a producer with this configuration.
@raise [ConfigError] When the configuration contains invalid options
@raise [ClientCreationError] When the native client cannot be created
@return [Producer] The created producer | [
"Create",
"a",
"producer",
"with",
"this",
"configuration",
"."
] | 87b3e0ddae5ea576847cb67228fcea06ec2a24d6 | https://github.com/appsignal/rdkafka-ruby/blob/87b3e0ddae5ea576847cb67228fcea06ec2a24d6/lib/rdkafka/config.rb#L134-L145 | train | Create Kafka producer object | [
30522,
13366,
3135,
1001,
3443,
28670,
28670,
1027,
28670,
1012,
2047,
1001,
3443,
10556,
24316,
2050,
9530,
8873,
2290,
9530,
8873,
2290,
1027,
3128,
1035,
9530,
8873,
2290,
1006,
28670,
1007,
1001,
2275,
2655,
5963,
2000,
4374,
6959,
4311... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.attributes_for_actor | def attributes_for_actor
raw_params = params[hash_key_for_curation_concern]
attributes = if raw_params
work_form_service.form_class(curation_concern).model_attributes(raw_params)
else
{}
end
# If they selected a BrowseEverything file, but then clicked the
# remove button, it will still show up in `selected_files`, but
# it will no longer be in uploaded_files. By checking the
# intersection, we get the files they added via BrowseEverything
# that they have not removed from the upload widget.
uploaded_files = params.fetch(:uploaded_files, [])
selected_files = params.fetch(:selected_files, {}).values
browse_everything_urls = uploaded_files &
selected_files.map { |f| f[:url] }
# we need the hash of files with url and file_name
browse_everything_files = selected_files
.select { |v| uploaded_files.include?(v[:url]) }
attributes[:remote_files] = browse_everything_files
# Strip out any BrowseEverthing files from the regular uploads.
attributes[:uploaded_files] = uploaded_files -
browse_everything_urls
attributes
end | ruby | def attributes_for_actor
raw_params = params[hash_key_for_curation_concern]
attributes = if raw_params
work_form_service.form_class(curation_concern).model_attributes(raw_params)
else
{}
end
# If they selected a BrowseEverything file, but then clicked the
# remove button, it will still show up in `selected_files`, but
# it will no longer be in uploaded_files. By checking the
# intersection, we get the files they added via BrowseEverything
# that they have not removed from the upload widget.
uploaded_files = params.fetch(:uploaded_files, [])
selected_files = params.fetch(:selected_files, {}).values
browse_everything_urls = uploaded_files &
selected_files.map { |f| f[:url] }
# we need the hash of files with url and file_name
browse_everything_files = selected_files
.select { |v| uploaded_files.include?(v[:url]) }
attributes[:remote_files] = browse_everything_files
# Strip out any BrowseEverthing files from the regular uploads.
attributes[:uploaded_files] = uploaded_files -
browse_everything_urls
attributes
end | [
"def",
"attributes_for_actor",
"raw_params",
"=",
"params",
"[",
"hash_key_for_curation_concern",
"]",
"attributes",
"=",
"if",
"raw_params",
"work_form_service",
".",
"form_class",
"(",
"curation_concern",
")",
".",
"model_attributes",
"(",
"raw_params",
")",
"else",
... | Add uploaded_files to the parameters received by the actor. | [
"Add",
"uploaded_files",
"to",
"the",
"parameters",
"received",
"by",
"the",
"actor",
"."
] | e2b4f56e829a53b1f11296324736e9d5b8c9ee5f | https://github.com/samvera/hyrax/blob/e2b4f56e829a53b1f11296324736e9d5b8c9ee5f/app/controllers/concerns/hyrax/works_controller_behavior.rb#L258-L284 | train | Returns the attributes for the actor | [
30522,
13366,
12332,
1035,
2005,
1035,
3364,
6315,
1035,
11498,
5244,
1027,
11498,
5244,
1031,
23325,
1035,
3145,
1035,
2005,
1035,
12731,
8156,
1035,
5142,
1033,
12332,
1027,
2065,
6315,
1035,
11498,
5244,
2147,
1035,
2433,
1035,
2326,
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... |
magnusvk/counter_culture | lib/counter_culture/counter.rb | CounterCulture.Counter.change_counter_cache | def change_counter_cache(obj, options)
change_counter_column = options.fetch(:counter_column) { counter_cache_name_for(obj) }
# default to the current foreign key value
id_to_change = foreign_key_value(obj, relation, options[:was])
# allow overwriting of foreign key value by the caller
id_to_change = foreign_key_values.call(id_to_change) if foreign_key_values
if id_to_change && change_counter_column
delta_magnitude = if delta_column
(options[:was] ? attribute_was(obj, delta_column) : obj.public_send(delta_column)) || 0
else
counter_delta_magnitude_for(obj)
end
# increment or decrement?
operator = options[:increment] ? '+' : '-'
# we don't use Rails' update_counters because we support changing the timestamp
quoted_column = model.connection.quote_column_name(change_counter_column)
updates = []
# this updates the actual counter
updates << "#{quoted_column} = COALESCE(#{quoted_column}, 0) #{operator} #{delta_magnitude}"
# and here we update the timestamp, if so desired
if touch
current_time = obj.send(:current_time_from_proper_timezone)
timestamp_columns = obj.send(:timestamp_attributes_for_update_in_model)
timestamp_columns << touch if touch != true
timestamp_columns.each do |timestamp_column|
updates << "#{timestamp_column} = '#{current_time.to_formatted_s(:db)}'"
end
end
klass = relation_klass(relation, source: obj, was: options[:was])
primary_key = relation_primary_key(relation, source: obj, was: options[:was])
if @with_papertrail
instance = klass.where(primary_key => id_to_change).first
if instance
if instance.paper_trail.respond_to?(:save_with_version)
# touch_with_version is deprecated starting in PaperTrail 9.0.0
current_time = obj.send(:current_time_from_proper_timezone)
timestamp_columns = obj.send(:timestamp_attributes_for_update_in_model)
timestamp_columns.each do |timestamp_column|
instance.send("#{timestamp_column}=", current_time)
end
instance.paper_trail.save_with_version(validate: false)
else
instance.paper_trail.touch_with_version
end
end
end
klass.where(primary_key => id_to_change).update_all updates.join(', ')
end
end | ruby | def change_counter_cache(obj, options)
change_counter_column = options.fetch(:counter_column) { counter_cache_name_for(obj) }
# default to the current foreign key value
id_to_change = foreign_key_value(obj, relation, options[:was])
# allow overwriting of foreign key value by the caller
id_to_change = foreign_key_values.call(id_to_change) if foreign_key_values
if id_to_change && change_counter_column
delta_magnitude = if delta_column
(options[:was] ? attribute_was(obj, delta_column) : obj.public_send(delta_column)) || 0
else
counter_delta_magnitude_for(obj)
end
# increment or decrement?
operator = options[:increment] ? '+' : '-'
# we don't use Rails' update_counters because we support changing the timestamp
quoted_column = model.connection.quote_column_name(change_counter_column)
updates = []
# this updates the actual counter
updates << "#{quoted_column} = COALESCE(#{quoted_column}, 0) #{operator} #{delta_magnitude}"
# and here we update the timestamp, if so desired
if touch
current_time = obj.send(:current_time_from_proper_timezone)
timestamp_columns = obj.send(:timestamp_attributes_for_update_in_model)
timestamp_columns << touch if touch != true
timestamp_columns.each do |timestamp_column|
updates << "#{timestamp_column} = '#{current_time.to_formatted_s(:db)}'"
end
end
klass = relation_klass(relation, source: obj, was: options[:was])
primary_key = relation_primary_key(relation, source: obj, was: options[:was])
if @with_papertrail
instance = klass.where(primary_key => id_to_change).first
if instance
if instance.paper_trail.respond_to?(:save_with_version)
# touch_with_version is deprecated starting in PaperTrail 9.0.0
current_time = obj.send(:current_time_from_proper_timezone)
timestamp_columns = obj.send(:timestamp_attributes_for_update_in_model)
timestamp_columns.each do |timestamp_column|
instance.send("#{timestamp_column}=", current_time)
end
instance.paper_trail.save_with_version(validate: false)
else
instance.paper_trail.touch_with_version
end
end
end
klass.where(primary_key => id_to_change).update_all updates.join(', ')
end
end | [
"def",
"change_counter_cache",
"(",
"obj",
",",
"options",
")",
"change_counter_column",
"=",
"options",
".",
"fetch",
"(",
":counter_column",
")",
"{",
"counter_cache_name_for",
"(",
"obj",
")",
"}",
"# default to the current foreign key value",
"id_to_change",
"=",
... | increments or decrements a counter cache
options:
:increment => true to increment, false to decrement
:relation => which relation to increment the count on,
:counter_cache_name => the column name of the counter cache
:counter_column => overrides :counter_cache_name
:delta_column => override the default count delta (1) with the value of this column in the counted record
:was => whether to get the current value or the old value of the
first part of the relation
:with_papertrail => update the column via Papertrail touch_with_version method | [
"increments",
"or",
"decrements",
"a",
"counter",
"cache"
] | 6b5bd4d6e1ee4f10f262ace7cfed5776af9520ba | https://github.com/magnusvk/counter_culture/blob/6b5bd4d6e1ee4f10f262ace7cfed5776af9520ba/lib/counter_culture/counter.rb#L36-L93 | train | This method is used to change the counter cache for the given object. | [
30522,
13366,
2689,
1035,
4675,
1035,
17053,
1006,
27885,
3501,
1010,
7047,
1007,
2689,
1035,
4675,
1035,
5930,
1027,
7047,
1012,
18584,
1006,
1024,
4675,
1035,
5930,
1007,
1063,
4675,
1035,
17053,
1035,
2171,
1035,
2005,
1006,
27885,
3501,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
chef/ohai | lib/ohai/loader.rb | Ohai.Loader.load_plugin | def load_plugin(plugin_path)
plugin_class = load_plugin_class(plugin_path)
return nil unless plugin_class.kind_of?(Class)
if plugin_class < Ohai::DSL::Plugin::VersionVII
load_v7_plugin(plugin_class)
else
raise Exceptions::IllegalPluginDefinition, "cannot create plugin of type #{plugin_class}"
end
end | ruby | def load_plugin(plugin_path)
plugin_class = load_plugin_class(plugin_path)
return nil unless plugin_class.kind_of?(Class)
if plugin_class < Ohai::DSL::Plugin::VersionVII
load_v7_plugin(plugin_class)
else
raise Exceptions::IllegalPluginDefinition, "cannot create plugin of type #{plugin_class}"
end
end | [
"def",
"load_plugin",
"(",
"plugin_path",
")",
"plugin_class",
"=",
"load_plugin_class",
"(",
"plugin_path",
")",
"return",
"nil",
"unless",
"plugin_class",
".",
"kind_of?",
"(",
"Class",
")",
"if",
"plugin_class",
"<",
"Ohai",
"::",
"DSL",
"::",
"Plugin",
"::... | Load a specified file as an ohai plugin and creates an instance of it.
Not used by ohai itself, but is used in the specs to load plugins for testing
@private
@param plugin_path [String] | [
"Load",
"a",
"specified",
"file",
"as",
"an",
"ohai",
"plugin",
"and",
"creates",
"an",
"instance",
"of",
"it",
".",
"Not",
"used",
"by",
"ohai",
"itself",
"but",
"is",
"used",
"in",
"the",
"specs",
"to",
"load",
"plugins",
"for",
"testing"
] | 8d66449940f04237586b2f928231c6b26e2cc19a | https://github.com/chef/ohai/blob/8d66449940f04237586b2f928231c6b26e2cc19a/lib/ohai/loader.rb#L84-L92 | train | Load a plugin from a given path | [
30522,
13366,
7170,
1035,
13354,
2378,
1006,
13354,
2378,
1035,
4130,
1007,
13354,
2378,
1035,
2465,
1027,
7170,
1035,
13354,
2378,
1035,
2465,
1006,
13354,
2378,
1035,
4130,
1007,
2709,
9152,
2140,
4983,
13354,
2378,
1035,
2465,
1012,
2785... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/api/v1_transactions_api.rb | SquareConnect.V1TransactionsApi.list_payments | def list_payments(location_id, opts = {})
data, _status_code, _headers = list_payments_with_http_info(location_id, opts)
return data
end | ruby | def list_payments(location_id, opts = {})
data, _status_code, _headers = list_payments_with_http_info(location_id, opts)
return data
end | [
"def",
"list_payments",
"(",
"location_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"list_payments_with_http_info",
"(",
"location_id",
",",
"opts",
")",
"return",
"data",
"end"
] | ListPayments
Provides summary information for all payments taken for a given Square account during a date range. Date ranges cannot exceed 1 year in length. See Date ranges for details of inclusive and exclusive dates. *Note**: Details for payments processed with Square Point of Sale while in offline mode may not be transmitted to Square for up to 72 hours. Offline payments have a `created_at` value that reflects the time the payment was originally processed, not the time it was subsequently transmitted to Square. Consequently, the ListPayments endpoint might list an offline payment chronologically between online payments that were seen in a previous request.
@param location_id The ID of the location to list payments for. If you specify me, this endpoint returns payments aggregated from all of the business's locations.
@param [Hash] opts the optional parameters
@option opts [String] :order The order in which payments are listed in the response.
@option opts [String] :begin_time The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year.
@option opts [String] :end_time The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time.
@option opts [Integer] :limit The maximum number of payments to return in a single response. This value cannot exceed 200.
@option opts [String] :batch_token A pagination cursor to retrieve the next set of results for your original query to the endpoint.
@option opts [BOOLEAN] :include_partial Indicates whether or not to include partial payments in the response. Partial payments will have the tenders collected so far, but the itemizations will be empty until the payment is completed.
@return [Array<V1Payment>] | [
"ListPayments",
"Provides",
"summary",
"information",
"for",
"all",
"payments",
"taken",
"for",
"a",
"given",
"Square",
"account",
"during",
"a",
"date",
"range",
".",
"Date",
"ranges",
"cannot",
"exceed",
"1",
"year",
"in",
"length",
".",
"See",
"Date",
"ra... | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/v1_transactions_api.rb#L212-L215 | train | Returns a list of all payments in a location. | [
30522,
13366,
2862,
1035,
10504,
1006,
3295,
1035,
8909,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
2862,
1035,
10504,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
3295,
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... |
markdownlint/markdownlint | lib/mdl/doc.rb | MarkdownLint.Doc.matching_lines | def matching_lines(re)
@lines.each_with_index.select{|text, linenum| re.match(text)}.map{
|i| i[1]+1}
end | ruby | def matching_lines(re)
@lines.each_with_index.select{|text, linenum| re.match(text)}.map{
|i| i[1]+1}
end | [
"def",
"matching_lines",
"(",
"re",
")",
"@lines",
".",
"each_with_index",
".",
"select",
"{",
"|",
"text",
",",
"linenum",
"|",
"re",
".",
"match",
"(",
"text",
")",
"}",
".",
"map",
"{",
"|",
"i",
"|",
"i",
"[",
"1",
"]",
"+",
"1",
"}",
"end"... | Returns line numbers for lines that match the given regular expression | [
"Returns",
"line",
"numbers",
"for",
"lines",
"that",
"match",
"the",
"given",
"regular",
"expression"
] | a9e80fcf3989d73b654b00bb2225a00be53983e8 | https://github.com/markdownlint/markdownlint/blob/a9e80fcf3989d73b654b00bb2225a00be53983e8/lib/mdl/doc.rb#L220-L223 | train | Returns a list of the matches for the given regex | [
30522,
13366,
9844,
1035,
3210,
1006,
2128,
1007,
1030,
3210,
1012,
2169,
1035,
2007,
1035,
5950,
1012,
7276,
1063,
1064,
3793,
1010,
17517,
2819,
1064,
2128,
1012,
2674,
1006,
3793,
1007,
1065,
1012,
4949,
1063,
1064,
1045,
1064,
1045,
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... |
piotrmurach/github | lib/github_api/client/issues/labels.rb | Github.Client::Issues::Labels.get | def get(*args)
arguments(args, required: [:user, :repo, :label_name])
params = arguments.params
get_request("/repos/#{arguments.user}/#{arguments.repo}/labels/#{arguments.label_name}", params)
end | ruby | def get(*args)
arguments(args, required: [:user, :repo, :label_name])
params = arguments.params
get_request("/repos/#{arguments.user}/#{arguments.repo}/labels/#{arguments.label_name}", params)
end | [
"def",
"get",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":label_name",
"]",
")",
"params",
"=",
"arguments",
".",
"params",
"get_request",
"(",
"\"/repos/#{arguments.user}/#{arguments.repo}/labels/#{a... | Get a single label
@example
github = Github.new
github.issues.labels.find 'user-name', 'repo-name', 'label-name'
@example
github = Github.new user: 'user-name', repo: 'repo-name'
github.issues.labels.get label_name: 'bug'
@api public | [
"Get",
"a",
"single",
"label"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/issues/labels.rb#L59-L64 | train | Get a label by name | [
30522,
13366,
2131,
1006,
1008,
12098,
5620,
1007,
9918,
1006,
12098,
5620,
1010,
3223,
1024,
1031,
1024,
5310,
1010,
1024,
16360,
2080,
1010,
1024,
3830,
1035,
2171,
1033,
1007,
11498,
5244,
1027,
9918,
1012,
11498,
5244,
2131,
1035,
5227,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/collection.rb | Mongo.Collection.replace_one | def replace_one(filter, replacement, options = {})
find(filter, options).replace_one(replacement, options)
end | ruby | def replace_one(filter, replacement, options = {})
find(filter, options).replace_one(replacement, options)
end | [
"def",
"replace_one",
"(",
"filter",
",",
"replacement",
",",
"options",
"=",
"{",
"}",
")",
"find",
"(",
"filter",
",",
"options",
")",
".",
"replace_one",
"(",
"replacement",
",",
"options",
")",
"end"
] | Replaces a single document in the collection with the new document.
@example Replace a single document.
collection.replace_one({ name: 'test' }, { name: 'test1' })
@param [ Hash ] filter The filter to use.
@param [ Hash ] replacement The replacement document..
@param [ Hash ] options The options.
@option options [ true, false ] :upsert Whether to upsert if the
document doesn't exist.
@option options [ true, false ] :bypass_document_validation Whether or
not to skip document level validation.
@option options [ Hash ] :collation The collation to use.
@option options [ Session ] :session The session to use.
@return [ Result ] The response from the database.
@since 2.1.0 | [
"Replaces",
"a",
"single",
"document",
"in",
"the",
"collection",
"with",
"the",
"new",
"document",
"."
] | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/collection.rb#L613-L615 | train | Replace one element in the list | [
30522,
13366,
5672,
1035,
2028,
1006,
11307,
1010,
6110,
1010,
7047,
1027,
1063,
1065,
1007,
2424,
1006,
11307,
1010,
7047,
1007,
1012,
5672,
1035,
2028,
1006,
6110,
1010,
7047,
1007,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_formatter.rb | Phonelib.PhoneFormatter.raw_national | def raw_national
return nil if sanitized.nil? || sanitized.empty?
if valid?
@national_number
elsif country_code && sanitized.start_with?(country_code)
sanitized[country_code.size..-1]
else
sanitized
end
end | ruby | def raw_national
return nil if sanitized.nil? || sanitized.empty?
if valid?
@national_number
elsif country_code && sanitized.start_with?(country_code)
sanitized[country_code.size..-1]
else
sanitized
end
end | [
"def",
"raw_national",
"return",
"nil",
"if",
"sanitized",
".",
"nil?",
"||",
"sanitized",
".",
"empty?",
"if",
"valid?",
"@national_number",
"elsif",
"country_code",
"&&",
"sanitized",
".",
"start_with?",
"(",
"country_code",
")",
"sanitized",
"[",
"country_code"... | Returns the raw national number that was defined during parsing
@return [String] raw national number | [
"Returns",
"the",
"raw",
"national",
"number",
"that",
"was",
"defined",
"during",
"parsing"
] | aa0023eab7c896b71275bf342bc7f49735cbdbbf | https://github.com/daddyz/phonelib/blob/aa0023eab7c896b71275bf342bc7f49735cbdbbf/lib/phonelib/phone_formatter.rb#L21-L30 | train | Returns the raw national number | [
30522,
13366,
6315,
1035,
2120,
2709,
9152,
2140,
2065,
2624,
25090,
5422,
1012,
9152,
2140,
1029,
1064,
1064,
2624,
25090,
5422,
1012,
4064,
1029,
2065,
9398,
1029,
1030,
2120,
1035,
2193,
3449,
5332,
2546,
2406,
1035,
3642,
1004,
1004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_cluster_health_chunk_using_policy_and_advanced_filters_with_http_info | def get_cluster_health_chunk_using_policy_and_advanced_filters_with_http_info(cluster_health_chunk_query_description:nil, timeout:60, custom_headers:nil)
get_cluster_health_chunk_using_policy_and_advanced_filters_async(cluster_health_chunk_query_description:cluster_health_chunk_query_description, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def get_cluster_health_chunk_using_policy_and_advanced_filters_with_http_info(cluster_health_chunk_query_description:nil, timeout:60, custom_headers:nil)
get_cluster_health_chunk_using_policy_and_advanced_filters_async(cluster_health_chunk_query_description:cluster_health_chunk_query_description, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"get_cluster_health_chunk_using_policy_and_advanced_filters_with_http_info",
"(",
"cluster_health_chunk_query_description",
":",
"nil",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"get_cluster_health_chunk_using_policy_and_advanced_filters_async",
"(",
... | Gets the health of a Service Fabric cluster using health chunks.
Gets the health of a Service Fabric cluster using health chunks. The health
evaluation is done based on the input cluster health chunk query description.
The query description allows users to specify health policies for evaluating
the cluster and its children.
Users can specify very flexible filters to select which cluster entities to
return. The selection can be done based on the entities health state and
based on the hierarchy.
The query can return multi-level children of the entities based on the
specified filters. For example, it can return one application with a
specified name, and for this application, return
only services that are in Error or Warning, and all partitions and replicas
for one of these services.
@param cluster_health_chunk_query_description
[ClusterHealthChunkQueryDescription] Describes the cluster and application
health policies used to evaluate the cluster health and the filters to select
which cluster entities to be returned.
If the cluster health policy is present, it is used to evaluate the cluster
events and the cluster nodes. If not present, the health evaluation uses the
cluster health policy defined in the cluster manifest or the default cluster
health policy.
By default, each application is evaluated using its specific application
health policy, defined in the application manifest, or the default health
policy, if no policy is defined in manifest.
If the application health policy map is specified, and it has an entry for an
application, the specified application health policy
is used to evaluate the application health.
Users can specify very flexible filters to select which cluster entities to
include in response. The selection can be done based on the entities health
state and based on the hierarchy.
The query can return multi-level children of the entities based on the
specified filters. For example, it can return one application with a
specified name, and for this application, return
only services that are in Error or Warning, and all partitions and replicas
for one of these services.
@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",
"health",
"of",
"a",
"Service",
"Fabric",
"cluster",
"using",
"health",
"chunks",
"."
] | 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#L1223-L1225 | train | Gets the health chunk using the policy and advanced filters. | [
30522,
13366,
2131,
1035,
9324,
1035,
2740,
1035,
20000,
1035,
2478,
1035,
3343,
1035,
1998,
1035,
3935,
1035,
17736,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
9324,
1035,
2740,
1035,
20000,
1035,
23032,
1035,
6412,
1024,
9152,
2140,
1010,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mikel/mail | lib/mail/network/delivery_methods/smtp.rb | Mail.SMTP.ssl_context | def ssl_context
openssl_verify_mode = settings[:openssl_verify_mode]
if openssl_verify_mode.kind_of?(String)
openssl_verify_mode = OpenSSL::SSL.const_get("VERIFY_#{openssl_verify_mode.upcase}")
end
context = Net::SMTP.default_ssl_context
context.verify_mode = openssl_verify_mode if openssl_verify_mode
context.ca_path = settings[:ca_path] if settings[:ca_path]
context.ca_file = settings[:ca_file] if settings[:ca_file]
context
end | ruby | def ssl_context
openssl_verify_mode = settings[:openssl_verify_mode]
if openssl_verify_mode.kind_of?(String)
openssl_verify_mode = OpenSSL::SSL.const_get("VERIFY_#{openssl_verify_mode.upcase}")
end
context = Net::SMTP.default_ssl_context
context.verify_mode = openssl_verify_mode if openssl_verify_mode
context.ca_path = settings[:ca_path] if settings[:ca_path]
context.ca_file = settings[:ca_file] if settings[:ca_file]
context
end | [
"def",
"ssl_context",
"openssl_verify_mode",
"=",
"settings",
"[",
":openssl_verify_mode",
"]",
"if",
"openssl_verify_mode",
".",
"kind_of?",
"(",
"String",
")",
"openssl_verify_mode",
"=",
"OpenSSL",
"::",
"SSL",
".",
"const_get",
"(",
"\"VERIFY_#{openssl_verify_mode.u... | Allow SSL context to be configured via settings, for Ruby >= 1.9
Just returns openssl verify mode for Ruby 1.8.x | [
"Allow",
"SSL",
"context",
"to",
"be",
"configured",
"via",
"settings",
"for",
"Ruby",
">",
"=",
"1",
".",
"9",
"Just",
"returns",
"openssl",
"verify",
"mode",
"for",
"Ruby",
"1",
".",
"8",
".",
"x"
] | fb53fb369eb2bf0494ac70675970c90cdcc3f495 | https://github.com/mikel/mail/blob/fb53fb369eb2bf0494ac70675970c90cdcc3f495/lib/mail/network/delivery_methods/smtp.rb#L135-L147 | train | Returns a new ssl context object for use with the SMTP server. | [
30522,
13366,
7020,
2140,
1035,
6123,
7480,
14540,
1035,
20410,
1035,
5549,
1027,
10906,
1031,
1024,
7480,
14540,
1035,
20410,
1035,
5549,
1033,
2065,
7480,
14540,
1035,
20410,
1035,
5549,
1012,
2785,
1035,
1997,
1029,
1006,
5164,
1007,
748... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_agents.rb | Azure::SQL::Mgmt::V2015_05_01_preview.SyncAgents.get_with_http_info | def get_with_http_info(resource_group_name, server_name, sync_agent_name, custom_headers:nil)
get_async(resource_group_name, server_name, sync_agent_name, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, server_name, sync_agent_name, custom_headers:nil)
get_async(resource_group_name, server_name, sync_agent_name, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"server_name",
",",
"sync_agent_name",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"sync_agent_name",
",",
"custom_headers",
":custom_headers",
")... | Gets a sync agent.
@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 on which the sync agent is
hosted.
@param sync_agent_name [String] The name of the sync agent.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"a",
"sync",
"agent",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_agents.rb#L60-L62 | train | Gets the specified sync agent s current sequence number. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
26351,
1035,
4005,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
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... |
projectcypress/health-data-standards | lib/hqmf-parser/converter/pass1/population_criteria_converter.rb | HQMF.PopulationCriteriaConverter.apply_to_submeasures | def apply_to_submeasures(subs, type, values, unpaired_type=nil, unpaired_keys=[])
new_subs = []
subs.each do |sub|
# this unless prevents us from forcing an exclusion or excepion onto a measure that has a submeasure without
# an exclusion or exception, but other populations with an exclusion or excepion.
unless unpaired_keys.include? sub[unpaired_type]
# duplicate each new value if it is set, otherwise set this key on each submeasure.
values.each do |value|
if (sub[type] and sub[type] != value.id)
tmp = {}
HQMF::PopulationCriteria::ALL_POPULATION_CODES.each do |key|
tmp[key] = sub[key] if sub[key]
end
sub = tmp
new_subs << sub
end
sub[type] = value.id
end
end
end
subs.concat(new_subs)
end | ruby | def apply_to_submeasures(subs, type, values, unpaired_type=nil, unpaired_keys=[])
new_subs = []
subs.each do |sub|
# this unless prevents us from forcing an exclusion or excepion onto a measure that has a submeasure without
# an exclusion or exception, but other populations with an exclusion or excepion.
unless unpaired_keys.include? sub[unpaired_type]
# duplicate each new value if it is set, otherwise set this key on each submeasure.
values.each do |value|
if (sub[type] and sub[type] != value.id)
tmp = {}
HQMF::PopulationCriteria::ALL_POPULATION_CODES.each do |key|
tmp[key] = sub[key] if sub[key]
end
sub = tmp
new_subs << sub
end
sub[type] = value.id
end
end
end
subs.concat(new_subs)
end | [
"def",
"apply_to_submeasures",
"(",
"subs",
",",
"type",
",",
"values",
",",
"unpaired_type",
"=",
"nil",
",",
"unpaired_keys",
"=",
"[",
"]",
")",
"new_subs",
"=",
"[",
"]",
"subs",
".",
"each",
"do",
"|",
"sub",
"|",
"# this unless prevents us from forcing... | create a copy of each submeasre adding on the new values of the given type
skip the unpaired values. Unpaired values are denominators without exclusions or populations without exceptions | [
"create",
"a",
"copy",
"of",
"each",
"submeasre",
"adding",
"on",
"the",
"new",
"values",
"of",
"the",
"given",
"type",
"skip",
"the",
"unpaired",
"values",
".",
"Unpaired",
"values",
"are",
"denominators",
"without",
"exclusions",
"or",
"populations",
"withou... | 252d4f0927c513eacde6b9ea41b76faa1423c34b | https://github.com/projectcypress/health-data-standards/blob/252d4f0927c513eacde6b9ea41b76faa1423c34b/lib/hqmf-parser/converter/pass1/population_criteria_converter.rb#L126-L147 | train | Apply the values to a list of submeasures | [
30522,
13366,
6611,
1035,
2000,
1035,
4942,
4168,
3022,
14900,
1006,
4942,
2015,
1010,
2828,
1010,
5300,
1010,
4895,
4502,
27559,
1035,
2828,
1027,
9152,
2140,
1010,
4895,
4502,
27559,
30524,
6932,
2019,
15945,
2030,
4654,
3401,
22071,
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... |
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_closed_list_with_http_info | def update_closed_list_with_http_info(app_id, version_id, cl_entity_id, closed_list_model_update_object, custom_headers:nil)
update_closed_list_async(app_id, version_id, cl_entity_id, closed_list_model_update_object, custom_headers:custom_headers).value!
end | ruby | def update_closed_list_with_http_info(app_id, version_id, cl_entity_id, closed_list_model_update_object, custom_headers:nil)
update_closed_list_async(app_id, version_id, cl_entity_id, closed_list_model_update_object, custom_headers:custom_headers).value!
end | [
"def",
"update_closed_list_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"cl_entity_id",
",",
"closed_list_model_update_object",
",",
"custom_headers",
":",
"nil",
")",
"update_closed_list_async",
"(",
"app_id",
",",
"version_id",
",",
"cl_entity_id",
",",
"cl... | Updates the list entity 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 model ID.
@param closed_list_model_update_object [ClosedListModelUpdateObject] The new
list entity name and words list.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Updates",
"the",
"list",
"entity",
"in",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L3147-L3149 | train | Updates the entity in a closed list. | [
30522,
13366,
10651,
1035,
2701,
1035,
2862,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
18856,
1035,
9178,
1035,
8909,
1010,
2701,
1035,
2862,
1035,
2944,
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... |
square/connect-ruby-sdk | lib/square_connect/api/v1_items_api.rb | SquareConnect.V1ItemsApi.create_fee | def create_fee(location_id, body, opts = {})
data, _status_code, _headers = create_fee_with_http_info(location_id, body, opts)
return data
end | ruby | def create_fee(location_id, body, opts = {})
data, _status_code, _headers = create_fee_with_http_info(location_id, body, opts)
return data
end | [
"def",
"create_fee",
"(",
"location_id",
",",
"body",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"create_fee_with_http_info",
"(",
"location_id",
",",
"body",
",",
"opts",
")",
"return",
"data",
"end"
] | CreateFee
Creates a fee (tax).
@param location_id The ID of the location to create a fee for.
@param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
@param [Hash] opts the optional parameters
@return [V1Fee] | [
"CreateFee",
"Creates",
"a",
"fee",
"(",
"tax",
")",
"."
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/v1_items_api.rb#L333-L336 | train | Create a fee | [
30522,
13366,
3443,
1035,
7408,
1006,
3295,
1035,
8909,
1010,
2303,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
3443,
1035,
7408,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/backend.rb | Azure::ApiManagement::Mgmt::V2018_01_01.Backend.reconnect | def reconnect(resource_group_name, service_name, backendid, parameters:nil, custom_headers:nil)
response = reconnect_async(resource_group_name, service_name, backendid, parameters:parameters, custom_headers:custom_headers).value!
nil
end | ruby | def reconnect(resource_group_name, service_name, backendid, parameters:nil, custom_headers:nil)
response = reconnect_async(resource_group_name, service_name, backendid, parameters:parameters, custom_headers:custom_headers).value!
nil
end | [
"def",
"reconnect",
"(",
"resource_group_name",
",",
"service_name",
",",
"backendid",
",",
"parameters",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"reconnect_async",
"(",
"resource_group_name",
",",
"service_name",
",",
"backendid",
","... | Notifies the APIM proxy to create a new connection to the backend after the
specified timeout. If no timeout was specified, timeout of 2 minutes is used.
@param resource_group_name [String] The name of the resource group.
@param service_name [String] The name of the API Management service.
@param backendid [String] Identifier of the Backend entity. Must be unique in
the current API Management service instance.
@param parameters [BackendReconnectContract] Reconnect request parameters.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Notifies",
"the",
"APIM",
"proxy",
"to",
"create",
"a",
"new",
"connection",
"to",
"the",
"backend",
"after",
"the",
"specified",
"timeout",
".",
"If",
"no",
"timeout",
"was",
"specified",
"timeout",
"of",
"2",
"minutes",
"is",
"used",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/backend.rb#L717-L720 | train | Reconnects a virtual network connection to the specified backend. | [
30522,
13366,
28667,
18256,
6593,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
2067,
10497,
3593,
1010,
11709,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
28667,
18256,
6593,
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... |
googleapis/google-cloud-ruby | google-cloud-error_reporting/lib/google-cloud-error_reporting.rb | Google.Cloud.error_reporting | def error_reporting scope: nil, timeout: nil, client_config: nil
Google::Cloud.error_reporting @project, @keyfile,
scope: scope,
timeout: (timeout || @timeout),
client_config: client_config
end | ruby | def error_reporting scope: nil, timeout: nil, client_config: nil
Google::Cloud.error_reporting @project, @keyfile,
scope: scope,
timeout: (timeout || @timeout),
client_config: client_config
end | [
"def",
"error_reporting",
"scope",
":",
"nil",
",",
"timeout",
":",
"nil",
",",
"client_config",
":",
"nil",
"Google",
"::",
"Cloud",
".",
"error_reporting",
"@project",
",",
"@keyfile",
",",
"scope",
":",
"scope",
",",
"timeout",
":",
"(",
"timeout",
"||"... | Create a new object for connecting to the Stackdriver Error Reporting
service. Each call creates a new connection.
For more information on connecting to Google Cloud see the
{file:AUTHENTICATION.md Authentication Guide}.
@param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
set of resources and operations that the connection can access. See
[Using OAuth 2.0 to Access Google
APIs](https://developers.google.com/identity/protocols/OAuth2).
The default scope is:
* `https://www.googleapis.com/auth/cloud-platform`
@param [Integer] timeout Default timeout to use in requests. Optional.
@param [Hash] client_config A hash of values to override the default
behavior of the API client. Optional.
@return [Google::Cloud::ErrorReporting::Project]
@example
require "google/cloud/error_reporting"
gcloud = Google::Cloud.new "GCP_Project_ID",
"/path/to/gcp/secretkey.json"
error_reporting = gcloud.error_reporting
error_event = error_reporting.error_event "Error with Backtrace",
event_time: Time.now,
service_name: "my_app_name",
service_version: "v8"
error_reporting.report error_event | [
"Create",
"a",
"new",
"object",
"for",
"connecting",
"to",
"the",
"Stackdriver",
"Error",
"Reporting",
"service",
".",
"Each",
"call",
"creates",
"a",
"new",
"connection",
"."
] | 846c1a57250ac860ef4de1b54853a480ab2ff702 | https://github.com/googleapis/google-cloud-ruby/blob/846c1a57250ac860ef4de1b54853a480ab2ff702/google-cloud-error_reporting/lib/google-cloud-error_reporting.rb#L62-L67 | train | Returns an array of error reporting objects. | [
30522,
13366,
7561,
1035,
7316,
9531,
1024,
9152,
2140,
1010,
2051,
5833,
1024,
9152,
2140,
1010,
7396,
1035,
9530,
8873,
2290,
1024,
9152,
2140,
8224,
1024,
1024,
6112,
1012,
7561,
1035,
7316,
1030,
2622,
1010,
1030,
3145,
8873,
2571,
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... |
rubocop-hq/rubocop | lib/rubocop/target_finder.rb | RuboCop.TargetFinder.find | def find(args)
return target_files_in_dir if args.empty?
files = []
args.uniq.each do |arg|
files += if File.directory?(arg)
target_files_in_dir(arg.chomp(File::SEPARATOR))
else
process_explicit_path(arg)
end
end
files.map { |f| File.expand_path(f) }.uniq
end | ruby | def find(args)
return target_files_in_dir if args.empty?
files = []
args.uniq.each do |arg|
files += if File.directory?(arg)
target_files_in_dir(arg.chomp(File::SEPARATOR))
else
process_explicit_path(arg)
end
end
files.map { |f| File.expand_path(f) }.uniq
end | [
"def",
"find",
"(",
"args",
")",
"return",
"target_files_in_dir",
"if",
"args",
".",
"empty?",
"files",
"=",
"[",
"]",
"args",
".",
"uniq",
".",
"each",
"do",
"|",
"arg",
"|",
"files",
"+=",
"if",
"File",
".",
"directory?",
"(",
"arg",
")",
"target_f... | Generate a list of target files by expanding globbing patterns
(if any). If args is empty, recursively find all Ruby source
files under the current directory
@return [Array] array of file paths | [
"Generate",
"a",
"list",
"of",
"target",
"files",
"by",
"expanding",
"globbing",
"patterns",
"(",
"if",
"any",
")",
".",
"If",
"args",
"is",
"empty",
"recursively",
"find",
"all",
"Ruby",
"source",
"files",
"under",
"the",
"current",
"directory"
] | 2a4f4f0fdac4e1bb25891fc312af2ea60c6aa2f0 | https://github.com/rubocop-hq/rubocop/blob/2a4f4f0fdac4e1bb25891fc312af2ea60c6aa2f0/lib/rubocop/target_finder.rb#L30-L44 | train | Find all the files in the specified directories. | [
30522,
13366,
2424,
1006,
12098,
5620,
1007,
2709,
4539,
1035,
6764,
1035,
1999,
1035,
16101,
2065,
12098,
5620,
1012,
4064,
1029,
6764,
1027,
1031,
1033,
12098,
5620,
1012,
4895,
18515,
1012,
2169,
2079,
1064,
12098,
2290,
1064,
6764,
1009... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | credentials_manager/lib/credentials_manager/cli.rb | CredentialsManager.CLI.run | def run
program :name, 'CredentialsManager'
program :version, Fastlane::VERSION
program :description, 'Manage credentials for fastlane tools.'
# Command to add entry to Keychain
command :add do |c|
c.syntax = 'fastlane fastlane-credentials add'
c.description = 'Adds a fastlane credential to the keychain.'
c.option('--username username', String, 'Username to add.')
c.option('--password password', String, 'Password to add.')
c.action do |args, options|
username = options.username || ask('Username: ')
password = options.password || ask('Password: ') { |q| q.echo = '*' }
add(username, password)
puts("Credential #{username}:#{'*' * password.length} added to keychain.")
end
end
# Command to remove credential from Keychain
command :remove do |c|
c.syntax = 'fastlane fastlane-credentials remove'
c.description = 'Removes a fastlane credential from the keychain.'
c.option('--username username', String, 'Username to remove.')
c.action do |args, options|
username = options.username || ask('Username: ')
remove(username)
end
end
run!
end | ruby | def run
program :name, 'CredentialsManager'
program :version, Fastlane::VERSION
program :description, 'Manage credentials for fastlane tools.'
# Command to add entry to Keychain
command :add do |c|
c.syntax = 'fastlane fastlane-credentials add'
c.description = 'Adds a fastlane credential to the keychain.'
c.option('--username username', String, 'Username to add.')
c.option('--password password', String, 'Password to add.')
c.action do |args, options|
username = options.username || ask('Username: ')
password = options.password || ask('Password: ') { |q| q.echo = '*' }
add(username, password)
puts("Credential #{username}:#{'*' * password.length} added to keychain.")
end
end
# Command to remove credential from Keychain
command :remove do |c|
c.syntax = 'fastlane fastlane-credentials remove'
c.description = 'Removes a fastlane credential from the keychain.'
c.option('--username username', String, 'Username to remove.')
c.action do |args, options|
username = options.username || ask('Username: ')
remove(username)
end
end
run!
end | [
"def",
"run",
"program",
":name",
",",
"'CredentialsManager'",
"program",
":version",
",",
"Fastlane",
"::",
"VERSION",
"program",
":description",
",",
"'Manage credentials for fastlane tools.'",
"# Command to add entry to Keychain",
"command",
":add",
"do",
"|",
"c",
"|"... | Parses command options and executes actions | [
"Parses",
"command",
"options",
"and",
"executes",
"actions"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/credentials_manager/lib/credentials_manager/cli.rb#L10-L48 | train | Runs the credentials manager. | [
30522,
13366,
2448,
2565,
1024,
2171,
1010,
1005,
22496,
24805,
4590,
1005,
2565,
1024,
2544,
1010,
3435,
20644,
1024,
1024,
2544,
2565,
1024,
6412,
1010,
1005,
6133,
22496,
2005,
3435,
20644,
5906,
1012,
1005,
1001,
3094,
2000,
5587,
4443,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_locks/lib/2015-01-01/generated/azure_mgmt_locks/management_locks.rb | Azure::Locks::Mgmt::V2015_01_01.ManagementLocks.get_at_resource_group_level | def get_at_resource_group_level(resource_group_name, lock_name, custom_headers:nil)
response = get_at_resource_group_level_async(resource_group_name, lock_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_at_resource_group_level(resource_group_name, lock_name, custom_headers:nil)
response = get_at_resource_group_level_async(resource_group_name, lock_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_at_resource_group_level",
"(",
"resource_group_name",
",",
"lock_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_at_resource_group_level_async",
"(",
"resource_group_name",
",",
"lock_name",
",",
"custom_headers",
":custom_headers",
")",
"... | Gets a management lock at the resource group level.
@param resource_group_name [String] The resource group name.
@param lock_name [String] The lock name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ManagementLockObject] operation results. | [
"Gets",
"a",
"management",
"lock",
"at",
"the",
"resource",
"group",
"level",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_locks/lib/2015-01-01/generated/azure_mgmt_locks/management_locks.rb#L234-L237 | train | Gets the lock at resource group level. | [
30522,
13366,
2131,
1035,
2012,
1035,
7692,
1035,
2177,
1035,
2504,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
5843,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
30524,
1010,
5843,
1035,
2171,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | actionpack/lib/action_controller/metal/request_forgery_protection.rb | ActionController.RequestForgeryProtection.valid_authenticity_token? | def valid_authenticity_token?(session, encoded_masked_token) # :doc:
if encoded_masked_token.nil? || encoded_masked_token.empty? || !encoded_masked_token.is_a?(String)
return false
end
begin
masked_token = Base64.strict_decode64(encoded_masked_token)
rescue ArgumentError # encoded_masked_token is invalid Base64
return false
end
# See if it's actually a masked token or not. In order to
# deploy this code, we should be able to handle any unmasked
# tokens that we've issued without error.
if masked_token.length == AUTHENTICITY_TOKEN_LENGTH
# This is actually an unmasked token. This is expected if
# you have just upgraded to masked tokens, but should stop
# happening shortly after installing this gem.
compare_with_real_token masked_token, session
elsif masked_token.length == AUTHENTICITY_TOKEN_LENGTH * 2
csrf_token = unmask_token(masked_token)
compare_with_real_token(csrf_token, session) ||
valid_per_form_csrf_token?(csrf_token, session)
else
false # Token is malformed.
end
end | ruby | def valid_authenticity_token?(session, encoded_masked_token) # :doc:
if encoded_masked_token.nil? || encoded_masked_token.empty? || !encoded_masked_token.is_a?(String)
return false
end
begin
masked_token = Base64.strict_decode64(encoded_masked_token)
rescue ArgumentError # encoded_masked_token is invalid Base64
return false
end
# See if it's actually a masked token or not. In order to
# deploy this code, we should be able to handle any unmasked
# tokens that we've issued without error.
if masked_token.length == AUTHENTICITY_TOKEN_LENGTH
# This is actually an unmasked token. This is expected if
# you have just upgraded to masked tokens, but should stop
# happening shortly after installing this gem.
compare_with_real_token masked_token, session
elsif masked_token.length == AUTHENTICITY_TOKEN_LENGTH * 2
csrf_token = unmask_token(masked_token)
compare_with_real_token(csrf_token, session) ||
valid_per_form_csrf_token?(csrf_token, session)
else
false # Token is malformed.
end
end | [
"def",
"valid_authenticity_token?",
"(",
"session",
",",
"encoded_masked_token",
")",
"# :doc:",
"if",
"encoded_masked_token",
".",
"nil?",
"||",
"encoded_masked_token",
".",
"empty?",
"||",
"!",
"encoded_masked_token",
".",
"is_a?",
"(",
"String",
")",
"return",
"f... | Checks the client's masked token to see if it matches the
session token. Essentially the inverse of
+masked_authenticity_token+. | [
"Checks",
"the",
"client",
"s",
"masked",
"token",
"to",
"see",
"if",
"it",
"matches",
"the",
"session",
"token",
".",
"Essentially",
"the",
"inverse",
"of",
"+",
"masked_authenticity_token",
"+",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/actionpack/lib/action_controller/metal/request_forgery_protection.rb#L339-L368 | train | Check if the given token is valid for the current session. | [
30522,
13366,
9398,
1035,
21452,
1035,
19204,
1029,
1006,
5219,
1010,
12359,
1035,
16520,
1035,
19204,
1007,
1001,
1024,
9986,
1024,
2065,
12359,
1035,
16520,
1035,
19204,
1012,
9152,
2140,
1029,
1064,
1064,
12359,
1035,
16520,
1035,
19204,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.list_by_node_as_lazy | def list_by_node_as_lazy(resource_group_name, automation_account_name, node_id, filter:nil, custom_headers:nil)
response = list_by_node_async(resource_group_name, automation_account_name, node_id, filter:filter, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_node_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_by_node_as_lazy(resource_group_name, automation_account_name, node_id, filter:nil, custom_headers:nil)
response = list_by_node_async(resource_group_name, automation_account_name, node_id, filter:filter, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_node_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_by_node_as_lazy",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"node_id",
",",
"filter",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_node_async",
"(",
"resource_group_name",
",",
"automation_account_name... | Retrieve the Dsc node report list by node 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 parameters supplied to the list operation.
@param filter [String] The filter to apply on the operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [DscNodeReportListResult] which provide lazy access to pages of the
response. | [
"Retrieve",
"the",
"Dsc",
"node",
"report",
"list",
"by",
"node",
"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#L423-L432 | train | Gets the list of nodes under the specified node. | [
30522,
13366,
2862,
1035,
2011,
1035,
13045,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
19309,
1035,
4070,
1035,
2171,
1010,
13045,
1035,
8909,
1010,
11307,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.start_partition_restart | def start_partition_restart(service_id, partition_id, operation_id, restart_partition_mode, timeout:60, custom_headers:nil)
response = start_partition_restart_async(service_id, partition_id, operation_id, restart_partition_mode, timeout:timeout, custom_headers:custom_headers).value!
nil
end | ruby | def start_partition_restart(service_id, partition_id, operation_id, restart_partition_mode, timeout:60, custom_headers:nil)
response = start_partition_restart_async(service_id, partition_id, operation_id, restart_partition_mode, timeout:timeout, custom_headers:custom_headers).value!
nil
end | [
"def",
"start_partition_restart",
"(",
"service_id",
",",
"partition_id",
",",
"operation_id",
",",
"restart_partition_mode",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"start_partition_restart_async",
"(",
"service_id",
",",
... | This API will restart some or all replicas or instances of the specified
partition.
This API is useful for testing failover.
If used to target a stateless service partition, RestartPartitionMode must be
AllReplicasOrInstances.
Call the GetPartitionRestartProgress API using the same OperationId to get
the progress.
@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 partition_id The identity of the partition.
@param operation_id A GUID that identifies a call of this API. This is
passed into the corresponding GetProgress API
@param restart_partition_mode [RestartPartitionMode] Describe which
partitions to restart. Possible values include: 'Invalid',
'AllReplicasOrInstances', 'OnlyActiveSecondaries'
@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. | [
"This",
"API",
"will",
"restart",
"some",
"or",
"all",
"replicas",
"or",
"instances",
"of",
"the",
"specified",
"partition",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L21318-L21321 | train | Start a partition restart. | [
30522,
13366,
2707,
1035,
13571,
1035,
23818,
1006,
2326,
1035,
8909,
1010,
13571,
1035,
8909,
1010,
3169,
1035,
8909,
1010,
23818,
1035,
13571,
1035,
5549,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machines.rb | Azure::Compute::Mgmt::V2016_04_30_preview.VirtualMachines.begin_capture_with_http_info | def begin_capture_with_http_info(resource_group_name, vm_name, parameters, custom_headers:nil)
begin_capture_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers).value!
end | ruby | def begin_capture_with_http_info(resource_group_name, vm_name, parameters, custom_headers:nil)
begin_capture_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_capture_with_http_info",
"(",
"resource_group_name",
",",
"vm_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_capture_async",
"(",
"resource_group_name",
",",
"vm_name",
",",
"parameters",
",",
"custom_headers",
":custom_headers",
... | Captures the VM by copying virtual hard disks of the VM and outputs a
template that can be used to create similar VMs.
@param resource_group_name [String] The name of the resource group.
@param vm_name [String] The name of the virtual machine.
@param parameters [VirtualMachineCaptureParameters] Parameters supplied to
the Capture Virtual Machine 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. | [
"Captures",
"the",
"VM",
"by",
"copying",
"virtual",
"hard",
"disks",
"of",
"the",
"VM",
"and",
"outputs",
"a",
"template",
"that",
"can",
"be",
"used",
"to",
"create",
"similar",
"VMs",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machines.rb#L1010-L1012 | train | Capture virtual machine. | [
30522,
13366,
4088,
1035,
5425,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
1035,
5425,
1035,
2004,
6038,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mongodb/mongoid | lib/mongoid/serializable.rb | Mongoid.Serializable.relation_names | def relation_names(inclusions)
inclusions.is_a?(Hash) ? inclusions.keys : Array.wrap(inclusions)
end | ruby | def relation_names(inclusions)
inclusions.is_a?(Hash) ? inclusions.keys : Array.wrap(inclusions)
end | [
"def",
"relation_names",
"(",
"inclusions",
")",
"inclusions",
".",
"is_a?",
"(",
"Hash",
")",
"?",
"inclusions",
".",
"keys",
":",
"Array",
".",
"wrap",
"(",
"inclusions",
")",
"end"
] | Since the inclusions can be a hash, symbol, or array of symbols, this is
provided as a convenience to parse out the names.
@example Get the association names.
document.relation_names(:include => [ :addresses ])
@param [ Hash, Symbol, Array<Symbol> ] inclusions The inclusions.
@return [ Array<Symbol> ] The names of the included associations.
@since 2.0.0.rc.6 | [
"Since",
"the",
"inclusions",
"can",
"be",
"a",
"hash",
"symbol",
"or",
"array",
"of",
"symbols",
"this",
"is",
"provided",
"as",
"a",
"convenience",
"to",
"parse",
"out",
"the",
"names",
"."
] | 56976e32610f4c2450882b0bfe14da099f0703f4 | https://github.com/mongodb/mongoid/blob/56976e32610f4c2450882b0bfe14da099f0703f4/lib/mongoid/serializable.rb#L147-L149 | train | Returns the relation names for the given inclusions | [
30522,
13366,
7189,
1035,
3415,
1006,
10502,
2015,
1007,
10502,
2015,
1012,
2003,
1035,
1037,
1029,
1006,
23325,
1007,
1029,
10502,
2015,
1012,
6309,
1024,
9140,
1012,
10236,
1006,
10502,
2015,
1007,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.get_prebuilt | def get_prebuilt(app_id, version_id, prebuilt_id, custom_headers:nil)
response = get_prebuilt_async(app_id, version_id, prebuilt_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_prebuilt(app_id, version_id, prebuilt_id, custom_headers:nil)
response = get_prebuilt_async(app_id, version_id, prebuilt_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_prebuilt",
"(",
"app_id",
",",
"version_id",
",",
"prebuilt_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_prebuilt_async",
"(",
"app_id",
",",
"version_id",
",",
"prebuilt_id",
",",
"custom_headers",
":custom_headers",
")",
".",
... | Gets information about a prebuilt entity model in a version of the
application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param prebuilt_id The prebuilt entity extractor ID.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [PrebuiltEntityExtractor] operation results. | [
"Gets",
"information",
"about",
"a",
"prebuilt",
"entity",
"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#L3444-L3447 | train | Gets the prebuilt product. | [
30522,
13366,
2131,
1035,
3653,
8569,
4014,
2102,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
3653,
8569,
4014,
2102,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
3653,
8569,
4014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb | Aws::EC2.Resource.create_network_acl | def create_network_acl(options = {})
resp = @client.create_network_acl(options)
NetworkAcl.new(
id: resp.data.network_acl.network_acl_id,
data: resp.data.network_acl,
client: @client
)
end | ruby | def create_network_acl(options = {})
resp = @client.create_network_acl(options)
NetworkAcl.new(
id: resp.data.network_acl.network_acl_id,
data: resp.data.network_acl,
client: @client
)
end | [
"def",
"create_network_acl",
"(",
"options",
"=",
"{",
"}",
")",
"resp",
"=",
"@client",
".",
"create_network_acl",
"(",
"options",
")",
"NetworkAcl",
".",
"new",
"(",
"id",
":",
"resp",
".",
"data",
".",
"network_acl",
".",
"network_acl_id",
",",
"data",
... | @example Request syntax with placeholder values
networkacl = ec2.create_network_acl({
dry_run: false,
vpc_id: "String", # required
})
@param [Hash] options ({})
@option options [Boolean] :dry_run
Checks whether you have the required permissions for the action,
without actually making the request, and provides an error response.
If you have the required permissions, the error response is
`DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
@option options [required, String] :vpc_id
The ID of the VPC.
@return [NetworkAcl] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb#L528-L535 | train | Create a network acl | [
30522,
13366,
3443,
1035,
2897,
1035,
9353,
2140,
1006,
7047,
1027,
1063,
1065,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
3443,
1035,
2897,
1035,
9353,
2140,
1006,
7047,
1007,
2897,
6305,
2140,
1012,
2047,
1006,
8909,
1024,
24501,
2361,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activesupport/lib/active_support/evented_file_update_checker.rb | ActiveSupport.EventedFileUpdateChecker.updated? | def updated?
@boot_mutex.synchronize do
if @pid != Process.pid
boot!
@pid = Process.pid
@updated.make_true
end
end
if @missing.any?(&:exist?)
@boot_mutex.synchronize do
appeared, @missing = @missing.partition(&:exist?)
shutdown!
@dtw += appeared
boot!
@updated.make_true
end
end
@updated.true?
end | ruby | def updated?
@boot_mutex.synchronize do
if @pid != Process.pid
boot!
@pid = Process.pid
@updated.make_true
end
end
if @missing.any?(&:exist?)
@boot_mutex.synchronize do
appeared, @missing = @missing.partition(&:exist?)
shutdown!
@dtw += appeared
boot!
@updated.make_true
end
end
@updated.true?
end | [
"def",
"updated?",
"@boot_mutex",
".",
"synchronize",
"do",
"if",
"@pid",
"!=",
"Process",
".",
"pid",
"boot!",
"@pid",
"=",
"Process",
".",
"pid",
"@updated",
".",
"make_true",
"end",
"end",
"if",
"@missing",
".",
"any?",
"(",
":exist?",
")",
"@boot_mutex... | :nodoc: all | [
":",
"nodoc",
":",
"all"
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/evented_file_update_checker.rb#L71-L93 | train | Returns true if the object has been updated. | [
30522,
13366,
7172,
1029,
1030,
9573,
1035,
20101,
2595,
1012,
26351,
8093,
10698,
4371,
2079,
2065,
1030,
14255,
2094,
999,
1027,
2832,
1012,
14255,
2094,
9573,
999,
1030,
14255,
2094,
1027,
2832,
1012,
14255,
2094,
1030,
7172,
1012,
2191,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_recovery_services_site_recovery/lib/2018-01-10/generated/azure_mgmt_recovery_services_site_recovery/replication_protection_container_mappings.rb | Azure::RecoveryServicesSiteRecovery::Mgmt::V2018_01_10.ReplicationProtectionContainerMappings.begin_create | def begin_create(fabric_name, protection_container_name, mapping_name, creation_input, custom_headers:nil)
response = begin_create_async(fabric_name, protection_container_name, mapping_name, creation_input, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_create(fabric_name, protection_container_name, mapping_name, creation_input, custom_headers:nil)
response = begin_create_async(fabric_name, protection_container_name, mapping_name, creation_input, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_create",
"(",
"fabric_name",
",",
"protection_container_name",
",",
"mapping_name",
",",
"creation_input",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_create_async",
"(",
"fabric_name",
",",
"protection_container_name",
",",
"mapping_na... | Create protection container mapping.
The operation to create a protection container mapping.
@param fabric_name [String] Fabric name.
@param protection_container_name [String] Protection container name.
@param mapping_name [String] Protection container mapping name.
@param creation_input [CreateProtectionContainerMappingInput] Mapping
creation input.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ProtectionContainerMapping] operation results. | [
"Create",
"protection",
"container",
"mapping",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_recovery_services_site_recovery/lib/2018-01-10/generated/azure_mgmt_recovery_services_site_recovery/replication_protection_container_mappings.rb#L521-L524 | train | Creates a new protection container mapping. | [
30522,
13366,
4088,
1035,
3443,
1006,
8313,
1035,
2171,
1010,
3860,
1035,
11661,
1035,
2171,
1010,
12375,
1035,
2171,
1010,
4325,
1035,
7953,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
3443,
1035,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_managed_applications/lib/2018-06-01/generated/azure_mgmt_managed_applications/application_definitions.rb | Azure::ManagedApplications::Mgmt::V2018_06_01.ApplicationDefinitions.get_by_id | def get_by_id(application_definition_id, custom_headers:nil)
response = get_by_id_async(application_definition_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_by_id(application_definition_id, custom_headers:nil)
response = get_by_id_async(application_definition_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_by_id",
"(",
"application_definition_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_by_id_async",
"(",
"application_definition_id",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"respon... | Gets the managed application definition.
@param application_definition_id [String] The fully qualified ID of the
managed application definition, including the managed application name and
the managed application definition resource type. Use the format,
/subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ApplicationDefinition] operation results. | [
"Gets",
"the",
"managed",
"application",
"definition",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_managed_applications/lib/2018-06-01/generated/azure_mgmt_managed_applications/application_definitions.rb#L325-L328 | train | Gets the specified application definition. | [
30522,
13366,
2131,
1035,
2011,
1035,
8909,
1006,
4646,
1035,
6210,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
2011,
1035,
8909,
1035,
2004,
6038,
2278,
1006,
4646,
1035,
6210,
1035,
8909,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/labs.rb | Azure::Labservices::Mgmt::V2018_10_15.Labs.update | def update(resource_group_name, lab_account_name, lab_name, lab, custom_headers:nil)
response = update_async(resource_group_name, lab_account_name, lab_name, lab, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def update(resource_group_name, lab_account_name, lab_name, lab, custom_headers:nil)
response = update_async(resource_group_name, lab_account_name, lab_name, lab, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"update",
"(",
"resource_group_name",
",",
"lab_account_name",
",",
"lab_name",
",",
"lab",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"update_async",
"(",
"resource_group_name",
",",
"lab_account_name",
",",
"lab_name",
",",
"lab",
",",
"cu... | Modify properties of labs.
@param resource_group_name [String] The name of the resource group.
@param lab_account_name [String] The name of the lab Account.
@param lab_name [String] The name of the lab.
@param lab [LabFragment] Represents a lab.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Lab] operation results. | [
"Modify",
"properties",
"of",
"labs",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/labs.rb#L408-L411 | train | Updates a lab s index. | [
30522,
13366,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
6845,
1035,
4070,
1035,
2171,
1010,
6845,
1035,
2171,
1010,
6845,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
10651,
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... |
spohlenz/tinymce-rails | lib/tinymce/rails/helper.rb | TinyMCE::Rails.Helper.tinymce_javascript | def tinymce_javascript(config=:default, options={})
options, config = config, :default if config.is_a?(Hash)
options = Configuration.new(options)
"TinyMCERails.initialize('#{config}', #{options.to_javascript});".html_safe
end | ruby | def tinymce_javascript(config=:default, options={})
options, config = config, :default if config.is_a?(Hash)
options = Configuration.new(options)
"TinyMCERails.initialize('#{config}', #{options.to_javascript});".html_safe
end | [
"def",
"tinymce_javascript",
"(",
"config",
"=",
":default",
",",
"options",
"=",
"{",
"}",
")",
"options",
",",
"config",
"=",
"config",
",",
":default",
"if",
"config",
".",
"is_a?",
"(",
"Hash",
")",
"options",
"=",
"Configuration",
".",
"new",
"(",
... | Returns the JavaScript code required to initialize TinyMCE. | [
"Returns",
"the",
"JavaScript",
"code",
"required",
"to",
"initialize",
"TinyMCE",
"."
] | 6f94b295f030939c8b3c7739f13812e42e6d920a | https://github.com/spohlenz/tinymce-rails/blob/6f94b295f030939c8b3c7739f13812e42e6d920a/lib/tinymce/rails/helper.rb#L31-L36 | train | Returns a JavaScript code that can be used to initialize the TinyMCE. | [
30522,
13366,
4714,
12458,
2063,
1035,
9262,
22483,
1006,
9530,
8873,
2290,
1027,
1024,
12398,
1010,
7047,
1027,
1063,
1065,
1007,
7047,
1010,
9530,
8873,
2290,
1027,
9530,
8873,
2290,
1010,
1024,
12398,
2065,
9530,
8873,
2290,
1012,
2003,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sporkmonger/addressable | lib/addressable/uri.rb | Addressable.URI.merge | def merge(hash)
if !hash.respond_to?(:to_hash)
raise TypeError, "Can't convert #{hash.class} into Hash."
end
hash = hash.to_hash
if hash.has_key?(:authority)
if (hash.keys & [:userinfo, :user, :password, :host, :port]).any?
raise ArgumentError,
"Cannot specify both an authority and any of the components " +
"within the authority."
end
end
if hash.has_key?(:userinfo)
if (hash.keys & [:user, :password]).any?
raise ArgumentError,
"Cannot specify both a userinfo and either the user or password."
end
end
uri = self.class.new
uri.defer_validation do
# Bunch of crazy logic required because of the composite components
# like userinfo and authority.
uri.scheme =
hash.has_key?(:scheme) ? hash[:scheme] : self.scheme
if hash.has_key?(:authority)
uri.authority =
hash.has_key?(:authority) ? hash[:authority] : self.authority
end
if hash.has_key?(:userinfo)
uri.userinfo =
hash.has_key?(:userinfo) ? hash[:userinfo] : self.userinfo
end
if !hash.has_key?(:userinfo) && !hash.has_key?(:authority)
uri.user =
hash.has_key?(:user) ? hash[:user] : self.user
uri.password =
hash.has_key?(:password) ? hash[:password] : self.password
end
if !hash.has_key?(:authority)
uri.host =
hash.has_key?(:host) ? hash[:host] : self.host
uri.port =
hash.has_key?(:port) ? hash[:port] : self.port
end
uri.path =
hash.has_key?(:path) ? hash[:path] : self.path
uri.query =
hash.has_key?(:query) ? hash[:query] : self.query
uri.fragment =
hash.has_key?(:fragment) ? hash[:fragment] : self.fragment
end
return uri
end | ruby | def merge(hash)
if !hash.respond_to?(:to_hash)
raise TypeError, "Can't convert #{hash.class} into Hash."
end
hash = hash.to_hash
if hash.has_key?(:authority)
if (hash.keys & [:userinfo, :user, :password, :host, :port]).any?
raise ArgumentError,
"Cannot specify both an authority and any of the components " +
"within the authority."
end
end
if hash.has_key?(:userinfo)
if (hash.keys & [:user, :password]).any?
raise ArgumentError,
"Cannot specify both a userinfo and either the user or password."
end
end
uri = self.class.new
uri.defer_validation do
# Bunch of crazy logic required because of the composite components
# like userinfo and authority.
uri.scheme =
hash.has_key?(:scheme) ? hash[:scheme] : self.scheme
if hash.has_key?(:authority)
uri.authority =
hash.has_key?(:authority) ? hash[:authority] : self.authority
end
if hash.has_key?(:userinfo)
uri.userinfo =
hash.has_key?(:userinfo) ? hash[:userinfo] : self.userinfo
end
if !hash.has_key?(:userinfo) && !hash.has_key?(:authority)
uri.user =
hash.has_key?(:user) ? hash[:user] : self.user
uri.password =
hash.has_key?(:password) ? hash[:password] : self.password
end
if !hash.has_key?(:authority)
uri.host =
hash.has_key?(:host) ? hash[:host] : self.host
uri.port =
hash.has_key?(:port) ? hash[:port] : self.port
end
uri.path =
hash.has_key?(:path) ? hash[:path] : self.path
uri.query =
hash.has_key?(:query) ? hash[:query] : self.query
uri.fragment =
hash.has_key?(:fragment) ? hash[:fragment] : self.fragment
end
return uri
end | [
"def",
"merge",
"(",
"hash",
")",
"if",
"!",
"hash",
".",
"respond_to?",
"(",
":to_hash",
")",
"raise",
"TypeError",
",",
"\"Can't convert #{hash.class} into Hash.\"",
"end",
"hash",
"=",
"hash",
".",
"to_hash",
"if",
"hash",
".",
"has_key?",
"(",
":authority"... | Merges a URI with a <code>Hash</code> of components.
This method has different behavior from <code>join</code>. Any
components present in the <code>hash</code> parameter will override the
original components. The path component is not treated specially.
@param [Hash, Addressable::URI, #to_hash] The components to merge with.
@return [Addressable::URI] The merged URI.
@see Hash#merge | [
"Merges",
"a",
"URI",
"with",
"a",
"<code",
">",
"Hash<",
"/",
"code",
">",
"of",
"components",
".",
"This",
"method",
"has",
"different",
"behavior",
"from",
"<code",
">",
"join<",
"/",
"code",
">",
".",
"Any",
"components",
"present",
"in",
"the",
"<... | 5894c95a7768435cb46d1355954611dbd194832e | https://github.com/sporkmonger/addressable/blob/5894c95a7768435cb46d1355954611dbd194832e/lib/addressable/uri.rb#L1981-L2036 | train | Merge the URI with the given Hash. | [
30522,
13366,
13590,
1006,
23325,
1007,
2065,
999,
23325,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
2000,
1035,
23325,
1007,
5333,
2828,
2121,
29165,
1010,
1000,
2064,
1005,
1056,
10463,
1001,
1063,
23325,
1012,
2465,
1065,
2046,
23325,
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... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_customvisiontraining/lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb | Azure::CognitiveServices::Customvisiontraining::V3_0.CustomvisiontrainingClient.export_iteration | def export_iteration(project_id, iteration_id, platform, flavor:nil, custom_headers:nil)
response = export_iteration_async(project_id, iteration_id, platform, flavor:flavor, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def export_iteration(project_id, iteration_id, platform, flavor:nil, custom_headers:nil)
response = export_iteration_async(project_id, iteration_id, platform, flavor:flavor, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"export_iteration",
"(",
"project_id",
",",
"iteration_id",
",",
"platform",
",",
"flavor",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"export_iteration_async",
"(",
"project_id",
",",
"iteration_id",
",",
"platform",
",",
"flavo... | Export a trained iteration.
@param project_id The project id.
@param iteration_id The iteration id.
@param platform [Enum] The target platform. Possible values include:
'CoreML', 'TensorFlow', 'DockerFile', 'ONNX', 'VAIDK'
@param flavor [Enum] The flavor of the target platform. Possible values
include: 'Linux', 'Windows', 'ONNX10', 'ONNX12', 'ARM'
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Export] operation results. | [
"Export",
"a",
"trained",
"iteration",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_customvisiontraining/lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb#L4105-L4108 | train | Export a single iteration of a project. | [
30522,
13366,
9167,
1035,
27758,
1006,
2622,
1035,
8909,
1010,
27758,
1035,
8909,
1010,
4132,
1010,
14894,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
9167,
1035,
27758,
1035,
2004,
6038,
2278,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/models/money.rb | SquareConnect.Money.valid? | def valid?
return false if !@amount.nil? && @amount < 0
currency_validator = EnumAttributeValidator.new('String', ["UNKNOWN_CURRENCY", "AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BOV", "BRL", "BSD", "BTN", "BWP", "BYR", "BZD", "CAD", "CDF", "CHE", "CHF", "CHW", "CLF", "CLP", "CNY", "COP", "COU", "CRC", "CUC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR", "FJD", "FKP", "GBP", "GEL", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "INR", "IQD", "IRR", "ISK", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LTL", "LVL", "LYD", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRO", "MUR", "MVR", "MWK", "MXN", "MXV", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLL", "SOS", "SRD", "SSP", "STD", "SVC", "SYP", "SZL", "THB", "TJS", "TMT", "TND", "TOP", "TRY", "TTD", "TWD", "TZS", "UAH", "UGX", "USD", "USN", "USS", "UYI", "UYU", "UZS", "VEF", "VND", "VUV", "WST", "XAF", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XDR", "XOF", "XPD", "XPF", "XPT", "XTS", "XXX", "YER", "ZAR", "ZMK", "ZMW", "BTC"])
return false unless currency_validator.valid?(@currency)
return true
end | ruby | def valid?
return false if !@amount.nil? && @amount < 0
currency_validator = EnumAttributeValidator.new('String', ["UNKNOWN_CURRENCY", "AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BOV", "BRL", "BSD", "BTN", "BWP", "BYR", "BZD", "CAD", "CDF", "CHE", "CHF", "CHW", "CLF", "CLP", "CNY", "COP", "COU", "CRC", "CUC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR", "FJD", "FKP", "GBP", "GEL", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "INR", "IQD", "IRR", "ISK", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LTL", "LVL", "LYD", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRO", "MUR", "MVR", "MWK", "MXN", "MXV", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLL", "SOS", "SRD", "SSP", "STD", "SVC", "SYP", "SZL", "THB", "TJS", "TMT", "TND", "TOP", "TRY", "TTD", "TWD", "TZS", "UAH", "UGX", "USD", "USN", "USS", "UYI", "UYU", "UZS", "VEF", "VND", "VUV", "WST", "XAF", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XDR", "XOF", "XPD", "XPF", "XPT", "XTS", "XXX", "YER", "ZAR", "ZMK", "ZMW", "BTC"])
return false unless currency_validator.valid?(@currency)
return true
end | [
"def",
"valid?",
"return",
"false",
"if",
"!",
"@amount",
".",
"nil?",
"&&",
"@amount",
"<",
"0",
"currency_validator",
"=",
"EnumAttributeValidator",
".",
"new",
"(",
"'String'",
",",
"[",
"\"UNKNOWN_CURRENCY\"",
",",
"\"AED\"",
",",
"\"AFN\"",
",",
"\"ALL\""... | 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/money.rb#L90-L95 | train | Checks if the given object is valid for the given index. | [
30522,
13366,
9398,
1029,
2709,
6270,
2065,
999,
1030,
3815,
1012,
9152,
2140,
1029,
1004,
1004,
1030,
3815,
1026,
1014,
9598,
1035,
9398,
8844,
1027,
4372,
12248,
4779,
3089,
8569,
2618,
10175,
8524,
4263,
1012,
2047,
1006,
1005,
5164,
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_customer_insights/lib/2017-01-01/generated/azure_mgmt_customer_insights/hubs.rb | Azure::CustomerInsights::Mgmt::V2017_01_01.Hubs.update_with_http_info | def update_with_http_info(resource_group_name, hub_name, parameters, custom_headers:nil)
update_async(resource_group_name, hub_name, parameters, custom_headers:custom_headers).value!
end | ruby | def update_with_http_info(resource_group_name, hub_name, parameters, custom_headers:nil)
update_async(resource_group_name, hub_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"update_with_http_info",
"(",
"resource_group_name",
",",
"hub_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"update_async",
"(",
"resource_group_name",
",",
"hub_name",
",",
"parameters",
",",
"custom_headers",
":custom_headers",
")",
".",
... | Updates a Hub.
@param resource_group_name [String] The name of the resource group.
@param hub_name [String] The name of the Hub.
@param parameters [Hub] Parameters supplied to the Update Hub 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. | [
"Updates",
"a",
"Hub",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_customer_insights/lib/2017-01-01/generated/azure_mgmt_customer_insights/hubs.rb#L173-L175 | train | Updates a node in the hub. | [
30522,
13366,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
9594,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
10651,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/diagnostics.rb | Azure::Web::Mgmt::V2018_02_01.Diagnostics.list_site_detectors_as_lazy | def list_site_detectors_as_lazy(resource_group_name, site_name, diagnostic_category, custom_headers:nil)
response = list_site_detectors_async(resource_group_name, site_name, diagnostic_category, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_site_detectors_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_site_detectors_as_lazy(resource_group_name, site_name, diagnostic_category, custom_headers:nil)
response = list_site_detectors_async(resource_group_name, site_name, diagnostic_category, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_site_detectors_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_site_detectors_as_lazy",
"(",
"resource_group_name",
",",
"site_name",
",",
"diagnostic_category",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_site_detectors_async",
"(",
"resource_group_name",
",",
"site_name",
",",
"diagnostic_category",
... | Get Detectors
Get Detectors
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param site_name [String] Site Name
@param diagnostic_category [String] Diagnostic Category
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [DiagnosticDetectorCollection] which provide lazy access to pages of
the response. | [
"Get",
"Detectors"
] | 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#L3672-L3681 | train | Gets all site detectors. | [
30522,
13366,
2862,
1035,
2609,
1035,
25971,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2609,
1035,
2171,
1010,
16474,
1035,
4696,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2609,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activesupport/lib/active_support/security_utils.rb | ActiveSupport.SecurityUtils.secure_compare | def secure_compare(a, b)
fixed_length_secure_compare(::Digest::SHA256.digest(a), ::Digest::SHA256.digest(b)) && a == b
end | ruby | def secure_compare(a, b)
fixed_length_secure_compare(::Digest::SHA256.digest(a), ::Digest::SHA256.digest(b)) && a == b
end | [
"def",
"secure_compare",
"(",
"a",
",",
"b",
")",
"fixed_length_secure_compare",
"(",
"::",
"Digest",
"::",
"SHA256",
".",
"digest",
"(",
"a",
")",
",",
"::",
"Digest",
"::",
"SHA256",
".",
"digest",
"(",
"b",
")",
")",
"&&",
"a",
"==",
"b",
"end"
] | Constant time string comparison, for variable length strings.
The values are first processed by SHA256, so that we don't leak length info
via timing attacks. | [
"Constant",
"time",
"string",
"comparison",
"for",
"variable",
"length",
"strings",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/security_utils.rb#L26-L28 | train | Compare two hashes of hashes | [
30522,
13366,
5851,
1035,
12826,
1006,
1037,
1010,
1038,
1007,
4964,
1035,
3091,
1035,
5851,
1035,
12826,
1006,
1024,
1024,
17886,
1024,
1024,
21146,
17788,
2575,
1012,
17886,
1006,
1037,
1007,
1010,
1024,
1024,
17886,
1024,
1024,
21146,
17... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.get_application_load_info_with_http_info | def get_application_load_info_with_http_info(application_id, timeout:60, custom_headers:nil)
get_application_load_info_async(application_id, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def get_application_load_info_with_http_info(application_id, timeout:60, custom_headers:nil)
get_application_load_info_async(application_id, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"get_application_load_info_with_http_info",
"(",
"application_id",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"get_application_load_info_async",
"(",
"application_id",
",",
"timeout",
":",
"timeout",
",",
"custom_headers",
":custom_headers",... | Gets load information about a Service Fabric application.
Returns the load information about the application that was created or in the
process of being created in the Service Fabric cluster and whose name matches
the one specified as the parameter. The response includes the name, minimum
nodes, maximum nodes, the number of nodes the application is occupying
currently, and application load metric information about the application.
@param application_id [String] The identity of the application. This is
typically the full name of the application without the 'fabric:' URI scheme.
Starting from version 6.0, hierarchical names are delimited with the "~"
character.
For example, if the application name is "fabric:/myapp/app1", the application
identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"load",
"information",
"about",
"a",
"Service",
"Fabric",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L6353-L6355 | train | Gets the load information of the specified application. | [
30522,
13366,
2131,
1035,
4646,
1035,
7170,
1035,
18558,
1035,
2007,
1035,
8299,
1035,
18558,
30524,
2015,
1007,
1012,
3643,
999,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/feature.rb | Flipper.Feature.enable | def enable(thing = true)
instrument(:enable) do |payload|
adapter.add self
gate = gate_for(thing)
wrapped_thing = gate.wrap(thing)
payload[:gate_name] = gate.name
payload[:thing] = wrapped_thing
adapter.enable self, gate, wrapped_thing
end
end | ruby | def enable(thing = true)
instrument(:enable) do |payload|
adapter.add self
gate = gate_for(thing)
wrapped_thing = gate.wrap(thing)
payload[:gate_name] = gate.name
payload[:thing] = wrapped_thing
adapter.enable self, gate, wrapped_thing
end
end | [
"def",
"enable",
"(",
"thing",
"=",
"true",
")",
"instrument",
"(",
":enable",
")",
"do",
"|",
"payload",
"|",
"adapter",
".",
"add",
"self",
"gate",
"=",
"gate_for",
"(",
"thing",
")",
"wrapped_thing",
"=",
"gate",
".",
"wrap",
"(",
"thing",
")",
"p... | Internal: Initializes a new feature instance.
name - The Symbol or String name of the feature.
adapter - The adapter that will be used to store details about this feature.
options - The Hash of options.
:instrumenter - What to use to instrument all the things.
Public: Enable this feature for something.
Returns the result of Adapter#enable. | [
"Internal",
":",
"Initializes",
"a",
"new",
"feature",
"instance",
"."
] | df0352b663ad3ed45d68710f10a8170249ff9d78 | https://github.com/jnunemaker/flipper/blob/df0352b663ad3ed45d68710f10a8170249ff9d78/lib/flipper/feature.rb#L43-L54 | train | Enable the given thing | [
30522,
13366,
9585,
1006,
2518,
30524,
15581,
2121,
1012,
5587,
2969,
4796,
1027,
4796,
1035,
2005,
1006,
2518,
1007,
5058,
1035,
2518,
1027,
4796,
1012,
10236,
1006,
2518,
1007,
18093,
1031,
1024,
4796,
1035,
2171,
1033,
1027,
4796,
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... |
piotrmurach/github | lib/github_api/client/issues.rb | Github.Client::Issues.edit | def edit(*args)
arguments(args, required: [:user, :repo, :number]) do
permit VALID_ISSUE_PARAM_NAMES
end
patch_request("/repos/#{arguments.user}/#{arguments.repo}/issues/#{arguments.number}", arguments.params)
end | ruby | def edit(*args)
arguments(args, required: [:user, :repo, :number]) do
permit VALID_ISSUE_PARAM_NAMES
end
patch_request("/repos/#{arguments.user}/#{arguments.repo}/issues/#{arguments.number}", arguments.params)
end | [
"def",
"edit",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":number",
"]",
")",
"do",
"permit",
"VALID_ISSUE_PARAM_NAMES",
"end",
"patch_request",
"(",
"\"/repos/#{arguments.user}/#{arguments.repo}/issues... | Edit an issue
@param [Hash] params
@option params [String] :title
Optional string
@option params [String] :body
Optional string
@option params [String] :assignee
Optional string - Login for the user that this issue should be assigned to.
@option params [String] :state
Optional string - State of the issue: open or closed
@option params [Number] :milestone
Optional number - Milestone to associate this issue with
@option params [Array[String]] :labels
Optional array of strings - Labels to associate with this issue.
Pass one or more Labels to replace the set of Labels on this Issue.
Send an empty array ([]) to clear all Labels from the Issue.
@example
github = Github.new
github.issues.edit 'user-name', 'repo-name', 'number'
title: "Found a bug",
body: "I'm having a problem with this.",
assignee: "octocat",
milestone: 1,
labels": [
"Label1",
"Label2"
]
@api public | [
"Edit",
"an",
"issue"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/issues.rb#L240-L246 | train | Edit an issue | [
30522,
13366,
10086,
1006,
1008,
12098,
5620,
1007,
9918,
1006,
12098,
5620,
1010,
3223,
1024,
1031,
1024,
5310,
1010,
1024,
16360,
2080,
1010,
1024,
2193,
1033,
1007,
2079,
9146,
9398,
1035,
3277,
1035,
11498,
2213,
1035,
3415,
2203,
8983,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb | Azure::Web::Mgmt::V2018_02_01.AppServiceEnvironments.begin_change_vnet_with_http_info | def begin_change_vnet_with_http_info(resource_group_name, name, vnet_info, custom_headers:nil)
begin_change_vnet_async(resource_group_name, name, vnet_info, custom_headers:custom_headers).value!
end | ruby | def begin_change_vnet_with_http_info(resource_group_name, name, vnet_info, custom_headers:nil)
begin_change_vnet_async(resource_group_name, name, vnet_info, custom_headers:custom_headers).value!
end | [
"def",
"begin_change_vnet_with_http_info",
"(",
"resource_group_name",
",",
"name",
",",
"vnet_info",
",",
"custom_headers",
":",
"nil",
")",
"begin_change_vnet_async",
"(",
"resource_group_name",
",",
"name",
",",
"vnet_info",
",",
"custom_headers",
":custom_headers",
... | Move an App Service Environment to a different VNET.
Move an App Service Environment to a different VNET.
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param name [String] Name of the App Service Environment.
@param vnet_info [VirtualNetworkProfile] Details for the new virtual network.
@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. | [
"Move",
"an",
"App",
"Service",
"Environment",
"to",
"a",
"different",
"VNET",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb#L4402-L4404 | train | Changes the virtual network of the specified resource group. | [
30522,
13366,
4088,
1035,
2689,
1035,
1058,
7159,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
1058,
7159,
1035,
18558,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
1035,
2689,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2018-04-01/generated/azure_mgmt_compute/virtual_machine_scale_set_rolling_upgrades.rb | Azure::Compute::Mgmt::V2018_04_01.VirtualMachineScaleSetRollingUpgrades.cancel_async | def cancel_async(resource_group_name, vm_scale_set_name, custom_headers:nil)
# Send request
promise = begin_cancel_async(resource_group_name, vm_scale_set_name, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | ruby | def cancel_async(resource_group_name, vm_scale_set_name, custom_headers:nil)
# Send request
promise = begin_cancel_async(resource_group_name, vm_scale_set_name, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | [
"def",
"cancel_async",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_cancel_async",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"custom_headers",
":custom_headers",
")"... | @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 custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"resource_group_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"resource",
"group",
".",
"@param",
"vm_scale_set_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"VM",
"scale",
"set",
".",
"@param",
"custom_headers",
"[",
"Hash",
"{",... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2018-04-01/generated/azure_mgmt_compute/virtual_machine_scale_set_rolling_upgrades.rb#L46-L60 | train | Cancels a virtual machine scale set. | [
30522,
13366,
17542,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
4094,
1035,
2275,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,
4088,
1035,
17542,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
github/linguist | samples/Ruby/sinatra.rb | Sinatra.Base.indifferent_params | def indifferent_params(object)
case object
when Hash
new_hash = indifferent_hash
object.each { |key, value| new_hash[key] = indifferent_params(value) }
new_hash
when Array
object.map { |item| indifferent_params(item) }
else
object
end
end | ruby | def indifferent_params(object)
case object
when Hash
new_hash = indifferent_hash
object.each { |key, value| new_hash[key] = indifferent_params(value) }
new_hash
when Array
object.map { |item| indifferent_params(item) }
else
object
end
end | [
"def",
"indifferent_params",
"(",
"object",
")",
"case",
"object",
"when",
"Hash",
"new_hash",
"=",
"indifferent_hash",
"object",
".",
"each",
"{",
"|",
"key",
",",
"value",
"|",
"new_hash",
"[",
"key",
"]",
"=",
"indifferent_params",
"(",
"value",
")",
"}... | Enable string or symbol key access to the nested params hash. | [
"Enable",
"string",
"or",
"symbol",
"key",
"access",
"to",
"the",
"nested",
"params",
"hash",
"."
] | 9116c90fcbb82ac03b4b33c58cfbde1fcf745e99 | https://github.com/github/linguist/blob/9116c90fcbb82ac03b4b33c58cfbde1fcf745e99/samples/Ruby/sinatra.rb#L912-L923 | train | Returns the indifferent params of the given object. | [
30522,
13366,
24436,
1035,
11498,
5244,
1006,
4874,
1007,
2553,
4874,
2043,
23325,
2047,
1035,
23325,
1027,
24436,
1035,
23325,
4874,
1012,
2169,
1063,
1064,
3145,
1010,
3643,
1064,
2047,
1035,
23325,
1031,
3145,
1033,
1027,
24436,
1035,
11... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_container_registry/lib/2018-02-01-preview/generated/azure_mgmt_container_registry/builds.rb | Azure::ContainerRegistry::Mgmt::V2018_02_01_preview.Builds.update_async | def update_async(resource_group_name, registry_name, build_id, build_update_parameters, custom_headers:nil)
# Send request
promise = begin_update_async(resource_group_name, registry_name, build_id, build_update_parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::ContainerRegistry::Mgmt::V2018_02_01_preview::Models::Build.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | ruby | def update_async(resource_group_name, registry_name, build_id, build_update_parameters, custom_headers:nil)
# Send request
promise = begin_update_async(resource_group_name, registry_name, build_id, build_update_parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::ContainerRegistry::Mgmt::V2018_02_01_preview::Models::Build.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | [
"def",
"update_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"build_id",
",",
"build_update_parameters",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_update_async",
"(",
"resource_group_name",
",",
"registry_name",
",... | @param resource_group_name [String] The name of the resource group to which
the container registry belongs.
@param registry_name [String] The name of the container registry.
@param build_id [String] The build ID.
@param build_update_parameters [BuildUpdateParameters] The build update
properties.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"resource_group_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"resource",
"group",
"to",
"which",
"the",
"container",
"registry",
"belongs",
".",
"@param",
"registry_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"container",
"regist... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_registry/lib/2018-02-01-preview/generated/azure_mgmt_container_registry/builds.rb#L271-L287 | train | Updates a build. | [
30522,
13366,
10651,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
3857,
1035,
8909,
1010,
3857,
1035,
10651,
1035,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.resume_service_backup_with_http_info | def resume_service_backup_with_http_info(service_id, timeout:60, custom_headers:nil)
resume_service_backup_async(service_id, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def resume_service_backup_with_http_info(service_id, timeout:60, custom_headers:nil)
resume_service_backup_async(service_id, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"resume_service_backup_with_http_info",
"(",
"service_id",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"resume_service_backup_async",
"(",
"service_id",
",",
"timeout",
":",
"timeout",
",",
"custom_headers",
":custom_headers",
")",
".",
... | Resumes periodic backup of a Service Fabric service which was previously
suspended.
The previously suspended Service Fabric service resumes taking periodic
backup as per the backup policy currently configured for the same.
@param service_id [String] The identity of the service. This is typically the
full name of the service without the 'fabric:' URI scheme.
Starting from version 6.0, hierarchical names are delimited with the "~"
character.
For example, if the service name is "fabric:/myapp/app1/svc1", the service
identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
versions.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Resumes",
"periodic",
"backup",
"of",
"a",
"Service",
"Fabric",
"service",
"which",
"was",
"previously",
"suspended",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L24638-L24640 | train | Resumes a service backup of the specified service. | [
30522,
13366,
13746,
1035,
2326,
1035,
10200,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2326,
1035,
8909,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
13746,
1035,
2326,
1035,
10200,
1035,
2004,
6038... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/generator/entry.rb | GitHubChangelogGenerator.Entry.sort_into_sections | def sort_into_sections(pull_requests, issues)
if @options[:issues]
unmapped_issues = sort_labeled_issues(issues)
add_unmapped_section(unmapped_issues)
end
if @options[:pulls]
unmapped_pull_requests = sort_labeled_issues(pull_requests)
add_unmapped_section(unmapped_pull_requests)
end
nil
end | ruby | def sort_into_sections(pull_requests, issues)
if @options[:issues]
unmapped_issues = sort_labeled_issues(issues)
add_unmapped_section(unmapped_issues)
end
if @options[:pulls]
unmapped_pull_requests = sort_labeled_issues(pull_requests)
add_unmapped_section(unmapped_pull_requests)
end
nil
end | [
"def",
"sort_into_sections",
"(",
"pull_requests",
",",
"issues",
")",
"if",
"@options",
"[",
":issues",
"]",
"unmapped_issues",
"=",
"sort_labeled_issues",
"(",
"issues",
")",
"add_unmapped_section",
"(",
"unmapped_issues",
")",
"end",
"if",
"@options",
"[",
":pu... | Sorts issues and PRs into entry sections by labels and lack of labels.
@param [Array] pull_requests
@param [Array] issues
@return [Nil] | [
"Sorts",
"issues",
"and",
"PRs",
"into",
"entry",
"sections",
"by",
"labels",
"and",
"lack",
"of",
"labels",
"."
] | f18c64b5cc0d7473b059275b88385ac11ca8b564 | https://github.com/github-changelog-generator/github-changelog-generator/blob/f18c64b5cc0d7473b059275b88385ac11ca8b564/lib/github_changelog_generator/generator/entry.rb#L143-L153 | train | Sort issues and pull requests into sections | [
30522,
13366,
4066,
1035,
2046,
1035,
5433,
1006,
4139,
1035,
11186,
1010,
3314,
1007,
2065,
1030,
7047,
1031,
1024,
3314,
1033,
4895,
2863,
11469,
1035,
3314,
1027,
4066,
1035,
12599,
1035,
3314,
1006,
3314,
1007,
5587,
1035,
4895,
2863,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/2015-06-01/generated/azure_mgmt_cdn/custom_domains.rb | Azure::CDN::Mgmt::V2015_06_01.CustomDomains.begin_delete_if_exists | def begin_delete_if_exists(custom_domain_name, endpoint_name, profile_name, resource_group_name, custom_headers:nil)
response = begin_delete_if_exists_async(custom_domain_name, endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_delete_if_exists(custom_domain_name, endpoint_name, profile_name, resource_group_name, custom_headers:nil)
response = begin_delete_if_exists_async(custom_domain_name, endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_delete_if_exists",
"(",
"custom_domain_name",
",",
"endpoint_name",
",",
"profile_name",
",",
"resource_group_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_delete_if_exists_async",
"(",
"custom_domain_name",
",",
"endpoint_name",
","... | Deletes an existing CDN custom domain within an endpoint.
@param custom_domain_name [String] Name of the custom domain within an
endpoint.
@param endpoint_name [String] Name of the endpoint within the CDN profile.
@param profile_name [String] Name of the CDN profile within the resource
group.
@param resource_group_name [String] Name of the resource group within the
Azure subscription.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [CustomDomain] operation results. | [
"Deletes",
"an",
"existing",
"CDN",
"custom",
"domain",
"within",
"an",
"endpoint",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_cdn/lib/2015-06-01/generated/azure_mgmt_cdn/custom_domains.rb#L624-L627 | train | Deletes a domain. | [
30522,
13366,
4088,
1035,
3972,
12870,
1035,
2065,
1035,
6526,
1006,
7661,
1035,
5884,
1035,
2171,
1010,
2203,
8400,
1035,
2171,
1010,
6337,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
guard/guard | lib/guard/dsl.rb | Guard.Dsl.group | def group(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
groups = args
groups.each do |group|
next unless group.to_sym == :all
fail ArgumentError, "'all' is not an allowed group name!"
end
if block_given?
groups.each do |group|
# TODO: let groups be added *after* evaluation
Guard.state.session.groups.add(group, options)
end
@current_groups ||= []
@current_groups.push(groups)
yield
@current_groups.pop
else
UI.error \
"No Guard plugins found in the group '#{ groups.join(', ') }',"\
" please add at least one."
end
end | ruby | def group(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
groups = args
groups.each do |group|
next unless group.to_sym == :all
fail ArgumentError, "'all' is not an allowed group name!"
end
if block_given?
groups.each do |group|
# TODO: let groups be added *after* evaluation
Guard.state.session.groups.add(group, options)
end
@current_groups ||= []
@current_groups.push(groups)
yield
@current_groups.pop
else
UI.error \
"No Guard plugins found in the group '#{ groups.join(', ') }',"\
" please add at least one."
end
end | [
"def",
"group",
"(",
"*",
"args",
")",
"options",
"=",
"args",
".",
"last",
".",
"is_a?",
"(",
"Hash",
")",
"?",
"args",
".",
"pop",
":",
"{",
"}",
"groups",
"=",
"args",
"groups",
".",
"each",
"do",
"|",
"group",
"|",
"next",
"unless",
"group",
... | Declares a group of Guard plugins to be run with `guard start --group
group_name`.
@example Declare two groups of Guard plugins
group :backend do
guard :spork
guard :rspec
end
group :frontend do
guard :passenger
guard :livereload
end
@param [Symbol, String, Array<Symbol, String>] name the group name called
from the CLI
@param [Hash] options the options accepted by the group
@yield a block where you can declare several Guard plugins
@see Group
@see Guard.add_group
@see #guard | [
"Declares",
"a",
"group",
"of",
"Guard",
"plugins",
"to",
"be",
"run",
"with",
"guard",
"start",
"--",
"group",
"group_name",
"."
] | e2508cd83badf0d537dbaba35d307adc35d92e4f | https://github.com/guard/guard/blob/e2508cd83badf0d537dbaba35d307adc35d92e4f/lib/guard/dsl.rb#L123-L149 | train | Group Guard plugins | [
30522,
13366,
2177,
1006,
1008,
12098,
5620,
1007,
7047,
1027,
12098,
5620,
1012,
2197,
1012,
2003,
1035,
1037,
1029,
1006,
23325,
1007,
1029,
12098,
5620,
1012,
3769,
1024,
1063,
1065,
2967,
1027,
12098,
5620,
2967,
1012,
2169,
2079,
1064,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb | Azure::KeyVault::V2016_10_01.KeyVaultClient.update_secret | def update_secret(vault_base_url, secret_name, secret_version, content_type:nil, secret_attributes:nil, tags:nil, custom_headers:nil)
response = update_secret_async(vault_base_url, secret_name, secret_version, content_type:content_type, secret_attributes:secret_attributes, tags:tags, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def update_secret(vault_base_url, secret_name, secret_version, content_type:nil, secret_attributes:nil, tags:nil, custom_headers:nil)
response = update_secret_async(vault_base_url, secret_name, secret_version, content_type:content_type, secret_attributes:secret_attributes, tags:tags, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"update_secret",
"(",
"vault_base_url",
",",
"secret_name",
",",
"secret_version",
",",
"content_type",
":",
"nil",
",",
"secret_attributes",
":",
"nil",
",",
"tags",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"update_secret_asyn... | Updates the attributes associated with a specified secret in a given key
vault.
The UPDATE operation changes specified attributes of an existing stored
secret. Attributes that are not specified in the request are left unchanged.
The value of a secret itself cannot be changed. This operation requires the
secrets/set permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param secret_name [String] The name of the secret.
@param secret_version [String] The version of the secret.
@param content_type [String] Type of the secret value such as a password.
@param secret_attributes [SecretAttributes] The secret management attributes.
@param tags [Hash{String => String}] Application specific metadata in the
form of key-value pairs.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [SecretBundle] operation results. | [
"Updates",
"the",
"attributes",
"associated",
"with",
"a",
"specified",
"secret",
"in",
"a",
"given",
"key",
"vault",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb#L2912-L2915 | train | Updates a secret. | [
30522,
13366,
10651,
1035,
3595,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
3595,
1035,
2171,
1010,
3595,
1035,
2544,
1010,
4180,
1035,
2828,
1024,
9152,
2140,
1010,
3595,
1035,
12332,
1024,
9152,
2140,
1010,
22073,
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... |
mongodb/mongo-ruby-driver | lib/mongo/lint.rb | Mongo.Lint.validate_read_concern_option | def validate_read_concern_option(read_concern)
return unless enabled?
return if read_concern.nil?
unless read_concern.is_a?(Hash)
raise Error::LintError, "Read concern is not a hash: #{read_concern}"
end
return if read_concern.empty?
keys = read_concern.keys
if keys != [:level]
raise Error::LintError, "Read concern has invalid keys: #{keys.inspect}"
end
level = read_concern[:level]
return if [:local, :majority, :snapshot].include?(level)
raise Error::LintError, "Read concern level is invalid: #{level.inspect}"
end | ruby | def validate_read_concern_option(read_concern)
return unless enabled?
return if read_concern.nil?
unless read_concern.is_a?(Hash)
raise Error::LintError, "Read concern is not a hash: #{read_concern}"
end
return if read_concern.empty?
keys = read_concern.keys
if keys != [:level]
raise Error::LintError, "Read concern has invalid keys: #{keys.inspect}"
end
level = read_concern[:level]
return if [:local, :majority, :snapshot].include?(level)
raise Error::LintError, "Read concern level is invalid: #{level.inspect}"
end | [
"def",
"validate_read_concern_option",
"(",
"read_concern",
")",
"return",
"unless",
"enabled?",
"return",
"if",
"read_concern",
".",
"nil?",
"unless",
"read_concern",
".",
"is_a?",
"(",
"Hash",
")",
"raise",
"Error",
"::",
"LintError",
",",
"\"Read concern is not a... | Validates the provided hash as a read concern object, per the
read/write concern specification
(https://github.com/mongodb/specifications/blob/master/source/read-write-concern/read-write-concern.rst#read-concern).
This method also accepts nil as input for convenience.
The read concern document as sent to the server may include
additional fields, for example afterClusterTime. These fields
are generated internally by the driver and cannot be specified by
the user (and would potentially lead to incorrect behavior if they
were specified by the user), hence this method prohibits them.
@param [ Hash ] read_concern The read concern options hash,
with the following optional keys:
- *:level* -- the read preference level as a symbol; valid values
are *:local*, *:majority*, and *:snapshot*
@raise [ Error::LintError ] If the validation failed. | [
"Validates",
"the",
"provided",
"hash",
"as",
"a",
"read",
"concern",
"object",
"per",
"the",
"read",
"/",
"write",
"concern",
"specification",
"(",
"https",
":",
"//",
"github",
".",
"com",
"/",
"mongodb",
"/",
"specifications",
"/",
"blob",
"/",
"master"... | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/lint.rb#L62-L76 | train | Validate the read concern option | [
30522,
13366,
9398,
3686,
1035,
3191,
1035,
5142,
1035,
5724,
1006,
3191,
1035,
5142,
1007,
2709,
4983,
9124,
1029,
2709,
2065,
3191,
1035,
5142,
1012,
9152,
2140,
1029,
4983,
3191,
1035,
5142,
1012,
2003,
1035,
1037,
1029,
1006,
23325,
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... |
sporkmonger/addressable | lib/addressable/template.rb | Addressable.Template.match | def match(uri, processor=nil)
uri = Addressable::URI.parse(uri)
mapping = {}
# First, we need to process the pattern, and extract the values.
expansions, expansion_regexp =
parse_template_pattern(pattern, processor)
return nil unless uri.to_str.match(expansion_regexp)
unparsed_values = uri.to_str.scan(expansion_regexp).flatten
if uri.to_str == pattern
return Addressable::Template::MatchData.new(uri, self, mapping)
elsif expansions.size > 0
index = 0
expansions.each do |expansion|
_, operator, varlist = *expansion.match(EXPRESSION)
varlist.split(',').each do |varspec|
_, name, modifier = *varspec.match(VARSPEC)
mapping[name] ||= nil
case operator
when nil, '+', '#', '/', '.'
unparsed_value = unparsed_values[index]
name = varspec[VARSPEC, 1]
value = unparsed_value
value = value.split(JOINERS[operator]) if value && modifier == '*'
when ';', '?', '&'
if modifier == '*'
if unparsed_values[index]
value = unparsed_values[index].split(JOINERS[operator])
value = value.inject({}) do |acc, v|
key, val = v.split('=')
val = "" if val.nil?
acc[key] = val
acc
end
end
else
if (unparsed_values[index])
name, value = unparsed_values[index].split('=')
value = "" if value.nil?
end
end
end
if processor != nil && processor.respond_to?(:restore)
value = processor.restore(name, value)
end
if processor == nil
if value.is_a?(Hash)
value = value.inject({}){|acc, (k, v)|
acc[Addressable::URI.unencode_component(k)] =
Addressable::URI.unencode_component(v)
acc
}
elsif value.is_a?(Array)
value = value.map{|v| Addressable::URI.unencode_component(v) }
else
value = Addressable::URI.unencode_component(value)
end
end
if !mapping.has_key?(name) || mapping[name].nil?
# Doesn't exist, set to value (even if value is nil)
mapping[name] = value
end
index = index + 1
end
end
return Addressable::Template::MatchData.new(uri, self, mapping)
else
return nil
end
end | ruby | def match(uri, processor=nil)
uri = Addressable::URI.parse(uri)
mapping = {}
# First, we need to process the pattern, and extract the values.
expansions, expansion_regexp =
parse_template_pattern(pattern, processor)
return nil unless uri.to_str.match(expansion_regexp)
unparsed_values = uri.to_str.scan(expansion_regexp).flatten
if uri.to_str == pattern
return Addressable::Template::MatchData.new(uri, self, mapping)
elsif expansions.size > 0
index = 0
expansions.each do |expansion|
_, operator, varlist = *expansion.match(EXPRESSION)
varlist.split(',').each do |varspec|
_, name, modifier = *varspec.match(VARSPEC)
mapping[name] ||= nil
case operator
when nil, '+', '#', '/', '.'
unparsed_value = unparsed_values[index]
name = varspec[VARSPEC, 1]
value = unparsed_value
value = value.split(JOINERS[operator]) if value && modifier == '*'
when ';', '?', '&'
if modifier == '*'
if unparsed_values[index]
value = unparsed_values[index].split(JOINERS[operator])
value = value.inject({}) do |acc, v|
key, val = v.split('=')
val = "" if val.nil?
acc[key] = val
acc
end
end
else
if (unparsed_values[index])
name, value = unparsed_values[index].split('=')
value = "" if value.nil?
end
end
end
if processor != nil && processor.respond_to?(:restore)
value = processor.restore(name, value)
end
if processor == nil
if value.is_a?(Hash)
value = value.inject({}){|acc, (k, v)|
acc[Addressable::URI.unencode_component(k)] =
Addressable::URI.unencode_component(v)
acc
}
elsif value.is_a?(Array)
value = value.map{|v| Addressable::URI.unencode_component(v) }
else
value = Addressable::URI.unencode_component(value)
end
end
if !mapping.has_key?(name) || mapping[name].nil?
# Doesn't exist, set to value (even if value is nil)
mapping[name] = value
end
index = index + 1
end
end
return Addressable::Template::MatchData.new(uri, self, mapping)
else
return nil
end
end | [
"def",
"match",
"(",
"uri",
",",
"processor",
"=",
"nil",
")",
"uri",
"=",
"Addressable",
"::",
"URI",
".",
"parse",
"(",
"uri",
")",
"mapping",
"=",
"{",
"}",
"# First, we need to process the pattern, and extract the values.",
"expansions",
",",
"expansion_regexp... | Extracts match data from the URI using a URI Template pattern.
@param [Addressable::URI, #to_str] uri
The URI to extract from.
@param [#restore, #match] processor
A template processor object may optionally be supplied.
The object should respond to either the <tt>restore</tt> or
<tt>match</tt> messages or both. The <tt>restore</tt> method should
take two parameters: `[String] name` and `[String] value`.
The <tt>restore</tt> method should reverse any transformations that
have been performed on the value to ensure a valid URI.
The <tt>match</tt> method should take a single
parameter: `[String] name`. The <tt>match</tt> method should return
a <tt>String</tt> containing a regular expression capture group for
matching on that particular variable. The default value is `".*?"`.
The <tt>match</tt> method has no effect on multivariate operator
expansions.
@return [Hash, NilClass]
The <tt>Hash</tt> mapping that was extracted from the URI, or
<tt>nil</tt> if the URI didn't match the template.
@example
class ExampleProcessor
def self.restore(name, value)
return value.gsub(/\+/, " ") if name == "query"
return value
end
def self.match(name)
return ".*?" if name == "first"
return ".*"
end
end
uri = Addressable::URI.parse(
"http://example.com/search/an+example+search+query/"
)
match = Addressable::Template.new(
"http://example.com/search/{query}/"
).match(uri, ExampleProcessor)
match.variables
#=> ["query"]
match.captures
#=> ["an example search query"]
uri = Addressable::URI.parse("http://example.com/a/b/c/")
match = Addressable::Template.new(
"http://example.com/{first}/{+second}/"
).match(uri, ExampleProcessor)
match.variables
#=> ["first", "second"]
match.captures
#=> ["a", "b/c"]
uri = Addressable::URI.parse("http://example.com/a/b/c/")
match = Addressable::Template.new(
"http://example.com/{first}{/second*}/"
).match(uri)
match.variables
#=> ["first", "second"]
match.captures
#=> ["a", ["b", "c"]] | [
"Extracts",
"match",
"data",
"from",
"the",
"URI",
"using",
"a",
"URI",
"Template",
"pattern",
"."
] | 5894c95a7768435cb46d1355954611dbd194832e | https://github.com/sporkmonger/addressable/blob/5894c95a7768435cb46d1355954611dbd194832e/lib/addressable/template.rb#L414-L485 | train | Given a URI and a processor we need to parse it and return the match data. | [
30522,
13366,
2674,
1006,
24471,
2072,
1010,
13151,
1027,
9152,
2140,
1007,
24471,
2072,
1027,
4769,
3085,
1024,
1024,
24471,
2072,
1012,
11968,
3366,
1006,
24471,
2072,
1007,
12375,
1027,
1063,
1065,
1001,
2034,
1010,
2057,
2342,
2000,
283... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activesupport/lib/active_support/dependencies.rb | ActiveSupport.Dependencies.load_file | def load_file(path, const_paths = loadable_constants_for_path(path))
const_paths = [const_paths].compact unless const_paths.is_a? Array
parent_paths = const_paths.collect { |const_path| const_path[/.*(?=::)/] || ::Object }
result = nil
newly_defined_paths = new_constants_in(*parent_paths) do
result = Kernel.load path
end
autoloaded_constants.concat newly_defined_paths unless load_once_path?(path)
autoloaded_constants.uniq!
result
end | ruby | def load_file(path, const_paths = loadable_constants_for_path(path))
const_paths = [const_paths].compact unless const_paths.is_a? Array
parent_paths = const_paths.collect { |const_path| const_path[/.*(?=::)/] || ::Object }
result = nil
newly_defined_paths = new_constants_in(*parent_paths) do
result = Kernel.load path
end
autoloaded_constants.concat newly_defined_paths unless load_once_path?(path)
autoloaded_constants.uniq!
result
end | [
"def",
"load_file",
"(",
"path",
",",
"const_paths",
"=",
"loadable_constants_for_path",
"(",
"path",
")",
")",
"const_paths",
"=",
"[",
"const_paths",
"]",
".",
"compact",
"unless",
"const_paths",
".",
"is_a?",
"Array",
"parent_paths",
"=",
"const_paths",
".",
... | Load the file at the provided path. +const_paths+ is a set of qualified
constant names. When loading the file, Dependencies will watch for the
addition of these constants. Each that is defined will be marked as
autoloaded, and will be removed when Dependencies.clear is next called.
If the second parameter is left off, then Dependencies will construct a
set of names that the file at +path+ may define. See
+loadable_constants_for_path+ for more details. | [
"Load",
"the",
"file",
"at",
"the",
"provided",
"path",
".",
"+",
"const_paths",
"+",
"is",
"a",
"set",
"of",
"qualified",
"constant",
"names",
".",
"When",
"loading",
"the",
"file",
"Dependencies",
"will",
"watch",
"for",
"the",
"addition",
"of",
"these",... | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/dependencies.rb#L482-L494 | train | Load a file from the given path. | [
30522,
13366,
7170,
1035,
5371,
1006,
4130,
1010,
9530,
3367,
1035,
10425,
1027,
7170,
3085,
1035,
5377,
2015,
1035,
2005,
1035,
4130,
1006,
4130,
1007,
1007,
9530,
3367,
1035,
10425,
1027,
1031,
9530,
3367,
1035,
10425,
1033,
1012,
9233,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mikker/passwordless | lib/passwordless/controller_helpers.rb | Passwordless.ControllerHelpers.sign_in | def sign_in(authenticatable)
key = cookie_name(authenticatable.class)
cookies.encrypted.permanent[key] = {value: authenticatable.id}
authenticatable
end | ruby | def sign_in(authenticatable)
key = cookie_name(authenticatable.class)
cookies.encrypted.permanent[key] = {value: authenticatable.id}
authenticatable
end | [
"def",
"sign_in",
"(",
"authenticatable",
")",
"key",
"=",
"cookie_name",
"(",
"authenticatable",
".",
"class",
")",
"cookies",
".",
"encrypted",
".",
"permanent",
"[",
"key",
"]",
"=",
"{",
"value",
":",
"authenticatable",
".",
"id",
"}",
"authenticatable",... | Signs in user by assigning their id to a permanent cookie.
@param authenticatable [ActiveRecord::Base] Instance of Model to sign in
(e.g - @user when @user = User.find(id: some_id)).
@return [ActiveRecord::Base] the record that is passed in. | [
"Signs",
"in",
"user",
"by",
"assigning",
"their",
"id",
"to",
"a",
"permanent",
"cookie",
"."
] | 80d3e00c78114aed01f336514a236dfc17d0a91a | https://github.com/mikker/passwordless/blob/80d3e00c78114aed01f336514a236dfc17d0a91a/lib/passwordless/controller_helpers.rb#L39-L43 | train | Sign in the given authenticatable object | [
30522,
13366,
3696,
1035,
1999,
1006,
14469,
27892,
1007,
3145,
1027,
17387,
1035,
2171,
1006,
14469,
27892,
1012,
2465,
1007,
16324,
1012,
4372,
26775,
22571,
3064,
1012,
4568,
1031,
3145,
1033,
1027,
1063,
3643,
1024,
14469,
27892,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.update_closed_list_entity_role | def update_closed_list_entity_role(app_id, version_id, entity_id, role_id, entity_role_update_object, custom_headers:nil)
response = update_closed_list_entity_role_async(app_id, version_id, entity_id, role_id, entity_role_update_object, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def update_closed_list_entity_role(app_id, version_id, entity_id, role_id, entity_role_update_object, custom_headers:nil)
response = update_closed_list_entity_role_async(app_id, version_id, entity_id, role_id, entity_role_update_object, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"update_closed_list_entity_role",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"role_id",
",",
"entity_role_update_object",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"update_closed_list_entity_role_async",
"(",
"app_id",
",",
"version_i... | Update a role for a given list entity in a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param entity_id The entity ID.
@param role_id The entity role ID.
@param entity_role_update_object [EntityRoleUpdateObject] The new entity
role.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OperationStatus] operation results. | [
"Update",
"a",
"role",
"for",
"a",
"given",
"list",
"entity",
"in",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L9504-L9507 | train | Updates an entity role in a version of the application. | [
30522,
13366,
10651,
1035,
2701,
1035,
2862,
1035,
9178,
1035,
2535,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
9178,
1035,
8909,
1010,
2535,
1035,
8909,
1010,
9178,
1035,
2535,
1035,
10651,
1035,
4874,
1010,
7661,
1035,
20346,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb | Azure::CognitiveServices::ComputerVision::V2_0.ComputerVisionClient.describe_image | def describe_image(url, max_candidates:1, language:nil, custom_headers:nil)
response = describe_image_async(url, max_candidates:max_candidates, language:language, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def describe_image(url, max_candidates:1, language:nil, custom_headers:nil)
response = describe_image_async(url, max_candidates:max_candidates, language:language, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"describe_image",
"(",
"url",
",",
"max_candidates",
":",
"1",
",",
"language",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"describe_image_async",
"(",
"url",
",",
"max_candidates",
":max_candidates",
",",
"language",
":",
"lan... | This operation generates a description of an image in human readable language
with complete sentences. The description is based on a collection of content
tags, which are also returned by the operation. More than one description can
be generated for each image. Descriptions are ordered by their confidence
score. All descriptions are in English.
Two input methods are supported -- (1) Uploading an image or (2) specifying
an image URL.
A successful response will be returned in JSON. If the request failed, the
response will contain an error code and a message to help understand what
went wrong.
@param url [String] Publicly reachable URL of an image.
@param max_candidates [Integer] Maximum number of candidate descriptions to
be returned. The default is 1.
@param language [Enum] The desired language for output generation. If this
parameter is not specified, the default value is "en".Supported
languages:en - English, Default. es - Spanish, ja - Japanese, pt -
Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es',
'ja', 'pt', 'zh'
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ImageDescription] operation results. | [
"This",
"operation",
"generates",
"a",
"description",
"of",
"an",
"image",
"in",
"human",
"readable",
"language",
"with",
"complete",
"sentences",
".",
"The",
"description",
"is",
"based",
"on",
"a",
"collection",
"of",
"content",
"tags",
"which",
"are",
"also... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb#L334-L337 | train | Gets the image description of an image. | [
30522,
13366,
6235,
1035,
3746,
1006,
24471,
2140,
1010,
4098,
1035,
5347,
1024,
1015,
1010,
2653,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
6235,
1035,
3746,
1035,
2004,
6038,
2278,
1006,
24471,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb | Azure::Compute::Mgmt::V2016_04_30_preview.VirtualMachineScaleSets.begin_start_with_http_info | def begin_start_with_http_info(resource_group_name, vm_scale_set_name, vm_instance_ids:nil, custom_headers:nil)
begin_start_async(resource_group_name, vm_scale_set_name, vm_instance_ids:vm_instance_ids, custom_headers:custom_headers).value!
end | ruby | def begin_start_with_http_info(resource_group_name, vm_scale_set_name, vm_instance_ids:nil, custom_headers:nil)
begin_start_async(resource_group_name, vm_scale_set_name, vm_instance_ids:vm_instance_ids, custom_headers:custom_headers).value!
end | [
"def",
"begin_start_with_http_info",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"vm_instance_ids",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"begin_start_async",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"vm_instance_ids",
":vm_i... | Starts one or more virtual machines in a VM scale set.
@param resource_group_name [String] The name of the resource group.
@param vm_scale_set_name [String] The name of the VM scale set.
@param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] A list of
virtual machine instance IDs from the VM scale set.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Starts",
"one",
"or",
"more",
"virtual",
"machines",
"in",
"a",
"VM",
"scale",
"set",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb#L1604-L1606 | train | Starts a virtual machine in a VM scale set. | [
30522,
13366,
4088,
1035,
2707,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
4094,
1035,
2275,
1035,
2171,
1010,
1058,
2213,
1035,
6013,
1035,
8909,
2015,
1024,
9152,
2140,
1010,
7661,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.update_regex_entity_model | def update_regex_entity_model(app_id, version_id, regex_entity_id, regex_entity_update_object, custom_headers:nil)
response = update_regex_entity_model_async(app_id, version_id, regex_entity_id, regex_entity_update_object, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def update_regex_entity_model(app_id, version_id, regex_entity_id, regex_entity_update_object, custom_headers:nil)
response = update_regex_entity_model_async(app_id, version_id, regex_entity_id, regex_entity_update_object, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"update_regex_entity_model",
"(",
"app_id",
",",
"version_id",
",",
"regex_entity_id",
",",
"regex_entity_update_object",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"update_regex_entity_model_async",
"(",
"app_id",
",",
"version_id",
",",
"regex_ent... | Updates the regular expression entity in a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param regex_entity_id The regular expression entity extractor ID.
@param regex_entity_update_object [RegexModelUpdateObject] An object
containing the new entity name and regex pattern.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OperationStatus] operation results. | [
"Updates",
"the",
"regular",
"expression",
"entity",
"in",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L8276-L8279 | train | Updates a regex entity model. | [
30522,
13366,
10651,
1035,
19723,
10288,
1035,
9178,
1035,
2944,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
19723,
10288,
1035,
9178,
1035,
8909,
1010,
19723,
10288,
1035,
9178,
1035,
10651,
1035,
4874,
1010,
7661,
1035,
20346,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.add_hierarchical_entity_child_with_http_info | def add_hierarchical_entity_child_with_http_info(app_id, version_id, h_entity_id, hierarchical_child_model_create_object, custom_headers:nil)
add_hierarchical_entity_child_async(app_id, version_id, h_entity_id, hierarchical_child_model_create_object, custom_headers:custom_headers).value!
end | ruby | def add_hierarchical_entity_child_with_http_info(app_id, version_id, h_entity_id, hierarchical_child_model_create_object, custom_headers:nil)
add_hierarchical_entity_child_async(app_id, version_id, h_entity_id, hierarchical_child_model_create_object, custom_headers:custom_headers).value!
end | [
"def",
"add_hierarchical_entity_child_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"h_entity_id",
",",
"hierarchical_child_model_create_object",
",",
"custom_headers",
":",
"nil",
")",
"add_hierarchical_entity_child_async",
"(",
"app_id",
",",
"version_id",
",",
... | Creates a single child in an existing hierarchical entity model in a version
of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param h_entity_id The hierarchical entity extractor ID.
@param hierarchical_child_model_create_object
[HierarchicalChildModelCreateObject] A model object containing the name of
the new hierarchical child model.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Creates",
"a",
"single",
"child",
"in",
"an",
"existing",
"hierarchical",
"entity",
"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#L5332-L5334 | train | Adds a hierarchical entity child to a version of the application. | [
30522,
13366,
5587,
1035,
25835,
1035,
9178,
1035,
2775,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
1044,
1035,
9178,
1035,
8909,
1010,
25835,
1035,
2775,
1035,
2944,
1035,
3443,
1035,
4874,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jnunemaker/httparty | lib/httparty.rb | HTTParty.ClassMethods.headers | def headers(h = nil)
if h
raise ArgumentError, 'Headers must be an object which responds to #to_hash' unless h.respond_to?(:to_hash)
default_options[:headers] ||= {}
default_options[:headers].merge!(h.to_hash)
else
default_options[:headers] || {}
end
end | ruby | def headers(h = nil)
if h
raise ArgumentError, 'Headers must be an object which responds to #to_hash' unless h.respond_to?(:to_hash)
default_options[:headers] ||= {}
default_options[:headers].merge!(h.to_hash)
else
default_options[:headers] || {}
end
end | [
"def",
"headers",
"(",
"h",
"=",
"nil",
")",
"if",
"h",
"raise",
"ArgumentError",
",",
"'Headers must be an object which responds to #to_hash'",
"unless",
"h",
".",
"respond_to?",
"(",
":to_hash",
")",
"default_options",
"[",
":headers",
"]",
"||=",
"{",
"}",
"d... | Allows setting HTTP headers to be used for each request.
class Foo
include HTTParty
headers 'Accept' => 'text/html'
end | [
"Allows",
"setting",
"HTTP",
"headers",
"to",
"be",
"used",
"for",
"each",
"request",
"."
] | b4099defba01231d2faaaa2660476f867e096bfb | https://github.com/jnunemaker/httparty/blob/b4099defba01231d2faaaa2660476f867e096bfb/lib/httparty.rb#L233-L241 | train | Returns the HTTP headers for this request. | [
30522,
13366,
20346,
2015,
1006,
1044,
1027,
9152,
2140,
1007,
2065,
1044,
5333,
6685,
2121,
29165,
1010,
1005,
20346,
2015,
2442,
2022,
2019,
4874,
2029,
16412,
2000,
1001,
2000,
1035,
23325,
1005,
4983,
1044,
1012,
6869,
1035,
2000,
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... |
rails/rails | actionpack/lib/action_controller/metal/redirecting.rb | ActionController.Redirecting.redirect_to | def redirect_to(options = {}, response_options = {})
raise ActionControllerError.new("Cannot redirect to nil!") unless options
raise AbstractController::DoubleRenderError if response_body
self.status = _extract_redirect_to_status(options, response_options)
self.location = _compute_redirect_to_location(request, options)
self.response_body = "<html><body>You are being <a href=\"#{ERB::Util.unwrapped_html_escape(response.location)}\">redirected</a>.</body></html>"
end | ruby | def redirect_to(options = {}, response_options = {})
raise ActionControllerError.new("Cannot redirect to nil!") unless options
raise AbstractController::DoubleRenderError if response_body
self.status = _extract_redirect_to_status(options, response_options)
self.location = _compute_redirect_to_location(request, options)
self.response_body = "<html><body>You are being <a href=\"#{ERB::Util.unwrapped_html_escape(response.location)}\">redirected</a>.</body></html>"
end | [
"def",
"redirect_to",
"(",
"options",
"=",
"{",
"}",
",",
"response_options",
"=",
"{",
"}",
")",
"raise",
"ActionControllerError",
".",
"new",
"(",
"\"Cannot redirect to nil!\"",
")",
"unless",
"options",
"raise",
"AbstractController",
"::",
"DoubleRenderError",
... | Redirects the browser to the target specified in +options+. This parameter can be any one of:
* <tt>Hash</tt> - The URL will be generated by calling url_for with the +options+.
* <tt>Record</tt> - The URL will be generated by calling url_for with the +options+, which will reference a named URL for that record.
* <tt>String</tt> starting with <tt>protocol://</tt> (like <tt>http://</tt>) or a protocol relative reference (like <tt>//</tt>) - Is passed straight through as the target for redirection.
* <tt>String</tt> not containing a protocol - The current protocol and host is prepended to the string.
* <tt>Proc</tt> - A block that will be executed in the controller's context. Should return any option accepted by +redirect_to+.
=== Examples:
redirect_to action: "show", id: 5
redirect_to @post
redirect_to "http://www.rubyonrails.org"
redirect_to "/images/screenshot.jpg"
redirect_to posts_url
redirect_to proc { edit_post_url(@post) }
The redirection happens as a <tt>302 Found</tt> header unless otherwise specified using the <tt>:status</tt> option:
redirect_to post_url(@post), status: :found
redirect_to action: 'atom', status: :moved_permanently
redirect_to post_url(@post), status: 301
redirect_to action: 'atom', status: 302
The status code can either be a standard {HTTP Status code}[https://www.iana.org/assignments/http-status-codes] as an
integer, or a symbol representing the downcased, underscored and symbolized description.
Note that the status code must be a 3xx HTTP code, or redirection will not occur.
If you are using XHR requests other than GET or POST and redirecting after the
request then some browsers will follow the redirect using the original request
method. This may lead to undesirable behavior such as a double DELETE. To work
around this you can return a <tt>303 See Other</tt> status code which will be
followed using a GET request.
redirect_to posts_url, status: :see_other
redirect_to action: 'index', status: 303
It is also possible to assign a flash message as part of the redirection. There are two special accessors for the commonly used flash names
+alert+ and +notice+ as well as a general purpose +flash+ bucket.
redirect_to post_url(@post), alert: "Watch it, mister!"
redirect_to post_url(@post), status: :found, notice: "Pay attention to the road"
redirect_to post_url(@post), status: 301, flash: { updated_post_id: @post.id }
redirect_to({ action: 'atom' }, alert: "Something serious happened")
Statements after +redirect_to+ in our controller get executed, so +redirect_to+ doesn't stop the execution of the function.
To terminate the execution of the function immediately after the +redirect_to+, use return.
redirect_to post_url(@post) and return | [
"Redirects",
"the",
"browser",
"to",
"the",
"target",
"specified",
"in",
"+",
"options",
"+",
".",
"This",
"parameter",
"can",
"be",
"any",
"one",
"of",
":"
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/actionpack/lib/action_controller/metal/redirecting.rb#L58-L65 | train | Returns the response body for the current request. | [
30522,
13366,
2417,
7442,
6593,
1035,
2000,
1006,
7047,
1027,
1063,
1065,
1010,
3433,
1035,
7047,
1027,
1063,
1065,
1007,
5333,
2895,
8663,
13181,
10820,
2121,
29165,
1012,
2047,
1006,
1000,
3685,
2417,
7442,
6593,
2000,
9152,
2140,
999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/sprockets | lib/sprockets/resolve.rb | Sprockets.Resolve.parse_accept_options | def parse_accept_options(mime_type, explicit_type)
if mime_type
return [[mime_type, 1.0]] if explicit_type.nil?
return [[mime_type, 1.0]] if HTTPUtils.parse_q_values(explicit_type).any? { |accept, _| HTTPUtils.match_mime_type?(mime_type, accept) }
return []
end
accepts = HTTPUtils.parse_q_values(explicit_type)
accepts << ['*/*'.freeze, 1.0] if accepts.empty?
return accepts
end | ruby | def parse_accept_options(mime_type, explicit_type)
if mime_type
return [[mime_type, 1.0]] if explicit_type.nil?
return [[mime_type, 1.0]] if HTTPUtils.parse_q_values(explicit_type).any? { |accept, _| HTTPUtils.match_mime_type?(mime_type, accept) }
return []
end
accepts = HTTPUtils.parse_q_values(explicit_type)
accepts << ['*/*'.freeze, 1.0] if accepts.empty?
return accepts
end | [
"def",
"parse_accept_options",
"(",
"mime_type",
",",
"explicit_type",
")",
"if",
"mime_type",
"return",
"[",
"[",
"mime_type",
",",
"1.0",
"]",
"]",
"if",
"explicit_type",
".",
"nil?",
"return",
"[",
"[",
"mime_type",
",",
"1.0",
"]",
"]",
"if",
"HTTPUtil... | Internal: Converts mimetype into accept Array
- mime_type - String, optional. e.g. "text/html"
- explicit_type - String, optional. e.g. "application/javascript"
When called with an explicit_type and a mime_type, only a mime_type
that matches the given explicit_type will be accepted.
Returns Array of Array
[["application/javascript", 1.0]]
[["*/*", 1.0]]
[] | [
"Internal",
":",
"Converts",
"mimetype",
"into",
"accept",
"Array"
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/resolve.rb#L279-L289 | train | Parse the accept options for the given mime type. | [
30522,
13366,
11968,
3366,
1035,
5138,
1035,
7047,
1006,
2771,
4168,
1035,
2828,
1010,
13216,
1035,
2828,
1007,
2065,
2771,
4168,
1035,
2828,
2709,
1031,
1031,
2771,
4168,
1035,
2828,
1010,
1015,
1012,
1014,
1033,
1033,
2065,
13216,
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... |
ankane/pgsync | lib/pgsync/data_source.rb | PgSync.DataSource.primary_key | def primary_key(table)
query = <<-SQL
SELECT
pg_attribute.attname,
format_type(pg_attribute.atttypid, pg_attribute.atttypmod)
FROM
pg_index, pg_class, pg_attribute, pg_namespace
WHERE
pg_class.oid = $2::regclass AND
indrelid = pg_class.oid AND
nspname = $1 AND
pg_class.relnamespace = pg_namespace.oid AND
pg_attribute.attrelid = pg_class.oid AND
pg_attribute.attnum = any(pg_index.indkey) AND
indisprimary
SQL
row = execute(query, [table.split(".", 2)[0], quote_ident_full(table)])[0]
row && row["attname"]
end | ruby | def primary_key(table)
query = <<-SQL
SELECT
pg_attribute.attname,
format_type(pg_attribute.atttypid, pg_attribute.atttypmod)
FROM
pg_index, pg_class, pg_attribute, pg_namespace
WHERE
pg_class.oid = $2::regclass AND
indrelid = pg_class.oid AND
nspname = $1 AND
pg_class.relnamespace = pg_namespace.oid AND
pg_attribute.attrelid = pg_class.oid AND
pg_attribute.attnum = any(pg_index.indkey) AND
indisprimary
SQL
row = execute(query, [table.split(".", 2)[0], quote_ident_full(table)])[0]
row && row["attname"]
end | [
"def",
"primary_key",
"(",
"table",
")",
"query",
"=",
"<<-SQL",
"SQL",
"row",
"=",
"execute",
"(",
"query",
",",
"[",
"table",
".",
"split",
"(",
"\".\"",
",",
"2",
")",
"[",
"0",
"]",
",",
"quote_ident_full",
"(",
"table",
")",
"]",
")",
"[",
"... | http://stackoverflow.com/a/20537829 | [
"http",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"a",
"/",
"20537829"
] | 2aa4741538ca09070efe86de6dd1281e13a1b5c5 | https://github.com/ankane/pgsync/blob/2aa4741538ca09070efe86de6dd1281e13a1b5c5/lib/pgsync/data_source.rb#L68-L86 | train | Returns the primary key for the given table. | [
30522,
13366,
3078,
1035,
3145,
1006,
2795,
1007,
23032,
1027,
1026,
1026,
1011,
29296,
7276,
18720,
1035,
17961,
1012,
2012,
2102,
18442,
1010,
4289,
1035,
2828,
1006,
18720,
1035,
17961,
1012,
2012,
15353,
23267,
1010,
18720,
1035,
17961,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activesupport/lib/active_support/security_utils.rb | ActiveSupport.SecurityUtils.fixed_length_secure_compare | def fixed_length_secure_compare(a, b)
raise ArgumentError, "string length mismatch." unless a.bytesize == b.bytesize
l = a.unpack "C#{a.bytesize}"
res = 0
b.each_byte { |byte| res |= byte ^ l.shift }
res == 0
end | ruby | def fixed_length_secure_compare(a, b)
raise ArgumentError, "string length mismatch." unless a.bytesize == b.bytesize
l = a.unpack "C#{a.bytesize}"
res = 0
b.each_byte { |byte| res |= byte ^ l.shift }
res == 0
end | [
"def",
"fixed_length_secure_compare",
"(",
"a",
",",
"b",
")",
"raise",
"ArgumentError",
",",
"\"string length mismatch.\"",
"unless",
"a",
".",
"bytesize",
"==",
"b",
".",
"bytesize",
"l",
"=",
"a",
".",
"unpack",
"\"C#{a.bytesize}\"",
"res",
"=",
"0",
"b",
... | Constant time string comparison, for fixed length strings.
The values compared should be of fixed length, such as strings
that have already been processed by HMAC. Raises in case of length mismatch. | [
"Constant",
"time",
"string",
"comparison",
"for",
"fixed",
"length",
"strings",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/security_utils.rb#L11-L19 | train | Compare two strings with fixed length secure comparison. | [
30522,
13366,
4964,
1035,
3091,
1035,
5851,
1035,
12826,
1006,
1037,
1010,
1038,
1007,
5333,
6685,
2121,
29165,
1010,
1000,
5164,
3091,
28616,
18900,
2818,
1012,
1000,
4983,
1037,
1012,
27507,
4697,
1027,
1027,
1038,
1012,
27507,
4697,
1048... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
piotrmurach/github | lib/github_api/mime_type.rb | Github.MimeType.parse | def parse(media)
version = 'v3'
media.sub!(/^[.]*|[.]*$/,"")
media = media.include?('+') ? media.split('+')[0] : media
version, media = media.split('.') if media.include?('.')
media_type = lookup_media(media)
"application/vnd.github.#{version}.#{media_type}"
end | ruby | def parse(media)
version = 'v3'
media.sub!(/^[.]*|[.]*$/,"")
media = media.include?('+') ? media.split('+')[0] : media
version, media = media.split('.') if media.include?('.')
media_type = lookup_media(media)
"application/vnd.github.#{version}.#{media_type}"
end | [
"def",
"parse",
"(",
"media",
")",
"version",
"=",
"'v3'",
"media",
".",
"sub!",
"(",
"/",
"/",
",",
"\"\"",
")",
"media",
"=",
"media",
".",
"include?",
"(",
"'+'",
")",
"?",
"media",
".",
"split",
"(",
"'+'",
")",
"[",
"0",
"]",
":",
"media",... | Parse media type param | [
"Parse",
"media",
"type",
"param"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/mime_type.rb#L17-L24 | train | Parse the media string | [
30522,
13366,
11968,
3366,
1006,
2865,
1007,
2544,
1027,
1005,
1058,
2509,
1005,
2865,
1012,
4942,
999,
1006,
1013,
1034,
1031,
1012,
1033,
1008,
1064,
1031,
1012,
1033,
1008,
1002,
1013,
1010,
1000,
1000,
1007,
2865,
1027,
2865,
1012,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_redis/lib/2017-02-01/generated/azure_mgmt_redis/redis.rb | Azure::Redis::Mgmt::V2017_02_01.Redis.list_keys | def list_keys(resource_group_name, name, custom_headers:nil)
response = list_keys_async(resource_group_name, name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_keys(resource_group_name, name, custom_headers:nil)
response = list_keys_async(resource_group_name, name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_keys",
"(",
"resource_group_name",
",",
"name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_keys_async",
"(",
"resource_group_name",
",",
"name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",... | Retrieve a Redis cache's access keys. This operation requires write
permission to the cache resource.
@param resource_group_name [String] The name of the resource group.
@param name [String] The name of the Redis cache.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [RedisAccessKeys] operation results. | [
"Retrieve",
"a",
"Redis",
"cache",
"s",
"access",
"keys",
".",
"This",
"operation",
"requires",
"write",
"permission",
"to",
"the",
"cache",
"resource",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_redis/lib/2017-02-01/generated/azure_mgmt_redis/redis.rb#L490-L493 | train | Gets the list of all the key names in a resource group. | [
30522,
13366,
2862,
1035,
6309,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
6309,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
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_customer_insights/lib/2017-01-01/generated/azure_mgmt_customer_insights/kpi.rb | Azure::CustomerInsights::Mgmt::V2017_01_01.Kpi.begin_create_or_update_with_http_info | def begin_create_or_update_with_http_info(resource_group_name, hub_name, kpi_name, parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, hub_name, kpi_name, parameters, custom_headers:custom_headers).value!
end | ruby | def begin_create_or_update_with_http_info(resource_group_name, hub_name, kpi_name, parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, hub_name, kpi_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_create_or_update_with_http_info",
"(",
"resource_group_name",
",",
"hub_name",
",",
"kpi_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"hub_name",
",",
"kpi_name",
",",
"p... | Creates a KPI or updates an existing KPI in the hub.
@param resource_group_name [String] The name of the resource group.
@param hub_name [String] The name of the hub.
@param kpi_name [String] The name of the KPI.
@param parameters [KpiResourceFormat] Parameters supplied to the
create/update KPI operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Creates",
"a",
"KPI",
"or",
"updates",
"an",
"existing",
"KPI",
"in",
"the",
"hub",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_customer_insights/lib/2017-01-01/generated/azure_mgmt_customer_insights/kpi.rb#L419-L421 | train | Creates or updates a KPI in the hub. | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
9594,
1035,
2171,
1010,
1047,
8197,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-core/lib/aws-sdk-core/shared_config.rb | Aws.SharedConfig.credentials | def credentials(opts = {})
p = opts[:profile] || @profile_name
validate_profile_exists(p) if credentials_present?
if credentials = credentials_from_shared(p, opts)
credentials
elsif credentials = credentials_from_config(p, opts)
credentials
else
nil
end
end | ruby | def credentials(opts = {})
p = opts[:profile] || @profile_name
validate_profile_exists(p) if credentials_present?
if credentials = credentials_from_shared(p, opts)
credentials
elsif credentials = credentials_from_config(p, opts)
credentials
else
nil
end
end | [
"def",
"credentials",
"(",
"opts",
"=",
"{",
"}",
")",
"p",
"=",
"opts",
"[",
":profile",
"]",
"||",
"@profile_name",
"validate_profile_exists",
"(",
"p",
")",
"if",
"credentials_present?",
"if",
"credentials",
"=",
"credentials_from_shared",
"(",
"p",
",",
... | Sources static credentials from shared credential/config files.
@param [Hash] opts
@option options [String] :profile the name of the configuration file from
which credentials are being sourced.
@return [Aws::Credentials] credentials sourced from configuration values,
or `nil` if no valid credentials were found. | [
"Sources",
"static",
"credentials",
"from",
"shared",
"credential",
"/",
"config",
"files",
"."
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-core/lib/aws-sdk-core/shared_config.rb#L99-L109 | train | Returns the credentials for the current user. | [
30522,
13366,
22496,
1006,
30524,
2171,
9398,
3686,
1035,
6337,
1035,
6526,
1006,
1052,
1007,
2065,
22496,
1035,
2556,
1029,
2065,
22496,
1027,
22496,
1035,
2013,
1035,
4207,
1006,
1052,
1010,
23569,
2015,
1007,
22496,
3449,
5332,
2546,
224... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2016-12-01/generated/azure_mgmt_network/network_interfaces.rb | Azure::Network::Mgmt::V2016_12_01.NetworkInterfaces.get_with_http_info | def get_with_http_info(resource_group_name, network_interface_name, expand:nil, custom_headers:nil)
get_async(resource_group_name, network_interface_name, expand:expand, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, network_interface_name, expand:nil, custom_headers:nil)
get_async(resource_group_name, network_interface_name, expand:expand, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"network_interface_name",
",",
"expand",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"network_interface_name",
",",
"expand",
":",
"expand",
",",
"cus... | Gets information about the specified network interface.
@param resource_group_name [String] The name of the resource group.
@param network_interface_name [String] The name of the network interface.
@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",
"information",
"about",
"the",
"specified",
"network",
"interface",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2016-12-01/generated/azure_mgmt_network/network_interfaces.rb#L392-L394 | train | Gets the specified network interface s segmentation. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2897,
1035,
8278,
1035,
2171,
1010,
7818,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
2004,
6038,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/models/order_fulfillment_pickup_details.rb | SquareConnect.OrderFulfillmentPickupDetails.valid? | def valid?
schedule_type_validator = EnumAttributeValidator.new('String', ["SCHEDULED", "ASAP"])
return false unless schedule_type_validator.valid?(@schedule_type)
return false if !@note.nil? && @note.to_s.length > 500
return false if !@cancel_reason.nil? && @cancel_reason.to_s.length > 100
return true
end | ruby | def valid?
schedule_type_validator = EnumAttributeValidator.new('String', ["SCHEDULED", "ASAP"])
return false unless schedule_type_validator.valid?(@schedule_type)
return false if !@note.nil? && @note.to_s.length > 500
return false if !@cancel_reason.nil? && @cancel_reason.to_s.length > 100
return true
end | [
"def",
"valid?",
"schedule_type_validator",
"=",
"EnumAttributeValidator",
".",
"new",
"(",
"'String'",
",",
"[",
"\"SCHEDULED\"",
",",
"\"ASAP\"",
"]",
")",
"return",
"false",
"unless",
"schedule_type_validator",
".",
"valid?",
"(",
"@schedule_type",
")",
"return",... | Check to see if the all the properties in the model are valid
@return true if the model is valid | [
"Check",
"to",
"see",
"if",
"the",
"all",
"the",
"properties",
"in",
"the",
"model",
"are",
"valid"
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/models/order_fulfillment_pickup_details.rb#L220-L226 | train | Returns true if the object is valid for the given array of objects. | [
30522,
13366,
9398,
1029,
6134,
1035,
2828,
1035,
9398,
8844,
1027,
4372,
12248,
4779,
3089,
8569,
2618,
10175,
8524,
4263,
1012,
2047,
1006,
1005,
5164,
1005,
1010,
1031,
1000,
5115,
1000,
1010,
1000,
17306,
2361,
1000,
1033,
1007,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_contentmoderator/lib/1.0/generated/azure_cognitiveservices_contentmoderator/reviews.rb | Azure::CognitiveServices::ContentModerator::V1_0.Reviews.create_reviews_with_http_info | def create_reviews_with_http_info(url_content_type, team_name, create_review_body, sub_team:nil, custom_headers:nil)
create_reviews_async(url_content_type, team_name, create_review_body, sub_team:sub_team, custom_headers:custom_headers).value!
end | ruby | def create_reviews_with_http_info(url_content_type, team_name, create_review_body, sub_team:nil, custom_headers:nil)
create_reviews_async(url_content_type, team_name, create_review_body, sub_team:sub_team, custom_headers:custom_headers).value!
end | [
"def",
"create_reviews_with_http_info",
"(",
"url_content_type",
",",
"team_name",
",",
"create_review_body",
",",
"sub_team",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"create_reviews_async",
"(",
"url_content_type",
",",
"team_name",
",",
"create_review_body... | The reviews created would show up for Reviewers on your team. As Reviewers
complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on
the specified CallBackEndpoint.
<h3>CallBack Schemas </h3>
<h4>Review Completion CallBack Sample</h4>
<p>
{<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",<br/>
"a": "False",<br/>
"racyscore": "0.xxx",<br/>
"r": "True"<br/>
},<br/>
"ReviewerResultTags": {<br/>
"a": "False",<br/>
"r": "True"<br/>
}<br/>
}<br/>
</p>.
@param url_content_type [String] The content type.
@param team_name [String] Your team name.
@param create_review_body [Array<CreateReviewBodyItem>] Body for create
reviews API
@param sub_team [String] SubTeam of your team, you want to assign the created
review to.
@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. | [
"The",
"reviews",
"created",
"would",
"show",
"up",
"for",
"Reviewers",
"on",
"your",
"team",
".",
"As",
"Reviewers",
"complete",
"reviewing",
"results",
"of",
"the",
"Review",
"would",
"be",
"POSTED",
"(",
"i",
".",
"e",
".",
"HTTP",
"POST",
")",
"on",
... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_contentmoderator/lib/1.0/generated/azure_cognitiveservices_contentmoderator/reviews.rb#L299-L301 | train | Creates a review for a team. | [
30522,
13366,
3443,
1035,
4391,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
24471,
2140,
1035,
4180,
1035,
2828,
1010,
2136,
1035,
2171,
1010,
3443,
1035,
3319,
1035,
2303,
1010,
4942,
1035,
2136,
1024,
9152,
2140,
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... |
rails/rails | activemodel/lib/active_model/serialization.rb | ActiveModel.Serialization.serializable_hash | def serializable_hash(options = nil)
options ||= {}
attribute_names = attributes.keys
if only = options[:only]
attribute_names &= Array(only).map(&:to_s)
elsif except = options[:except]
attribute_names -= Array(except).map(&:to_s)
end
hash = {}
attribute_names.each { |n| hash[n] = read_attribute_for_serialization(n) }
Array(options[:methods]).each { |m| hash[m.to_s] = send(m) }
serializable_add_includes(options) do |association, records, opts|
hash[association.to_s] = if records.respond_to?(:to_ary)
records.to_ary.map { |a| a.serializable_hash(opts) }
else
records.serializable_hash(opts)
end
end
hash
end | ruby | def serializable_hash(options = nil)
options ||= {}
attribute_names = attributes.keys
if only = options[:only]
attribute_names &= Array(only).map(&:to_s)
elsif except = options[:except]
attribute_names -= Array(except).map(&:to_s)
end
hash = {}
attribute_names.each { |n| hash[n] = read_attribute_for_serialization(n) }
Array(options[:methods]).each { |m| hash[m.to_s] = send(m) }
serializable_add_includes(options) do |association, records, opts|
hash[association.to_s] = if records.respond_to?(:to_ary)
records.to_ary.map { |a| a.serializable_hash(opts) }
else
records.serializable_hash(opts)
end
end
hash
end | [
"def",
"serializable_hash",
"(",
"options",
"=",
"nil",
")",
"options",
"||=",
"{",
"}",
"attribute_names",
"=",
"attributes",
".",
"keys",
"if",
"only",
"=",
"options",
"[",
":only",
"]",
"attribute_names",
"&=",
"Array",
"(",
"only",
")",
".",
"map",
"... | Returns a serialized hash of your object.
class Person
include ActiveModel::Serialization
attr_accessor :name, :age
def attributes
{'name' => nil, 'age' => nil}
end
def capitalized_name
name.capitalize
end
end
person = Person.new
person.name = 'bob'
person.age = 22
person.serializable_hash # => {"name"=>"bob", "age"=>22}
person.serializable_hash(only: :name) # => {"name"=>"bob"}
person.serializable_hash(except: :name) # => {"age"=>22}
person.serializable_hash(methods: :capitalized_name)
# => {"name"=>"bob", "age"=>22, "capitalized_name"=>"Bob"}
Example with <tt>:include</tt> option
class User
include ActiveModel::Serializers::JSON
attr_accessor :name, :notes # Emulate has_many :notes
def attributes
{'name' => nil}
end
end
class Note
include ActiveModel::Serializers::JSON
attr_accessor :title, :text
def attributes
{'title' => nil, 'text' => nil}
end
end
note = Note.new
note.title = 'Battle of Austerlitz'
note.text = 'Some text here'
user = User.new
user.name = 'Napoleon'
user.notes = [note]
user.serializable_hash
# => {"name" => "Napoleon"}
user.serializable_hash(include: { notes: { only: 'title' }})
# => {"name" => "Napoleon", "notes" => [{"title"=>"Battle of Austerlitz"}]} | [
"Returns",
"a",
"serialized",
"hash",
"of",
"your",
"object",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activemodel/lib/active_model/serialization.rb#L126-L150 | train | Returns a serializable hash of the model. | [
30522,
13366,
7642,
21335,
3468,
1035,
23325,
1006,
7047,
1027,
9152,
2140,
1007,
7047,
1064,
1064,
1027,
1063,
1065,
17961,
1035,
3415,
1027,
12332,
1012,
6309,
2065,
2069,
1027,
7047,
1031,
1024,
2069,
1033,
17961,
1035,
3415,
1004,
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... |
troessner/reek | lib/reek/smell_warning.rb | Reek.SmellWarning.to_hash | def to_hash
stringified_params = Hash[parameters.map { |key, val| [key.to_s, val] }]
base_hash.merge(stringified_params)
end | ruby | def to_hash
stringified_params = Hash[parameters.map { |key, val| [key.to_s, val] }]
base_hash.merge(stringified_params)
end | [
"def",
"to_hash",
"stringified_params",
"=",
"Hash",
"[",
"parameters",
".",
"map",
"{",
"|",
"key",
",",
"val",
"|",
"[",
"key",
".",
"to_s",
",",
"val",
"]",
"}",
"]",
"base_hash",
".",
"merge",
"(",
"stringified_params",
")",
"end"
] | @note When using Reek's public API, you should not create SmellWarning
objects yourself. This is why the initializer is not part of the
public API.
@quality :reek:LongParameterList { max_params: 6 }
@public
@public
@public
@public | [
"@note",
"When",
"using",
"Reek",
"s",
"public",
"API",
"you",
"should",
"not",
"create",
"SmellWarning",
"objects",
"yourself",
".",
"This",
"is",
"why",
"the",
"initializer",
"is",
"not",
"part",
"of",
"the",
"public",
"API",
"."
] | 8c6b5c0c6228a6981ab48543457889f9ea984054 | https://github.com/troessner/reek/blob/8c6b5c0c6228a6981ab48543457889f9ea984054/lib/reek/smell_warning.rb#L54-L57 | train | Returns a hash with the parameters | [
30522,
13366,
2000,
1035,
23325,
5164,
7810,
1035,
11498,
5244,
1027,
23325,
1031,
11709,
1012,
4949,
1063,
1064,
3145,
1010,
11748,
1064,
1031,
3145,
1012,
2000,
1035,
1055,
1010,
11748,
1033,
1065,
1033,
2918,
1035,
23325,
1012,
13590,
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_customer_insights/lib/2017-01-01/generated/azure_mgmt_customer_insights/interactions.rb | Azure::CustomerInsights::Mgmt::V2017_01_01.Interactions.get_with_http_info | def get_with_http_info(resource_group_name, hub_name, interaction_name, locale_code:'en-us', custom_headers:nil)
get_async(resource_group_name, hub_name, interaction_name, locale_code:locale_code, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, hub_name, interaction_name, locale_code:'en-us', custom_headers:nil)
get_async(resource_group_name, hub_name, interaction_name, locale_code:locale_code, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"hub_name",
",",
"interaction_name",
",",
"locale_code",
":",
"'en-us'",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"hub_name",
",",
"interaction_name",
",",
"lo... | Gets information about the specified interaction.
@param resource_group_name [String] The name of the resource group.
@param hub_name [String] The name of the hub.
@param interaction_name [String] The name of the interaction.
@param locale_code [String] Locale of interaction to retrieve, default is
en-us.
@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",
"information",
"about",
"the",
"specified",
"interaction",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_customer_insights/lib/2017-01-01/generated/azure_mgmt_customer_insights/interactions.rb#L106-L108 | train | Gets the specified HDInsight network interaction. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
9594,
1035,
2171,
1010,
8290,
1035,
2171,
1010,
2334,
2063,
1035,
3642,
1024,
1005,
4372,
1011,
2149,
1005,
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... |
chaps-io/public_activity | lib/public_activity/common.rb | PublicActivity.Common.call_hook_safe | def call_hook_safe(key)
hook = self.get_hook(key)
if hook
# provides hook with model and controller
hook.call(self, PublicActivity.get_controller)
else
true
end
end | ruby | def call_hook_safe(key)
hook = self.get_hook(key)
if hook
# provides hook with model and controller
hook.call(self, PublicActivity.get_controller)
else
true
end
end | [
"def",
"call_hook_safe",
"(",
"key",
")",
"hook",
"=",
"self",
".",
"get_hook",
"(",
"key",
")",
"if",
"hook",
"# provides hook with model and controller",
"hook",
".",
"call",
"(",
"self",
",",
"PublicActivity",
".",
"get_controller",
")",
"else",
"true",
"en... | Calls hook safely.
If a hook for given action exists, calls it with model (self) and
controller (if available, see {StoreController})
@param key (see #get_hook)
@return [Boolean] if hook exists, it's decision, if there's no hook, true
@since 0.4.0
@api private | [
"Calls",
"hook",
"safely",
".",
"If",
"a",
"hook",
"for",
"given",
"action",
"exists",
"calls",
"it",
"with",
"model",
"(",
"self",
")",
"and",
"controller",
"(",
"if",
"available",
"see",
"{",
"StoreController",
"}",
")"
] | e4357cd14db67299e0cbbd656300f51b7069ea9b | https://github.com/chaps-io/public_activity/blob/e4357cd14db67299e0cbbd656300f51b7069ea9b/lib/public_activity/common.rb#L183-L191 | train | Calls the hook if it exists | [
30522,
13366,
2655,
1035,
8103,
1035,
3647,
1006,
3145,
1007,
8103,
1027,
2969,
1012,
2131,
1035,
8103,
1006,
3145,
1007,
2065,
8103,
1001,
3640,
8103,
2007,
2944,
1998,
11486,
8103,
1012,
2655,
1006,
2969,
1010,
2270,
18908,
7730,
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... |
mhenrixon/sidekiq-unique-jobs | lib/sidekiq_unique_jobs/locksmith.rb | SidekiqUniqueJobs.Locksmith.delete! | def delete!
Scripts.call(
:delete,
redis_pool,
keys: [exists_key, grabbed_key, available_key, version_key, UNIQUE_SET, unique_digest],
)
end | ruby | def delete!
Scripts.call(
:delete,
redis_pool,
keys: [exists_key, grabbed_key, available_key, version_key, UNIQUE_SET, unique_digest],
)
end | [
"def",
"delete!",
"Scripts",
".",
"call",
"(",
":delete",
",",
"redis_pool",
",",
"keys",
":",
"[",
"exists_key",
",",
"grabbed_key",
",",
"available_key",
",",
"version_key",
",",
"UNIQUE_SET",
",",
"unique_digest",
"]",
",",
")",
"end"
] | Deletes the lock regardless of if it has a ttl set | [
"Deletes",
"the",
"lock",
"regardless",
"of",
"if",
"it",
"has",
"a",
"ttl",
"set"
] | 2944b97c720528f53962ccfd17d43ac939a77f46 | https://github.com/mhenrixon/sidekiq-unique-jobs/blob/2944b97c720528f53962ccfd17d43ac939a77f46/lib/sidekiq_unique_jobs/locksmith.rb#L43-L49 | train | Delete the object from the cache. | [
30522,
13366,
3972,
12870,
999,
14546,
1012,
2655,
1006,
1024,
3972,
12870,
1010,
2417,
2483,
1035,
4770,
1010,
6309,
1024,
1031,
6526,
1035,
3145,
1010,
4046,
1035,
3145,
1010,
2800,
1035,
3145,
1010,
2544,
1035,
3145,
1010,
4310,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_msi/lib/2015-08-31-preview/generated/azure_mgmt_msi/user_assigned_identities.rb | Azure::ManagedServiceIdentity::Mgmt::V2015_08_31_preview.UserAssignedIdentities.update_with_http_info | def update_with_http_info(resource_group_name, resource_name, parameters, custom_headers:nil)
update_async(resource_group_name, resource_name, parameters, custom_headers:custom_headers).value!
end | ruby | def update_with_http_info(resource_group_name, resource_name, parameters, custom_headers:nil)
update_async(resource_group_name, resource_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"update_with_http_info",
"(",
"resource_group_name",
",",
"resource_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"update_async",
"(",
"resource_group_name",
",",
"resource_name",
",",
"parameters",
",",
"custom_headers",
":custom_headers",
")... | Update an identity in the specified subscription and resource group.
@param resource_group_name [String] The name of the Resource Group to which
the identity belongs.
@param resource_name [String] The name of the identity resource.
@param parameters [Identity] Parameters to update the identity
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Update",
"an",
"identity",
"in",
"the",
"specified",
"subscription",
"and",
"resource",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_msi/lib/2015-08-31-preview/generated/azure_mgmt_msi/user_assigned_identities.rb#L353-L355 | train | Updates an existing Central Search specification. | [
30522,
13366,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7692,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
10651,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb | Azure::SQL::Mgmt::V2017_03_01_preview.LongTermRetentionBackups.begin_delete | def begin_delete(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:nil)
response = begin_delete_async(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:custom_headers).value!
nil
end | ruby | def begin_delete(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:nil)
response = begin_delete_async(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_delete",
"(",
"location_name",
",",
"long_term_retention_server_name",
",",
"long_term_retention_database_name",
",",
"backup_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_delete_async",
"(",
"location_name",
",",
"long_term_retention_... | Deletes a long term retention backup.
@param location_name [String] The location of the database
@param long_term_retention_server_name [String] The name of the server
@param long_term_retention_database_name [String] The name of the database
@param backup_name [String] The backup name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Deletes",
"a",
"long",
"term",
"retention",
"backup",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb#L501-L504 | train | Deletes a long term retention database. | [
30522,
13366,
4088,
1035,
3972,
12870,
1006,
3295,
1035,
2171,
1010,
2146,
1035,
2744,
1035,
20125,
1035,
8241,
1035,
2171,
1010,
2146,
1035,
2744,
1035,
20125,
1035,
7809,
1035,
2171,
1010,
10200,
1035,
2171,
1010,
7661,
1035,
20346,
2015,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/job_target_executions.rb | Azure::SQL::Mgmt::V2017_03_01_preview.JobTargetExecutions.list_by_step | def list_by_step(resource_group_name, server_name, job_agent_name, job_name, job_execution_id, step_name, create_time_min:nil, create_time_max:nil, end_time_min:nil, end_time_max:nil, is_active:nil, skip:nil, top:nil, custom_headers:nil)
first_page = list_by_step_as_lazy(resource_group_name, server_name, job_agent_name, job_name, job_execution_id, step_name, create_time_min:create_time_min, create_time_max:create_time_max, end_time_min:end_time_min, end_time_max:end_time_max, is_active:is_active, skip:skip, top:top, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_by_step(resource_group_name, server_name, job_agent_name, job_name, job_execution_id, step_name, create_time_min:nil, create_time_max:nil, end_time_min:nil, end_time_max:nil, is_active:nil, skip:nil, top:nil, custom_headers:nil)
first_page = list_by_step_as_lazy(resource_group_name, server_name, job_agent_name, job_name, job_execution_id, step_name, create_time_min:create_time_min, create_time_max:create_time_max, end_time_min:end_time_min, end_time_max:end_time_max, is_active:is_active, skip:skip, top:top, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_by_step",
"(",
"resource_group_name",
",",
"server_name",
",",
"job_agent_name",
",",
"job_name",
",",
"job_execution_id",
",",
"step_name",
",",
"create_time_min",
":",
"nil",
",",
"create_time_max",
":",
"nil",
",",
"end_time_min",
":",
"nil",
",",
... | Lists the target executions of a job step execution.
@param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param server_name [String] The name of the server.
@param job_agent_name [String] The name of the job agent.
@param job_name [String] The name of the job to get.
@param job_execution_id The id of the job execution
@param step_name [String] The name of the step.
@param create_time_min [DateTime] If specified, only job executions created
at or after the specified time are included.
@param create_time_max [DateTime] If specified, only job executions created
before the specified time are included.
@param end_time_min [DateTime] If specified, only job executions completed at
or after the specified time are included.
@param end_time_max [DateTime] If specified, only job executions completed
before the specified time are included.
@param is_active [Boolean] If specified, only active or only completed job
executions are included.
@param skip [Integer] The number of elements in the collection to skip.
@param top [Integer] The number of elements to return from the collection.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<JobExecution>] operation results. | [
"Lists",
"the",
"target",
"executions",
"of",
"a",
"job",
"step",
"execution",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/job_target_executions.rb#L201-L204 | train | Gets all the job execution steps. | [
30522,
13366,
2862,
1035,
2011,
1035,
3357,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
3105,
1035,
4005,
1035,
2171,
1010,
3105,
1035,
2171,
1010,
3105,
1035,
7781,
1035,
8909,
1010,
3357,
1035,
2171,
1010,
3443,
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_storage/lib/2018-07-01/generated/azure_mgmt_storage/blob_containers.rb | Azure::Storage::Mgmt::V2018_07_01.BlobContainers.create | def create(resource_group_name, account_name, container_name, blob_container, custom_headers:nil)
response = create_async(resource_group_name, account_name, container_name, blob_container, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create(resource_group_name, account_name, container_name, blob_container, custom_headers:nil)
response = create_async(resource_group_name, account_name, container_name, blob_container, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create",
"(",
"resource_group_name",
",",
"account_name",
",",
"container_name",
",",
"blob_container",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"container_name",
",",
"blo... | Creates a new container under the specified account as described by request
body. The container resource includes metadata and properties for that
container. It does not include a list of the blobs contained by the
container.
@param resource_group_name [String] The name of the resource group within the
user's subscription. The name is case insensitive.
@param account_name [String] The name of the storage account within the
specified resource group. Storage account names must be between 3 and 24
characters in length and use numbers and lower-case letters only.
@param container_name [String] The name of the blob container within the
specified storage account. Blob container names must be between 3 and 63
characters in length and use numbers, lower-case letters and dash (-) only.
Every dash (-) character must be immediately preceded and followed by a
letter or number.
@param blob_container [BlobContainer] Properties of the blob container to
create.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [BlobContainer] operation results. | [
"Creates",
"a",
"new",
"container",
"under",
"the",
"specified",
"account",
"as",
"described",
"by",
"request",
"body",
".",
"The",
"container",
"resource",
"includes",
"metadata",
"and",
"properties",
"for",
"that",
"container",
".",
"It",
"does",
"not",
"inc... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_storage/lib/2018-07-01/generated/azure_mgmt_storage/blob_containers.rb#L158-L161 | train | Creates a new container in the specified container group. | [
30522,
13366,
3443,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
11661,
1035,
2171,
1010,
1038,
4135,
2497,
1035,
11661,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3443,
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... |
danger/danger | lib/danger/plugin_support/plugin_linter.rb | Danger.PluginLinter.link | def link(ref)
if ref.kind_of?(Range)
"@see - " + "https://github.com/dbgrandi/danger-prose/blob/v2.0.0/lib/danger_plugin.rb#L#{ref.min}#-L#{ref.max}".blue
elsif ref.kind_of?(Integer)
"@see - " + "https://github.com/dbgrandi/danger-prose/blob/v2.0.0/lib/danger_plugin.rb#L#{ref}".blue
else
"@see - " + "https://github.com/dbgrandi/danger-prose/blob/v2.0.0/lib/danger_plugin.rb".blue
end
end | ruby | def link(ref)
if ref.kind_of?(Range)
"@see - " + "https://github.com/dbgrandi/danger-prose/blob/v2.0.0/lib/danger_plugin.rb#L#{ref.min}#-L#{ref.max}".blue
elsif ref.kind_of?(Integer)
"@see - " + "https://github.com/dbgrandi/danger-prose/blob/v2.0.0/lib/danger_plugin.rb#L#{ref}".blue
else
"@see - " + "https://github.com/dbgrandi/danger-prose/blob/v2.0.0/lib/danger_plugin.rb".blue
end
end | [
"def",
"link",
"(",
"ref",
")",
"if",
"ref",
".",
"kind_of?",
"(",
"Range",
")",
"\"@see - \"",
"+",
"\"https://github.com/dbgrandi/danger-prose/blob/v2.0.0/lib/danger_plugin.rb#L#{ref.min}#-L#{ref.max}\"",
".",
"blue",
"elsif",
"ref",
".",
"kind_of?",
"(",
"Integer",
"... | Generates a link to see an example of said rule | [
"Generates",
"a",
"link",
"to",
"see",
"an",
"example",
"of",
"said",
"rule"
] | 0d6d09f2d949c287fe75202d947374042b0679f4 | https://github.com/danger/danger/blob/0d6d09f2d949c287fe75202d947374042b0679f4/lib/danger/plugin_support/plugin_linter.rb#L132-L140 | train | Link a reference to a specific resource | [
30522,
13366,
4957,
1006,
25416,
1007,
2065,
25416,
1012,
2785,
1035,
1997,
1029,
1006,
2846,
1007,
1000,
1030,
2156,
1011,
1000,
1009,
1000,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
16962,
17643,
16089,
1013,
5473,
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/2018-08-01/generated/azure_mgmt_network/network_watchers.rb | Azure::Network::Mgmt::V2018_08_01.NetworkWatchers.verify_ipflow | def verify_ipflow(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
response = verify_ipflow_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def verify_ipflow(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
response = verify_ipflow_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"verify_ipflow",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"verify_ipflow_async",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"parameters",
",",
"custom_h... | Verify IP flow from the specified VM to a location given the currently
configured NSG rules.
@param resource_group_name [String] The name of the resource group.
@param network_watcher_name [String] The name of the network watcher.
@param parameters [VerificationIPFlowParameters] Parameters that define the
IP flow to be verified.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [VerificationIPFlowResult] operation results. | [
"Verify",
"IP",
"flow",
"from",
"the",
"specified",
"VM",
"to",
"a",
"location",
"given",
"the",
"currently",
"configured",
"NSG",
"rules",
"."
] | 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#L667-L670 | train | Verify IP flow. | [
30522,
13366,
20410,
1035,
12997,
12314,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2897,
1035,
3422,
2121,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
20410,
1035,
12997,
12314,
1035,
2004,
60... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/overcommit | lib/overcommit/hook_context/pre_commit.rb | Overcommit::HookContext.PreCommit.modified_files | def modified_files
unless @modified_files
currently_staged = Overcommit::GitRepo.modified_files(staged: true)
@modified_files = currently_staged
# Include files modified in last commit if amending
if amendment?
subcmd = 'show --format=%n'
previously_modified = Overcommit::GitRepo.modified_files(subcmd: subcmd)
@modified_files |= filter_modified_files(previously_modified)
end
end
@modified_files
end | ruby | def modified_files
unless @modified_files
currently_staged = Overcommit::GitRepo.modified_files(staged: true)
@modified_files = currently_staged
# Include files modified in last commit if amending
if amendment?
subcmd = 'show --format=%n'
previously_modified = Overcommit::GitRepo.modified_files(subcmd: subcmd)
@modified_files |= filter_modified_files(previously_modified)
end
end
@modified_files
end | [
"def",
"modified_files",
"unless",
"@modified_files",
"currently_staged",
"=",
"Overcommit",
"::",
"GitRepo",
".",
"modified_files",
"(",
"staged",
":",
"true",
")",
"@modified_files",
"=",
"currently_staged",
"# Include files modified in last commit if amending",
"if",
"am... | Get a list of added, copied, or modified files that have been staged.
Renames and deletions are ignored, since there should be nothing to check. | [
"Get",
"a",
"list",
"of",
"added",
"copied",
"or",
"modified",
"files",
"that",
"have",
"been",
"staged",
".",
"Renames",
"and",
"deletions",
"are",
"ignored",
"since",
"there",
"should",
"be",
"nothing",
"to",
"check",
"."
] | 35d60adb41da942178b789560968e3ad030b0ac7 | https://github.com/sds/overcommit/blob/35d60adb41da942178b789560968e3ad030b0ac7/lib/overcommit/hook_context/pre_commit.rb#L99-L112 | train | Returns the modified files of the current branch | [
30522,
13366,
6310,
1035,
6764,
4983,
1030,
6310,
1035,
6764,
2747,
1035,
9813,
1027,
2058,
9006,
22930,
1024,
1024,
21025,
7913,
6873,
1012,
6310,
1035,
6764,
1006,
9813,
1024,
2995,
1007,
1030,
6310,
1035,
6764,
1027,
2747,
1035,
9813,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.