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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
activeadmin/activeadmin | lib/active_admin/dsl.rb | ActiveAdmin.DSL.batch_action | def batch_action(title, options = {}, &block)
# Create symbol & title information
if title.is_a? String
sym = title.titleize.tr(' ', '').underscore.to_sym
else
sym = title
title = sym.to_s.titleize
end
# Either add/remove the batch action
unless options == false
config.add_batch_action(sym, title, options, &block)
else
config.remove_batch_action sym
end
end | ruby | def batch_action(title, options = {}, &block)
# Create symbol & title information
if title.is_a? String
sym = title.titleize.tr(' ', '').underscore.to_sym
else
sym = title
title = sym.to_s.titleize
end
# Either add/remove the batch action
unless options == false
config.add_batch_action(sym, title, options, &block)
else
config.remove_batch_action sym
end
end | [
"def",
"batch_action",
"(",
"title",
",",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"# Create symbol & title information",
"if",
"title",
".",
"is_a?",
"String",
"sym",
"=",
"title",
".",
"titleize",
".",
"tr",
"(",
"' '",
",",
"''",
")",
".",
... | Add a new batch action item to the resource
Provide a symbol/string to register the action, options, & block to execute on request
To unregister an existing action, just provide the symbol & pass false as the second param
@param [Symbol or String] title
@param [Hash] options valid keys include:
=> :if is a proc that will be called to determine if the BatchAction should be displayed
=> :sort_order is used to sort the batch actions ascending
=> :confirm is a string which the user will have to accept in order to process the action | [
"Add",
"a",
"new",
"batch",
"action",
"item",
"to",
"the",
"resource",
"Provide",
"a",
"symbol",
"/",
"string",
"to",
"register",
"the",
"action",
"options",
"&",
"block",
"to",
"execute",
"on",
"request"
] | 0759c8dcf97865748c9344459162ac3c7e65a6cd | https://github.com/activeadmin/activeadmin/blob/0759c8dcf97865748c9344459162ac3c7e65a6cd/lib/active_admin/dsl.rb#L101-L116 | train | Create a new batch action | [
30522,
13366,
14108,
1035,
2895,
1006,
2516,
1010,
7047,
1027,
1063,
1065,
1010,
1004,
3796,
1007,
1001,
3443,
6454,
1004,
2516,
2592,
2065,
2516,
1012,
2003,
1035,
1037,
1029,
5164,
25353,
2213,
1027,
2516,
1012,
2516,
4697,
1012,
19817,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/search.rb | Github.Client::Search.users | def users(*args)
params = arguments(args, required: [:q]).params
params['q'] ||= arguments.q
get_request('/search/users', arguments.params)
end | ruby | def users(*args)
params = arguments(args, required: [:q]).params
params['q'] ||= arguments.q
get_request('/search/users', arguments.params)
end | [
"def",
"users",
"(",
"*",
"args",
")",
"params",
"=",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":q",
"]",
")",
".",
"params",
"params",
"[",
"'q'",
"]",
"||=",
"arguments",
".",
"q",
"get_request",
"(",
"'/search/users'",
",",
"arguments",
... | Search users
Find users by keyword.
@param [Hash] params
@option params [String] :q
The search terms. This can be any combination of the supported
issue search parameters.
@option params [String] :sort
Optional sort field. One of comments, created, or updated.
If not provided, results are sorted by best match.
@option params [String] :order
The sort order if sort parameter is provided.
One of asc or desc. Default: desc
@example
github = Github.new
github.search.users q: 'wycats'
@api public | [
"Search",
"users"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/search.rb#L100-L105 | train | Get a list of users | [
30522,
13366,
5198,
1006,
1008,
12098,
5620,
1007,
11498,
5244,
1027,
9918,
1006,
12098,
5620,
1010,
3223,
1024,
1031,
1024,
1053,
1033,
1007,
1012,
11498,
5244,
11498,
5244,
1031,
1005,
1053,
1005,
1033,
1064,
1064,
1027,
9918,
1012,
1053,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mojombo/chronic | lib/chronic/handler.rb | Chronic.Handler.match | def match(tokens, definitions)
token_index = 0
@pattern.each do |elements|
was_optional = false
elements = [elements] unless elements.is_a?(Array)
elements.each_index do |i|
name = elements[i].to_s
optional = name[-1, 1] == '?'
name = name.chop if optional
case elements[i]
when Symbol
if tags_match?(name, tokens, token_index)
token_index += 1
break
else
if optional
was_optional = true
next
elsif i + 1 < elements.count
next
else
return false unless was_optional
end
end
when String
return true if optional && token_index == tokens.size
if definitions.key?(name.to_sym)
sub_handlers = definitions[name.to_sym]
else
raise "Invalid subset #{name} specified"
end
sub_handlers.each do |sub_handler|
return true if sub_handler.match(tokens[token_index..tokens.size], definitions)
end
else
raise "Invalid match type: #{elements[i].class}"
end
end
end
return false if token_index != tokens.size
return true
end | ruby | def match(tokens, definitions)
token_index = 0
@pattern.each do |elements|
was_optional = false
elements = [elements] unless elements.is_a?(Array)
elements.each_index do |i|
name = elements[i].to_s
optional = name[-1, 1] == '?'
name = name.chop if optional
case elements[i]
when Symbol
if tags_match?(name, tokens, token_index)
token_index += 1
break
else
if optional
was_optional = true
next
elsif i + 1 < elements.count
next
else
return false unless was_optional
end
end
when String
return true if optional && token_index == tokens.size
if definitions.key?(name.to_sym)
sub_handlers = definitions[name.to_sym]
else
raise "Invalid subset #{name} specified"
end
sub_handlers.each do |sub_handler|
return true if sub_handler.match(tokens[token_index..tokens.size], definitions)
end
else
raise "Invalid match type: #{elements[i].class}"
end
end
end
return false if token_index != tokens.size
return true
end | [
"def",
"match",
"(",
"tokens",
",",
"definitions",
")",
"token_index",
"=",
"0",
"@pattern",
".",
"each",
"do",
"|",
"elements",
"|",
"was_optional",
"=",
"false",
"elements",
"=",
"[",
"elements",
"]",
"unless",
"elements",
".",
"is_a?",
"(",
"Array",
"... | pattern - An Array of patterns to match tokens against.
handler_method - A Symbol representing the method to be invoked
when a pattern matches.
tokens - An Array of tokens to process.
definitions - A Hash of definitions to check against.
Returns true if a match is found. | [
"pattern",
"-",
"An",
"Array",
"of",
"patterns",
"to",
"match",
"tokens",
"against",
".",
"handler_method",
"-",
"A",
"Symbol",
"representing",
"the",
"method",
"to",
"be",
"invoked",
"when",
"a",
"pattern",
"matches",
".",
"tokens",
"-",
"An",
"Array",
"o... | 2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c | https://github.com/mojombo/chronic/blob/2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c/lib/chronic/handler.rb#L20-L68 | train | Returns true if the tokens match the pattern | [
30522,
13366,
2674,
1006,
19204,
2015,
1010,
15182,
1007,
19204,
1035,
5950,
1027,
1014,
1030,
5418,
1012,
2169,
2079,
1064,
3787,
1064,
2001,
1035,
11887,
1027,
6270,
3787,
1027,
1031,
3787,
1033,
4983,
3787,
1012,
2003,
1035,
1037,
1029,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/devices.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.Devices.begin_deactivate | def begin_deactivate(device_name, resource_group_name, manager_name, custom_headers:nil)
response = begin_deactivate_async(device_name, resource_group_name, manager_name, custom_headers:custom_headers).value!
nil
end | ruby | def begin_deactivate(device_name, resource_group_name, manager_name, custom_headers:nil)
response = begin_deactivate_async(device_name, resource_group_name, manager_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_deactivate",
"(",
"device_name",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_deactivate_async",
"(",
"device_name",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",... | Deactivates the device.
@param device_name [String] The device name
@param resource_group_name [String] The resource group name
@param manager_name [String] The manager name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Deactivates",
"the",
"device",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/devices.rb#L1402-L1405 | train | Deactivates the specified managed hardware. | [
30522,
13366,
4088,
1035,
26709,
6593,
21466,
1006,
5080,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
26709,
6593,
21466,
1035,
2004,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/express_route_circuits.rb | Azure::Network::Mgmt::V2019_02_01.ExpressRouteCircuits.begin_create_or_update_with_http_info | def begin_create_or_update_with_http_info(resource_group_name, circuit_name, parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, circuit_name, parameters, custom_headers:custom_headers).value!
end | ruby | def begin_create_or_update_with_http_info(resource_group_name, circuit_name, parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, circuit_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_create_or_update_with_http_info",
"(",
"resource_group_name",
",",
"circuit_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"circuit_name",
",",
"parameters",
",",
"custom_heade... | Creates or updates an express route circuit.
@param resource_group_name [String] The name of the resource group.
@param circuit_name [String] The name of the circuit.
@param parameters [ExpressRouteCircuit] Parameters supplied to the create or
update express route circuit operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Creates",
"or",
"updates",
"an",
"express",
"route",
"circuit",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/express_route_circuits.rb#L857-L859 | train | Creates or updates an express route circuit. | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4984,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
1035,
3443,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.report_deployed_application_health | def report_deployed_application_health(node_name, application_id, health_information, immediate:false, timeout:60, custom_headers:nil)
response = report_deployed_application_health_async(node_name, application_id, health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
nil
end | ruby | def report_deployed_application_health(node_name, application_id, health_information, immediate:false, timeout:60, custom_headers:nil)
response = report_deployed_application_health_async(node_name, application_id, health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
nil
end | [
"def",
"report_deployed_application_health",
"(",
"node_name",
",",
"application_id",
",",
"health_information",
",",
"immediate",
":",
"false",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"report_deployed_application_health_async... | Sends a health report on the Service Fabric application deployed on a Service
Fabric node.
Reports health state of the application deployed on a Service Fabric node.
The report must contain the information about the source of the health report
and property on which it is reported.
The report is sent to a Service Fabric gateway Service, which forwards to the
health store.
The report may be accepted by the gateway, but rejected by the health store
after extra validation.
For example, the health store may reject the report because of an invalid
parameter, like a stale sequence number.
To see whether the report was applied in the health store, get deployed
application health and check that the report appears in the HealthEvents
section.
@param node_name [String] The name of the node.
@param application_id [String] The identity of the application. This is
typically the full name of the application without the 'fabric:' URI scheme.
Starting from version 6.0, hierarchical names are delimited with the "~"
character.
For example, if the application name is "fabric:/myapp/app1", the application
identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
@param health_information [HealthInformation] Describes the health
information for the health report. This information needs to be present in
all of the health reports sent to the health manager.
@param immediate [Boolean] A flag which indicates whether the report should
be sent immediately.
A health report is sent to a Service Fabric gateway Application, which
forwards to the health store.
If Immediate is set to true, the report is sent immediately from HTTP Gateway
to the health store, regardless of the fabric client settings that the HTTP
Gateway Application is using.
This is useful for critical reports that should be sent as soon as possible.
Depending on timing and other conditions, sending the report may still fail,
for example if the HTTP Gateway is closed or the message doesn't reach the
Gateway.
If Immediate is set to false, the report is sent based on the health client
settings from the HTTP Gateway. Therefore, it will be batched according to
the HealthReportSendInterval configuration.
This is the recommended setting because it allows the health client to
optimize health reporting messages to health store as well as health report
processing.
By default, reports are not sent immediately.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Sends",
"a",
"health",
"report",
"on",
"the",
"Service",
"Fabric",
"application",
"deployed",
"on",
"a",
"Service",
"Fabric",
"node",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L9376-L9379 | train | Report the health of the deployed application. | [
30522,
13366,
3189,
1035,
7333,
1035,
4646,
1035,
2740,
1006,
13045,
1035,
2171,
1010,
4646,
1035,
8909,
1010,
2740,
1035,
2592,
1010,
6234,
1024,
6270,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-s3/lib/aws-sdk-s3/client.rb | Aws::S3.Client.get_object | def get_object(params = {}, options = {}, &block)
req = build_request(:get_object, params)
req.send_request(options, &block)
end | ruby | def get_object(params = {}, options = {}, &block)
req = build_request(:get_object, params)
req.send_request(options, &block)
end | [
"def",
"get_object",
"(",
"params",
"=",
"{",
"}",
",",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"req",
"=",
"build_request",
"(",
":get_object",
",",
"params",
")",
"req",
".",
"send_request",
"(",
"options",
",",
"block",
")",
"end"
] | Retrieves objects from Amazon S3.
@option params [String, IO] :response_target
Where to write response data, file path, or IO object.
@option params [required, String] :bucket
@option params [String] :if_match
Return the object only if its entity tag (ETag) is the same as the one
specified, otherwise return a 412 (precondition failed).
@option params [Time,DateTime,Date,Integer,String] :if_modified_since
Return the object only if it has been modified since the specified
time, otherwise return a 304 (not modified).
@option params [String] :if_none_match
Return the object only if its entity tag (ETag) is different from the
one specified, otherwise return a 304 (not modified).
@option params [Time,DateTime,Date,Integer,String] :if_unmodified_since
Return the object only if it has not been modified since the specified
time, otherwise return a 412 (precondition failed).
@option params [required, String] :key
@option params [String] :range
Downloads the specified range bytes of an object. For more information
about the HTTP Range header, go to
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.
@option params [String] :response_cache_control
Sets the Cache-Control header of the response.
@option params [String] :response_content_disposition
Sets the Content-Disposition header of the response
@option params [String] :response_content_encoding
Sets the Content-Encoding header of the response.
@option params [String] :response_content_language
Sets the Content-Language header of the response.
@option params [String] :response_content_type
Sets the Content-Type header of the response.
@option params [Time,DateTime,Date,Integer,String] :response_expires
Sets the Expires header of the response.
@option params [String] :version_id
VersionId used to reference a specific version of the object.
@option params [String] :sse_customer_algorithm
Specifies the algorithm to use to when encrypting the object (e.g.,
AES256).
@option params [String] :sse_customer_key
Specifies the customer-provided encryption key for Amazon S3 to use in
encrypting data. This value is used to store the object and then it is
discarded; Amazon does not store the encryption key. The key must be
appropriate for use with the algorithm specified in the
x-amz-server-side-encryption-customer-algorithm header.
@option params [String] :sse_customer_key_md5
Specifies the 128-bit MD5 digest of the encryption key according to
RFC 1321. Amazon S3 uses this header for a message integrity check to
ensure the encryption key was transmitted without error.
@option params [String] :request_payer
Confirms that the requester knows that she or he will be charged for
the request. Bucket owners need not specify this parameter in their
requests. Documentation on downloading objects from requester pays
buckets can be found at
http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
@option params [Integer] :part_number
Part number of the object being read. This is a positive integer
between 1 and 10,000. Effectively performs a 'ranged' GET request
for the part specified. Useful for downloading just a part of an
object.
@return [Types::GetObjectOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
* {Types::GetObjectOutput#body #body} => IO
* {Types::GetObjectOutput#delete_marker #delete_marker} => Boolean
* {Types::GetObjectOutput#accept_ranges #accept_ranges} => String
* {Types::GetObjectOutput#expiration #expiration} => String
* {Types::GetObjectOutput#restore #restore} => String
* {Types::GetObjectOutput#last_modified #last_modified} => Time
* {Types::GetObjectOutput#content_length #content_length} => Integer
* {Types::GetObjectOutput#etag #etag} => String
* {Types::GetObjectOutput#missing_meta #missing_meta} => Integer
* {Types::GetObjectOutput#version_id #version_id} => String
* {Types::GetObjectOutput#cache_control #cache_control} => String
* {Types::GetObjectOutput#content_disposition #content_disposition} => String
* {Types::GetObjectOutput#content_encoding #content_encoding} => String
* {Types::GetObjectOutput#content_language #content_language} => String
* {Types::GetObjectOutput#content_range #content_range} => String
* {Types::GetObjectOutput#content_type #content_type} => String
* {Types::GetObjectOutput#expires #expires} => Time
* {Types::GetObjectOutput#expires_string #expires_string} => String
* {Types::GetObjectOutput#website_redirect_location #website_redirect_location} => String
* {Types::GetObjectOutput#server_side_encryption #server_side_encryption} => String
* {Types::GetObjectOutput#metadata #metadata} => Hash<String,String>
* {Types::GetObjectOutput#sse_customer_algorithm #sse_customer_algorithm} => String
* {Types::GetObjectOutput#sse_customer_key_md5 #sse_customer_key_md5} => String
* {Types::GetObjectOutput#ssekms_key_id #ssekms_key_id} => String
* {Types::GetObjectOutput#storage_class #storage_class} => String
* {Types::GetObjectOutput#request_charged #request_charged} => String
* {Types::GetObjectOutput#replication_status #replication_status} => String
* {Types::GetObjectOutput#parts_count #parts_count} => Integer
* {Types::GetObjectOutput#tag_count #tag_count} => Integer
* {Types::GetObjectOutput#object_lock_mode #object_lock_mode} => String
* {Types::GetObjectOutput#object_lock_retain_until_date #object_lock_retain_until_date} => Time
* {Types::GetObjectOutput#object_lock_legal_hold_status #object_lock_legal_hold_status} => String
@example Example: To retrieve an object
# The following example retrieves an object for an S3 bucket.
resp = client.get_object({
bucket: "examplebucket",
key: "HappyFace.jpg",
})
resp.to_h outputs the following:
{
accept_ranges: "bytes",
content_length: 3191,
content_type: "image/jpeg",
etag: "\"6805f2cfc46c0f04559748bb039d69ae\"",
last_modified: Time.parse("Thu, 15 Dec 2016 01:19:41 GMT"),
metadata: {
},
tag_count: 2,
version_id: "null",
}
@example Example: To retrieve a byte range of an object
# The following example retrieves an object for an S3 bucket. The request specifies the range header to retrieve a
# specific byte range.
resp = client.get_object({
bucket: "examplebucket",
key: "SampleFile.txt",
range: "bytes=0-9",
})
resp.to_h outputs the following:
{
accept_ranges: "bytes",
content_length: 10,
content_range: "bytes 0-9/43",
content_type: "text/plain",
etag: "\"0d94420ffd0bc68cd3d152506b97a9cc\"",
last_modified: Time.parse("Thu, 09 Oct 2014 22:57:28 GMT"),
metadata: {
},
version_id: "null",
}
@example Download an object to disk
# stream object directly to disk
resp = s3.get_object(
response_target: '/path/to/file',
bucket: 'bucket-name',
key: 'object-key')
# you can still access other response data
resp.metadata #=> { ... }
resp.etag #=> "..."
@example Download object into memory
# omit :response_target to download to a StringIO in memory
resp = s3.get_object(bucket: 'bucket-name', key: 'object-key')
# call #read or #string on the response body
resp.body.read
#=> '...'
@example Streaming data to a block
# WARNING: yielding data to a block disables retries of networking errors
File.open('/path/to/file', 'wb') do |file|
s3.get_object(bucket: 'bucket-name', key: 'object-key') do |chunk|
file.write(chunk)
end
end
@example Request syntax with placeholder values
resp = client.get_object({
bucket: "BucketName", # required
if_match: "IfMatch",
if_modified_since: Time.now,
if_none_match: "IfNoneMatch",
if_unmodified_since: Time.now,
key: "ObjectKey", # required
range: "Range",
response_cache_control: "ResponseCacheControl",
response_content_disposition: "ResponseContentDisposition",
response_content_encoding: "ResponseContentEncoding",
response_content_language: "ResponseContentLanguage",
response_content_type: "ResponseContentType",
response_expires: Time.now,
version_id: "ObjectVersionId",
sse_customer_algorithm: "SSECustomerAlgorithm",
sse_customer_key: "SSECustomerKey",
sse_customer_key_md5: "SSECustomerKeyMD5",
request_payer: "requester", # accepts requester
part_number: 1,
})
@example Response structure
resp.body #=> IO
resp.delete_marker #=> Boolean
resp.accept_ranges #=> String
resp.expiration #=> String
resp.restore #=> String
resp.last_modified #=> Time
resp.content_length #=> Integer
resp.etag #=> String
resp.missing_meta #=> Integer
resp.version_id #=> String
resp.cache_control #=> String
resp.content_disposition #=> String
resp.content_encoding #=> String
resp.content_language #=> String
resp.content_range #=> String
resp.content_type #=> String
resp.expires #=> Time
resp.expires_string #=> String
resp.website_redirect_location #=> String
resp.server_side_encryption #=> String, one of "AES256", "aws:kms"
resp.metadata #=> Hash
resp.metadata["MetadataKey"] #=> String
resp.sse_customer_algorithm #=> String
resp.sse_customer_key_md5 #=> String
resp.ssekms_key_id #=> String
resp.storage_class #=> String, one of "STANDARD", "REDUCED_REDUNDANCY", "STANDARD_IA", "ONEZONE_IA", "INTELLIGENT_TIERING", "GLACIER", "DEEP_ARCHIVE"
resp.request_charged #=> String, one of "requester"
resp.replication_status #=> String, one of "COMPLETE", "PENDING", "FAILED", "REPLICA"
resp.parts_count #=> Integer
resp.tag_count #=> Integer
resp.object_lock_mode #=> String, one of "GOVERNANCE", "COMPLIANCE"
resp.object_lock_retain_until_date #=> Time
resp.object_lock_legal_hold_status #=> String, one of "ON", "OFF"
@see http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObject AWS API Documentation
@overload get_object(params = {})
@param [Hash] params ({}) | [
"Retrieves",
"objects",
"from",
"Amazon",
"S3",
"."
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-s3/lib/aws-sdk-s3/client.rb#L2900-L2903 | train | Get an object | [
30522,
13366,
2131,
1035,
4874,
1006,
11498,
5244,
1027,
1063,
1065,
1010,
7047,
1027,
1063,
1065,
1010,
1004,
3796,
1007,
2128,
4160,
1027,
3857,
1035,
5227,
1006,
1024,
2131,
1035,
4874,
1010,
11498,
5244,
1007,
2128,
4160,
1012,
4604,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rmosolgo/graphql-ruby | lib/graphql/rake_task.rb | GraphQL.RakeTask.define_task | def define_task
namespace(@namespace) do
namespace("schema") do
desc("Dump the schema to IDL in #{idl_path}")
task :idl => @dependencies do
write_outfile(:to_definition, idl_path)
puts "Schema IDL dumped into #{idl_path}"
end
desc("Dump the schema to JSON in #{json_path}")
task :json => @dependencies do
write_outfile(:to_json, json_path)
puts "Schema JSON dumped into #{json_path}"
end
desc("Dump the schema to JSON and IDL")
task :dump => [:idl, :json]
end
end
end | ruby | def define_task
namespace(@namespace) do
namespace("schema") do
desc("Dump the schema to IDL in #{idl_path}")
task :idl => @dependencies do
write_outfile(:to_definition, idl_path)
puts "Schema IDL dumped into #{idl_path}"
end
desc("Dump the schema to JSON in #{json_path}")
task :json => @dependencies do
write_outfile(:to_json, json_path)
puts "Schema JSON dumped into #{json_path}"
end
desc("Dump the schema to JSON and IDL")
task :dump => [:idl, :json]
end
end
end | [
"def",
"define_task",
"namespace",
"(",
"@namespace",
")",
"do",
"namespace",
"(",
"\"schema\"",
")",
"do",
"desc",
"(",
"\"Dump the schema to IDL in #{idl_path}\"",
")",
"task",
":idl",
"=>",
"@dependencies",
"do",
"write_outfile",
"(",
":to_definition",
",",
"idl_... | Use the Rake DSL to add tasks | [
"Use",
"the",
"Rake",
"DSL",
"to",
"add",
"tasks"
] | d5be13a816f220b9efbabeaa69a3e56fedf311f5 | https://github.com/rmosolgo/graphql-ruby/blob/d5be13a816f220b9efbabeaa69a3e56fedf311f5/lib/graphql/rake_task.rb#L121-L140 | train | Define the task for the task | [
30522,
13366,
9375,
1035,
4708,
3415,
15327,
1006,
1030,
3415,
15327,
1007,
2079,
3415,
15327,
1006,
1000,
8040,
28433,
1000,
1007,
2079,
4078,
2278,
1006,
1000,
15653,
1996,
8040,
28433,
2000,
8909,
2140,
1999,
1001,
1063,
8909,
2140,
1035... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
randym/axlsx | lib/axlsx/drawing/scatter_chart.rb | Axlsx.ScatterChart.to_xml_string | def to_xml_string(str = '')
super(str) do
str << '<c:scatterChart>'
str << ('<c:scatterStyle val="' << scatter_style.to_s << '"/>')
str << ('<c:varyColors val="' << vary_colors.to_s << '"/>')
@series.each { |ser| ser.to_xml_string(str) }
d_lbls.to_xml_string(str) if @d_lbls
axes.to_xml_string(str, :ids => true)
str << '</c:scatterChart>'
axes.to_xml_string(str)
end
str
end | ruby | def to_xml_string(str = '')
super(str) do
str << '<c:scatterChart>'
str << ('<c:scatterStyle val="' << scatter_style.to_s << '"/>')
str << ('<c:varyColors val="' << vary_colors.to_s << '"/>')
@series.each { |ser| ser.to_xml_string(str) }
d_lbls.to_xml_string(str) if @d_lbls
axes.to_xml_string(str, :ids => true)
str << '</c:scatterChart>'
axes.to_xml_string(str)
end
str
end | [
"def",
"to_xml_string",
"(",
"str",
"=",
"''",
")",
"super",
"(",
"str",
")",
"do",
"str",
"<<",
"'<c:scatterChart>'",
"str",
"<<",
"(",
"'<c:scatterStyle val=\"'",
"<<",
"scatter_style",
".",
"to_s",
"<<",
"'\"/>'",
")",
"str",
"<<",
"(",
"'<c:varyColors va... | Serializes the object
@param [String] str
@return [String] | [
"Serializes",
"the",
"object"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/drawing/scatter_chart.rb#L53-L65 | train | Returns the XML string for this chart. | [
30522,
13366,
2000,
1035,
20950,
1035,
5164,
1006,
2358,
2099,
1027,
1005,
1005,
1007,
3565,
1006,
2358,
2099,
1007,
2079,
2358,
2099,
1026,
1026,
1005,
1026,
1039,
1024,
8040,
20097,
7507,
5339,
1028,
1005,
2358,
2099,
1026,
1026,
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_web/lib/2018-02-01/generated/azure_mgmt_web/diagnostics.rb | Azure::Web::Mgmt::V2018_02_01.Diagnostics.execute_site_detector_slot | def execute_site_detector_slot(resource_group_name, site_name, detector_name, diagnostic_category, slot, start_time:nil, end_time:nil, time_grain:nil, custom_headers:nil)
response = execute_site_detector_slot_async(resource_group_name, site_name, detector_name, diagnostic_category, slot, start_time:start_time, end_time:end_time, time_grain:time_grain, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def execute_site_detector_slot(resource_group_name, site_name, detector_name, diagnostic_category, slot, start_time:nil, end_time:nil, time_grain:nil, custom_headers:nil)
response = execute_site_detector_slot_async(resource_group_name, site_name, detector_name, diagnostic_category, slot, start_time:start_time, end_time:end_time, time_grain:time_grain, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"execute_site_detector_slot",
"(",
"resource_group_name",
",",
"site_name",
",",
"detector_name",
",",
"diagnostic_category",
",",
"slot",
",",
"start_time",
":",
"nil",
",",
"end_time",
":",
"nil",
",",
"time_grain",
":",
"nil",
",",
"custom_headers",
":",... | Execute Detector
Execute Detector
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param site_name [String] Site Name
@param detector_name [String] Detector Resource Name
@param diagnostic_category [String] Category Name
@param slot [String] Slot Name
@param start_time [DateTime] Start Time
@param end_time [DateTime] End Time
@param time_grain [String] Time Grain
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [DiagnosticDetectorResponse] operation results. | [
"Execute",
"Detector"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/diagnostics.rb#L2415-L2418 | train | Executes a site detector. | [
30522,
13366,
15389,
1035,
2609,
1035,
19034,
1035,
10453,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2609,
1035,
2171,
1010,
19034,
1035,
2171,
1010,
16474,
1035,
4696,
1010,
10453,
1010,
2707,
1035,
2051,
1024,
9152,
2140,
1010,
2203,
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... |
tongueroo/jets | lib/jets/resource/api_gateway/rest_api.rb | Jets::Resource::ApiGateway.RestApi.binary_media_types | def binary_media_types
types = Jets.config.api.binary_media_types
return nil if types.nil? || types.empty?
[types].flatten
end | ruby | def binary_media_types
types = Jets.config.api.binary_media_types
return nil if types.nil? || types.empty?
[types].flatten
end | [
"def",
"binary_media_types",
"types",
"=",
"Jets",
".",
"config",
".",
"api",
".",
"binary_media_types",
"return",
"nil",
"if",
"types",
".",
"nil?",
"||",
"types",
".",
"empty?",
"[",
"types",
"]",
".",
"flatten",
"end"
] | TODO: Looks like there's a bug with CloudFormation. On an API Gateway update
we need to pass in the escaped version: multipart~1form-data
On a brand new API Gateway creation, we need to pass in the unescaped form:
multipart/form-data
We are handling this with a full API Gateway replacement instead because it
can be generalized more easily. | [
"TODO",
":",
"Looks",
"like",
"there",
"s",
"a",
"bug",
"with",
"CloudFormation",
".",
"On",
"an",
"API",
"Gateway",
"update",
"we",
"need",
"to",
"pass",
"in",
"the",
"escaped",
"version",
":",
"multipart~1form",
"-",
"data",
"On",
"a",
"brand",
"new",
... | 46943a519224067e58aa3e2d5656e3ca083150f9 | https://github.com/tongueroo/jets/blob/46943a519224067e58aa3e2d5656e3ca083150f9/lib/jets/resource/api_gateway/rest_api.rb#L53-L58 | train | Returns the array of binary media types that are the same as the given array of media types. | [
30522,
13366,
12441,
1035,
2865,
1035,
4127,
4127,
1027,
9924,
1012,
9530,
8873,
2290,
1012,
17928,
1012,
12441,
1035,
2865,
1035,
4127,
2709,
9152,
2140,
2065,
4127,
1012,
9152,
2140,
1029,
1064,
1064,
4127,
1012,
4064,
1029,
1031,
4127,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
puppetlabs/pdk | lib/pdk/template_file.rb | PDK.TemplateFile.template_content | def template_content
if File.file?(@template_file) && File.readable?(@template_file)
return File.read(@template_file)
end
raise ArgumentError, _("'%{template}' is not a readable file") % { template: @template_file }
end | ruby | def template_content
if File.file?(@template_file) && File.readable?(@template_file)
return File.read(@template_file)
end
raise ArgumentError, _("'%{template}' is not a readable file") % { template: @template_file }
end | [
"def",
"template_content",
"if",
"File",
".",
"file?",
"(",
"@template_file",
")",
"&&",
"File",
".",
"readable?",
"(",
"@template_file",
")",
"return",
"File",
".",
"read",
"(",
"@template_file",
")",
"end",
"raise",
"ArgumentError",
",",
"_",
"(",
"\"'%{te... | Reads the content of the template file into memory.
@return [String] The content of the template file.
@raise [ArgumentError] If the template file does not exist or can not be
read.
@api private | [
"Reads",
"the",
"content",
"of",
"the",
"template",
"file",
"into",
"memory",
"."
] | 0d864aff62ffef04b5104addf399d0476afd71e7 | https://github.com/puppetlabs/pdk/blob/0d864aff62ffef04b5104addf399d0476afd71e7/lib/pdk/template_file.rb#L63-L69 | train | Returns the content of the template file. | [
30522,
13366,
23561,
1035,
4180,
2065,
5371,
1012,
5371,
1029,
1006,
1030,
23561,
1035,
5371,
1007,
1004,
1004,
5371,
1012,
3191,
3085,
1029,
1006,
1030,
23561,
1035,
5371,
1007,
2709,
5371,
1012,
3191,
1006,
1030,
23561,
1035,
5371,
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_network/lib/2018-07-01/generated/azure_mgmt_network/azure_firewalls.rb | Azure::Network::Mgmt::V2018_07_01.AzureFirewalls.begin_create_or_update_with_http_info | def begin_create_or_update_with_http_info(resource_group_name, azure_firewall_name, parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, azure_firewall_name, parameters, custom_headers:custom_headers).value!
end | ruby | def begin_create_or_update_with_http_info(resource_group_name, azure_firewall_name, parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, azure_firewall_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_create_or_update_with_http_info",
"(",
"resource_group_name",
",",
"azure_firewall_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"azure_firewall_name",
",",
"parameters",
",",
... | Creates or updates the specified Azure Firewall.
@param resource_group_name [String] The name of the resource group.
@param azure_firewall_name [String] The name of the Azure Firewall.
@param parameters [AzureFirewall] Parameters supplied to the create or update
Azure Firewall operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Creates",
"or",
"updates",
"the",
"specified",
"Azure",
"Firewall",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/azure_firewalls.rb#L482-L484 | train | Creates or updates an existing Azure firewall. | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
24296,
1035,
2543,
9628,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_event_hub/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/namespaces.rb | Azure::EventHub::Mgmt::V2018_01_01_preview.Namespaces.create_or_update_ip_filter_rule_with_http_info | def create_or_update_ip_filter_rule_with_http_info(resource_group_name, namespace_name, ip_filter_rule_name, parameters, custom_headers:nil)
create_or_update_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, parameters, custom_headers:custom_headers).value!
end | ruby | def create_or_update_ip_filter_rule_with_http_info(resource_group_name, namespace_name, ip_filter_rule_name, parameters, custom_headers:nil)
create_or_update_ip_filter_rule_async(resource_group_name, namespace_name, ip_filter_rule_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"create_or_update_ip_filter_rule_with_http_info",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"ip_filter_rule_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"create_or_update_ip_filter_rule_async",
"(",
"resource_group_name",
",",
"namespac... | Creates or updates an IpFilterRule for a Namespace.
@param resource_group_name [String] Name of the resource group within the
Azure subscription.
@param namespace_name [String] The Namespace name
@param ip_filter_rule_name [String] The IP Filter Rule name.
@param parameters [IpFilterRule] The Namespace IpFilterRule.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Creates",
"or",
"updates",
"an",
"IpFilterRule",
"for",
"a",
"Namespace",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_event_hub/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/namespaces.rb#L655-L657 | train | Creates or updates an existing ip filter rule. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1035,
12997,
1035,
11307,
1035,
3627,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3415,
15327,
1035,
2171,
1010,
12997,
1035,
11307,
1035,
3627,
1035,
2171,
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... |
cloudfoundry/bosh | src/bosh-director/lib/bosh/director/deployment_plan/assembler.rb | Bosh::Director.DeploymentPlan::Assembler.bind_releases | def bind_releases
releases = @deployment_plan.releases
with_release_locks(releases.map(&:name)) do
releases.each do |release|
release.bind_model
end
end
end | ruby | def bind_releases
releases = @deployment_plan.releases
with_release_locks(releases.map(&:name)) do
releases.each do |release|
release.bind_model
end
end
end | [
"def",
"bind_releases",
"releases",
"=",
"@deployment_plan",
".",
"releases",
"with_release_locks",
"(",
"releases",
".",
"map",
"(",
":name",
")",
")",
"do",
"releases",
".",
"each",
"do",
"|",
"release",
"|",
"release",
".",
"bind_model",
"end",
"end",
"en... | Binds release DB record(s) to a plan
@return [void] | [
"Binds",
"release",
"DB",
"record",
"(",
"s",
")",
"to",
"a",
"plan"
] | 2eaa7100879ddd20cd909cd698514746195e28b7 | https://github.com/cloudfoundry/bosh/blob/2eaa7100879ddd20cd909cd698514746195e28b7/src/bosh-director/lib/bosh/director/deployment_plan/assembler.rb#L117-L124 | train | Bind the model to the current release | [
30522,
13366,
14187,
1035,
7085,
7085,
1027,
1030,
10813,
1035,
2933,
1012,
7085,
2007,
1035,
2713,
1035,
11223,
1006,
7085,
1012,
4949,
1006,
1004,
1024,
2171,
1007,
1007,
2079,
7085,
1012,
2169,
2079,
1064,
2713,
1064,
2713,
1012,
14187,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/uri.rb | Mongo.URI.hash_extractor | def hash_extractor(name, value)
value.split(',').reduce({}) do |set, tag|
k, v = tag.split(':')
if v.nil?
log_warn("Invalid hash value for #{name}: #{value}")
return nil
end
set.merge(decode(k).downcase.to_sym => decode(v))
end
end | ruby | def hash_extractor(name, value)
value.split(',').reduce({}) do |set, tag|
k, v = tag.split(':')
if v.nil?
log_warn("Invalid hash value for #{name}: #{value}")
return nil
end
set.merge(decode(k).downcase.to_sym => decode(v))
end
end | [
"def",
"hash_extractor",
"(",
"name",
",",
"value",
")",
"value",
".",
"split",
"(",
"','",
")",
".",
"reduce",
"(",
"{",
"}",
")",
"do",
"|",
"set",
",",
"tag",
"|",
"k",
",",
"v",
"=",
"tag",
".",
"split",
"(",
"':'",
")",
"if",
"v",
".",
... | Extract values from the string and put them into a nested hash.
@param value [ String ] The string to build a hash from.
@return [ Hash ] The hash built from the string. | [
"Extract",
"values",
"from",
"the",
"string",
"and",
"put",
"them",
"into",
"a",
"nested",
"hash",
"."
] | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/uri.rb#L1016-L1026 | train | Extract the hash from the given value. | [
30522,
13366,
23325,
1035,
14817,
2953,
1006,
2171,
1010,
3643,
1007,
3643,
1012,
3975,
1006,
1005,
1010,
1005,
1007,
1012,
5547,
1006,
1063,
1065,
1007,
2079,
1064,
2275,
1010,
6415,
1064,
1047,
1010,
1058,
1027,
6415,
1012,
3975,
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... |
randym/axlsx | lib/axlsx/workbook/worksheet/conditional_formatting.rb | Axlsx.ConditionalFormatting.add_rules | def add_rules(rules)
rules = [rules] if rules.is_a? Hash
rules.each do |rule|
add_rule rule
end
end | ruby | def add_rules(rules)
rules = [rules] if rules.is_a? Hash
rules.each do |rule|
add_rule rule
end
end | [
"def",
"add_rules",
"(",
"rules",
")",
"rules",
"=",
"[",
"rules",
"]",
"if",
"rules",
".",
"is_a?",
"Hash",
"rules",
".",
"each",
"do",
"|",
"rule",
"|",
"add_rule",
"rule",
"end",
"end"
] | Add Conditional Formatting Rules to this object. Rules can either
be already created {ConditionalFormattingRule} elements or
hashes of options for automatic creation. If rules is a hash
instead of an array, assume only one rule being added.
@example This would apply formatting "1" to cells > 20, and formatting "2" to cells < 1
conditional_formatting.add_rules [
{ :type => :cellIs, :operator => :greaterThan, :formula => "20", :dxfId => 1, :priority=> 1 },
{ :type => :cellIs, :operator => :lessThan, :formula => "10", :dxfId => 2, :priority=> 2 } ]
@param [Array|Hash] rules the rules to apply, can be just one in hash form
@see ConditionalFormattingRule#initialize | [
"Add",
"Conditional",
"Formatting",
"Rules",
"to",
"this",
"object",
".",
"Rules",
"can",
"either",
"be",
"already",
"created",
"{",
"ConditionalFormattingRule",
"}",
"elements",
"or",
"hashes",
"of",
"options",
"for",
"automatic",
"creation",
".",
"If",
"rules"... | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/worksheet/conditional_formatting.rb#L43-L48 | train | Add rules to the current page | [
30522,
13366,
5587,
1035,
3513,
1006,
3513,
1007,
3513,
1027,
1031,
3513,
1033,
2065,
3513,
1012,
2003,
1035,
1037,
1029,
23325,
3513,
1012,
2169,
2079,
1064,
3627,
1064,
5587,
1035,
3627,
3627,
2203,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.backup_key | def backup_key(vault_base_url, key_name, custom_headers:nil)
response = backup_key_async(vault_base_url, key_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def backup_key(vault_base_url, key_name, custom_headers:nil)
response = backup_key_async(vault_base_url, key_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"backup_key",
"(",
"vault_base_url",
",",
"key_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"backup_key_async",
"(",
"vault_base_url",
",",
"key_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",... | Requests that a backup of the specified key be downloaded to the client.
The Key Backup operation exports a key from Azure Key Vault in a protected
form. Note that this operation does NOT return key material in a form that
can be used outside the Azure Key Vault system, the returned key material is
either protected to a Azure Key Vault HSM or to Azure Key Vault itself. The
intent of this operation is to allow a client to GENERATE a key in one Azure
Key Vault instance, BACKUP the key, and then RESTORE it into another Azure
Key Vault instance. The BACKUP operation may be used to export, in protected
form, any key type from Azure Key Vault. Individual versions of a key cannot
be backed up. BACKUP / RESTORE can be performed within geographical
boundaries only; meaning that a BACKUP from one geographical area cannot be
restored to another geographical area. For example, a backup from the US
geographical area cannot be restored in an EU geographical area. This
operation requires the key/backup 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 [BackupKeyResult] operation results. | [
"Requests",
"that",
"a",
"backup",
"of",
"the",
"specified",
"key",
"be",
"downloaded",
"to",
"the",
"client",
"."
] | 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#L1046-L1049 | train | Backup a key. | [
30522,
13366,
10200,
1035,
3145,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
3145,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
10200,
1035,
3145,
1035,
2004,
6038,
2278,
1006,
11632,
1035,
2918,
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... |
sds/overcommit | lib/overcommit/hook_signer.rb | Overcommit.HookSigner.update_signature! | def update_signature!
result = Overcommit::Utils.execute(
%w[git config --local] + [signature_config_key, signature]
)
unless result.success?
raise Overcommit::Exceptions::GitConfigError,
"Unable to write to local repo git config: #{result.stderr}"
end
end | ruby | def update_signature!
result = Overcommit::Utils.execute(
%w[git config --local] + [signature_config_key, signature]
)
unless result.success?
raise Overcommit::Exceptions::GitConfigError,
"Unable to write to local repo git config: #{result.stderr}"
end
end | [
"def",
"update_signature!",
"result",
"=",
"Overcommit",
"::",
"Utils",
".",
"execute",
"(",
"%w[",
"git",
"config",
"--local",
"]",
"+",
"[",
"signature_config_key",
",",
"signature",
"]",
")",
"unless",
"result",
".",
"success?",
"raise",
"Overcommit",
"::",... | Update the current stored signature for this hook. | [
"Update",
"the",
"current",
"stored",
"signature",
"for",
"this",
"hook",
"."
] | 35d60adb41da942178b789560968e3ad030b0ac7 | https://github.com/sds/overcommit/blob/35d60adb41da942178b789560968e3ad030b0ac7/lib/overcommit/hook_signer.rb#L69-L78 | train | Update the signature of the current object. | [
30522,
13366,
10651,
1035,
8085,
999,
2765,
1027,
2058,
9006,
22930,
1024,
1024,
21183,
12146,
1012,
15389,
1006,
1003,
1059,
1031,
21025,
2102,
9530,
8873,
2290,
1011,
1011,
2334,
1033,
1009,
1031,
8085,
1035,
9530,
8873,
2290,
1035,
3145,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
boazsegev/combine_pdf | lib/combine_pdf/fonts.rb | CombinePDF.Fonts.dimensions_of | def dimensions_of(text, fonts, size = 1000)
fonts = [fonts] unless fonts.is_a? Array
merged_metrics = {}
# merge the metrics last to first (so that important fonts override secondary fonts)
fonts.length.downto(1).each do |i|
f = get_original_font(fonts[i - 1])
if f && f.metrics
merged_metrics.update(get_original_font(fonts[i - 1]).metrics)
else
warn 'metrics of font not found!'
end
end
metrics_array = []
text.each_char do |c|
metrics_array << (merged_metrics[c] || { wx: 0, boundingbox: [0, 0, 0, 0] })
end
height = metrics_array.map { |m| m ? m[:boundingbox][3] : 0 } .max
height -= (metrics_array.map { |m| m ? m[:boundingbox][1] : 0 }).min
width = 0.0
metrics_array.each do |m|
width += (m[:wx] || m[:wy])
end
return [height.to_f / 1000 * size, width.to_f / 1000 * size] if metrics_array[0][:wy]
[width.to_f / 1000 * size, height.to_f / 1000 * size]
end | ruby | def dimensions_of(text, fonts, size = 1000)
fonts = [fonts] unless fonts.is_a? Array
merged_metrics = {}
# merge the metrics last to first (so that important fonts override secondary fonts)
fonts.length.downto(1).each do |i|
f = get_original_font(fonts[i - 1])
if f && f.metrics
merged_metrics.update(get_original_font(fonts[i - 1]).metrics)
else
warn 'metrics of font not found!'
end
end
metrics_array = []
text.each_char do |c|
metrics_array << (merged_metrics[c] || { wx: 0, boundingbox: [0, 0, 0, 0] })
end
height = metrics_array.map { |m| m ? m[:boundingbox][3] : 0 } .max
height -= (metrics_array.map { |m| m ? m[:boundingbox][1] : 0 }).min
width = 0.0
metrics_array.each do |m|
width += (m[:wx] || m[:wy])
end
return [height.to_f / 1000 * size, width.to_f / 1000 * size] if metrics_array[0][:wy]
[width.to_f / 1000 * size, height.to_f / 1000 * size]
end | [
"def",
"dimensions_of",
"(",
"text",
",",
"fonts",
",",
"size",
"=",
"1000",
")",
"fonts",
"=",
"[",
"fonts",
"]",
"unless",
"fonts",
".",
"is_a?",
"Array",
"merged_metrics",
"=",
"{",
"}",
"# merge the metrics last to first (so that important fonts override seconda... | gets the dimentions (width and height) of the text, as it will be printed in the PDF.
text:: the text to measure
fonts:: a font name or an Array of font names. Font names should be registered fonts. The 14 standard fonts are pre regitered with the font library.
size:: the size of the font (defaults to 1000 points). | [
"gets",
"the",
"dimentions",
"(",
"width",
"and",
"height",
")",
"of",
"the",
"text",
"as",
"it",
"will",
"be",
"printed",
"in",
"the",
"PDF",
"."
] | 09054051019c069f551f3e60be789577c0f93900 | https://github.com/boazsegev/combine_pdf/blob/09054051019c069f551f3e60be789577c0f93900/lib/combine_pdf/fonts.rb#L124-L149 | train | Returns the dimensions of the text. | [
30522,
13366,
9646,
1035,
1997,
1006,
3793,
1010,
15489,
2015,
1010,
2946,
1027,
6694,
1007,
15489,
2015,
1027,
1031,
15489,
2015,
1033,
4983,
15489,
2015,
1012,
2003,
1035,
1037,
1029,
9140,
5314,
1035,
12046,
2015,
1027,
1063,
1065,
1001,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
opal/opal | lib/opal/compiler.rb | Opal.Compiler.unique_temp | def unique_temp(name)
name = name.to_s
if name && !name.empty?
name = name
.to_s
.gsub('<=>', '$lt_eq_gt')
.gsub('===', '$eq_eq_eq')
.gsub('==', '$eq_eq')
.gsub('=~', '$eq_tilde')
.gsub('!~', '$excl_tilde')
.gsub('!=', '$not_eq')
.gsub('<=', '$lt_eq')
.gsub('>=', '$gt_eq')
.gsub('=', '$eq')
.gsub('?', '$ques')
.gsub('!', '$excl')
.gsub('/', '$slash')
.gsub('%', '$percent')
.gsub('+', '$plus')
.gsub('-', '$minus')
.gsub('<', '$lt')
.gsub('>', '$gt')
.gsub(/[^\w\$]/, '$')
end
unique = (@unique += 1)
"#{'$' unless name.start_with?('$')}#{name}$#{unique}"
end | ruby | def unique_temp(name)
name = name.to_s
if name && !name.empty?
name = name
.to_s
.gsub('<=>', '$lt_eq_gt')
.gsub('===', '$eq_eq_eq')
.gsub('==', '$eq_eq')
.gsub('=~', '$eq_tilde')
.gsub('!~', '$excl_tilde')
.gsub('!=', '$not_eq')
.gsub('<=', '$lt_eq')
.gsub('>=', '$gt_eq')
.gsub('=', '$eq')
.gsub('?', '$ques')
.gsub('!', '$excl')
.gsub('/', '$slash')
.gsub('%', '$percent')
.gsub('+', '$plus')
.gsub('-', '$minus')
.gsub('<', '$lt')
.gsub('>', '$gt')
.gsub(/[^\w\$]/, '$')
end
unique = (@unique += 1)
"#{'$' unless name.start_with?('$')}#{name}$#{unique}"
end | [
"def",
"unique_temp",
"(",
"name",
")",
"name",
"=",
"name",
".",
"to_s",
"if",
"name",
"&&",
"!",
"name",
".",
"empty?",
"name",
"=",
"name",
".",
"to_s",
".",
"gsub",
"(",
"'<=>'",
",",
"'$lt_eq_gt'",
")",
".",
"gsub",
"(",
"'==='",
",",
"'$eq_eq... | Used to generate a unique id name per file. These are used
mainly to name method bodies for methods that use blocks. | [
"Used",
"to",
"generate",
"a",
"unique",
"id",
"name",
"per",
"file",
".",
"These",
"are",
"used",
"mainly",
"to",
"name",
"method",
"bodies",
"for",
"methods",
"that",
"use",
"blocks",
"."
] | 41aedc0fd62aab00d3c117ba0caf00206bedd981 | https://github.com/opal/opal/blob/41aedc0fd62aab00d3c117ba0caf00206bedd981/lib/opal/compiler.rb#L270-L296 | train | Returns a unique temp name | [
30522,
13366,
4310,
1035,
8915,
8737,
1006,
2171,
1007,
2171,
1027,
2171,
1012,
2000,
1035,
1055,
2065,
2171,
1004,
1004,
999,
2171,
1012,
4064,
1029,
2171,
1027,
2171,
1012,
2000,
1035,
1055,
1012,
28177,
12083,
1006,
1005,
1026,
1027,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hashicorp/vault-ruby | lib/vault/encode.rb | Vault.EncodePath.encode_path | def encode_path(path)
path.b.gsub(%r!([^a-zA-Z0-9_.-/]+)!) { |m|
'%' + m.unpack('H2' * m.bytesize).join('%').upcase
}
end | ruby | def encode_path(path)
path.b.gsub(%r!([^a-zA-Z0-9_.-/]+)!) { |m|
'%' + m.unpack('H2' * m.bytesize).join('%').upcase
}
end | [
"def",
"encode_path",
"(",
"path",
")",
"path",
".",
"b",
".",
"gsub",
"(",
"%r!",
"!",
")",
"{",
"|",
"m",
"|",
"'%'",
"+",
"m",
".",
"unpack",
"(",
"'H2'",
"*",
"m",
".",
"bytesize",
")",
".",
"join",
"(",
"'%'",
")",
".",
"upcase",
"}",
... | Encodes a string according to the rules for URL paths. This is
used as opposed to CGI.escape because in a URL path, space
needs to be escaped as %20 and CGI.escapes a space as +.
@param [String]
@return [String] | [
"Encodes",
"a",
"string",
"according",
"to",
"the",
"rules",
"for",
"URL",
"paths",
".",
"This",
"is",
"used",
"as",
"opposed",
"to",
"CGI",
".",
"escape",
"because",
"in",
"a",
"URL",
"path",
"space",
"needs",
"to",
"be",
"escaped",
"as",
"%20",
"and"... | 02f0532a802ba1a2a0d8703a4585dab76eb9d864 | https://github.com/hashicorp/vault-ruby/blob/02f0532a802ba1a2a0d8703a4585dab76eb9d864/lib/vault/encode.rb#L11-L15 | train | Encode a path to a valid URL. | [
30522,
13366,
4372,
16044,
1035,
4130,
1006,
4130,
1007,
4130,
1012,
1038,
1012,
28177,
12083,
1006,
1003,
1054,
999,
1006,
1031,
1034,
1037,
1011,
23564,
1011,
1062,
2692,
1011,
1023,
1035,
1012,
1011,
1013,
1033,
1009,
1007,
999,
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... |
backup/backup | lib/backup/model.rb | Backup.Model.procedures | def procedures
return [] unless databases.any? || archives.any?
[-> { prepare! }, databases, archives,
-> { package! }, -> { store! }, -> { clean! }]
end | ruby | def procedures
return [] unless databases.any? || archives.any?
[-> { prepare! }, databases, archives,
-> { package! }, -> { store! }, -> { clean! }]
end | [
"def",
"procedures",
"return",
"[",
"]",
"unless",
"databases",
".",
"any?",
"||",
"archives",
".",
"any?",
"[",
"->",
"{",
"prepare!",
"}",
",",
"databases",
",",
"archives",
",",
"->",
"{",
"package!",
"}",
",",
"->",
"{",
"store!",
"}",
",",
"->",... | Returns an array of procedures that will be performed if any
Archives or Databases are configured for the model. | [
"Returns",
"an",
"array",
"of",
"procedures",
"that",
"will",
"be",
"performed",
"if",
"any",
"Archives",
"or",
"Databases",
"are",
"configured",
"for",
"the",
"model",
"."
] | 64370f925e859f858766b674717a3dbee0de7a26 | https://github.com/backup/backup/blob/64370f925e859f858766b674717a3dbee0de7a26/lib/backup/model.rb#L297-L302 | train | Returns an array of procedures that are executed in the order they were created. | [
30522,
13366,
8853,
2709,
1031,
1033,
4983,
17881,
1012,
2151,
1029,
1064,
1064,
8264,
1012,
2151,
1029,
1031,
1011,
1028,
1063,
7374,
999,
1065,
1010,
17881,
1010,
8264,
1010,
1011,
1028,
1063,
7427,
999,
1065,
1010,
1011,
1028,
1063,
35... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_datalake_analytics/lib/2016-11-01/generated/azure_mgmt_datalake_analytics/locations.rb | Azure::DataLakeAnalytics::Mgmt::V2016_11_01.Locations.get_capability | def get_capability(location, custom_headers:nil)
response = get_capability_async(location, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_capability(location, custom_headers:nil)
response = get_capability_async(location, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_capability",
"(",
"location",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_capability_async",
"(",
"location",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"response",
".",
"nil?",
... | Gets subscription-level properties and limits for Data Lake Analytics
specified by resource location.
@param location [String] The resource location without whitespace.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [CapabilityInformation] operation results. | [
"Gets",
"subscription",
"-",
"level",
"properties",
"and",
"limits",
"for",
"Data",
"Lake",
"Analytics",
"specified",
"by",
"resource",
"location",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_datalake_analytics/lib/2016-11-01/generated/azure_mgmt_datalake_analytics/locations.rb#L34-L37 | train | Gets the capability of a given location. | [
30522,
13366,
2131,
1035,
10673,
1006,
3295,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
10673,
1035,
2004,
6038,
2278,
1006,
3295,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
20346,
2015,
1007,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/network_watchers.rb | Azure::Network::Mgmt::V2018_08_01.NetworkWatchers.get_troubleshooting_result | def get_troubleshooting_result(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
response = get_troubleshooting_result_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_troubleshooting_result(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
response = get_troubleshooting_result_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_troubleshooting_result",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_troubleshooting_result_async",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"param... | Get the last completed troubleshooting result on a specified resource
@param resource_group_name [String] The name of the resource group.
@param network_watcher_name [String] The name of the network watcher
resource.
@param parameters [QueryTroubleshootingParameters] Parameters that define the
resource to query the troubleshooting result.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [TroubleshootingResult] operation results. | [
"Get",
"the",
"last",
"completed",
"troubleshooting",
"result",
"on",
"a",
"specified",
"resource"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/network_watchers.rb#L854-L857 | train | Gets the troubleshooting result of a specified resource group. | [
30522,
13366,
2131,
1035,
13460,
23416,
2075,
1035,
2765,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2897,
1035,
3422,
2121,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
13460,
23416... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/workflow_triggers.rb | Azure::Logic::Mgmt::V2016_06_01.WorkflowTriggers.reset | def reset(resource_group_name, workflow_name, trigger_name, custom_headers:nil)
response = reset_async(resource_group_name, workflow_name, trigger_name, custom_headers:custom_headers).value!
nil
end | ruby | def reset(resource_group_name, workflow_name, trigger_name, custom_headers:nil)
response = reset_async(resource_group_name, workflow_name, trigger_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"reset",
"(",
"resource_group_name",
",",
"workflow_name",
",",
"trigger_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"reset_async",
"(",
"resource_group_name",
",",
"workflow_name",
",",
"trigger_name",
",",
"custom_headers",
":custom_header... | Resets a workflow trigger.
@param resource_group_name [String] The resource group name.
@param workflow_name [String] The workflow name.
@param trigger_name [String] The workflow trigger name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Resets",
"a",
"workflow",
"trigger",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/workflow_triggers.rb#L228-L231 | train | Reset a workflow trigger. | [
30522,
13366,
25141,
1006,
7692,
1035,
2177,
1035,
2171,
30524,
1035,
2177,
1035,
2171,
1010,
2147,
12314,
1035,
2171,
1010,
9495,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
20346,
2015,
1007,
1012,
3643,
999,
9152,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_storagesync/lib/2018-07-01/generated/azure_mgmt_storagesync/server_endpoints.rb | Azure::StorageSync::Mgmt::V2018_07_01.ServerEndpoints.begin_create | def begin_create(resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, parameters, custom_headers:nil)
response = begin_create_async(resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_create(resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, parameters, custom_headers:nil)
response = begin_create_async(resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_create",
"(",
"resource_group_name",
",",
"storage_sync_service_name",
",",
"sync_group_name",
",",
"server_endpoint_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_create_async",
"(",
"resource_group_name",
",",
"... | Create a new ServerEndpoint.
@param resource_group_name [String] The name of the resource group. The name
is case insensitive.
@param storage_sync_service_name [String] Name of Storage Sync Service
resource.
@param sync_group_name [String] Name of Sync Group resource.
@param server_endpoint_name [String] Name of Server Endpoint object.
@param parameters [ServerEndpointCreateParameters] Body of Server Endpoint
object.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ServerEndpoint] operation results. | [
"Create",
"a",
"new",
"ServerEndpoint",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_storagesync/lib/2018-07-01/generated/azure_mgmt_storagesync/server_endpoints.rb#L460-L463 | train | Creates a new server endpoint. | [
30522,
13366,
4088,
1035,
3443,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
5527,
1035,
26351,
1035,
2326,
1035,
2171,
1010,
26351,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2203,
8400,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/scss-lint | lib/scss_lint/linter/space_before_brace.rb | SCSSLint.Linter::SpaceBeforeBrace.newline_before_nonwhitespace | def newline_before_nonwhitespace(string)
offset = -2
while /\S/.match(string[offset]).nil?
return true if string[offset] == "\n"
offset -= 1
end
false
end | ruby | def newline_before_nonwhitespace(string)
offset = -2
while /\S/.match(string[offset]).nil?
return true if string[offset] == "\n"
offset -= 1
end
false
end | [
"def",
"newline_before_nonwhitespace",
"(",
"string",
")",
"offset",
"=",
"-",
"2",
"while",
"/",
"\\S",
"/",
".",
"match",
"(",
"string",
"[",
"offset",
"]",
")",
".",
"nil?",
"return",
"true",
"if",
"string",
"[",
"offset",
"]",
"==",
"\"\\n\"",
"off... | Check if, starting from the end of a string
and moving backwards, towards the beginning,
we find a new line before any non-whitespace characters | [
"Check",
"if",
"starting",
"from",
"the",
"end",
"of",
"a",
"string",
"and",
"moving",
"backwards",
"towards",
"the",
"beginning",
"we",
"find",
"a",
"new",
"line",
"before",
"any",
"non",
"-",
"whitespace",
"characters"
] | e99afe4ede041a431a06e585c12ce82f6ad50116 | https://github.com/sds/scss-lint/blob/e99afe4ede041a431a06e585c12ce82f6ad50116/lib/scss_lint/linter/space_before_brace.rb#L67-L74 | train | Returns true if the string starts with a newline. | [
30522,
13366,
2047,
4179,
1035,
2077,
1035,
2512,
2860,
16584,
2229,
15327,
1006,
5164,
1007,
16396,
1027,
1011,
1016,
2096,
1013,
1032,
1055,
1013,
1012,
2674,
1006,
5164,
1031,
16396,
1033,
1007,
1012,
9152,
2140,
1029,
2709,
2995,
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_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/devices.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.Devices.get_update_summary_with_http_info | def get_update_summary_with_http_info(device_name, resource_group_name, manager_name, custom_headers:nil)
get_update_summary_async(device_name, resource_group_name, manager_name, custom_headers:custom_headers).value!
end | ruby | def get_update_summary_with_http_info(device_name, resource_group_name, manager_name, custom_headers:nil)
get_update_summary_async(device_name, resource_group_name, manager_name, custom_headers:custom_headers).value!
end | [
"def",
"get_update_summary_with_http_info",
"(",
"device_name",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"get_update_summary_async",
"(",
"device_name",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
... | Returns the update summary of the specified device name.
@param device_name [String] The device name
@param resource_group_name [String] The resource group name
@param manager_name [String] The manager name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Returns",
"the",
"update",
"summary",
"of",
"the",
"specified",
"device",
"name",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/devices.rb#L969-L971 | train | Gets the update summary of the specified managed volume. | [
30522,
13366,
2131,
1035,
10651,
1035,
12654,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
5080,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
10651,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_scheduler/lib/2016-03-01/generated/azure_mgmt_scheduler/jobs.rb | Azure::Scheduler::Mgmt::V2016_03_01.Jobs.list_job_history_as_lazy | def list_job_history_as_lazy(resource_group_name, job_collection_name, job_name, top:nil, skip:nil, filter:nil, custom_headers:nil)
response = list_job_history_async(resource_group_name, job_collection_name, job_name, top:top, skip:skip, filter:filter, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_job_history_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_job_history_as_lazy(resource_group_name, job_collection_name, job_name, top:nil, skip:nil, filter:nil, custom_headers:nil)
response = list_job_history_async(resource_group_name, job_collection_name, job_name, top:top, skip:skip, filter:filter, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_job_history_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_job_history_as_lazy",
"(",
"resource_group_name",
",",
"job_collection_name",
",",
"job_name",
",",
"top",
":",
"nil",
",",
"skip",
":",
"nil",
",",
"filter",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_job_history_asy... | Lists job history.
@param resource_group_name [String] The resource group name.
@param job_collection_name [String] The job collection name.
@param job_name [String] The job name.
@param top [Integer] the number of job history to request, in the of range of
[1..100].
@param skip [Integer] The (0-based) index of the job history list from which
to begin requesting entries.
@param filter [String] The filter to apply on the job state.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [JobHistoryListResult] which provide lazy access to pages of the
response. | [
"Lists",
"job",
"history",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_scheduler/lib/2016-03-01/generated/azure_mgmt_scheduler/jobs.rb#L955-L964 | train | Gets the job history of a job. | [
30522,
13366,
2862,
1035,
3105,
1035,
2381,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3105,
1035,
3074,
1035,
2171,
1010,
3105,
1035,
2171,
1010,
2327,
1024,
9152,
2140,
1010,
13558,
1024,
9152,
2140,
1010,
11307,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/databases.rb | Azure::SQL::Mgmt::V2014_04_01.Databases.create_import_operation | def create_import_operation(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
response = create_import_operation_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_import_operation(resource_group_name, server_name, database_name, parameters, custom_headers:nil)
response = create_import_operation_async(resource_group_name, server_name, database_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_import_operation",
"(",
"resource_group_name",
",",
"server_name",
",",
"database_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_import_operation_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"dat... | Creates an import operation that imports a bacpac into an existing database.
The existing database must be empty.
@param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param server_name [String] The name of the server.
@param database_name [String] The name of the database to import into
@param parameters [ImportExtensionRequest] The required parameters for
importing a Bacpac into a database.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ImportExportResponse] operation results. | [
"Creates",
"an",
"import",
"operation",
"that",
"imports",
"a",
"bacpac",
"into",
"an",
"existing",
"database",
".",
"The",
"existing",
"database",
"must",
"be",
"empty",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/databases.rb#L1030-L1033 | train | Creates an import operation. | [
30522,
13366,
3443,
1035,
12324,
1035,
3169,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
7809,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3443,
1035,
12324,
1035,
3169,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.create_tag_with_http_info | def create_tag_with_http_info(project_id, name, description:nil, type:nil, custom_headers:nil)
create_tag_async(project_id, name, description:description, type:type, custom_headers:custom_headers).value!
end | ruby | def create_tag_with_http_info(project_id, name, description:nil, type:nil, custom_headers:nil)
create_tag_async(project_id, name, description:description, type:type, custom_headers:custom_headers).value!
end | [
"def",
"create_tag_with_http_info",
"(",
"project_id",
",",
"name",
",",
"description",
":",
"nil",
",",
"type",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"create_tag_async",
"(",
"project_id",
",",
"name",
",",
"description",
":",
"description",
","... | Create a tag for the project.
@param project_id The project id.
@param name [String] The tag name.
@param description [String] Optional description for the tag.
@param type [Enum] Optional type for the tag. Possible values include:
'Regular', 'Negative'
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Create",
"a",
"tag",
"for",
"the",
"project",
"."
] | 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#L4624-L4626 | train | Creates a tag for a given project. | [
30522,
13366,
3443,
1035,
6415,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2622,
1035,
8909,
1010,
2171,
1010,
6412,
1024,
9152,
2140,
1010,
2828,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3443,
1035,
6415,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_key_with_http_info | def update_key_with_http_info(vault_base_url, key_name, key_version, key_ops:nil, key_attributes:nil, tags:nil, custom_headers:nil)
update_key_async(vault_base_url, key_name, key_version, key_ops:key_ops, key_attributes:key_attributes, tags:tags, custom_headers:custom_headers).value!
end | ruby | def update_key_with_http_info(vault_base_url, key_name, key_version, key_ops:nil, key_attributes:nil, tags:nil, custom_headers:nil)
update_key_async(vault_base_url, key_name, key_version, key_ops:key_ops, key_attributes:key_attributes, tags:tags, custom_headers:custom_headers).value!
end | [
"def",
"update_key_with_http_info",
"(",
"vault_base_url",
",",
"key_name",
",",
"key_version",
",",
"key_ops",
":",
"nil",
",",
"key_attributes",
":",
"nil",
",",
"tags",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"update_key_async",
"(",
"vault_base_u... | The update key operation changes specified attributes of a stored key and can
be applied to any key type and key version stored in Azure Key Vault.
In order to perform this operation, the key must already exist in the Key
Vault. Note: The cryptographic material of a key itself cannot be changed.
This operation requires the keys/update permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param key_name [String] The name of key to update.
@param key_version [String] The version of the key to update.
@param key_ops [Array<JsonWebKeyOperation>] Json web key operations. For more
information on possible key operations, see JsonWebKeyOperation.
@param key_attributes [KeyAttributes]
@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 [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"The",
"update",
"key",
"operation",
"changes",
"specified",
"attributes",
"of",
"a",
"stored",
"key",
"and",
"can",
"be",
"applied",
"to",
"any",
"key",
"type",
"and",
"key",
"version",
"stored",
"in",
"Azure",
"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#L586-L588 | train | Updates a key in a key vault. | [
30522,
13366,
10651,
1035,
3145,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
3145,
1035,
2171,
1010,
3145,
1035,
2544,
1010,
3145,
1035,
23092,
1024,
9152,
2140,
1010,
3145,
1035,
12332,
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... |
haml/haml | lib/haml/buffer.rb | Haml.Buffer.parse_object_ref | def parse_object_ref(ref)
prefix = ref[1]
ref = ref[0]
# Let's make sure the value isn't nil. If it is, return the default Hash.
return {} if ref.nil?
class_name =
if ref.respond_to?(:haml_object_ref)
ref.haml_object_ref
else
underscore(ref.class)
end
ref_id =
if ref.respond_to?(:to_key)
key = ref.to_key
key.join('_') unless key.nil?
else
ref.id
end
id = "#{class_name}_#{ref_id || 'new'}"
if prefix
class_name = "#{ prefix }_#{ class_name}"
id = "#{ prefix }_#{ id }"
end
{ 'id'.freeze => id, 'class'.freeze => class_name }
end | ruby | def parse_object_ref(ref)
prefix = ref[1]
ref = ref[0]
# Let's make sure the value isn't nil. If it is, return the default Hash.
return {} if ref.nil?
class_name =
if ref.respond_to?(:haml_object_ref)
ref.haml_object_ref
else
underscore(ref.class)
end
ref_id =
if ref.respond_to?(:to_key)
key = ref.to_key
key.join('_') unless key.nil?
else
ref.id
end
id = "#{class_name}_#{ref_id || 'new'}"
if prefix
class_name = "#{ prefix }_#{ class_name}"
id = "#{ prefix }_#{ id }"
end
{ 'id'.freeze => id, 'class'.freeze => class_name }
end | [
"def",
"parse_object_ref",
"(",
"ref",
")",
"prefix",
"=",
"ref",
"[",
"1",
"]",
"ref",
"=",
"ref",
"[",
"0",
"]",
"# Let's make sure the value isn't nil. If it is, return the default Hash.",
"return",
"{",
"}",
"if",
"ref",
".",
"nil?",
"class_name",
"=",
"if",... | Takes an array of objects and uses the class and id of the first
one to create an attributes hash.
The second object, if present, is used as a prefix,
just like you can do with `dom_id()` and `dom_class()` in Rails | [
"Takes",
"an",
"array",
"of",
"objects",
"and",
"uses",
"the",
"class",
"and",
"id",
"of",
"the",
"first",
"one",
"to",
"create",
"an",
"attributes",
"hash",
".",
"The",
"second",
"object",
"if",
"present",
"is",
"used",
"as",
"a",
"prefix",
"just",
"l... | 9aa0fbe4a91b999978927be569d2ad0cd39076f1 | https://github.com/haml/haml/blob/9aa0fbe4a91b999978927be569d2ad0cd39076f1/lib/haml/buffer.rb#L197-L222 | train | Parse an object ref. | [
30522,
13366,
11968,
3366,
1035,
4874,
1035,
25416,
1006,
25416,
1007,
17576,
1027,
25416,
1031,
1015,
1033,
25416,
1027,
25416,
1031,
1014,
1033,
1001,
2292,
1005,
1055,
2191,
2469,
1996,
3643,
3475,
1005,
1056,
9152,
2140,
1012,
2065,
200... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.retrieve_modifier_list | def retrieve_modifier_list(location_id, modifier_list_id, opts = {})
data, _status_code, _headers = retrieve_modifier_list_with_http_info(location_id, modifier_list_id, opts)
return data
end | ruby | def retrieve_modifier_list(location_id, modifier_list_id, opts = {})
data, _status_code, _headers = retrieve_modifier_list_with_http_info(location_id, modifier_list_id, opts)
return data
end | [
"def",
"retrieve_modifier_list",
"(",
"location_id",
",",
"modifier_list_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"retrieve_modifier_list_with_http_info",
"(",
"location_id",
",",
"modifier_list_id",
",",
"opts",
")",
... | RetrieveModifierList
Provides the details for a single modifier list.
@param location_id The ID of the item's associated location.
@param modifier_list_id The modifier list's ID.
@param [Hash] opts the optional parameters
@return [V1ModifierList] | [
"RetrieveModifierList",
"Provides",
"the",
"details",
"for",
"a",
"single",
"modifier",
"list",
"."
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/v1_items_api.rb#L1819-L1822 | train | Retrieve a modifier list | [
30522,
13366,
12850,
1035,
16913,
18095,
1035,
2862,
1006,
3295,
1035,
8909,
1010,
16913,
18095,
1035,
2862,
1035,
8909,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
12850,
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_policy_insights/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_states.rb | Azure::PolicyInsights::Mgmt::V2018_04_04.PolicyStates.list_query_results_for_subscription_level_policy_assignment | def list_query_results_for_subscription_level_policy_assignment(policy_states_resource, subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
response = list_query_results_for_subscription_level_policy_assignment_async(policy_states_resource, subscription_id, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_query_results_for_subscription_level_policy_assignment(policy_states_resource, subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
response = list_query_results_for_subscription_level_policy_assignment_async(policy_states_resource, subscription_id, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_query_results_for_subscription_level_policy_assignment",
"(",
"policy_states_resource",
",",
"subscription_id",
",",
"policy_assignment_name",
",",
"query_options",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_query_results_for_subscri... | Queries policy states for the subscription level policy assignment.
@param policy_states_resource [PolicyStatesResource] The virtual resource
under PolicyStates resource type. In a given time range, 'latest' represents
the latest policy state(s), whereas 'default' represents all policy state(s).
Possible values include: 'default', 'latest'
@param subscription_id [String] Microsoft Azure subscription ID.
@param policy_assignment_name [String] Policy assignment name.
@param query_options [QueryOptions] Additional parameters for the operation
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [PolicyStatesQueryResults] operation results. | [
"Queries",
"policy",
"states",
"for",
"the",
"subscription",
"level",
"policy",
"assignment",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_policy_insights/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_states.rb#L1499-L1502 | train | Gets the policy states for the subscription level policy assignment. | [
30522,
13366,
2862,
1035,
23032,
1035,
3463,
1035,
2005,
1035,
15002,
1035,
2504,
1035,
3343,
1035,
8775,
1006,
3343,
1035,
2163,
1035,
7692,
1010,
15002,
1035,
8909,
1010,
3343,
30524,
2163,
1035,
7692,
1010,
15002,
1035,
8909,
1010,
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... |
daddyz/phonelib | lib/phonelib/phone_analyzer_helper.rb | Phonelib.PhoneAnalyzerHelper.vanity_converted | def vanity_converted(phone)
return phone unless Phonelib.vanity_conversion
(phone || '').gsub(cr('[a-zA-Z]')) do |c|
c.upcase!
# subtract "A"
n = (c.ord - 65) / 3
# account for #7 & #9 which have 4 chars
n -= 1 if c.match(Core::VANITY_4_LETTERS_KEYS_REGEX)
(n + 2).to_s
end
end | ruby | def vanity_converted(phone)
return phone unless Phonelib.vanity_conversion
(phone || '').gsub(cr('[a-zA-Z]')) do |c|
c.upcase!
# subtract "A"
n = (c.ord - 65) / 3
# account for #7 & #9 which have 4 chars
n -= 1 if c.match(Core::VANITY_4_LETTERS_KEYS_REGEX)
(n + 2).to_s
end
end | [
"def",
"vanity_converted",
"(",
"phone",
")",
"return",
"phone",
"unless",
"Phonelib",
".",
"vanity_conversion",
"(",
"phone",
"||",
"''",
")",
".",
"gsub",
"(",
"cr",
"(",
"'[a-zA-Z]'",
")",
")",
"do",
"|",
"c",
"|",
"c",
".",
"upcase!",
"# subtract \"A... | converts symbols in phone to numbers | [
"converts",
"symbols",
"in",
"phone",
"to",
"numbers"
] | aa0023eab7c896b71275bf342bc7f49735cbdbbf | https://github.com/daddyz/phonelib/blob/aa0023eab7c896b71275bf342bc7f49735cbdbbf/lib/phonelib/phone_analyzer_helper.rb#L11-L22 | train | converts a phone number to a valid vanity phrase | [
30522,
13366,
18736,
1035,
4991,
1006,
3042,
1007,
2709,
3042,
4983,
3042,
29521,
1012,
18736,
1035,
7584,
1006,
3042,
1064,
1064,
1005,
1005,
1007,
1012,
28177,
12083,
1006,
13675,
1006,
1005,
1031,
1037,
1011,
23564,
1011,
1062,
1033,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
samvera/hyrax | app/controllers/concerns/hyrax/local_file_downloads_controller_behavior.rb | Hyrax.LocalFileDownloadsControllerBehavior.prepare_local_file_headers | def prepare_local_file_headers
send_file_headers! local_content_options
response.headers['Content-Type'] = local_file_mime_type
response.headers['Content-Length'] ||= local_file_size.to_s
# Prevent Rack::ETag from calculating a digest over body
response.headers['Last-Modified'] = local_file_last_modified.utc.strftime("%a, %d %b %Y %T GMT")
self.content_type = local_file_mime_type
end | ruby | def prepare_local_file_headers
send_file_headers! local_content_options
response.headers['Content-Type'] = local_file_mime_type
response.headers['Content-Length'] ||= local_file_size.to_s
# Prevent Rack::ETag from calculating a digest over body
response.headers['Last-Modified'] = local_file_last_modified.utc.strftime("%a, %d %b %Y %T GMT")
self.content_type = local_file_mime_type
end | [
"def",
"prepare_local_file_headers",
"send_file_headers!",
"local_content_options",
"response",
".",
"headers",
"[",
"'Content-Type'",
"]",
"=",
"local_file_mime_type",
"response",
".",
"headers",
"[",
"'Content-Length'",
"]",
"||=",
"local_file_size",
".",
"to_s",
"# Pre... | Override | [
"Override"
] | e2b4f56e829a53b1f11296324736e9d5b8c9ee5f | https://github.com/samvera/hyrax/blob/e2b4f56e829a53b1f11296324736e9d5b8c9ee5f/app/controllers/concerns/hyrax/local_file_downloads_controller_behavior.rb#L63-L70 | train | Prepare the local file headers | [
30522,
13366,
7374,
1035,
2334,
1035,
5371,
1035,
20346,
2015,
4604,
1035,
5371,
1035,
20346,
2015,
999,
2334,
1035,
4180,
1035,
7047,
3433,
1012,
20346,
2015,
1031,
1005,
4180,
1011,
2828,
1005,
1033,
1027,
2334,
1035,
5371,
1035,
2771,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jekyll/jekyll | lib/jekyll/site.rb | Jekyll.Site.in_cache_dir | def in_cache_dir(*paths)
paths.reduce(cache_dir) do |base, path|
Jekyll.sanitized_path(base, path)
end
end | ruby | def in_cache_dir(*paths)
paths.reduce(cache_dir) do |base, path|
Jekyll.sanitized_path(base, path)
end
end | [
"def",
"in_cache_dir",
"(",
"*",
"paths",
")",
"paths",
".",
"reduce",
"(",
"cache_dir",
")",
"do",
"|",
"base",
",",
"path",
"|",
"Jekyll",
".",
"sanitized_path",
"(",
"base",
",",
"path",
")",
"end",
"end"
] | Public: Prefix a given path with the cache directory.
paths - (optional) path elements to a file or directory within the
cache directory
Returns a path which is prefixed with the cache directory. | [
"Public",
":",
"Prefix",
"a",
"given",
"path",
"with",
"the",
"cache",
"directory",
"."
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/site.rb#L416-L420 | train | Returns the cache directory for the given paths. | [
30522,
13366,
1999,
1035,
17053,
1035,
16101,
1006,
1008,
10425,
1007,
10425,
1012,
5547,
1006,
17053,
1035,
16101,
1007,
2079,
1064,
2918,
1010,
4130,
1064,
15333,
4801,
3363,
1012,
2624,
25090,
5422,
1035,
4130,
1006,
2918,
1010,
4130,
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_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb | Azure::Web::Mgmt::V2018_02_01.AppServiceEnvironments.reboot_async | def reboot_async(resource_group_name, name, custom_headers:nil)
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+[^\.]$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+[^\.]$$')).nil?
fail ArgumentError, 'name is nil' if name.nil?
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/reboot'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'resourceGroupName' => resource_group_name,'name' => name,'subscriptionId' => @client.subscription_id},
query_params: {'api-version' => @client.api_version},
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:post, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 202 || status_code == 400 || status_code == 404 || status_code == 409
error_model = JSON.load(response_content)
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
result
end
promise.execute
end | ruby | def reboot_async(resource_group_name, name, custom_headers:nil)
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+[^\.]$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+[^\.]$$')).nil?
fail ArgumentError, 'name is nil' if name.nil?
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/reboot'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'resourceGroupName' => resource_group_name,'name' => name,'subscriptionId' => @client.subscription_id},
query_params: {'api-version' => @client.api_version},
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:post, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 202 || status_code == 400 || status_code == 404 || status_code == 409
error_model = JSON.load(response_content)
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
result
end
promise.execute
end | [
"def",
"reboot_async",
"(",
"resource_group_name",
",",
"name",
",",
"custom_headers",
":",
"nil",
")",
"fail",
"ArgumentError",
",",
"'resource_group_name is nil'",
"if",
"resource_group_name",
".",
"nil?",
"fail",
"ArgumentError",
",",
"\"'resource_group_name' should sa... | Reboot all machines in an App Service Environment.
Reboot all machines in an App Service Environment.
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param name [String] Name of the App Service Environment.
@param [Hash{String => String}] A hash of custom headers that will be added
to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response. | [
"Reboot",
"all",
"machines",
"in",
"an",
"App",
"Service",
"Environment",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb#L2516-L2560 | train | Reboot a hosting environment. | [
30522,
13366,
2128,
27927,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
8246,
6685,
2121,
29165,
1010,
1005,
7692,
1035,
2177,
1035,
2171,
2003,
9152,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_consumption/lib/2017-11-30/generated/azure_mgmt_consumption/reservations_summaries.rb | Azure::Consumption::Mgmt::V2017_11_30.ReservationsSummaries.list | def list(scope, grain, filter:nil, custom_headers:nil)
response = list_async(scope, grain, filter:filter, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list(scope, grain, filter:nil, custom_headers:nil)
response = list_async(scope, grain, filter:filter, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list",
"(",
"scope",
",",
"grain",
",",
"filter",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_async",
"(",
"scope",
",",
"grain",
",",
"filter",
":",
"filter",
",",
"custom_headers",
":custom_headers",
")",
".",
"va... | Lists the reservations summaries for daily or monthly grain.
@param scope [String] The scope of the reservation summaries. The scope can
be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or
'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}'
@param grain [Datagrain] Can be daily or monthly. Possible values include:
'DailyGrain', 'MonthlyGrain'
@param filter [String] Required only for daily grain. The
properties/UsageDate for start date and end date. The filter supports 'le'
and 'ge'
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ReservationSummariesListResult] operation results. | [
"Lists",
"the",
"reservations",
"summaries",
"for",
"daily",
"or",
"monthly",
"grain",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_consumption/lib/2017-11-30/generated/azure_mgmt_consumption/reservations_summaries.rb#L41-L44 | train | Gets the list of the image IDs for a given image grain. | [
30522,
13366,
2862,
1006,
9531,
1010,
8982,
1010,
11307,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2004,
6038,
2278,
1006,
9531,
1010,
8982,
1010,
11307,
1024,
11307,
1010,
7661,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_advisor/lib/2017-04-19/generated/azure_mgmt_advisor/configurations.rb | Azure::Advisor::Mgmt::V2017_04_19.Configurations.list_by_resource_group | def list_by_resource_group(resource_group, custom_headers:nil)
response = list_by_resource_group_async(resource_group, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_resource_group(resource_group, custom_headers:nil)
response = list_by_resource_group_async(resource_group, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_resource_group",
"(",
"resource_group",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_resource_group_async",
"(",
"resource_group",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"re... | Retrieve Azure Advisor configurations.
@param resource_group [String] The name of the Azure resource group.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ConfigurationListResult] operation results. | [
"Retrieve",
"Azure",
"Advisor",
"configurations",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_advisor/lib/2017-04-19/generated/azure_mgmt_advisor/configurations.rb#L233-L236 | train | Gets the list of all the elastic advisor objects in a resource group. | [
30522,
13366,
2862,
1035,
2011,
1035,
7692,
1035,
2177,
1006,
7692,
1035,
2177,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
7692,
1035,
2177,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.delete_name_with_http_info | def delete_name_with_http_info(name_id, timeout:60, custom_headers:nil)
delete_name_async(name_id, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def delete_name_with_http_info(name_id, timeout:60, custom_headers:nil)
delete_name_async(name_id, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"delete_name_with_http_info",
"(",
"name_id",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"delete_name_async",
"(",
"name_id",
",",
"timeout",
":",
"timeout",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"end"
] | Deletes a Service Fabric name.
Deletes the specified Service Fabric name. A name must be created before it
can be deleted. Deleting a name with child properties will fail.
@param name_id [String] The Service Fabric name, without the 'fabric:' URI
scheme.
@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. | [
"Deletes",
"a",
"Service",
"Fabric",
"name",
"."
] | 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#L26350-L26352 | train | Deletes the specified name. | [
30522,
13366,
3972,
12870,
1035,
2171,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2171,
1035,
8909,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3972,
12870,
1035,
2171,
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... |
ruby/rake | lib/rake/file_utils_ext.rb | Rake.FileUtilsExt.nowrite | def nowrite(value=nil)
oldvalue = FileUtilsExt.nowrite_flag
FileUtilsExt.nowrite_flag = value unless value.nil?
if block_given?
begin
yield
ensure
FileUtilsExt.nowrite_flag = oldvalue
end
end
oldvalue
end | ruby | def nowrite(value=nil)
oldvalue = FileUtilsExt.nowrite_flag
FileUtilsExt.nowrite_flag = value unless value.nil?
if block_given?
begin
yield
ensure
FileUtilsExt.nowrite_flag = oldvalue
end
end
oldvalue
end | [
"def",
"nowrite",
"(",
"value",
"=",
"nil",
")",
"oldvalue",
"=",
"FileUtilsExt",
".",
"nowrite_flag",
"FileUtilsExt",
".",
"nowrite_flag",
"=",
"value",
"unless",
"value",
".",
"nil?",
"if",
"block_given?",
"begin",
"yield",
"ensure",
"FileUtilsExt",
".",
"no... | Get/set the nowrite flag controlling output from the FileUtils
utilities. If verbose is true, then the utility method is
echoed to standard output.
Examples:
nowrite # return the current value of the
# nowrite flag
nowrite(v) # set the nowrite flag to _v_.
nowrite(v) { code } # Execute code with the nowrite flag set
# temporarily to _v_. Return to the
# original value when code is done. | [
"Get",
"/",
"set",
"the",
"nowrite",
"flag",
"controlling",
"output",
"from",
"the",
"FileUtils",
"utilities",
".",
"If",
"verbose",
"is",
"true",
"then",
"the",
"utility",
"method",
"is",
"echoed",
"to",
"standard",
"output",
"."
] | 1c22b490ee6cb8bd614fa8d0d6145f671466206b | https://github.com/ruby/rake/blob/1c22b490ee6cb8bd614fa8d0d6145f671466206b/lib/rake/file_utils_ext.rb#L78-L89 | train | Sets the flag for the current file. | [
30522,
13366,
2085,
17625,
1006,
3643,
1027,
9152,
2140,
1007,
2214,
10175,
5657,
1027,
5371,
21823,
4877,
10288,
2102,
1012,
2085,
17625,
1035,
5210,
5371,
21823,
4877,
10288,
2102,
1012,
2085,
17625,
1035,
5210,
1027,
3643,
4983,
3643,
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-07-01/generated/azure_mgmt_network/virtual_networks.rb | Azure::Network::Mgmt::V2018_07_01.VirtualNetworks.list_usage_next | def list_usage_next(next_page_link, custom_headers:nil)
response = list_usage_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_usage_next(next_page_link, custom_headers:nil)
response = list_usage_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_usage_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_usage_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"response",
"."... | Lists usage stats.
@param next_page_link [String] The NextLink from the previous successful call
to List operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [VirtualNetworkListUsageResult] operation results. | [
"Lists",
"usage",
"stats",
"."
] | 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#L1097-L1100 | train | Gets the usage of the specified resource group. | [
30522,
13366,
2862,
1035,
8192,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
8192,
1035,
2279,
1035,
2004,
6038,
2278,
1006,
2279,
1035,
3931,
1035,
4957,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jekyll/jekyll | lib/jekyll/renderer.rb | Jekyll.Renderer.convert | def convert(content)
converters.reduce(content) do |output, converter|
begin
converter.convert output
rescue StandardError => e
Jekyll.logger.error "Conversion error:",
"#{converter.class} encountered an error while "\
"converting '#{document.relative_path}':"
Jekyll.logger.error("", e.to_s)
raise e
end
end
end | ruby | def convert(content)
converters.reduce(content) do |output, converter|
begin
converter.convert output
rescue StandardError => e
Jekyll.logger.error "Conversion error:",
"#{converter.class} encountered an error while "\
"converting '#{document.relative_path}':"
Jekyll.logger.error("", e.to_s)
raise e
end
end
end | [
"def",
"convert",
"(",
"content",
")",
"converters",
".",
"reduce",
"(",
"content",
")",
"do",
"|",
"output",
",",
"converter",
"|",
"begin",
"converter",
".",
"convert",
"output",
"rescue",
"StandardError",
"=>",
"e",
"Jekyll",
".",
"logger",
".",
"error"... | rubocop: enable AbcSize
Convert the document using the converters which match this renderer's document.
Returns String the converted content. | [
"rubocop",
":",
"enable",
"AbcSize",
"Convert",
"the",
"document",
"using",
"the",
"converters",
"which",
"match",
"this",
"renderer",
"s",
"document",
"."
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/renderer.rb#L99-L111 | train | Convert the content to a sequence of words | [
30522,
13366,
10463,
1006,
4180,
1007,
10463,
2545,
1012,
5547,
1006,
4180,
1007,
2079,
1064,
6434,
1010,
10463,
2121,
1064,
4088,
10463,
2121,
1012,
10463,
6434,
5343,
3115,
2121,
29165,
1027,
1028,
1041,
15333,
4801,
3363,
1012,
8833,
459... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/node_reports.rb | Azure::Automation::Mgmt::V2015_10_31.NodeReports.get_content | def get_content(resource_group_name, automation_account_name, node_id, report_id, custom_headers:nil)
response = get_content_async(resource_group_name, automation_account_name, node_id, report_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_content(resource_group_name, automation_account_name, node_id, report_id, custom_headers:nil)
response = get_content_async(resource_group_name, automation_account_name, node_id, report_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_content",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"node_id",
",",
"report_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_content_async",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"node_id",
... | Retrieve the Dsc node reports by node id and report id.
@param resource_group_name [String] Name of an Azure Resource group.
@param automation_account_name [String] The name of the automation account.
@param node_id [String] The Dsc node id.
@param report_id [String] The report id.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Object] operation results. | [
"Retrieve",
"the",
"Dsc",
"node",
"reports",
"by",
"node",
"id",
"and",
"report",
"id",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/node_reports.rb#L241-L244 | train | Gets the content of the node. | [
30522,
13366,
2131,
1035,
4180,
1006,
7692,
30524,
1035,
2171,
1010,
19309,
1035,
4070,
1035,
2171,
1010,
13045,
1035,
8909,
1010,
3189,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
20346,
2015,
1007,
1012,
3643,
999,
3433,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jekyll/jekyll | lib/jekyll/convertible.rb | Jekyll.Convertible.render_liquid | def render_liquid(content, payload, info, path)
_renderer.render_liquid(content, payload, info, path)
end | ruby | def render_liquid(content, payload, info, path)
_renderer.render_liquid(content, payload, info, path)
end | [
"def",
"render_liquid",
"(",
"content",
",",
"payload",
",",
"info",
",",
"path",
")",
"_renderer",
".",
"render_liquid",
"(",
"content",
",",
"payload",
",",
"info",
",",
"path",
")",
"end"
] | Render Liquid in the content
content - the raw Liquid content to render
payload - the payload for Liquid
info - the info for Liquid
Returns the converted content | [
"Render",
"Liquid",
"in",
"the",
"content"
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/convertible.rb#L107-L109 | train | Render a liquid | [
30522,
13366,
17552,
1035,
6381,
1006,
4180,
1010,
18093,
1010,
18558,
1010,
4130,
1007,
1035,
17552,
2121,
1012,
17552,
1035,
6381,
1006,
4180,
1010,
18093,
1010,
18558,
1010,
4130,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_marketplace_ordering/lib/2015-06-01/generated/azure_mgmt_marketplace_ordering/marketplace_agreements.rb | Azure::MarketplaceOrdering::Mgmt::V2015_06_01.MarketplaceAgreements.get | def get(publisher_id, offer_id, plan_id, custom_headers:nil)
response = get_async(publisher_id, offer_id, plan_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get(publisher_id, offer_id, plan_id, custom_headers:nil)
response = get_async(publisher_id, offer_id, plan_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get",
"(",
"publisher_id",
",",
"offer_id",
",",
"plan_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_async",
"(",
"publisher_id",
",",
"offer_id",
",",
"plan_id",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"respo... | Get marketplace terms.
@param publisher_id [String] Publisher identifier string of image being
deployed.
@param offer_id [String] Offer identifier string of image being deployed.
@param plan_id [String] Plan identifier string of image being deployed.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [AgreementTerms] operation results. | [
"Get",
"marketplace",
"terms",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_marketplace_ordering/lib/2015-06-01/generated/azure_mgmt_marketplace_ordering/marketplace_agreements.rb#L36-L39 | train | Gets the specified product s covering specification. | [
30522,
13366,
2131,
1006,
6674,
1035,
8909,
1010,
3749,
1035,
8909,
1010,
2933,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
2004,
6038,
2278,
1006,
6674,
1035,
8909,
1010,
3749,
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... |
jekyll/jekyll | lib/jekyll/utils.rb | Jekyll.Utils.add_permalink_suffix | def add_permalink_suffix(template, permalink_style)
template = template.dup
case permalink_style
when :pretty
template << "/"
when :date, :ordinal, :none
template << ":output_ext"
else
template << "/" if permalink_style.to_s.end_with?("/")
template << ":output_ext" if permalink_style.to_s.end_with?(":output_ext")
end
template
end | ruby | def add_permalink_suffix(template, permalink_style)
template = template.dup
case permalink_style
when :pretty
template << "/"
when :date, :ordinal, :none
template << ":output_ext"
else
template << "/" if permalink_style.to_s.end_with?("/")
template << ":output_ext" if permalink_style.to_s.end_with?(":output_ext")
end
template
end | [
"def",
"add_permalink_suffix",
"(",
"template",
",",
"permalink_style",
")",
"template",
"=",
"template",
".",
"dup",
"case",
"permalink_style",
"when",
":pretty",
"template",
"<<",
"\"/\"",
"when",
":date",
",",
":ordinal",
",",
":none",
"template",
"<<",
"\":o... | Add an appropriate suffix to template so that it matches the specified
permalink style.
template - permalink template without trailing slash or file extension
permalink_style - permalink style, either built-in or custom
The returned permalink template will use the same ending style as
specified in permalink_style. For example, if permalink_style contains a
trailing slash (or is :pretty, which indirectly has a trailing slash),
then so will the returned template. If permalink_style has a trailing
":output_ext" (or is :none, :date, or :ordinal) then so will the returned
template. Otherwise, template will be returned without modification.
Examples:
add_permalink_suffix("/:basename", :pretty)
# => "/:basename/"
add_permalink_suffix("/:basename", :date)
# => "/:basename:output_ext"
add_permalink_suffix("/:basename", "/:year/:month/:title/")
# => "/:basename/"
add_permalink_suffix("/:basename", "/:year/:month/:title")
# => "/:basename"
Returns the updated permalink template | [
"Add",
"an",
"appropriate",
"suffix",
"to",
"template",
"so",
"that",
"it",
"matches",
"the",
"specified",
"permalink",
"style",
"."
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/utils.rb#L249-L263 | train | Add the permalink suffix to the template | [
30522,
13366,
5587,
1035,
2566,
9067,
19839,
1035,
16809,
1006,
23561,
1010,
2566,
9067,
19839,
1035,
2806,
1007,
23561,
1027,
23561,
1012,
4241,
2361,
2553,
2566,
9067,
19839,
1035,
2806,
2043,
1024,
3492,
23561,
1026,
1026,
1000,
1013,
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... |
activerecord-hackery/ransack | polyamorous/lib/polyamorous/activerecord_5.2.0_ruby_2/join_dependency.rb | Polyamorous.JoinDependencyExtensions.make_polyamorous_left_outer_joins | def make_polyamorous_left_outer_joins(parent, child)
tables = child.tables
join_type = Arel::Nodes::OuterJoin
info = make_constraints parent, child, tables, join_type
info + child.children.flat_map { |c|
make_polyamorous_left_outer_joins(child, c)
}
end | ruby | def make_polyamorous_left_outer_joins(parent, child)
tables = child.tables
join_type = Arel::Nodes::OuterJoin
info = make_constraints parent, child, tables, join_type
info + child.children.flat_map { |c|
make_polyamorous_left_outer_joins(child, c)
}
end | [
"def",
"make_polyamorous_left_outer_joins",
"(",
"parent",
",",
"child",
")",
"tables",
"=",
"child",
".",
"tables",
"join_type",
"=",
"Arel",
"::",
"Nodes",
"::",
"OuterJoin",
"info",
"=",
"make_constraints",
"parent",
",",
"child",
",",
"tables",
",",
"join_... | Replaces ActiveRecord::Associations::JoinDependency#make_left_outer_joins,
a new method that was added in Rails 5.0 with the following commit:
https://github.com/rails/rails/commit/e038975 | [
"Replaces",
"ActiveRecord",
"::",
"Associations",
"::",
"JoinDependency#make_left_outer_joins",
"a",
"new",
"method",
"that",
"was",
"added",
"in",
"Rails",
"5",
".",
"0",
"with",
"the",
"following",
"commit",
":",
"https",
":",
"//",
"github",
".",
"com",
"/"... | d44bfe6fe21ab374ceea9d060267d0d38b09ef28 | https://github.com/activerecord-hackery/ransack/blob/d44bfe6fe21ab374ceea9d060267d0d38b09ef28/polyamorous/lib/polyamorous/activerecord_5.2.0_ruby_2/join_dependency.rb#L65-L73 | train | Make the outer joins for the given parent node. | [
30522,
13366,
2191,
1035,
26572,
22591,
13288,
1035,
2187,
1035,
6058,
1035,
9794,
1006,
6687,
1010,
2775,
1007,
7251,
1027,
2775,
1012,
7251,
3693,
1035,
2828,
1027,
2024,
2140,
1024,
1024,
14164,
1024,
1024,
6058,
5558,
2378,
18558,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.get_application_info_list_with_http_info | def get_application_info_list_with_http_info(application_definition_kind_filter:0, application_type_name:nil, exclude_application_parameters:false, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
get_application_info_list_async(application_definition_kind_filter:application_definition_kind_filter, application_type_name:application_type_name, exclude_application_parameters:exclude_application_parameters, continuation_token:continuation_token, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def get_application_info_list_with_http_info(application_definition_kind_filter:0, application_type_name:nil, exclude_application_parameters:false, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
get_application_info_list_async(application_definition_kind_filter:application_definition_kind_filter, application_type_name:application_type_name, exclude_application_parameters:exclude_application_parameters, continuation_token:continuation_token, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"get_application_info_list_with_http_info",
"(",
"application_definition_kind_filter",
":",
"0",
",",
"application_type_name",
":",
"nil",
",",
"exclude_application_parameters",
":",
"false",
",",
"continuation_token",
":",
"nil",
",",
"max_results",
":",
"0",
",",... | Gets the list of applications created in the Service Fabric cluster that
match the specified filters.
Gets the information about the applications that were created or in the
process of being created in the Service Fabric cluster and match the
specified filters. The response includes the name, type, status, parameters,
and other details about the application. If the applications do not fit in a
page, one page of results is returned as well as a continuation token which
can be used to get the next page. Filters ApplicationTypeName and
ApplicationDefinitionKindFilter cannot be specified at the same time.
@param application_definition_kind_filter [Integer] Used to filter on
ApplicationDefinitionKind which is the mechanism used to define a Service
Fabric application.
- Default - Default value, which performs the same function as selecting
"All". The value is 0.
- All - Filter that matches input with any ApplicationDefinitionKind value.
The value is 65535.
- ServiceFabricApplicationDescription - Filter that matches input with
ApplicationDefinitionKind value ServiceFabricApplicationDescription. The
value is 1.
- Compose - Filter that matches input with ApplicationDefinitionKind value
Compose. The value is 2.
@param application_type_name [String] The application type name used to
filter the applications to query for. This value should not contain the
application type version.
@param exclude_application_parameters [Boolean] The flag that specifies
whether application parameters will be excluded from the result.
@param continuation_token [String] The continuation token parameter is used
to obtain next set of results. A continuation token with a non empty value is
included in the response of the API when the results from the system do not
fit in a single response. When this value is passed to the next API call, the
API returns next set of results. If there are no further results then the
continuation token does not contain a value. The value of this parameter
should not be URL encoded.
@param max_results [Integer] The maximum number of results to be returned as
part of the paged queries. This parameter defines the upper bound on the
number of results returned. The results returned can be less than the
specified maximum results if they do not fit in the message as per the max
message size restrictions defined in the configuration. If this parameter is
zero or not specified, the paged queries includes as many results as possible
that fit in the return message.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"list",
"of",
"applications",
"created",
"in",
"the",
"Service",
"Fabric",
"cluster",
"that",
"match",
"the",
"specified",
"filters",
"."
] | 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#L6543-L6545 | train | Gets the list of all the applications in a given App Service Environment. | [
30522,
13366,
2131,
1035,
4646,
1035,
18558,
1035,
2862,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
4646,
1035,
6210,
1035,
2785,
1035,
11307,
1024,
1014,
1010,
4646,
1035,
2828,
1035,
2171,
1024,
9152,
2140,
1010,
23329,
1035,
4646,
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... |
abonas/kubeclient | lib/kubeclient/common.rb | Kubeclient.ClientMixin.get_entity | def get_entity(resource_name, name, namespace = nil, options = {})
ns_prefix = build_namespace_prefix(namespace)
response = handle_exception do
rest_client[ns_prefix + resource_name + "/#{name}"]
.get(@headers)
end
format_response(options[:as] || @as, response.body)
end | ruby | def get_entity(resource_name, name, namespace = nil, options = {})
ns_prefix = build_namespace_prefix(namespace)
response = handle_exception do
rest_client[ns_prefix + resource_name + "/#{name}"]
.get(@headers)
end
format_response(options[:as] || @as, response.body)
end | [
"def",
"get_entity",
"(",
"resource_name",
",",
"name",
",",
"namespace",
"=",
"nil",
",",
"options",
"=",
"{",
"}",
")",
"ns_prefix",
"=",
"build_namespace_prefix",
"(",
"namespace",
")",
"response",
"=",
"handle_exception",
"do",
"rest_client",
"[",
"ns_pref... | Accepts the following options:
:as (:raw|:ros) - defaults to :ros
:raw - return the raw response body as a string
:ros - return a collection of RecursiveOpenStruct objects | [
"Accepts",
"the",
"following",
"options",
":",
":",
"as",
"(",
":",
"raw|",
":",
"ros",
")",
"-",
"defaults",
"to",
":",
"ros",
":",
"raw",
"-",
"return",
"the",
"raw",
"response",
"body",
"as",
"a",
"string",
":",
"ros",
"-",
"return",
"a",
"colle... | 3630f6c82532fba04f3e1a62d6b99c6cf2910451 | https://github.com/abonas/kubeclient/blob/3630f6c82532fba04f3e1a62d6b99c6cf2910451/lib/kubeclient/common.rb#L340-L347 | train | Get an entity | [
30522,
13366,
2131,
1035,
9178,
1006,
7692,
1035,
2171,
1010,
2171,
1010,
3415,
15327,
1027,
9152,
2140,
1010,
7047,
1027,
1063,
1065,
1007,
24978,
1035,
17576,
1027,
3857,
1035,
3415,
15327,
1035,
17576,
1006,
3415,
15327,
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... |
CocoaPods/Xcodeproj | lib/xcodeproj/workspace.rb | Xcodeproj.Workspace.xcworkspace_element_start_xml | def xcworkspace_element_start_xml(depth, elem)
attributes = case elem.name
when 'Group'
%w(location name)
when 'FileRef'
%w(location)
end
contents = "<#{elem.name}"
indent = ' ' * depth
attributes.each { |name| contents += "\n #{name} = \"#{elem.attribute(name)}\"" }
contents.split("\n").map { |line| "#{indent}#{line}" }.join("\n") + ">\n"
end | ruby | def xcworkspace_element_start_xml(depth, elem)
attributes = case elem.name
when 'Group'
%w(location name)
when 'FileRef'
%w(location)
end
contents = "<#{elem.name}"
indent = ' ' * depth
attributes.each { |name| contents += "\n #{name} = \"#{elem.attribute(name)}\"" }
contents.split("\n").map { |line| "#{indent}#{line}" }.join("\n") + ">\n"
end | [
"def",
"xcworkspace_element_start_xml",
"(",
"depth",
",",
"elem",
")",
"attributes",
"=",
"case",
"elem",
".",
"name",
"when",
"'Group'",
"%w(",
"location",
"name",
")",
"when",
"'FileRef'",
"%w(",
"location",
")",
"end",
"contents",
"=",
"\"<#{elem.name}\"",
... | @param [Integer] depth The depth of the element in the tree
@param [REXML::Document::Element] elem The XML element to format.
@return [String] The Xcode-specific XML formatting of an element start | [
"@param",
"[",
"Integer",
"]",
"depth",
"The",
"depth",
"of",
"the",
"element",
"in",
"the",
"tree",
"@param",
"[",
"REXML",
"::",
"Document",
"::",
"Element",
"]",
"elem",
"The",
"XML",
"element",
"to",
"format",
"."
] | 3be1684437a6f8e69c7836ad4c85a2b78663272f | https://github.com/CocoaPods/Xcodeproj/blob/3be1684437a6f8e69c7836ad4c85a2b78663272f/lib/xcodeproj/workspace.rb#L251-L262 | train | start xml for a XCWorkspace element | [
30522,
13366,
1060,
2278,
9316,
15327,
1035,
5783,
1035,
2707,
1035,
20950,
1006,
5995,
1010,
3449,
6633,
1007,
12332,
1027,
2553,
3449,
6633,
1012,
2171,
2043,
1005,
2177,
1005,
1003,
1059,
1006,
3295,
2171,
1007,
2043,
1005,
5371,
2890,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_cdn/lib/2016-04-02/generated/azure_mgmt_cdn/profiles.rb | Azure::CDN::Mgmt::V2016_04_02.Profiles.begin_delete_if_exists | def begin_delete_if_exists(profile_name, resource_group_name, custom_headers:nil)
response = begin_delete_if_exists_async(profile_name, resource_group_name, custom_headers:custom_headers).value!
nil
end | ruby | def begin_delete_if_exists(profile_name, resource_group_name, custom_headers:nil)
response = begin_delete_if_exists_async(profile_name, resource_group_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_delete_if_exists",
"(",
"profile_name",
",",
"resource_group_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_delete_if_exists_async",
"(",
"profile_name",
",",
"resource_group_name",
",",
"custom_headers",
":custom_headers",
")",
".",
... | Deletes an existing CDN profile with the specified parameters. Deleting a
profile will result in the deletion of all subresources including endpoints,
origins and custom domains.
@param profile_name [String] Name of the CDN profile within the resource
group.
@param resource_group_name [String] Name of the resource group within the
Azure subscription.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Deletes",
"an",
"existing",
"CDN",
"profile",
"with",
"the",
"specified",
"parameters",
".",
"Deleting",
"a",
"profile",
"will",
"result",
"in",
"the",
"deletion",
"of",
"all",
"subresources",
"including",
"endpoints",
"origins",
"and",
"custom",
"domains",
"."... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_cdn/lib/2016-04-02/generated/azure_mgmt_cdn/profiles.rb#L818-L821 | train | Deletes the specified managed network interface. | [
30522,
13366,
4088,
1035,
3972,
12870,
1035,
2065,
1035,
6526,
1006,
6337,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
3972,
12870,
1035,
2065,
1035,
6526,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/sprockets | lib/sprockets/path_utils.rb | Sprockets.PathUtils.find_matching_path_for_extensions | def find_matching_path_for_extensions(path, basename, extensions)
matches = []
entries(path).each do |entry|
next unless File.basename(entry).start_with?(basename)
extname, value = match_path_extname(entry, extensions)
if basename == entry.chomp(extname)
filename = File.join(path, entry)
if file?(filename)
matches << [filename, value]
end
end
end
matches
end | ruby | def find_matching_path_for_extensions(path, basename, extensions)
matches = []
entries(path).each do |entry|
next unless File.basename(entry).start_with?(basename)
extname, value = match_path_extname(entry, extensions)
if basename == entry.chomp(extname)
filename = File.join(path, entry)
if file?(filename)
matches << [filename, value]
end
end
end
matches
end | [
"def",
"find_matching_path_for_extensions",
"(",
"path",
",",
"basename",
",",
"extensions",
")",
"matches",
"=",
"[",
"]",
"entries",
"(",
"path",
")",
".",
"each",
"do",
"|",
"entry",
"|",
"next",
"unless",
"File",
".",
"basename",
"(",
"entry",
")",
"... | Internal: Match paths in a directory against available extensions.
path - String directory
basename - String basename of target file
extensions - Hash of String extnames to values
Examples
exts = { ".js" => "application/javascript" }
find_matching_path_for_extensions("app/assets", "application", exts)
# => ["app/assets/application.js", "application/javascript"]
Returns an Array of [String path, Object value] matches. | [
"Internal",
":",
"Match",
"paths",
"in",
"a",
"directory",
"against",
"available",
"extensions",
"."
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/path_utils.rb#L231-L244 | train | Find the matching path for the given basename and extensions | [
30522,
13366,
2424,
1035,
9844,
1035,
4130,
1035,
2005,
1035,
14305,
1006,
4130,
1010,
2918,
18442,
1010,
14305,
1007,
3503,
1027,
1031,
1033,
10445,
1006,
4130,
1007,
1012,
2169,
2079,
1064,
4443,
1064,
2279,
4983,
5371,
1012,
2918,
18442,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
etewiah/property_web_builder | app/controllers/pwb/api/v1/web_contents_controller.rb | Pwb.Api::V1::WebContentsController.update_photo | def update_photo
content_tag = params[:content_tag]
# photo = ContentPhoto.find(params[:id])
# find would throw error if not found
photo = ContentPhoto.find_by_id(params[:id])
unless photo
if content_tag
# where photo has never been set before, associated Content will not exist
content = Content.find_by_key(content_tag) || Content.create({ key: content_tag, tag: 'appearance' })
photo = ContentPhoto.create
if content_tag == "logo"
# TODO: This is a workaround
# need to have a way of determining content that should only have
# one photo and enforcing that
content.content_photos.destroy_all
end
content.content_photos.push photo
end
# TODO: - handle where no photo or content_tag..
end
if params[:file]
photo.image = params[:file]
end
photo.save!
photo.reload
render json: photo.to_json
end | ruby | def update_photo
content_tag = params[:content_tag]
# photo = ContentPhoto.find(params[:id])
# find would throw error if not found
photo = ContentPhoto.find_by_id(params[:id])
unless photo
if content_tag
# where photo has never been set before, associated Content will not exist
content = Content.find_by_key(content_tag) || Content.create({ key: content_tag, tag: 'appearance' })
photo = ContentPhoto.create
if content_tag == "logo"
# TODO: This is a workaround
# need to have a way of determining content that should only have
# one photo and enforcing that
content.content_photos.destroy_all
end
content.content_photos.push photo
end
# TODO: - handle where no photo or content_tag..
end
if params[:file]
photo.image = params[:file]
end
photo.save!
photo.reload
render json: photo.to_json
end | [
"def",
"update_photo",
"content_tag",
"=",
"params",
"[",
":content_tag",
"]",
"# photo = ContentPhoto.find(params[:id])",
"# find would throw error if not found",
"photo",
"=",
"ContentPhoto",
".",
"find_by_id",
"(",
"params",
"[",
":id",
"]",
")",
"unless",
"photo",
"... | below is used by logo_photo and about_us_photo,
where only one photo is allowed | [
"below",
"is",
"used",
"by",
"logo_photo",
"and",
"about_us_photo",
"where",
"only",
"one",
"photo",
"is",
"allowed"
] | fba4e6d4ffa7bc1f4d3b50dfa5a6a9fbfee23f21 | https://github.com/etewiah/property_web_builder/blob/fba4e6d4ffa7bc1f4d3b50dfa5a6a9fbfee23f21/app/controllers/pwb/api/v1/web_contents_controller.rb#L9-L35 | train | update photo by id | [
30522,
13366,
10651,
1035,
6302,
4180,
1035,
6415,
1027,
11498,
5244,
1031,
1024,
4180,
1035,
6415,
1033,
1001,
6302,
1027,
4180,
8458,
11439,
1012,
2424,
1006,
11498,
5244,
1031,
1024,
8909,
1033,
1007,
1001,
2424,
2052,
5466,
7561,
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... |
opal/opal | opal/corelib/marshal/read_buffer.rb | Marshal.ReadBuffer.read_user_class | def read_user_class
klass_name = read(cache: false)
klass = safe_const_get(klass_name)
value = read(cache: false)
result = if klass < Hash
klass[value]
else
klass.new(value)
end
@object_cache << result
result
end | ruby | def read_user_class
klass_name = read(cache: false)
klass = safe_const_get(klass_name)
value = read(cache: false)
result = if klass < Hash
klass[value]
else
klass.new(value)
end
@object_cache << result
result
end | [
"def",
"read_user_class",
"klass_name",
"=",
"read",
"(",
"cache",
":",
"false",
")",
"klass",
"=",
"safe_const_get",
"(",
"klass_name",
")",
"value",
"=",
"read",
"(",
"cache",
":",
"false",
")",
"result",
"=",
"if",
"klass",
"<",
"Hash",
"klass",
"[",
... | Reads and User Class (instance of String/Regexp/Array/Hash subclass)
@example
UserArray = Class.new(Array)
UserArray[100, 200, 300]
is encoded as
'C', :UserArray, [100, 200, 300] | [
"Reads",
"and",
"User",
"Class",
"(",
"instance",
"of",
"String",
"/",
"Regexp",
"/",
"Array",
"/",
"Hash",
"subclass",
")"
] | 41aedc0fd62aab00d3c117ba0caf00206bedd981 | https://github.com/opal/opal/blob/41aedc0fd62aab00d3c117ba0caf00206bedd981/opal/corelib/marshal/read_buffer.rb#L480-L494 | train | Read the user class object | [
30522,
13366,
3191,
1035,
5310,
1035,
2465,
1047,
27102,
1035,
2171,
1027,
3191,
1006,
17053,
1024,
6270,
1007,
1047,
27102,
1027,
3647,
1035,
9530,
3367,
1035,
2131,
1006,
1047,
27102,
1035,
2171,
1007,
3643,
1027,
3191,
1006,
17053,
1024,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_kusto/lib/2017-09-07-privatepreview/generated/azure_mgmt_kusto/databases.rb | Azure::Kusto::Mgmt::V2018_09_07_privatepreview.Databases.add_principals | def add_principals(resource_group_name, cluster_name, database_name, database_principals_to_add, custom_headers:nil)
response = add_principals_async(resource_group_name, cluster_name, database_name, database_principals_to_add, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def add_principals(resource_group_name, cluster_name, database_name, database_principals_to_add, custom_headers:nil)
response = add_principals_async(resource_group_name, cluster_name, database_name, database_principals_to_add, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"add_principals",
"(",
"resource_group_name",
",",
"cluster_name",
",",
"database_name",
",",
"database_principals_to_add",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"add_principals_async",
"(",
"resource_group_name",
",",
"cluster_name",
",",
"dat... | Add Database principals permissions.
@param resource_group_name [String] The name of the resource group containing
the Kusto cluster.
@param cluster_name [String] The name of the Kusto cluster.
@param database_name [String] The name of the database in the Kusto cluster.
@param database_principals_to_add [DatabasePrincipalListRequest] List of
database principals to add.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [DatabasePrincipalListResult] operation results. | [
"Add",
"Database",
"principals",
"permissions",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_kusto/lib/2017-09-07-privatepreview/generated/azure_mgmt_kusto/databases.rb#L584-L587 | train | Adds a list of principals to the specified database. | [
30522,
13366,
5587,
1035,
27928,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
9324,
1035,
2171,
1010,
7809,
1035,
2171,
1010,
7809,
1035,
27928,
1035,
2000,
1035,
5587,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
5587,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
randym/axlsx | lib/axlsx/workbook/worksheet/protected_ranges.rb | Axlsx.ProtectedRanges.to_xml_string | def to_xml_string(str = '')
return if empty?
str << '<protectedRanges>'
each { |range| range.to_xml_string(str) }
str << '</protectedRanges>'
end | ruby | def to_xml_string(str = '')
return if empty?
str << '<protectedRanges>'
each { |range| range.to_xml_string(str) }
str << '</protectedRanges>'
end | [
"def",
"to_xml_string",
"(",
"str",
"=",
"''",
")",
"return",
"if",
"empty?",
"str",
"<<",
"'<protectedRanges>'",
"each",
"{",
"|",
"range",
"|",
"range",
".",
"to_xml_string",
"(",
"str",
")",
"}",
"str",
"<<",
"'</protectedRanges>'",
"end"
] | Serializes the protected ranges
@param [String] str
@return [String] | [
"Serializes",
"the",
"protected",
"ranges"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/worksheet/protected_ranges.rb#L30-L35 | train | Convert the list of protected ranges to XML string. | [
30522,
13366,
2000,
1035,
20950,
1035,
5164,
1006,
2358,
2099,
1027,
1005,
1005,
1007,
2709,
2065,
4064,
1029,
2358,
2099,
1026,
1026,
1005,
1026,
5123,
24388,
2229,
1028,
1005,
2169,
1063,
1064,
2846,
1064,
2846,
1012,
2000,
1035,
20950,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rmagick/rmagick | lib/rmagick_internal.rb | Magick.ImageList.is_an_image_array | def is_an_image_array(ary)
Kernel.raise ArgumentError, "Magick::ImageList or array of Magick::Images required (#{ary.class} given)" unless ary.respond_to? :each
ary.each { |obj| is_an_image obj }
true
end | ruby | def is_an_image_array(ary)
Kernel.raise ArgumentError, "Magick::ImageList or array of Magick::Images required (#{ary.class} given)" unless ary.respond_to? :each
ary.each { |obj| is_an_image obj }
true
end | [
"def",
"is_an_image_array",
"(",
"ary",
")",
"Kernel",
".",
"raise",
"ArgumentError",
",",
"\"Magick::ImageList or array of Magick::Images required (#{ary.class} given)\"",
"unless",
"ary",
".",
"respond_to?",
":each",
"ary",
".",
"each",
"{",
"|",
"obj",
"|",
"is_an_im... | Ensure array is always an array of Magick::Image objects | [
"Ensure",
"array",
"is",
"always",
"an",
"array",
"of",
"Magick",
"::",
"Image",
"objects"
] | ef6688ed9d76bf123c2ea1a483eff8635051adb7 | https://github.com/rmagick/rmagick/blob/ef6688ed9d76bf123c2ea1a483eff8635051adb7/lib/rmagick_internal.rb#L1240-L1244 | train | Returns true if the array is an image array | [
30522,
13366,
2003,
1035,
2019,
1035,
3746,
1035,
9140,
1006,
12098,
2100,
1007,
16293,
1012,
5333,
6685,
2121,
29165,
1010,
1000,
3894,
2243,
1024,
1024,
3746,
9863,
2030,
9140,
1997,
3894,
2243,
1024,
1024,
4871,
3223,
1006,
1001,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | actionmailer/lib/action_mailer/mail_helper.rb | ActionMailer.MailHelper.format_paragraph | def format_paragraph(text, len = 72, indent = 2)
sentences = [[]]
text.split.each do |word|
if sentences.first.present? && (sentences.last + [word]).join(" ").length > len
sentences << [word]
else
sentences.last << word
end
end
indentation = " " * indent
sentences.map! { |sentence|
"#{indentation}#{sentence.join(' ')}"
}.join "\n"
end | ruby | def format_paragraph(text, len = 72, indent = 2)
sentences = [[]]
text.split.each do |word|
if sentences.first.present? && (sentences.last + [word]).join(" ").length > len
sentences << [word]
else
sentences.last << word
end
end
indentation = " " * indent
sentences.map! { |sentence|
"#{indentation}#{sentence.join(' ')}"
}.join "\n"
end | [
"def",
"format_paragraph",
"(",
"text",
",",
"len",
"=",
"72",
",",
"indent",
"=",
"2",
")",
"sentences",
"=",
"[",
"[",
"]",
"]",
"text",
".",
"split",
".",
"each",
"do",
"|",
"word",
"|",
"if",
"sentences",
".",
"first",
".",
"present?",
"&&",
... | Returns +text+ wrapped at +len+ columns and indented +indent+ spaces.
By default column length +len+ equals 72 characters and indent
+indent+ equal two spaces.
my_text = 'Here is a sample text with more than 40 characters'
format_paragraph(my_text, 25, 4)
# => " Here is a sample text with\n more than 40 characters" | [
"Returns",
"+",
"text",
"+",
"wrapped",
"at",
"+",
"len",
"+",
"columns",
"and",
"indented",
"+",
"indent",
"+",
"spaces",
".",
"By",
"default",
"column",
"length",
"+",
"len",
"+",
"equals",
"72",
"characters",
"and",
"indent",
"+",
"indent",
"+",
"eq... | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/actionmailer/lib/action_mailer/mail_helper.rb#L55-L70 | train | Format a paragraph of text | [
30522,
13366,
4289,
1035,
20423,
1006,
3793,
1010,
18798,
1027,
5824,
1010,
27427,
4765,
1027,
1016,
1007,
11746,
1027,
1031,
1031,
1033,
1033,
3793,
1012,
3975,
1012,
2169,
2079,
1064,
2773,
1064,
2065,
11746,
1012,
2034,
1012,
2556,
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... |
tongueroo/jets | lib/jets/job/dsl/dynamodb_event.rb | Jets::Job::Dsl.DynamodbEvent.full_dynamodb_stream_arn | def full_dynamodb_stream_arn(table_name)
return table_name if table_name.include?("arn:aws:dynamodb") # assume full stream arn
begin
resp = dynamodb.describe_table(table_name: table_name)
rescue Aws::DynamoDB::Errors::ResourceNotFoundException => e
puts e.message
puts "ERROR: Was not able to find the DynamoDB table: #{table_name}.".color(:red)
code_line = caller.grep(%r{/app/jobs}).first
puts "Please check: #{code_line}"
puts "Exiting"
exit 1
end
stream_arn = resp.table.latest_stream_arn
return stream_arn if stream_arn
end | ruby | def full_dynamodb_stream_arn(table_name)
return table_name if table_name.include?("arn:aws:dynamodb") # assume full stream arn
begin
resp = dynamodb.describe_table(table_name: table_name)
rescue Aws::DynamoDB::Errors::ResourceNotFoundException => e
puts e.message
puts "ERROR: Was not able to find the DynamoDB table: #{table_name}.".color(:red)
code_line = caller.grep(%r{/app/jobs}).first
puts "Please check: #{code_line}"
puts "Exiting"
exit 1
end
stream_arn = resp.table.latest_stream_arn
return stream_arn if stream_arn
end | [
"def",
"full_dynamodb_stream_arn",
"(",
"table_name",
")",
"return",
"table_name",
"if",
"table_name",
".",
"include?",
"(",
"\"arn:aws:dynamodb\"",
")",
"# assume full stream arn",
"begin",
"resp",
"=",
"dynamodb",
".",
"describe_table",
"(",
"table_name",
":",
"tabl... | Expands table name to the full stream arn. Example:
test-table
To:
arn:aws:dynamodb:us-west-2:112233445566:table/test-table/stream/2019-02-15T21:41:15.217
Note, this does not check if the stream has been disabled. | [
"Expands",
"table",
"name",
"to",
"the",
"full",
"stream",
"arn",
".",
"Example",
":"
] | 46943a519224067e58aa3e2d5656e3ca083150f9 | https://github.com/tongueroo/jets/blob/46943a519224067e58aa3e2d5656e3ca083150f9/lib/jets/job/dsl/dynamodb_event.rb#L30-L45 | train | Returns the full stream arn for the specified DynamoDB table. | [
30522,
13366,
2440,
1035,
17205,
18939,
1035,
5460,
1035,
12098,
2078,
1006,
2795,
30524,
1006,
2795,
1035,
2171,
1024,
2795,
1035,
2171,
1007,
5343,
22091,
2015,
1024,
1024,
17205,
18939,
1024,
1024,
10697,
1024,
1024,
7692,
17048,
14876,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2016-12-01/generated/azure_mgmt_network/virtual_network_gateways.rb | Azure::Network::Mgmt::V2016_12_01.VirtualNetworkGateways.begin_get_advertised_routes | def begin_get_advertised_routes(resource_group_name, virtual_network_gateway_name, peer, custom_headers:nil)
response = begin_get_advertised_routes_async(resource_group_name, virtual_network_gateway_name, peer, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_get_advertised_routes(resource_group_name, virtual_network_gateway_name, peer, custom_headers:nil)
response = begin_get_advertised_routes_async(resource_group_name, virtual_network_gateway_name, peer, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_get_advertised_routes",
"(",
"resource_group_name",
",",
"virtual_network_gateway_name",
",",
"peer",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_get_advertised_routes_async",
"(",
"resource_group_name",
",",
"virtual_network_gateway_name",
"... | This operation retrieves a list of routes the virtual network gateway is
advertising to the specified peer.
@param resource_group_name [String] The name of the resource group.
@param virtual_network_gateway_name [String] The name of the virtual network
gateway.
@param peer [String] The IP address of the peer
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [GatewayRouteListResult] operation results. | [
"This",
"operation",
"retrieves",
"a",
"list",
"of",
"routes",
"the",
"virtual",
"network",
"gateway",
"is",
"advertising",
"to",
"the",
"specified",
"peer",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2016-12-01/generated/azure_mgmt_network/virtual_network_gateways.rb#L1117-L1120 | train | Gets the advertised routes for the virtual network gateway. | [
30522,
13366,
4088,
1035,
2131,
1035,
17099,
1035,
5847,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7484,
1035,
2897,
1035,
11909,
1035,
2171,
1010,
8152,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
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... |
rails/sprockets | lib/sprockets/dependencies.rb | Sprockets.Dependencies.resolve_dependency | def resolve_dependency(str)
# Optimize for the most common scheme to
# save 22k allocations on an average Spree app.
scheme = if str.start_with?('file-digest:'.freeze)
'file-digest'.freeze
else
str[/([^:]+)/, 1]
end
if resolver = config[:dependency_resolvers][scheme]
resolver.call(self, str)
else
nil
end
end | ruby | def resolve_dependency(str)
# Optimize for the most common scheme to
# save 22k allocations on an average Spree app.
scheme = if str.start_with?('file-digest:'.freeze)
'file-digest'.freeze
else
str[/([^:]+)/, 1]
end
if resolver = config[:dependency_resolvers][scheme]
resolver.call(self, str)
else
nil
end
end | [
"def",
"resolve_dependency",
"(",
"str",
")",
"# Optimize for the most common scheme to",
"# save 22k allocations on an average Spree app.",
"scheme",
"=",
"if",
"str",
".",
"start_with?",
"(",
"'file-digest:'",
".",
"freeze",
")",
"'file-digest'",
".",
"freeze",
"else",
... | Internal: Resolve dependency URIs.
Returns resolved Object. | [
"Internal",
":",
"Resolve",
"dependency",
"URIs",
"."
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/dependencies.rb#L58-L72 | train | Resolve a dependency to a specific scheme. | [
30522,
13366,
10663,
1035,
24394,
1006,
2358,
2099,
1007,
1001,
23569,
27605,
4371,
2005,
1996,
2087,
2691,
5679,
2000,
1001,
3828,
2570,
2243,
16169,
2015,
2006,
2019,
2779,
11867,
9910,
10439,
1012,
5679,
1027,
2065,
2358,
2099,
1012,
270... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
floere/phony | lib/phony/dsl.rb | Phony.DSL.match | def match regex, options = {}
# Check if regexp has a group in it.
#
raise "Regexp /#{regex.source}/ needs a group in it that defines which digits belong to the NDC." unless regex.source =~ /\(/
NationalSplitters::Regex.instance_for regex, options[:on_fail_take], options
end | ruby | def match regex, options = {}
# Check if regexp has a group in it.
#
raise "Regexp /#{regex.source}/ needs a group in it that defines which digits belong to the NDC." unless regex.source =~ /\(/
NationalSplitters::Regex.instance_for regex, options[:on_fail_take], options
end | [
"def",
"match",
"regex",
",",
"options",
"=",
"{",
"}",
"# Check if regexp has a group in it.",
"#",
"raise",
"\"Regexp /#{regex.source}/ needs a group in it that defines which digits belong to the NDC.\"",
"unless",
"regex",
".",
"source",
"=~",
"/",
"\\(",
"/",
"NationalSpl... | If you have a number of (possibly) variable length NDCs
that can be well expressed via regexp, use this.
@param [Regexp] regex A Regexp describing the NDCs (First group must contain the NDC, eg. /^(0\d{2})\d+$/) contains all NDCs with 0xx...
@return NationalSplitters::Regex A regexp-based national splitter.
@example With several NDC matchers.
country '52',
match(/^(0\d{2})\d+$/) >> split(2,2,2,2) |
match(/^(33|55|81)\d+$/) >> split(2,2,2,2) |
match(/^(\d{3})\d+$/) >> split(3,2,2) | [
"If",
"you",
"have",
"a",
"number",
"of",
"(",
"possibly",
")",
"variable",
"length",
"NDCs",
"that",
"can",
"be",
"well",
"expressed",
"via",
"regexp",
"use",
"this",
"."
] | 9ca50743499cf478a25fdb927bcdacd29d2c90c7 | https://github.com/floere/phony/blob/9ca50743499cf478a25fdb927bcdacd29d2c90c7/lib/phony/dsl.rb#L160-L166 | train | Match a regular expression against the NDC. | [
30522,
13366,
2674,
19723,
10288,
1010,
7047,
1027,
1063,
1065,
1001,
4638,
2065,
19723,
10288,
2361,
2038,
1037,
2177,
1999,
2009,
1012,
1001,
5333,
1000,
19723,
10288,
2361,
1013,
1001,
1063,
19723,
10288,
1012,
3120,
1065,
1013,
3791,
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... |
randym/axlsx | lib/axlsx/util/serialized_attributes.rb | Axlsx.SerializedAttributes.serialized_attributes | def serialized_attributes(str = '', additional_attributes = {})
attributes = declared_attributes.merge! additional_attributes
attributes.each do |key, value|
str << "#{Axlsx.camel(key, false)}=\"#{Axlsx.camel(Axlsx.booleanize(value), false)}\" "
end
str
end | ruby | def serialized_attributes(str = '', additional_attributes = {})
attributes = declared_attributes.merge! additional_attributes
attributes.each do |key, value|
str << "#{Axlsx.camel(key, false)}=\"#{Axlsx.camel(Axlsx.booleanize(value), false)}\" "
end
str
end | [
"def",
"serialized_attributes",
"(",
"str",
"=",
"''",
",",
"additional_attributes",
"=",
"{",
"}",
")",
"attributes",
"=",
"declared_attributes",
".",
"merge!",
"additional_attributes",
"attributes",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"str",
"<... | serializes the instance values of the defining object based on the
list of serializable attributes.
@param [String] str The string instance to append this
serialization to.
@param [Hash] additional_attributes An option key value hash for
defining values that are not serializable attributes list. | [
"serializes",
"the",
"instance",
"values",
"of",
"the",
"defining",
"object",
"based",
"on",
"the",
"list",
"of",
"serializable",
"attributes",
"."
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/util/serialized_attributes.rb#L52-L58 | train | Serialize the attributes of the object | [
30522,
13366,
27289,
1035,
12332,
1006,
2358,
2099,
1027,
1005,
1005,
1010,
3176,
1035,
12332,
1027,
1063,
1065,
1007,
12332,
1027,
4161,
1035,
12332,
1012,
13590,
999,
3176,
1035,
12332,
12332,
1012,
2169,
2079,
1064,
3145,
1010,
3643,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hanami/hanami | lib/hanami/application_configuration.rb | Hanami.ApplicationConfiguration.sessions | def sessions(adapter = nil, options = {})
if adapter.nil?
@sessions ||= Config::Sessions.new
else
@sessions = Config::Sessions.new(adapter, options, self)
end
end | ruby | def sessions(adapter = nil, options = {})
if adapter.nil?
@sessions ||= Config::Sessions.new
else
@sessions = Config::Sessions.new(adapter, options, self)
end
end | [
"def",
"sessions",
"(",
"adapter",
"=",
"nil",
",",
"options",
"=",
"{",
"}",
")",
"if",
"adapter",
".",
"nil?",
"@sessions",
"||=",
"Config",
"::",
"Sessions",
".",
"new",
"else",
"@sessions",
"=",
"Config",
"::",
"Sessions",
".",
"new",
"(",
"adapter... | Configure sessions
Enable sessions (disabled by default).
This is part of a DSL, for this reason when this method is called with
an argument, it will set the corresponding instance variable. When
called without, it will return the already set value, or the default.
Given Class as adapter it will be used as sessions middleware.
Given String as adapter it will be resolved as class name and used as
sessions middleware.
Given Symbol as adapter it is assumed it's name of the class under
Rack::Session namespace that will be used as sessions middleware
(e.g. :cookie for Rack::Session::Cookie).
By default options include domain inferred from host configuration, and
secure flag inferred from scheme configuration.
@overload sessions(adapter, options)
Sets the given value.
@param adapter [Class, String, Symbol] Rack middleware for sessions management
@param options [Hash] options to pass to sessions middleware
@overload sessions(false)
Disables sessions
@overload sessions
Gets the value.
@return [Hanami::Config::Sessions] sessions configuration
@since 0.2.0
@see Hanami::Configuration#host
@see Hanami::Configuration#scheme
@example Getting the value
require 'hanami'
module Bookshelf
class Application < Hanami::Application
end
end
Bookshelf::Application.configuration.sessions
# => #<Hanami::Config::Sessions:0x00000001ca0c28 @enabled=false>
@example Setting the value with symbol
require 'hanami'
module Bookshelf
class Application < Hanami::Application
configure do
sessions :cookie, secret: 'abc123'
end
end
end
Bookshelf::Application.configuration.sessions
# => #<Hanami::Config::Sessions:0x00000001589458 @enabled=true, @adapter=:cookie, @options={:domain=>"localhost", :secure=>false}>
@example Disabling previously enabled sessions
require 'hanami'
module Bookshelf
class Application < Hanami::Application
configure do
sessions :cookie
sessions false
end
end
end
Bookshelf::Application.configuration.sessions
# => #<Hanami::Config::Sessions:0x00000002460d78 @enabled=false> | [
"Configure",
"sessions",
"Enable",
"sessions",
"(",
"disabled",
"by",
"default",
")",
"."
] | 8c6e5147e92ef869b25379448572da3698eacfdc | https://github.com/hanami/hanami/blob/8c6e5147e92ef869b25379448572da3698eacfdc/lib/hanami/application_configuration.rb#L464-L470 | train | Creates a new Sessions object. | [
30522,
13366,
6521,
1006,
15581,
2121,
1027,
9152,
2140,
1010,
7047,
1027,
1063,
1065,
1007,
2065,
15581,
2121,
1012,
9152,
2140,
1029,
1030,
6521,
1064,
1064,
1027,
9530,
8873,
2290,
1024,
1024,
6521,
1012,
2047,
2842,
1030,
6521,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_api_management/lib/2019-01-01/generated/azure_mgmt_api_management/cache.rb | Azure::ApiManagement::Mgmt::V2019_01_01.Cache.get_with_http_info | def get_with_http_info(resource_group_name, service_name, cache_id, custom_headers:nil)
get_async(resource_group_name, service_name, cache_id, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, service_name, cache_id, custom_headers:nil)
get_async(resource_group_name, service_name, cache_id, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"service_name",
",",
"cache_id",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"service_name",
",",
"cache_id",
",",
"custom_headers",
":custom_headers",
")",
".",
... | Gets the details of the Cache specified by its identifier.
@param resource_group_name [String] The name of the resource group.
@param service_name [String] The name of the API Management service.
@param cache_id [String] Identifier of the Cache entity. Cache identifier
(should be either 'default' or valid Azure region identifier).
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"details",
"of",
"the",
"Cache",
"specified",
"by",
"its",
"identifier",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2019-01-01/generated/azure_mgmt_api_management/cache.rb#L253-L255 | train | Gets the specified cache s index. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
17053,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
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... |
seejohnrun/ice_cube | lib/ice_cube/schedule.rb | IceCube.Schedule.next_occurrence | def next_occurrence(from = nil, options = {})
from = TimeUtil.match_zone(from, start_time) || TimeUtil.now(start_time)
enumerate_occurrences(from + 1, nil, options).next
rescue StopIteration
nil
end | ruby | def next_occurrence(from = nil, options = {})
from = TimeUtil.match_zone(from, start_time) || TimeUtil.now(start_time)
enumerate_occurrences(from + 1, nil, options).next
rescue StopIteration
nil
end | [
"def",
"next_occurrence",
"(",
"from",
"=",
"nil",
",",
"options",
"=",
"{",
"}",
")",
"from",
"=",
"TimeUtil",
".",
"match_zone",
"(",
"from",
",",
"start_time",
")",
"||",
"TimeUtil",
".",
"now",
"(",
"start_time",
")",
"enumerate_occurrences",
"(",
"f... | The next occurrence after now (overridable) | [
"The",
"next",
"occurrence",
"after",
"now",
"(",
"overridable",
")"
] | fb6c657bdc4f87dfda2bf83f15c5f487b78ccabd | https://github.com/seejohnrun/ice_cube/blob/fb6c657bdc4f87dfda2bf83f15c5f487b78ccabd/lib/ice_cube/schedule.rb#L177-L182 | train | Returns the next occurrence of the given time. | [
30522,
13366,
2279,
1035,
14404,
1006,
2013,
1027,
9152,
2140,
1010,
7047,
1027,
1063,
1065,
1007,
2013,
1027,
2051,
21823,
2140,
1012,
2674,
1035,
4224,
1006,
2013,
1010,
2707,
1035,
2051,
1007,
1064,
1064,
2051,
21823,
2140,
1012,
2085,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
randym/axlsx | lib/axlsx/drawing/view_3D.rb | Axlsx.View3D.element_for_attribute | def element_for_attribute(name, namespace='')
val = instance_values[name]
return "" if val == nil
"<%s:%s val='%s'/>" % [namespace, Axlsx::camel(name, false), val]
end | ruby | def element_for_attribute(name, namespace='')
val = instance_values[name]
return "" if val == nil
"<%s:%s val='%s'/>" % [namespace, Axlsx::camel(name, false), val]
end | [
"def",
"element_for_attribute",
"(",
"name",
",",
"namespace",
"=",
"''",
")",
"val",
"=",
"instance_values",
"[",
"name",
"]",
"return",
"\"\"",
"if",
"val",
"==",
"nil",
"\"<%s:%s val='%s'/>\"",
"%",
"[",
"namespace",
",",
"Axlsx",
"::",
"camel",
"(",
"n... | Note: move this to Axlsx module if we find the smae pattern elsewhere. | [
"Note",
":",
"move",
"this",
"to",
"Axlsx",
"module",
"if",
"we",
"find",
"the",
"smae",
"pattern",
"elsewhere",
"."
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/drawing/view_3D.rb#L109-L113 | train | Returns the element for the given attribute. | [
30522,
13366,
5783,
1035,
2005,
1035,
17961,
1006,
2171,
1010,
3415,
15327,
1027,
1005,
1005,
1007,
11748,
1027,
6013,
1035,
5300,
1031,
2171,
1033,
2709,
1000,
1000,
2065,
11748,
1027,
1027,
9152,
2140,
1000,
1026,
1003,
1055,
1024,
1003,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | spaceship/lib/spaceship/tunes/tunes_client.rb | Spaceship.TunesClient.upload_messages_screenshot | def upload_messages_screenshot(app_version, upload_image, device)
raise "app_version is required" unless app_version
raise "upload_image is required" unless upload_image
raise "device is required" unless device
du_client.upload_messages_screenshot(app_version, upload_image, content_provider_id, sso_token_for_image, device)
end | ruby | def upload_messages_screenshot(app_version, upload_image, device)
raise "app_version is required" unless app_version
raise "upload_image is required" unless upload_image
raise "device is required" unless device
du_client.upload_messages_screenshot(app_version, upload_image, content_provider_id, sso_token_for_image, device)
end | [
"def",
"upload_messages_screenshot",
"(",
"app_version",
",",
"upload_image",
",",
"device",
")",
"raise",
"\"app_version is required\"",
"unless",
"app_version",
"raise",
"\"upload_image is required\"",
"unless",
"upload_image",
"raise",
"\"device is required\"",
"unless",
"... | Uploads an iMessage screenshot
@param app_version (AppVersion): The version of your app
@param upload_image (UploadFile): The image to upload
@param device (string): The target device
@return [JSON] the response | [
"Uploads",
"an",
"iMessage",
"screenshot"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/spaceship/lib/spaceship/tunes/tunes_client.rb#L833-L839 | train | Upload a screenshot to the server | [
30522,
13366,
2039,
11066,
1035,
7696,
1035,
12117,
12326,
1006,
10439,
1035,
2544,
1010,
2039,
11066,
1035,
3746,
1010,
5080,
1007,
5333,
1000,
10439,
1035,
2544,
2003,
3223,
1000,
4983,
10439,
1035,
2544,
5333,
1000,
2039,
11066,
1035,
37... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
castwide/solargraph | lib/solargraph/source.rb | Solargraph.Source.synchronize | def synchronize updater
raise 'Invalid synchronization' unless updater.filename == filename
real_code = updater.write(@code)
if real_code == @code
@version = updater.version
return self
end
synced = Source.new(real_code, filename)
if synced.parsed?
synced.version = updater.version
return synced
end
incr_code = updater.repair(@repaired)
synced = Source.new(incr_code, filename)
synced.error_ranges.concat (error_ranges + updater.changes.map(&:range))
synced.code = real_code
synced.version = updater.version
synced
end | ruby | def synchronize updater
raise 'Invalid synchronization' unless updater.filename == filename
real_code = updater.write(@code)
if real_code == @code
@version = updater.version
return self
end
synced = Source.new(real_code, filename)
if synced.parsed?
synced.version = updater.version
return synced
end
incr_code = updater.repair(@repaired)
synced = Source.new(incr_code, filename)
synced.error_ranges.concat (error_ranges + updater.changes.map(&:range))
synced.code = real_code
synced.version = updater.version
synced
end | [
"def",
"synchronize",
"updater",
"raise",
"'Invalid synchronization'",
"unless",
"updater",
".",
"filename",
"==",
"filename",
"real_code",
"=",
"updater",
".",
"write",
"(",
"@code",
")",
"if",
"real_code",
"==",
"@code",
"@version",
"=",
"updater",
".",
"versi... | Synchronize the Source with an update. This method applies changes to the
code, parses the new code's AST, and returns the resulting Source object.
@param updater [Source::Updater]
@return [Source] | [
"Synchronize",
"the",
"Source",
"with",
"an",
"update",
".",
"This",
"method",
"applies",
"changes",
"to",
"the",
"code",
"parses",
"the",
"new",
"code",
"s",
"AST",
"and",
"returns",
"the",
"resulting",
"Source",
"object",
"."
] | 47badb5d151aca775ccbe6c470236089eae7839d | https://github.com/castwide/solargraph/blob/47badb5d151aca775ccbe6c470236089eae7839d/lib/solargraph/source.rb#L156-L174 | train | Synchronize the source with the source. | [
30522,
13366,
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,
3642,
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... |
gocardless/hutch | lib/hutch/cli.rb | Hutch.CLI.run | def run(argv = ARGV)
Hutch::Config.initialize
parse_options(argv)
daemonise_process
write_pid if Hutch::Config.pidfile
Hutch.logger.info "hutch booted with pid #{::Process.pid}"
if load_app && start_work_loop == :success
# If we got here, the worker was shut down nicely
Hutch.logger.info 'hutch shut down gracefully'
exit 0
else
Hutch.logger.info 'hutch terminated due to an error'
exit 1
end
end | ruby | def run(argv = ARGV)
Hutch::Config.initialize
parse_options(argv)
daemonise_process
write_pid if Hutch::Config.pidfile
Hutch.logger.info "hutch booted with pid #{::Process.pid}"
if load_app && start_work_loop == :success
# If we got here, the worker was shut down nicely
Hutch.logger.info 'hutch shut down gracefully'
exit 0
else
Hutch.logger.info 'hutch terminated due to an error'
exit 1
end
end | [
"def",
"run",
"(",
"argv",
"=",
"ARGV",
")",
"Hutch",
"::",
"Config",
".",
"initialize",
"parse_options",
"(",
"argv",
")",
"daemonise_process",
"write_pid",
"if",
"Hutch",
"::",
"Config",
".",
"pidfile",
"Hutch",
".",
"logger",
".",
"info",
"\"hutch booted ... | Run a Hutch worker with the command line interface. | [
"Run",
"a",
"Hutch",
"worker",
"with",
"the",
"command",
"line",
"interface",
"."
] | 9314b3b8c84abeb78170730757f3eb8ccc4f54c5 | https://github.com/gocardless/hutch/blob/9314b3b8c84abeb78170730757f3eb8ccc4f54c5/lib/hutch/cli.rb#L13-L31 | train | Run the worker | [
30522,
13366,
2448,
1006,
12098,
2290,
2615,
1027,
12098,
2290,
2615,
1007,
12570,
2818,
1024,
1024,
9530,
8873,
2290,
1012,
3988,
4697,
11968,
3366,
1035,
7047,
1006,
12098,
2290,
2615,
1007,
12828,
5562,
1035,
2832,
4339,
1035,
14255,
209... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.create_images_from_predictions | def create_images_from_predictions(project_id, batch, custom_headers:nil)
response = create_images_from_predictions_async(project_id, batch, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_images_from_predictions(project_id, batch, custom_headers:nil)
response = create_images_from_predictions_async(project_id, batch, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_images_from_predictions",
"(",
"project_id",
",",
"batch",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_images_from_predictions_async",
"(",
"project_id",
",",
"batch",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"r... | Add the specified predicted images to the set of training images.
This API creates a batch of images from predicted images specified. There is
a limit of 64 images and 20 tags.
@param project_id The project id.
@param batch [ImageIdCreateBatch] Image and tag ids. Limited to 64 images and
20 tags per batch.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ImageCreateSummary] operation results. | [
"Add",
"the",
"specified",
"predicted",
"images",
"to",
"the",
"set",
"of",
"training",
"images",
"."
] | 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#L1807-L1810 | train | Creates images from predictions. | [
30522,
13366,
3443,
1035,
4871,
1035,
2013,
1035,
20932,
1006,
2622,
1035,
8909,
1010,
14108,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3443,
1035,
4871,
1035,
2013,
1035,
20932,
1035,
2004,
6038,
2278,
1006,
2622,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/device_settings.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.DeviceSettings.begin_create_or_update_time_settings | def begin_create_or_update_time_settings(device_name, parameters, resource_group_name, manager_name, custom_headers:nil)
response = begin_create_or_update_time_settings_async(device_name, parameters, resource_group_name, manager_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_create_or_update_time_settings(device_name, parameters, resource_group_name, manager_name, custom_headers:nil)
response = begin_create_or_update_time_settings_async(device_name, parameters, resource_group_name, manager_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_create_or_update_time_settings",
"(",
"device_name",
",",
"parameters",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_create_or_update_time_settings_async",
"(",
"device_name",
",",
"parameters... | Creates or updates the time settings of the specified device.
@param device_name [String] The device name
@param parameters [TimeSettings] The time settings to be added or updated.
@param resource_group_name [String] The resource group name
@param manager_name [String] The manager name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [TimeSettings] operation results. | [
"Creates",
"or",
"updates",
"the",
"time",
"settings",
"of",
"the",
"specified",
"device",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/device_settings.rb#L1071-L1074 | train | Creates or updates the time settings of the specified device. | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1035,
2051,
1035,
10906,
1006,
5080,
1035,
2171,
1010,
11709,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
randym/axlsx | lib/axlsx/workbook/worksheet/worksheet.rb | Axlsx.Worksheet.name_to_cell | def name_to_cell(name)
col_index, row_index = *Axlsx::name_to_indices(name)
r = rows[row_index]
r[col_index] if r
end | ruby | def name_to_cell(name)
col_index, row_index = *Axlsx::name_to_indices(name)
r = rows[row_index]
r[col_index] if r
end | [
"def",
"name_to_cell",
"(",
"name",
")",
"col_index",
",",
"row_index",
"=",
"Axlsx",
"::",
"name_to_indices",
"(",
"name",
")",
"r",
"=",
"rows",
"[",
"row_index",
"]",
"r",
"[",
"col_index",
"]",
"if",
"r",
"end"
] | returns the column and row index for a named based cell
@param [String] name The cell or cell range to return. "A1" will return the first cell of the first row.
@return [Cell] | [
"returns",
"the",
"column",
"and",
"row",
"index",
"for",
"a",
"named",
"based",
"cell"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/worksheet/worksheet.rb#L602-L606 | train | Returns the cell with the given name. | [
30522,
13366,
2171,
1035,
2000,
1035,
3526,
1006,
2171,
1007,
8902,
1035,
5950,
1010,
5216,
1035,
5950,
1027,
1008,
22260,
4877,
2595,
1024,
1024,
2171,
1035,
2000,
1035,
29299,
1006,
2171,
1007,
1054,
1027,
10281,
1031,
5216,
1035,
5950,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
puppetlabs/puppet | lib/puppet/util/windows/service.rb | Puppet::Util::Windows.Service.set_startup_mode | def set_startup_mode(service_name, startup_type)
startup_code = SERVICE_START_TYPES.key(startup_type)
if startup_code.nil?
raise Puppet::Error.new(_("Unknown start type %{start_type}") % {startup_type: startup_type.to_s})
end
open_service(service_name, SC_MANAGER_CONNECT, SERVICE_CHANGE_CONFIG) do |service|
# Currently the only thing puppet's API can really manage
# in this list is dwStartType (the third param). Thus no
# generic function was written to make use of all the params
# since the API as-is couldn't use them anyway
success = ChangeServiceConfigW(
service,
SERVICE_NO_CHANGE, # dwServiceType
startup_code, # dwStartType
SERVICE_NO_CHANGE, # dwErrorControl
FFI::Pointer::NULL, # lpBinaryPathName
FFI::Pointer::NULL, # lpLoadOrderGroup
FFI::Pointer::NULL, # lpdwTagId
FFI::Pointer::NULL, # lpDependencies
FFI::Pointer::NULL, # lpServiceStartName
FFI::Pointer::NULL, # lpPassword
FFI::Pointer::NULL # lpDisplayName
)
if success == FFI::WIN32_FALSE
raise Puppet::Util::Windows::Error.new(_("Failed to update service configuration"))
end
end
end | ruby | def set_startup_mode(service_name, startup_type)
startup_code = SERVICE_START_TYPES.key(startup_type)
if startup_code.nil?
raise Puppet::Error.new(_("Unknown start type %{start_type}") % {startup_type: startup_type.to_s})
end
open_service(service_name, SC_MANAGER_CONNECT, SERVICE_CHANGE_CONFIG) do |service|
# Currently the only thing puppet's API can really manage
# in this list is dwStartType (the third param). Thus no
# generic function was written to make use of all the params
# since the API as-is couldn't use them anyway
success = ChangeServiceConfigW(
service,
SERVICE_NO_CHANGE, # dwServiceType
startup_code, # dwStartType
SERVICE_NO_CHANGE, # dwErrorControl
FFI::Pointer::NULL, # lpBinaryPathName
FFI::Pointer::NULL, # lpLoadOrderGroup
FFI::Pointer::NULL, # lpdwTagId
FFI::Pointer::NULL, # lpDependencies
FFI::Pointer::NULL, # lpServiceStartName
FFI::Pointer::NULL, # lpPassword
FFI::Pointer::NULL # lpDisplayName
)
if success == FFI::WIN32_FALSE
raise Puppet::Util::Windows::Error.new(_("Failed to update service configuration"))
end
end
end | [
"def",
"set_startup_mode",
"(",
"service_name",
",",
"startup_type",
")",
"startup_code",
"=",
"SERVICE_START_TYPES",
".",
"key",
"(",
"startup_type",
")",
"if",
"startup_code",
".",
"nil?",
"raise",
"Puppet",
"::",
"Error",
".",
"new",
"(",
"_",
"(",
"\"Unkno... | Change the startup mode of a windows service
@param [string] service_name the name of the service to modify
@param [Int] startup_type a code corresponding to a start type for
windows service, see the "Service start type codes" section in the
Puppet::Util::Windows::Service file for the list of available codes | [
"Change",
"the",
"startup",
"mode",
"of",
"a",
"windows",
"service"
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/util/windows/service.rb#L403-L430 | train | Set the startup mode of a service | [
30522,
13366,
2275,
1035,
22752,
1035,
5549,
1006,
2326,
1035,
2171,
1010,
22752,
1035,
2828,
1007,
22752,
1035,
3642,
1027,
2326,
1035,
2707,
1035,
4127,
1012,
3145,
1006,
22752,
1035,
2828,
1007,
2065,
22752,
1035,
3642,
1012,
9152,
2140,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/sprockets | lib/sprockets/encoding_utils.rb | Sprockets.EncodingUtils.deflate | def deflate(str)
deflater = Zlib::Deflate.new(
Zlib::BEST_COMPRESSION,
-Zlib::MAX_WBITS,
Zlib::MAX_MEM_LEVEL,
Zlib::DEFAULT_STRATEGY
)
deflater << str
deflater.finish
end | ruby | def deflate(str)
deflater = Zlib::Deflate.new(
Zlib::BEST_COMPRESSION,
-Zlib::MAX_WBITS,
Zlib::MAX_MEM_LEVEL,
Zlib::DEFAULT_STRATEGY
)
deflater << str
deflater.finish
end | [
"def",
"deflate",
"(",
"str",
")",
"deflater",
"=",
"Zlib",
"::",
"Deflate",
".",
"new",
"(",
"Zlib",
"::",
"BEST_COMPRESSION",
",",
"-",
"Zlib",
"::",
"MAX_WBITS",
",",
"Zlib",
"::",
"MAX_MEM_LEVEL",
",",
"Zlib",
"::",
"DEFAULT_STRATEGY",
")",
"deflater",... | Binary encodings
Public: Use deflate to compress data.
str - String data
Returns a compressed String | [
"Binary",
"encodings",
"Public",
":",
"Use",
"deflate",
"to",
"compress",
"data",
"."
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/encoding_utils.rb#L19-L28 | train | deflate a string | [
30522,
13366,
13366,
13806,
1006,
2358,
2099,
1007,
13366,
13806,
2099,
1027,
1062,
29521,
1024,
1024,
13366,
13806,
1012,
2047,
1006,
1062,
29521,
1024,
1024,
2190,
1035,
13379,
1010,
1011,
1062,
29521,
1024,
1024,
4098,
1035,
25610,
12762,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_extension_images.rb | Azure::Compute::Mgmt::V2018_04_01.VirtualMachineExtensionImages.get_with_http_info | def get_with_http_info(location, publisher_name, type, version, custom_headers:nil)
get_async(location, publisher_name, type, version, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(location, publisher_name, type, version, custom_headers:nil)
get_async(location, publisher_name, type, version, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"location",
",",
"publisher_name",
",",
"type",
",",
"version",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"location",
",",
"publisher_name",
",",
"type",
",",
"version",
",",
"custom_headers",
":custom_headers",
... | Gets a virtual machine extension image.
@param location [String] The name of a supported Azure region.
@param publisher_name [String]
@param type [String]
@param version [String]
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"a",
"virtual",
"machine",
"extension",
"image",
"."
] | 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_extension_images.rb#L53-L55 | train | Gets the index of the specified resource group. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
3295,
1010,
6674,
1035,
2171,
1010,
2828,
1010,
2544,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
2004,
6038,
2278,
1006,
3295,
1010,
6674,
1035,
2171,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activesupport/lib/active_support/values/time_zone.rb | ActiveSupport.TimeZone.local | def local(*args)
time = Time.utc(*args)
ActiveSupport::TimeWithZone.new(nil, self, time)
end | ruby | def local(*args)
time = Time.utc(*args)
ActiveSupport::TimeWithZone.new(nil, self, time)
end | [
"def",
"local",
"(",
"*",
"args",
")",
"time",
"=",
"Time",
".",
"utc",
"(",
"args",
")",
"ActiveSupport",
"::",
"TimeWithZone",
".",
"new",
"(",
"nil",
",",
"self",
",",
"time",
")",
"end"
] | Method for creating new ActiveSupport::TimeWithZone instance in time zone
of +self+ from given values.
Time.zone = 'Hawaii' # => "Hawaii"
Time.zone.local(2007, 2, 1, 15, 30, 45) # => Thu, 01 Feb 2007 15:30:45 HST -10:00 | [
"Method",
"for",
"creating",
"new",
"ActiveSupport",
"::",
"TimeWithZone",
"instance",
"in",
"time",
"zone",
"of",
"+",
"self",
"+",
"from",
"given",
"values",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/values/time_zone.rb#L347-L350 | train | Returns a new TimeWithZone with the local time | [
30522,
13366,
2334,
1006,
1008,
12098,
5620,
1007,
2051,
1027,
2051,
1012,
11396,
1006,
1008,
12098,
5620,
1007,
3161,
6342,
9397,
11589,
1024,
1024,
2051,
24415,
15975,
1012,
2047,
1006,
9152,
2140,
1010,
2969,
1010,
2051,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
decidim/decidim | decidim-core/app/services/decidim/email_notification_generator.rb | Decidim.EmailNotificationGenerator.send_email_to | def send_email_to(recipient, user_role:)
return unless recipient
return unless recipient.email_on_notification?
NotificationMailer
.event_received(
event,
event_class.name,
resource,
recipient,
user_role.to_s,
extra
)
.deliver_later
end | ruby | def send_email_to(recipient, user_role:)
return unless recipient
return unless recipient.email_on_notification?
NotificationMailer
.event_received(
event,
event_class.name,
resource,
recipient,
user_role.to_s,
extra
)
.deliver_later
end | [
"def",
"send_email_to",
"(",
"recipient",
",",
"user_role",
":",
")",
"return",
"unless",
"recipient",
"return",
"unless",
"recipient",
".",
"email_on_notification?",
"NotificationMailer",
".",
"event_received",
"(",
"event",
",",
"event_class",
".",
"name",
",",
... | Private: sends the notification email to the user if they have the
`email_on_notification` flag active.
recipient - The user that will receive the email.
user_role - the role the user takes for this notification (either
`:follower` or `:affected_user`)
Returns nothing. | [
"Private",
":",
"sends",
"the",
"notification",
"email",
"to",
"the",
"user",
"if",
"they",
"have",
"the",
"email_on_notification",
"flag",
"active",
"."
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/app/services/decidim/email_notification_generator.rb#L63-L77 | train | Send email to a recipient | [
30522,
13366,
4604,
1035,
10373,
1035,
2000,
1006,
7799,
1010,
5310,
1035,
2535,
1024,
1007,
2709,
4983,
7799,
2709,
4983,
7799,
1012,
10373,
1035,
2006,
1035,
26828,
1029,
26828,
21397,
2121,
1012,
2724,
1035,
2363,
1006,
2724,
1010,
2724,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
castwide/solargraph | lib/solargraph/library.rb | Solargraph.Library.checkout | def checkout filename
checked = read(filename)
@synchronized = (checked == @current) if synchronized?
@current = checked
# Cataloging is necessary to avoid FileNotFoundErrors when the file is
# not in the workspace. Otherwise it should be safe to defer
# synchronization.
catalog unless workspace.has_file?(filename)
@current
end | ruby | def checkout filename
checked = read(filename)
@synchronized = (checked == @current) if synchronized?
@current = checked
# Cataloging is necessary to avoid FileNotFoundErrors when the file is
# not in the workspace. Otherwise it should be safe to defer
# synchronization.
catalog unless workspace.has_file?(filename)
@current
end | [
"def",
"checkout",
"filename",
"checked",
"=",
"read",
"(",
"filename",
")",
"@synchronized",
"=",
"(",
"checked",
"==",
"@current",
")",
"if",
"synchronized?",
"@current",
"=",
"checked",
"# Cataloging is necessary to avoid FileNotFoundErrors when the file is",
"# not in... | Check a file out of the library. If the file is not part of the
workspace, the ApiMap will virtualize it for mapping purposes. If
filename is nil, any source currently checked out of the library
will be removed from the ApiMap. Only one file can be checked out
(virtualized) at a time.
@raise [FileNotFoundError] if the file does not exist.
@param filename [String]
@return [Source] | [
"Check",
"a",
"file",
"out",
"of",
"the",
"library",
".",
"If",
"the",
"file",
"is",
"not",
"part",
"of",
"the",
"workspace",
"the",
"ApiMap",
"will",
"virtualize",
"it",
"for",
"mapping",
"purposes",
".",
"If",
"filename",
"is",
"nil",
"any",
"source",
... | 47badb5d151aca775ccbe6c470236089eae7839d | https://github.com/castwide/solargraph/blob/47badb5d151aca775ccbe6c470236089eae7839d/lib/solargraph/library.rb#L256-L265 | train | Checkout the file in the workspace. | [
30522,
13366,
4638,
5833,
5371,
18442,
7039,
1027,
3191,
1006,
5371,
18442,
1007,
1030,
25549,
1027,
1006,
7039,
1027,
1027,
1030,
2783,
1007,
2065,
25549,
1029,
1030,
2783,
1027,
7039,
1001,
12105,
2075,
2003,
4072,
2000,
4468,
5371,
17048... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getsentry/raven-ruby | lib/raven/configuration.rb | Raven.Configuration.qualified_const_get | def qualified_const_get(x)
x = x.to_s
if !x.match(/::/)
Object.const_get(x)
else
x.split(MODULE_SEPARATOR).reject(&:empty?).inject(Object) { |a, e| a.const_get(e) }
end
rescue NameError # There's no way to safely ask if a constant exist for an unknown string
nil
end | ruby | def qualified_const_get(x)
x = x.to_s
if !x.match(/::/)
Object.const_get(x)
else
x.split(MODULE_SEPARATOR).reject(&:empty?).inject(Object) { |a, e| a.const_get(e) }
end
rescue NameError # There's no way to safely ask if a constant exist for an unknown string
nil
end | [
"def",
"qualified_const_get",
"(",
"x",
")",
"x",
"=",
"x",
".",
"to_s",
"if",
"!",
"x",
".",
"match",
"(",
"/",
"/",
")",
"Object",
".",
"const_get",
"(",
"x",
")",
"else",
"x",
".",
"split",
"(",
"MODULE_SEPARATOR",
")",
".",
"reject",
"(",
":e... | In Ruby <2.0 const_get can't lookup "SomeModule::SomeClass" in one go | [
"In",
"Ruby",
"<2",
".",
"0",
"const_get",
"can",
"t",
"lookup",
"SomeModule",
"::",
"SomeClass",
"in",
"one",
"go"
] | 729c22f9284939695f14822683bff1a0b72502bd | https://github.com/getsentry/raven-ruby/blob/729c22f9284939695f14822683bff1a0b72502bd/lib/raven/configuration.rb#L376-L385 | train | Get the constant for a given string | [
30522,
13366,
4591,
1035,
9530,
3367,
1035,
2131,
1006,
1060,
1007,
1060,
1027,
1060,
1012,
2000,
1035,
1055,
2065,
999,
1060,
1012,
2674,
1006,
1013,
1024,
1024,
1013,
1007,
4874,
1012,
9530,
3367,
1035,
2131,
1006,
1060,
1007,
2842,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
puppetlabs/pdk | lib/pdk/util.rb | PDK.Util.find_valid_json_in | def find_valid_json_in(text, opts = {})
break_on_first = opts.key?(:break_on_first) ? opts[:break_on_first] : true
json_result = break_on_first ? nil : []
text.scan(%r{\{(?:[^{}]|(?:\g<0>))*\}}x) do |str|
begin
if break_on_first
json_result = JSON.parse(str)
break
else
json_result.push(JSON.parse(str))
end
rescue JSON::ParserError
next
end
end
json_result
end | ruby | def find_valid_json_in(text, opts = {})
break_on_first = opts.key?(:break_on_first) ? opts[:break_on_first] : true
json_result = break_on_first ? nil : []
text.scan(%r{\{(?:[^{}]|(?:\g<0>))*\}}x) do |str|
begin
if break_on_first
json_result = JSON.parse(str)
break
else
json_result.push(JSON.parse(str))
end
rescue JSON::ParserError
next
end
end
json_result
end | [
"def",
"find_valid_json_in",
"(",
"text",
",",
"opts",
"=",
"{",
"}",
")",
"break_on_first",
"=",
"opts",
".",
"key?",
"(",
":break_on_first",
")",
"?",
"opts",
"[",
":break_on_first",
"]",
":",
"true",
"json_result",
"=",
"break_on_first",
"?",
"nil",
":"... | Iterate through possible JSON documents until we find one that is valid.
@param [String] text the text in which to find a JSON document
@param [Hash] opts options
@option opts [Boolean] :break_on_first Whether or not to break after valid JSON is found, defaults to true
@return [Hash, Array<Hash>, nil] subset of text as Hash of first valid JSON found, array of all valid JSON found, or nil if no valid
JSON found in the text
@private | [
"Iterate",
"through",
"possible",
"JSON",
"documents",
"until",
"we",
"find",
"one",
"that",
"is",
"valid",
"."
] | 0d864aff62ffef04b5104addf399d0476afd71e7 | https://github.com/puppetlabs/pdk/blob/0d864aff62ffef04b5104addf399d0476afd71e7/lib/pdk/util.rb#L165-L184 | train | Find valid JSON in the text | [
30522,
13366,
2424,
1035,
9398,
1035,
1046,
3385,
1035,
1999,
1006,
3793,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
3338,
1035,
2006,
1035,
2034,
1027,
23569,
2015,
1012,
3145,
1029,
1006,
1024,
3338,
1035,
2006,
1035,
2034,
30524,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-10-01/generated/azure_mgmt_network/vpn_sites.rb | Azure::Network::Mgmt::V2018_10_01.VpnSites.begin_create_or_update | def begin_create_or_update(resource_group_name, vpn_site_name, vpn_site_parameters, custom_headers:nil)
response = begin_create_or_update_async(resource_group_name, vpn_site_name, vpn_site_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_create_or_update(resource_group_name, vpn_site_name, vpn_site_parameters, custom_headers:nil)
response = begin_create_or_update_async(resource_group_name, vpn_site_name, vpn_site_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_create_or_update",
"(",
"resource_group_name",
",",
"vpn_site_name",
",",
"vpn_site_parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"vpn_site_name",
",",
"vpn_site_parameter... | Creates a VpnSite resource if it doesn't exist else updates the existing
VpnSite.
@param resource_group_name [String] The resource group name of the VpnSite.
@param vpn_site_name [String] The name of the VpnSite being created or
updated.
@param vpn_site_parameters [VpnSite] Parameters supplied to create or update
VpnSite.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [VpnSite] operation results. | [
"Creates",
"a",
"VpnSite",
"resource",
"if",
"it",
"doesn",
"t",
"exist",
"else",
"updates",
"the",
"existing",
"VpnSite",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-10-01/generated/azure_mgmt_network/vpn_sites.rb#L435-L438 | train | Creates or updates a virtual network site. | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
21210,
2078,
1035,
2609,
1035,
2171,
1010,
21210,
2078,
1035,
2609,
1035,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2017-10-01-preview/generated/azure_mgmt_sql/managed_database_vulnerability_assessment_scans.rb | Azure::SQL::Mgmt::V2017_10_01_preview.ManagedDatabaseVulnerabilityAssessmentScans.begin_initiate_scan | def begin_initiate_scan(resource_group_name, managed_instance_name, database_name, scan_id, custom_headers:nil)
response = begin_initiate_scan_async(resource_group_name, managed_instance_name, database_name, scan_id, custom_headers:custom_headers).value!
nil
end | ruby | def begin_initiate_scan(resource_group_name, managed_instance_name, database_name, scan_id, custom_headers:nil)
response = begin_initiate_scan_async(resource_group_name, managed_instance_name, database_name, scan_id, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_initiate_scan",
"(",
"resource_group_name",
",",
"managed_instance_name",
",",
"database_name",
",",
"scan_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_initiate_scan_async",
"(",
"resource_group_name",
",",
"managed_instance_name",
",... | Executes a Vulnerability Assessment database scan.
@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 managed_instance_name [String] The name of the managed instance.
@param database_name [String] The name of the database.
@param scan_id [String] The vulnerability assessment scan Id of the scan to
retrieve.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Executes",
"a",
"Vulnerability",
"Assessment",
"database",
"scan",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2017-10-01-preview/generated/azure_mgmt_sql/managed_database_vulnerability_assessment_scans.rb#L422-L425 | train | Initialize a scan of a managed database. | [
30522,
13366,
4088,
1035,
17820,
1035,
13594,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3266,
1035,
6013,
1035,
2171,
1010,
7809,
1035,
2171,
1010,
13594,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
awesome-print/awesome_print | lib/awesome_print/ext/mongoid.rb | AwesomePrint.Mongoid.awesome_mongoid_class | def awesome_mongoid_class(object)
return object.inspect if !defined?(::ActiveSupport::OrderedHash) || !object.respond_to?(:fields)
data = object.fields.sort_by { |key| key }.inject(::ActiveSupport::OrderedHash.new) do |hash, c|
hash[c[1].name.to_sym] = (c[1].type || 'undefined').to_s.underscore.intern
hash
end
name = "class #{awesome_simple(object.to_s, :class)}"
base = "< #{awesome_simple(object.superclass.to_s, :class)}"
[name, base, awesome_hash(data)].join(' ')
end | ruby | def awesome_mongoid_class(object)
return object.inspect if !defined?(::ActiveSupport::OrderedHash) || !object.respond_to?(:fields)
data = object.fields.sort_by { |key| key }.inject(::ActiveSupport::OrderedHash.new) do |hash, c|
hash[c[1].name.to_sym] = (c[1].type || 'undefined').to_s.underscore.intern
hash
end
name = "class #{awesome_simple(object.to_s, :class)}"
base = "< #{awesome_simple(object.superclass.to_s, :class)}"
[name, base, awesome_hash(data)].join(' ')
end | [
"def",
"awesome_mongoid_class",
"(",
"object",
")",
"return",
"object",
".",
"inspect",
"if",
"!",
"defined?",
"(",
"::",
"ActiveSupport",
"::",
"OrderedHash",
")",
"||",
"!",
"object",
".",
"respond_to?",
"(",
":fields",
")",
"data",
"=",
"object",
".",
"... | Format Mongoid class object.
------------------------------------------------------------------------------ | [
"Format",
"Mongoid",
"class",
"object",
".",
"------------------------------------------------------------------------------"
] | 4564fd74721562cbef2443f7d97109bf9192343d | https://github.com/awesome-print/awesome_print/blob/4564fd74721562cbef2443f7d97109bf9192343d/lib/awesome_print/ext/mongoid.rb#L32-L44 | train | Returns a unique identifier for a given object. | [
30522,
13366,
12476,
1035,
12256,
3995,
3593,
1035,
2465,
1006,
4874,
1007,
2709,
4874,
1012,
22459,
2065,
999,
4225,
1029,
1006,
1024,
1024,
3161,
6342,
9397,
11589,
1024,
1024,
3641,
14949,
2232,
1007,
1064,
1064,
999,
4874,
1012,
6869,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cloudfoundry/bosh | src/bosh-monitor/lib/bosh/monitor/director.rb | Bosh::Monitor.Director.perform_request | def perform_request(method, uri, options={})
f = Fiber.current
target_uri = endpoint + uri
headers = {}
unless options.fetch(:no_login, false)
headers['authorization'] = auth_provider.auth_header
end
http = EM::HttpRequest.new(target_uri).send(method.to_sym, :head => headers)
http.callback { f.resume(http) }
http.errback { f.resume(http) }
Fiber.yield
rescue URI::Error
raise DirectorError, "Invalid URI: #{target_uri}"
end | ruby | def perform_request(method, uri, options={})
f = Fiber.current
target_uri = endpoint + uri
headers = {}
unless options.fetch(:no_login, false)
headers['authorization'] = auth_provider.auth_header
end
http = EM::HttpRequest.new(target_uri).send(method.to_sym, :head => headers)
http.callback { f.resume(http) }
http.errback { f.resume(http) }
Fiber.yield
rescue URI::Error
raise DirectorError, "Invalid URI: #{target_uri}"
end | [
"def",
"perform_request",
"(",
"method",
",",
"uri",
",",
"options",
"=",
"{",
"}",
")",
"f",
"=",
"Fiber",
".",
"current",
"target_uri",
"=",
"endpoint",
"+",
"uri",
"headers",
"=",
"{",
"}",
"unless",
"options",
".",
"fetch",
"(",
":no_login",
",",
... | JMS and GO: This effectively turns async requests into synchronous requests.
This is a very bad thing to do on eventmachine because it will block the single
event loop. This code should be removed and all requests converted
to "the eventmachine way". | [
"JMS",
"and",
"GO",
":",
"This",
"effectively",
"turns",
"async",
"requests",
"into",
"synchronous",
"requests",
".",
"This",
"is",
"a",
"very",
"bad",
"thing",
"to",
"do",
"on",
"eventmachine",
"because",
"it",
"will",
"block",
"the",
"single",
"event",
"... | 2eaa7100879ddd20cd909cd698514746195e28b7 | https://github.com/cloudfoundry/bosh/blob/2eaa7100879ddd20cd909cd698514746195e28b7/src/bosh-monitor/lib/bosh/monitor/director.rb#L69-L88 | train | Perform a request to the Director | [
30522,
13366,
4685,
1035,
5227,
1006,
4118,
1010,
24471,
2072,
1010,
7047,
1027,
1063,
1065,
1007,
1042,
1027,
11917,
1012,
2783,
4539,
1035,
24471,
2072,
1027,
2203,
8400,
1009,
24471,
2072,
20346,
2015,
1027,
1063,
1065,
4983,
7047,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/instance.rb | Aws::AutoScaling.Instance.set_health | def set_health(options = {})
options = options.merge(instance_id: @id)
resp = @client.set_instance_health(options)
resp.data
end | ruby | def set_health(options = {})
options = options.merge(instance_id: @id)
resp = @client.set_instance_health(options)
resp.data
end | [
"def",
"set_health",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"instance_id",
":",
"@id",
")",
"resp",
"=",
"@client",
".",
"set_instance_health",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
instance.set_health({
health_status: "XmlStringMaxLen32", # required
should_respect_grace_period: false,
})
@param [Hash] options ({})
@option options [required, String] :health_status
The health status of the instance. Set to `Healthy` to have the
instance remain in service. Set to `Unhealthy` to have the instance be
out of service. Amazon EC2 Auto Scaling terminates and replaces the
unhealthy instance.
@option options [Boolean] :should_respect_grace_period
If the Auto Scaling group of the specified instance has a
`HealthCheckGracePeriod` specified for the group, by default, this
call respects the grace period. Set this to `False`, to have the call
not respect the grace period associated with the group.
For more information about the health check grace period, see
CreateAutoScalingGroup.
@return [EmptyStructure] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/instance.rb#L327-L331 | train | Set instance health | [
30522,
13366,
2275,
1035,
2740,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
6013,
1035,
8909,
1024,
1030,
8909,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
2275,
1035,
6013,
1035,
2740,
1006,
7047,
1007,
24501,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/api/v1_items_api.rb | SquareConnect.V1ItemsApi.create_item | def create_item(location_id, body, opts = {})
data, _status_code, _headers = create_item_with_http_info(location_id, body, opts)
return data
end | ruby | def create_item(location_id, body, opts = {})
data, _status_code, _headers = create_item_with_http_info(location_id, body, opts)
return data
end | [
"def",
"create_item",
"(",
"location_id",
",",
"body",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"create_item_with_http_info",
"(",
"location_id",
",",
"body",
",",
"opts",
")",
"return",
"data",
"end"
] | CreateItem
Creates an item and at least one variation for it. Item-related entities include fields you can use to associate them with entities in a non-Square system. When you create an item-related entity, you can optionally specify its `id`. This value must be unique among all IDs ever specified for the account, including those specified by other applications. You can never reuse an entity ID. If you do not specify an ID, Square generates one for the entity. Item variations have a `user_data` string that lets you associate arbitrary metadata with the variation. The string cannot exceed 255 characters.
@param location_id The ID of the location to create an item 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 [V1Item] | [
"CreateItem",
"Creates",
"an",
"item",
"and",
"at",
"least",
"one",
"variation",
"for",
"it",
".",
"Item",
"-",
"related",
"entities",
"include",
"fields",
"you",
"can",
"use",
"to",
"associate",
"them",
"with",
"entities",
"in",
"a",
"non",
"-",
"Square",... | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/v1_items_api.rb#L392-L395 | train | Creates an item | [
30522,
13366,
3443,
1035,
8875,
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,
8875,
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... |
sds/scss-lint | lib/scss_lint/linter/space_after_property_colon.rb | SCSSLint.Linter::SpaceAfterPropertyColon.value_offset | def value_offset(prop)
src_range = prop.name_source_range
src_range.start_pos.offset +
(src_range.end_pos.offset - src_range.start_pos.offset) +
whitespace_after_colon(prop).take_while { |w| w == ' ' }.size
end | ruby | def value_offset(prop)
src_range = prop.name_source_range
src_range.start_pos.offset +
(src_range.end_pos.offset - src_range.start_pos.offset) +
whitespace_after_colon(prop).take_while { |w| w == ' ' }.size
end | [
"def",
"value_offset",
"(",
"prop",
")",
"src_range",
"=",
"prop",
".",
"name_source_range",
"src_range",
".",
"start_pos",
".",
"offset",
"+",
"(",
"src_range",
".",
"end_pos",
".",
"offset",
"-",
"src_range",
".",
"start_pos",
".",
"offset",
")",
"+",
"w... | Offset of value for property | [
"Offset",
"of",
"value",
"for",
"property"
] | e99afe4ede041a431a06e585c12ce82f6ad50116 | https://github.com/sds/scss-lint/blob/e99afe4ede041a431a06e585c12ce82f6ad50116/lib/scss_lint/linter/space_after_property_colon.rb#L75-L80 | train | Returns the offset of the value in the property. | [
30522,
13366,
3643,
1035,
16396,
1006,
17678,
1007,
5034,
2278,
1035,
2846,
1027,
17678,
1012,
2171,
1035,
3120,
1035,
2846,
5034,
2278,
1035,
2846,
1012,
2707,
1035,
13433,
2015,
1012,
16396,
1009,
1006,
5034,
2278,
1035,
2846,
1012,
2203,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/backup_schedules.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.BackupSchedules.list_by_backup_policy | def list_by_backup_policy(device_name, backup_policy_name, resource_group_name, manager_name, custom_headers:nil)
response = list_by_backup_policy_async(device_name, backup_policy_name, resource_group_name, manager_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_backup_policy(device_name, backup_policy_name, resource_group_name, manager_name, custom_headers:nil)
response = list_by_backup_policy_async(device_name, backup_policy_name, resource_group_name, manager_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_backup_policy",
"(",
"device_name",
",",
"backup_policy_name",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_backup_policy_async",
"(",
"device_name",
",",
"backup_policy_name",
",",
"r... | Gets all the backup schedules in a backup policy.
@param device_name [String] The device name
@param backup_policy_name [String] The backup policy name.
@param resource_group_name [String] The resource group name
@param manager_name [String] The manager name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [BackupScheduleList] operation results. | [
"Gets",
"all",
"the",
"backup",
"schedules",
"in",
"a",
"backup",
"policy",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/backup_schedules.rb#L36-L39 | train | Gets the list of all the managed managed | [
30522,
13366,
2862,
1035,
2011,
1035,
10200,
1035,
3343,
1006,
5080,
1035,
2171,
1010,
10200,
1035,
3343,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mojombo/chronic | lib/chronic/handlers.rb | Chronic.Handlers.handle_sm_sy | def handle_sm_sy(tokens, options)
month = tokens[0].get_tag(ScalarMonth).type
year = tokens[1].get_tag(ScalarYear).type
handle_year_and_month(year, month)
end | ruby | def handle_sm_sy(tokens, options)
month = tokens[0].get_tag(ScalarMonth).type
year = tokens[1].get_tag(ScalarYear).type
handle_year_and_month(year, month)
end | [
"def",
"handle_sm_sy",
"(",
"tokens",
",",
"options",
")",
"month",
"=",
"tokens",
"[",
"0",
"]",
".",
"get_tag",
"(",
"ScalarMonth",
")",
".",
"type",
"year",
"=",
"tokens",
"[",
"1",
"]",
".",
"get_tag",
"(",
"ScalarYear",
")",
".",
"type",
"handle... | Handle scalar-month/scalar-year | [
"Handle",
"scalar",
"-",
"month",
"/",
"scalar",
"-",
"year"
] | 2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c | https://github.com/mojombo/chronic/blob/2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c/lib/chronic/handlers.rb#L293-L297 | train | Handle the SMMsy token | [
30522,
13366,
5047,
1035,
15488,
1035,
25353,
1006,
19204,
2015,
1010,
7047,
1007,
3204,
1027,
19204,
2015,
1031,
1014,
1033,
1012,
2131,
1035,
6415,
1006,
26743,
10867,
12162,
2232,
1007,
1012,
2828,
2095,
1027,
19204,
2015,
1031,
1015,
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_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.get_partitions_event_list | def get_partitions_event_list(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
response = get_partitions_event_list_async(start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_partitions_event_list(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
response = get_partitions_event_list_async(start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_partitions_event_list",
"(",
"start_time_utc",
",",
"end_time_utc",
",",
"timeout",
":",
"60",
",",
"events_types_filter",
":",
"nil",
",",
"exclude_analysis_events",
":",
"nil",
",",
"skip_correlation_lookup",
":",
"nil",
",",
"custom_headers",
":",
"ni... | Gets all Partitions-related events.
The response is list of PartitionEvent objects.
@param start_time_utc [String] The start time of a lookup query in ISO UTC
yyyy-MM-ddTHH:mm:ssZ.
@param end_time_utc [String] The end time of a lookup query in ISO UTC
yyyy-MM-ddTHH:mm:ssZ.
@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 events_types_filter [String] This is a comma separated string
specifying the types of FabricEvents that should only be included in the
response.
@param exclude_analysis_events [Boolean] This param disables the retrieval of
AnalysisEvents if true is passed.
@param skip_correlation_lookup [Boolean] This param disables the search of
CorrelatedEvents information if true is passed. otherwise the
CorrelationEvents get processed and HasCorrelatedEvents field in every
FabricEvent gets populated.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array] operation results. | [
"Gets",
"all",
"Partitions",
"-",
"related",
"events",
"."
] | 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#L28695-L28698 | train | Gets the partitions event list. | [
30522,
13366,
2131,
1035,
13571,
2015,
1035,
2724,
1035,
2862,
1006,
2707,
1035,
2051,
1035,
11396,
1010,
2203,
1035,
2051,
1035,
11396,
1010,
2051,
5833,
1024,
3438,
1010,
2824,
1035,
4127,
1035,
11307,
1024,
9152,
2140,
1010,
23329,
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_netapp/lib/2017-08-15-preview/generated/azure_mgmt_netapp/snapshots.rb | Azure::NetApp::Mgmt::V2017_08_15_preview.Snapshots.begin_create | def begin_create(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:nil)
response = begin_create_async(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_create(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:nil)
response = begin_create_async(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_create",
"(",
"body",
",",
"resource_group_name",
",",
"account_name",
",",
"pool_name",
",",
"volume_name",
",",
"snapshot_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_create_async",
"(",
"body",
",",
"resource_group_name",
... | Create a snapshot
@param body [Snapshot] Snapshot object supplied in the body of the operation.
@param resource_group_name [String] The name of the resource group.
@param account_name [String] The name of the NetApp account
@param pool_name [String] The name of the capacity pool
@param volume_name [String] The name of the volume
@param snapshot_name [String] The name of the mount target
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Snapshot] operation results. | [
"Create",
"a",
"snapshot"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_netapp/lib/2017-08-15-preview/generated/azure_mgmt_netapp/snapshots.rb#L463-L466 | train | Creates a snapshot of a specified volume. | [
30522,
13366,
4088,
1035,
3443,
1006,
2303,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
4770,
1035,
2171,
1010,
3872,
1035,
2171,
1010,
20057,
12326,
1035,
2171,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb | Aws::Glacier.Vault.upload_archive | def upload_archive(options = {})
options = options.merge(
vault_name: @name,
account_id: @account_id
)
resp = @client.upload_archive(options)
Archive.new(
id: resp.data.archive_id,
account_id: @account_id,
vault_name: @name,
client: @client
)
end | ruby | def upload_archive(options = {})
options = options.merge(
vault_name: @name,
account_id: @account_id
)
resp = @client.upload_archive(options)
Archive.new(
id: resp.data.archive_id,
account_id: @account_id,
vault_name: @name,
client: @client
)
end | [
"def",
"upload_archive",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"vault_name",
":",
"@name",
",",
"account_id",
":",
"@account_id",
")",
"resp",
"=",
"@client",
".",
"upload_archive",
"(",
"options",
")",
"Archive"... | @example Request syntax with placeholder values
archive = vault.upload_archive({
archive_description: "string",
checksum: "string",
body: "data",
})
@param [Hash] options ({})
@option options [String] :archive_description
The optional description of the archive you are uploading.
@option options [String] :checksum
The SHA256 tree hash of the data being uploaded.
@option options [String, IO] :body
The data to upload.
@return [Archive] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-glacier/lib/aws-sdk-glacier/vault.rb#L312-L324 | train | Upload an archive to the vault | [
30522,
13366,
2039,
11066,
1035,
8756,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
11632,
1035,
2171,
1024,
1030,
2171,
1010,
4070,
1035,
8909,
1024,
1030,
4070,
1035,
8909,
1007,
24501,
2361,
1027,
1030,
7396,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_container_registry/lib/2017-06-01-preview/generated/azure_mgmt_container_registry/replications.rb | Azure::ContainerRegistry::Mgmt::V2017_06_01_preview.Replications.begin_update_with_http_info | def begin_update_with_http_info(resource_group_name, registry_name, replication_name, replication_update_parameters, custom_headers:nil)
begin_update_async(resource_group_name, registry_name, replication_name, replication_update_parameters, custom_headers:custom_headers).value!
end | ruby | def begin_update_with_http_info(resource_group_name, registry_name, replication_name, replication_update_parameters, custom_headers:nil)
begin_update_async(resource_group_name, registry_name, replication_name, replication_update_parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_update_with_http_info",
"(",
"resource_group_name",
",",
"registry_name",
",",
"replication_name",
",",
"replication_update_parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_update_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"repli... | Updates a replication for a container registry with the specified parameters.
@param resource_group_name [String] The name of the resource group to which
the container registry belongs.
@param registry_name [String] The name of the container registry.
@param replication_name [String] The name of the replication.
@param replication_update_parameters [ReplicationUpdateParameters] The
parameters for updating a replication.
@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",
"replication",
"for",
"a",
"container",
"registry",
"with",
"the",
"specified",
"parameters",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_registry/lib/2017-06-01-preview/generated/azure_mgmt_container_registry/replications.rb#L620-L622 | train | Updates a replication specification. | [
30522,
13366,
4088,
1035,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
21647,
1035,
2171,
1010,
21647,
1035,
10651,
1035,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mongodb/mongo-ruby-driver | lib/mongo/server.rb | Mongo.Server.summary | def summary
status = case
when primary?
'PRIMARY'
when secondary?
'SECONDARY'
when standalone?
'STANDALONE'
when arbiter?
'ARBITER'
when ghost?
'GHOST'
when other?
'OTHER'
when unknown?
'UNKNOWN'
else
# Since the summary method is often used for debugging, do not raise
# an exception in case none of the expected types matched
''
end
if replica_set_name
status += " replica_set=#{replica_set_name}"
end
address_bit = if address
"#{address.host}:#{address.port}"
else
'nil'
end
"#<Server address=#{address_bit} #{status}>"
end | ruby | def summary
status = case
when primary?
'PRIMARY'
when secondary?
'SECONDARY'
when standalone?
'STANDALONE'
when arbiter?
'ARBITER'
when ghost?
'GHOST'
when other?
'OTHER'
when unknown?
'UNKNOWN'
else
# Since the summary method is often used for debugging, do not raise
# an exception in case none of the expected types matched
''
end
if replica_set_name
status += " replica_set=#{replica_set_name}"
end
address_bit = if address
"#{address.host}:#{address.port}"
else
'nil'
end
"#<Server address=#{address_bit} #{status}>"
end | [
"def",
"summary",
"status",
"=",
"case",
"when",
"primary?",
"'PRIMARY'",
"when",
"secondary?",
"'SECONDARY'",
"when",
"standalone?",
"'STANDALONE'",
"when",
"arbiter?",
"'ARBITER'",
"when",
"ghost?",
"'GHOST'",
"when",
"other?",
"'OTHER'",
"when",
"unknown?",
"'UNK... | @note This method is experimental and subject to change.
@api experimental
@since 2.7.0 | [
"@note",
"This",
"method",
"is",
"experimental",
"and",
"subject",
"to",
"change",
"."
] | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/server.rb#L252-L282 | train | Returns the summary of the server. | [
30522,
13366,
12654,
3570,
1027,
2553,
2043,
3078,
1029,
1005,
3078,
1005,
2043,
3905,
1029,
1005,
3905,
1005,
2043,
26609,
1029,
1005,
26609,
1005,
2043,
12098,
16313,
2121,
1029,
1005,
12098,
16313,
2121,
1005,
2043,
5745,
1029,
1005,
574... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_node_info_with_http_info | def get_node_info_with_http_info(node_name, timeout:60, custom_headers:nil)
get_node_info_async(node_name, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def get_node_info_with_http_info(node_name, timeout:60, custom_headers:nil)
get_node_info_async(node_name, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"get_node_info_with_http_info",
"(",
"node_name",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"get_node_info_async",
"(",
"node_name",
",",
"timeout",
":",
"timeout",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"end"... | Gets the information about a specific node in the Service Fabric cluster.
Gets the information about a specific node in the Service Fabric Cluster. The
response includes the name, status, id, health, uptime, and other details
about the node.
@param node_name [String] The name of the node.
@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",
"information",
"about",
"a",
"specific",
"node",
"in",
"the",
"Service",
"Fabric",
"cluster",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L3385-L3387 | train | Gets information about the specified node. | [
30522,
13366,
2131,
1035,
13045,
1035,
18558,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
13045,
1035,
2171,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
13045,
1035,
18558,
1035,
2004,
603... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.