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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-ruby | management/azure_mgmt_policy/lib/2017-06-01-preview/generated/azure_mgmt_policy/policy_set_definitions.rb | Azure::Policy::Mgmt::V2017_06_01_preview.PolicySetDefinitions.list_by_management_group_next | def list_by_management_group_next(next_page_link, custom_headers:nil)
response = list_by_management_group_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_management_group_next(next_page_link, custom_headers:nil)
response = list_by_management_group_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_management_group_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_management_group_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"... | Gets all the policy set definitions for a subscription at management group.
@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 [PolicySetDefinitionListResult] operation results. | [
"Gets",
"all",
"the",
"policy",
"set",
"definitions",
"for",
"a",
"subscription",
"at",
"management",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_policy/lib/2017-06-01-preview/generated/azure_mgmt_policy/policy_set_definitions.rb#L1129-L1132 | train | Gets the list of all the managed network interfaces in a management group. | [
30522,
13366,
2862,
1035,
2011,
1035,
2968,
1035,
2177,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
2968,
1035,
2177,
1035,
2279,
1035,
2004,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alexreisner/geocoder | lib/geocoder/logger.rb | Geocoder.Logger.current_logger | def current_logger
logger = Geocoder.config[:logger]
if logger == :kernel
logger = Geocoder::KernelLogger.instance
end
logger
end | ruby | def current_logger
logger = Geocoder.config[:logger]
if logger == :kernel
logger = Geocoder::KernelLogger.instance
end
logger
end | [
"def",
"current_logger",
"logger",
"=",
"Geocoder",
".",
"config",
"[",
":logger",
"]",
"if",
"logger",
"==",
":kernel",
"logger",
"=",
"Geocoder",
"::",
"KernelLogger",
".",
"instance",
"end",
"logger",
"end"
] | ---------------------------------------------------------------- | [
"----------------------------------------------------------------"
] | e087dc2759264ee6f307b926bb2de4ec2406859e | https://github.com/alexreisner/geocoder/blob/e087dc2759264ee6f307b926bb2de4ec2406859e/lib/geocoder/logger.rb#L35-L41 | train | Returns the current logger object | [
30522,
13366,
2783,
1035,
8833,
4590,
8833,
4590,
1027,
20248,
16044,
2099,
1012,
9530,
8873,
2290,
1031,
1024,
8833,
4590,
1033,
2065,
8833,
4590,
1027,
1027,
1024,
16293,
8833,
4590,
1027,
20248,
16044,
2099,
1024,
1024,
16293,
21197,
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... |
cheezy/page-object | lib/page-object/page_populator.rb | PageObject.PagePopulator.populate_page_with | def populate_page_with(data)
data.to_h.each do |key, value|
populate_section(key, value) if value.respond_to?(:to_h)
populate_value(self, key, value)
end
end | ruby | def populate_page_with(data)
data.to_h.each do |key, value|
populate_section(key, value) if value.respond_to?(:to_h)
populate_value(self, key, value)
end
end | [
"def",
"populate_page_with",
"(",
"data",
")",
"data",
".",
"to_h",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"populate_section",
"(",
"key",
",",
"value",
")",
"if",
"value",
".",
"respond_to?",
"(",
":to_h",
")",
"populate_value",
"(",
"self",
... | This method will populate all matched page TextFields,
TextAreas, SelectLists, FileFields, Checkboxes, and Radio Buttons from the
Hash passed as an argument. The way it find an element is by
matching the Hash key to the name you provided when declaring
the element on your page.
Checkbox and Radio Button values must be true or false.
@example
class ExamplePage
include PageObject
text_field(:username, :id => 'username_id')
checkbox(:active, :id => 'active_id')
end
...
@browser = Watir::Browser.new :firefox
example_page = ExamplePage.new(@browser)
example_page.populate_page_with :username => 'a name', :active => true
@param data [Hash] the data to use to populate this page. The key
can be either a string or a symbol. The value must be a string
for TextField, TextArea, SelectList, and FileField and must be true or
false for a Checkbox or RadioButton. | [
"This",
"method",
"will",
"populate",
"all",
"matched",
"page",
"TextFields",
"TextAreas",
"SelectLists",
"FileFields",
"Checkboxes",
"and",
"Radio",
"Buttons",
"from",
"the",
"Hash",
"passed",
"as",
"an",
"argument",
".",
"The",
"way",
"it",
"find",
"an",
"el... | 850d775bf63768fbb1551a34480195785fe8e193 | https://github.com/cheezy/page-object/blob/850d775bf63768fbb1551a34480195785fe8e193/lib/page-object/page_populator.rb#L32-L37 | train | Populate the page with the given data | [
30522,
13366,
3769,
9869,
1035,
3931,
1035,
2007,
1006,
2951,
1007,
2951,
1012,
2000,
1035,
1044,
1012,
2169,
2079,
1064,
3145,
1010,
3643,
1064,
3769,
9869,
1035,
2930,
1006,
3145,
1010,
3643,
1007,
2065,
3643,
1012,
6869,
1035,
2000,
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_authorization/lib/2018-09-01-preview/generated/azure_mgmt_authorization/role_assignments.rb | Azure::Authorization::Mgmt::V2018_09_01_preview.RoleAssignments.list_for_resource_next | def list_for_resource_next(next_page_link, custom_headers:nil)
response = list_for_resource_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_for_resource_next(next_page_link, custom_headers:nil)
response = list_for_resource_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_for_resource_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_for_resource_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"re... | Gets role assignments for a resource.
@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 [RoleAssignmentListResult] operation results. | [
"Gets",
"role",
"assignments",
"for",
"a",
"resource",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_authorization/lib/2018-09-01-preview/generated/azure_mgmt_authorization/role_assignments.rb#L1044-L1047 | train | Gets the list of all the available advisors. | [
30522,
13366,
2862,
1035,
2005,
1035,
7692,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2005,
1035,
7692,
1035,
2279,
1035,
2004,
6038,
2278,
1006,
2279,
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... |
alexreisner/geocoder | lib/geocoder/cache.rb | Geocoder.Cache.expire | def expire(url)
if url == :all
if store.respond_to?(:keys)
urls.each{ |u| expire(u) }
else
raise(NoMethodError, "The Geocoder cache store must implement `#keys` for `expire(:all)` to work")
end
else
expire_single_url(url)
end
end | ruby | def expire(url)
if url == :all
if store.respond_to?(:keys)
urls.each{ |u| expire(u) }
else
raise(NoMethodError, "The Geocoder cache store must implement `#keys` for `expire(:all)` to work")
end
else
expire_single_url(url)
end
end | [
"def",
"expire",
"(",
"url",
")",
"if",
"url",
"==",
":all",
"if",
"store",
".",
"respond_to?",
"(",
":keys",
")",
"urls",
".",
"each",
"{",
"|",
"u",
"|",
"expire",
"(",
"u",
")",
"}",
"else",
"raise",
"(",
"NoMethodError",
",",
"\"The Geocoder cach... | Delete cache entry for given URL,
or pass <tt>:all</tt> to clear all URLs. | [
"Delete",
"cache",
"entry",
"for",
"given",
"URL",
"or",
"pass",
"<tt",
">",
":",
"all<",
"/",
"tt",
">",
"to",
"clear",
"all",
"URLs",
"."
] | e087dc2759264ee6f307b926bb2de4ec2406859e | https://github.com/alexreisner/geocoder/blob/e087dc2759264ee6f307b926bb2de4ec2406859e/lib/geocoder/cache.rb#L41-L51 | train | Expire a url from the cache store | [
30522,
13366,
4654,
20781,
1006,
24471,
2140,
1007,
2065,
24471,
2140,
1027,
1027,
1024,
2035,
2065,
3573,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
6309,
1007,
24471,
4877,
1012,
2169,
1063,
1064,
1057,
1064,
4654,
20781,
1006,
1057,
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... |
github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/octo_fetcher.rb | GitHubChangelogGenerator.OctoFetcher.github_fetch_tags | def github_fetch_tags
tags = []
page_i = 0
count_pages = calculate_pages(@client, "tags", {})
iterate_pages(@client, "tags") do |new_tags|
page_i += PER_PAGE_NUMBER
print_in_same_line("Fetching tags... #{page_i}/#{count_pages * PER_PAGE_NUMBER}")
tags.concat(new_tags)
end
print_empty_line
if tags.count == 0
Helper.log.warn "Warning: Can't find any tags in repo. \
Make sure, that you push tags to remote repo via 'git push --tags'"
else
Helper.log.info "Found #{tags.count} tags"
end
# tags are a Sawyer::Resource. Convert to hash
tags.map { |resource| stringify_keys_deep(resource.to_hash) }
end | ruby | def github_fetch_tags
tags = []
page_i = 0
count_pages = calculate_pages(@client, "tags", {})
iterate_pages(@client, "tags") do |new_tags|
page_i += PER_PAGE_NUMBER
print_in_same_line("Fetching tags... #{page_i}/#{count_pages * PER_PAGE_NUMBER}")
tags.concat(new_tags)
end
print_empty_line
if tags.count == 0
Helper.log.warn "Warning: Can't find any tags in repo. \
Make sure, that you push tags to remote repo via 'git push --tags'"
else
Helper.log.info "Found #{tags.count} tags"
end
# tags are a Sawyer::Resource. Convert to hash
tags.map { |resource| stringify_keys_deep(resource.to_hash) }
end | [
"def",
"github_fetch_tags",
"tags",
"=",
"[",
"]",
"page_i",
"=",
"0",
"count_pages",
"=",
"calculate_pages",
"(",
"@client",
",",
"\"tags\"",
",",
"{",
"}",
")",
"iterate_pages",
"(",
"@client",
",",
"\"tags\"",
")",
"do",
"|",
"new_tags",
"|",
"page_i",
... | Fill input array with tags
@return [Array <Hash>] array of tags in repo | [
"Fill",
"input",
"array",
"with",
"tags"
] | f18c64b5cc0d7473b059275b88385ac11ca8b564 | https://github.com/github-changelog-generator/github-changelog-generator/blob/f18c64b5cc0d7473b059275b88385ac11ca8b564/lib/github_changelog_generator/octo_fetcher.rb#L109-L129 | train | Fetch all tags from GitHub | [
30522,
13366,
21025,
2705,
12083,
1035,
18584,
1035,
22073,
22073,
1027,
1031,
1033,
3931,
1035,
1045,
1027,
1014,
4175,
1035,
5530,
1027,
18422,
1035,
5530,
1006,
1030,
7396,
1010,
1000,
22073,
1000,
1010,
1063,
1065,
1007,
2009,
22139,
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_media_services/lib/2015-10-01/generated/azure_mgmt_media_services/media_service_operations.rb | Azure::MediaServices::Mgmt::V2015_10_01.MediaServiceOperations.update_with_http_info | def update_with_http_info(resource_group_name, media_service_name, parameters, custom_headers:nil)
update_async(resource_group_name, media_service_name, parameters, custom_headers:custom_headers).value!
end | ruby | def update_with_http_info(resource_group_name, media_service_name, parameters, custom_headers:nil)
update_async(resource_group_name, media_service_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"update_with_http_info",
"(",
"resource_group_name",
",",
"media_service_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"update_async",
"(",
"resource_group_name",
",",
"media_service_name",
",",
"parameters",
",",
"custom_headers",
":custom_head... | Updates a Media Service.
@param resource_group_name [String] Name of the resource group within the
Azure subscription.
@param media_service_name [String] Name of the Media Service.
@param parameters [MediaService] Media Service properties needed for update.
@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",
"Media",
"Service",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_media_services/lib/2015-10-01/generated/azure_mgmt_media_services/media_service_operations.rb#L542-L544 | train | Updates a specific media service s index. | [
30522,
13366,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2865,
1035,
2326,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
10651,
1035,
2004,
6038,
2278,
1006,
7692,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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_policy_definition | def list_query_results_for_policy_definition(policy_states_resource, subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
response = list_query_results_for_policy_definition_async(policy_states_resource, subscription_id, policy_definition_name, query_options:query_options, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_query_results_for_policy_definition(policy_states_resource, subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
response = list_query_results_for_policy_definition_async(policy_states_resource, subscription_id, policy_definition_name, query_options:query_options, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_query_results_for_policy_definition",
"(",
"policy_states_resource",
",",
"subscription_id",
",",
"policy_definition_name",
",",
"query_options",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_query_results_for_policy_definition_async",
... | Queries policy states for the subscription level policy definition.
@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_definition_name [String] Policy definition 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",
"definition",
"."
] | 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#L1251-L1254 | train | Gets the policy states for the subscription. | [
30522,
13366,
2862,
1035,
23032,
1035,
3463,
1035,
2005,
1035,
3343,
1035,
6210,
1006,
3343,
1035,
2163,
1035,
7692,
1010,
15002,
1035,
8909,
1010,
3343,
1035,
6210,
1035,
2171,
1010,
23032,
1035,
7047,
1024,
9152,
2140,
1010,
7661,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2018-04-01/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb | Azure::Compute::Mgmt::V2018_04_01.VirtualMachineScaleSets.redeploy | def redeploy(resource_group_name, vm_scale_set_name, vm_instance_ids:nil, custom_headers:nil)
response = redeploy_async(resource_group_name, vm_scale_set_name, vm_instance_ids:vm_instance_ids, custom_headers:custom_headers).value!
nil
end | ruby | def redeploy(resource_group_name, vm_scale_set_name, vm_instance_ids:nil, custom_headers:nil)
response = redeploy_async(resource_group_name, vm_scale_set_name, vm_instance_ids:vm_instance_ids, custom_headers:custom_headers).value!
nil
end | [
"def",
"redeploy",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"vm_instance_ids",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"redeploy_async",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"vm_instance_ids",
":vm_i... | Redeploy one or more virtual machines in a VM scale set.
@param resource_group_name [String] The name of the resource group.
@param vm_scale_set_name [String] The name of the VM scale set.
@param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] A list of
virtual machine instance IDs from the VM scale set.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Redeploy",
"one",
"or",
"more",
"virtual",
"machines",
"in",
"a",
"VM",
"scale",
"set",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2018-04-01/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb#L930-L933 | train | Redeploy a virtual machine. | [
30522,
13366,
2417,
13699,
4135,
2100,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
4094,
1035,
2275,
1035,
2171,
1010,
1058,
2213,
1035,
6013,
1035,
8909,
2015,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/nat_gateways.rb | Azure::Network::Mgmt::V2019_02_01.NatGateways.get_with_http_info | def get_with_http_info(resource_group_name, nat_gateway_name, expand:nil, custom_headers:nil)
get_async(resource_group_name, nat_gateway_name, expand:expand, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, nat_gateway_name, expand:nil, custom_headers:nil)
get_async(resource_group_name, nat_gateway_name, expand:expand, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"nat_gateway_name",
",",
"expand",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"nat_gateway_name",
",",
"expand",
":",
"expand",
",",
"custom_headers"... | Gets the specified nat gateway in a specified resource group.
@param resource_group_name [String] The name of the resource group.
@param nat_gateway_name [String] The name of the nat gateway.
@param expand [String] Expands referenced resources.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"specified",
"nat",
"gateway",
"in",
"a",
"specified",
"resource",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/nat_gateways.rb#L89-L91 | train | Gets the specified NAT Gateway. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
14085,
1035,
11909,
1035,
2171,
1010,
7818,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
2004,
6038,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
appium/ruby_lib | lib/appium_lib/driver.rb | Appium.Driver.set_location | def set_location(opts = {})
latitude = opts.fetch(:latitude)
longitude = opts.fetch(:longitude)
altitude = opts.fetch(:altitude, 75)
@driver.set_location(latitude, longitude, altitude)
end | ruby | def set_location(opts = {})
latitude = opts.fetch(:latitude)
longitude = opts.fetch(:longitude)
altitude = opts.fetch(:altitude, 75)
@driver.set_location(latitude, longitude, altitude)
end | [
"def",
"set_location",
"(",
"opts",
"=",
"{",
"}",
")",
"latitude",
"=",
"opts",
".",
"fetch",
"(",
":latitude",
")",
"longitude",
"=",
"opts",
".",
"fetch",
"(",
":longitude",
")",
"altitude",
"=",
"opts",
".",
"fetch",
"(",
":altitude",
",",
"75",
... | Calls @driver.set_location
@note This method does not work on real devices.
@param [Hash] opts consisting of:
@option opts [Float] :latitude the latitude in degrees (required)
@option opts [Float] :longitude the longitude in degees (required)
@option opts [Float] :altitude the altitude, defaulting to 75
@return [Selenium::WebDriver::Location] the location constructed by the selenium webdriver | [
"Calls",
"@driver",
".",
"set_location"
] | 1f5898400dd1928bfe42ddd5f842d1f8738f2f76 | https://github.com/appium/ruby_lib/blob/1f5898400dd1928bfe42ddd5f842d1f8738f2f76/lib/appium_lib/driver.rb#L756-L761 | train | Set the location of the object | [
30522,
13366,
2275,
1035,
3295,
1006,
23569,
2015,
1027,
1063,
1065,
1007,
15250,
1027,
23569,
2015,
1012,
18584,
1006,
1024,
15250,
1007,
20413,
1027,
23569,
2015,
1012,
18584,
1006,
1024,
20413,
1007,
7998,
1027,
23569,
2015,
1012,
18584,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_customer_insights/lib/2017-01-01/generated/azure_mgmt_customer_insights/authorization_policies.rb | Azure::CustomerInsights::Mgmt::V2017_01_01.AuthorizationPolicies.regenerate_primary_key_with_http_info | def regenerate_primary_key_with_http_info(resource_group_name, hub_name, authorization_policy_name, custom_headers:nil)
regenerate_primary_key_async(resource_group_name, hub_name, authorization_policy_name, custom_headers:custom_headers).value!
end | ruby | def regenerate_primary_key_with_http_info(resource_group_name, hub_name, authorization_policy_name, custom_headers:nil)
regenerate_primary_key_async(resource_group_name, hub_name, authorization_policy_name, custom_headers:custom_headers).value!
end | [
"def",
"regenerate_primary_key_with_http_info",
"(",
"resource_group_name",
",",
"hub_name",
",",
"authorization_policy_name",
",",
"custom_headers",
":",
"nil",
")",
"regenerate_primary_key_async",
"(",
"resource_group_name",
",",
"hub_name",
",",
"authorization_policy_name",
... | Regenerates the primary policy key of the specified authorization policy.
@param resource_group_name [String] The name of the resource group.
@param hub_name [String] The name of the hub.
@param authorization_policy_name [String] The name of the policy.
@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. | [
"Regenerates",
"the",
"primary",
"policy",
"key",
"of",
"the",
"specified",
"authorization",
"policy",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_customer_insights/lib/2017-01-01/generated/azure_mgmt_customer_insights/authorization_policies.rb#L365-L367 | train | Regenerate the primary key of the authorization policy. | [
30522,
13366,
19723,
24454,
3686,
1035,
3078,
1035,
3145,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
9594,
1035,
2171,
1010,
20104,
1035,
3343,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/thrift | lib/rb/lib/thrift/protocol/json_protocol.rb | Thrift.JsonProtocol.read_json_double | def read_json_double
@context.read(@reader)
num = 0
if (@reader.peek == @@kJSONStringDelimiter)
str = read_json_string(true)
# Check for NaN, Infinity and -Infinity
if (str == @@kThriftNan)
num = (+1.0/0.0)/(+1.0/0.0)
elsif (str == @@kThriftInfinity)
num = +1.0/0.0
elsif (str == @@kThriftNegativeInfinity)
num = -1.0/0.0
else
if (!@context.escapeNum)
# Raise exception -- we should not be in a string in this case
raise ProtocolException.new(ProtocolException::INVALID_DATA, "Numeric data unexpectedly quoted")
end
begin
num = Float(str)
rescue
raise ProtocolException.new(ProtocolException::INVALID_DATA, "Expected numeric value; got \"#{str}\"")
end
end
else
if (@context.escapeNum)
# This will throw - we should have had a quote if escapeNum == true
read_json_syntax_char(@@kJSONStringDelimiter)
end
str = read_json_numeric_chars
begin
num = Float(str)
rescue
raise ProtocolException.new(ProtocolException::INVALID_DATA, "Expected numeric value; got \"#{str}\"")
end
end
return num
end | ruby | def read_json_double
@context.read(@reader)
num = 0
if (@reader.peek == @@kJSONStringDelimiter)
str = read_json_string(true)
# Check for NaN, Infinity and -Infinity
if (str == @@kThriftNan)
num = (+1.0/0.0)/(+1.0/0.0)
elsif (str == @@kThriftInfinity)
num = +1.0/0.0
elsif (str == @@kThriftNegativeInfinity)
num = -1.0/0.0
else
if (!@context.escapeNum)
# Raise exception -- we should not be in a string in this case
raise ProtocolException.new(ProtocolException::INVALID_DATA, "Numeric data unexpectedly quoted")
end
begin
num = Float(str)
rescue
raise ProtocolException.new(ProtocolException::INVALID_DATA, "Expected numeric value; got \"#{str}\"")
end
end
else
if (@context.escapeNum)
# This will throw - we should have had a quote if escapeNum == true
read_json_syntax_char(@@kJSONStringDelimiter)
end
str = read_json_numeric_chars
begin
num = Float(str)
rescue
raise ProtocolException.new(ProtocolException::INVALID_DATA, "Expected numeric value; got \"#{str}\"")
end
end
return num
end | [
"def",
"read_json_double",
"@context",
".",
"read",
"(",
"@reader",
")",
"num",
"=",
"0",
"if",
"(",
"@reader",
".",
"peek",
"==",
"@@kJSONStringDelimiter",
")",
"str",
"=",
"read_json_string",
"(",
"true",
")",
"# Check for NaN, Infinity and -Infinity",
"if",
"... | Reads a JSON number or string and interprets it as a double. | [
"Reads",
"a",
"JSON",
"number",
"or",
"string",
"and",
"interprets",
"it",
"as",
"a",
"double",
"."
] | 27d8387c49a49fcf193893f834e9766ae0b051c1 | https://github.com/apache/thrift/blob/27d8387c49a49fcf193893f834e9766ae0b051c1/lib/rb/lib/thrift/protocol/json_protocol.rb#L599-L635 | train | Read a double value from the JSON stream. | [
30522,
13366,
3191,
1035,
1046,
3385,
1035,
3313,
1030,
6123,
1012,
3191,
1006,
1030,
8068,
1007,
16371,
2213,
1027,
1014,
2065,
1006,
1030,
8068,
1012,
19043,
1027,
1027,
1030,
1030,
1047,
22578,
5644,
18886,
3070,
9247,
27605,
3334,
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-rds/lib/aws-sdk-rds/db_parameter_group.rb | Aws::RDS.DBParameterGroup.delete | def delete(options = {})
options = options.merge(db_parameter_group_name: @name)
resp = @client.delete_db_parameter_group(options)
resp.data
end | ruby | def delete(options = {})
options = options.merge(db_parameter_group_name: @name)
resp = @client.delete_db_parameter_group(options)
resp.data
end | [
"def",
"delete",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"db_parameter_group_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"delete_db_parameter_group",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
db_parameter_group.delete()
@param [Hash] options ({})
@return [EmptyStructure] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-rds/lib/aws-sdk-rds/db_parameter_group.rb#L286-L290 | train | Delete a DB Parameter Group | [
30522,
13366,
3972,
12870,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
16962,
1035,
16381,
1035,
2177,
1035,
2171,
1024,
1030,
2171,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
3972,
12870,
1035,
16962,
1035,
163... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/route_filter_rules.rb | Azure::Network::Mgmt::V2018_07_01.RouteFilterRules.begin_delete_with_http_info | def begin_delete_with_http_info(resource_group_name, route_filter_name, rule_name, custom_headers:nil)
begin_delete_async(resource_group_name, route_filter_name, rule_name, custom_headers:custom_headers).value!
end | ruby | def begin_delete_with_http_info(resource_group_name, route_filter_name, rule_name, custom_headers:nil)
begin_delete_async(resource_group_name, route_filter_name, rule_name, custom_headers:custom_headers).value!
end | [
"def",
"begin_delete_with_http_info",
"(",
"resource_group_name",
",",
"route_filter_name",
",",
"rule_name",
",",
"custom_headers",
":",
"nil",
")",
"begin_delete_async",
"(",
"resource_group_name",
",",
"route_filter_name",
",",
"rule_name",
",",
"custom_headers",
":cus... | Deletes the specified rule from a route filter.
@param resource_group_name [String] The name of the resource group.
@param route_filter_name [String] The name of the route filter.
@param rule_name [String] The name of the rule.
@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",
"the",
"specified",
"rule",
"from",
"a",
"route",
"filter",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/route_filter_rules.rb#L374-L376 | train | Deletes a route filter rule. | [
30522,
13366,
4088,
1035,
3972,
12870,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2799,
1035,
11307,
1035,
2171,
1010,
3627,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
projectcypress/health-data-standards | lib/hqmf-parser/2.0/data_criteria.rb | HQMF2.DataCriteria.to_s | def to_s
props = {
property: property,
type: type,
status: status,
section: section
}
"DataCriteria#{props}"
end | ruby | def to_s
props = {
property: property,
type: type,
status: status,
section: section
}
"DataCriteria#{props}"
end | [
"def",
"to_s",
"props",
"=",
"{",
"property",
":",
"property",
",",
"type",
":",
"type",
",",
"status",
":",
"status",
",",
"section",
":",
"section",
"}",
"\"DataCriteria#{props}\"",
"end"
] | Create a new instance based on the supplied HQMF entry
@param [Nokogiri::XML::Element] entry the parsed HQMF entry | [
"Create",
"a",
"new",
"instance",
"based",
"on",
"the",
"supplied",
"HQMF",
"entry"
] | 252d4f0927c513eacde6b9ea41b76faa1423c34b | https://github.com/projectcypress/health-data-standards/blob/252d4f0927c513eacde6b9ea41b76faa1423c34b/lib/hqmf-parser/2.0/data_criteria.rb#L39-L47 | train | Convert the object to a string | [
30522,
13366,
2000,
1035,
1055,
24387,
1027,
1063,
3200,
1024,
3200,
1010,
2828,
1024,
2828,
1010,
3570,
1024,
3570,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_monitor/lib/2017-04-01/generated/azure_mgmt_monitor/activity_log_alerts.rb | Azure::Monitor::Mgmt::V2017_04_01.ActivityLogAlerts.update | def update(resource_group_name, activity_log_alert_name, activity_log_alert_patch, custom_headers:nil)
response = update_async(resource_group_name, activity_log_alert_name, activity_log_alert_patch, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def update(resource_group_name, activity_log_alert_name, activity_log_alert_patch, custom_headers:nil)
response = update_async(resource_group_name, activity_log_alert_name, activity_log_alert_patch, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"update",
"(",
"resource_group_name",
",",
"activity_log_alert_name",
",",
"activity_log_alert_patch",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"update_async",
"(",
"resource_group_name",
",",
"activity_log_alert_name",
",",
"activity_log_alert_patch"... | Updates an existing ActivityLogAlertResource's tags. To update other fields
use the CreateOrUpdate method.
@param resource_group_name [String] The name of the resource group.
@param activity_log_alert_name [String] The name of the activity log alert.
@param activity_log_alert_patch [ActivityLogAlertPatchBody] Parameters
supplied to the operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ActivityLogAlertResource] operation results. | [
"Updates",
"an",
"existing",
"ActivityLogAlertResource",
"s",
"tags",
".",
"To",
"update",
"other",
"fields",
"use",
"the",
"CreateOrUpdate",
"method",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_monitor/lib/2017-04-01/generated/azure_mgmt_monitor/activity_log_alerts.rb#L326-L329 | train | Updates an existing activity log alert. | [
30522,
13366,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4023,
1035,
8833,
1035,
9499,
1035,
2171,
1010,
4023,
1035,
8833,
1035,
9499,
1035,
8983,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
10651,
1035,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/models/location.rb | SquareConnect.Location.currency= | def currency=(currency)
validator = EnumAttributeValidator.new('String', ["UNKNOWN_CURRENCY", "AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BOV", "BRL", "BSD", "BTN", "BWP", "BYR", "BZD", "CAD", "CDF", "CHE", "CHF", "CHW", "CLF", "CLP", "CNY", "COP", "COU", "CRC", "CUC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR", "FJD", "FKP", "GBP", "GEL", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "INR", "IQD", "IRR", "ISK", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LTL", "LVL", "LYD", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRO", "MUR", "MVR", "MWK", "MXN", "MXV", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLL", "SOS", "SRD", "SSP", "STD", "SVC", "SYP", "SZL", "THB", "TJS", "TMT", "TND", "TOP", "TRY", "TTD", "TWD", "TZS", "UAH", "UGX", "USD", "USN", "USS", "UYI", "UYU", "UZS", "VEF", "VND", "VUV", "WST", "XAF", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XDR", "XOF", "XPD", "XPF", "XPT", "XTS", "XXX", "YER", "ZAR", "ZMK", "ZMW", "BTC"])
unless validator.valid?(currency)
fail ArgumentError, "invalid value for 'currency', must be one of #{validator.allowable_values}."
end
@currency = currency
end | ruby | def currency=(currency)
validator = EnumAttributeValidator.new('String', ["UNKNOWN_CURRENCY", "AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BOV", "BRL", "BSD", "BTN", "BWP", "BYR", "BZD", "CAD", "CDF", "CHE", "CHF", "CHW", "CLF", "CLP", "CNY", "COP", "COU", "CRC", "CUC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR", "FJD", "FKP", "GBP", "GEL", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "INR", "IQD", "IRR", "ISK", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LTL", "LVL", "LYD", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRO", "MUR", "MVR", "MWK", "MXN", "MXV", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLL", "SOS", "SRD", "SSP", "STD", "SVC", "SYP", "SZL", "THB", "TJS", "TMT", "TND", "TOP", "TRY", "TTD", "TWD", "TZS", "UAH", "UGX", "USD", "USN", "USS", "UYI", "UYU", "UZS", "VEF", "VND", "VUV", "WST", "XAF", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XDR", "XOF", "XPD", "XPF", "XPT", "XTS", "XXX", "YER", "ZAR", "ZMK", "ZMW", "BTC"])
unless validator.valid?(currency)
fail ArgumentError, "invalid value for 'currency', must be one of #{validator.allowable_values}."
end
@currency = currency
end | [
"def",
"currency",
"=",
"(",
"currency",
")",
"validator",
"=",
"EnumAttributeValidator",
".",
"new",
"(",
"'String'",
",",
"[",
"\"UNKNOWN_CURRENCY\"",
",",
"\"AED\"",
",",
"\"AFN\"",
",",
"\"ALL\"",
",",
"\"AMD\"",
",",
"\"ANG\"",
",",
"\"AOA\"",
",",
"\"A... | Custom attribute writer method checking allowed values (enum).
@param [Object] currency Object to be assigned | [
"Custom",
"attribute",
"writer",
"method",
"checking",
"allowed",
"values",
"(",
"enum",
")",
"."
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/models/location.rb#L239-L245 | train | Returns the index of the last valid currency. | [
30522,
13366,
9598,
1027,
1006,
9598,
1007,
9398,
8844,
1027,
4372,
12248,
4779,
3089,
8569,
2618,
10175,
8524,
4263,
1012,
2047,
1006,
1005,
5164,
1005,
1010,
1031,
1000,
4242,
1035,
9598,
1000,
1010,
1000,
29347,
2094,
1000,
1010,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
projectcypress/health-data-standards | lib/hqmf-parser/2.0/document_helpers/doc_utilities.rb | HQMF2.DocumentUtilities.detect_criteria_covered_by_criteria | def detect_criteria_covered_by_criteria(data_criteria, check_criteria)
base_checks = true
# Check whether basic features are the same
base_checks &&= data_criteria.definition == check_criteria.definition # same definition
base_checks &&= data_criteria.status == check_criteria.status # same status
# same children
base_checks &&= data_criteria.children_criteria.sort.join(',') == check_criteria.children_criteria.sort.join(',')
# Ensure it doesn't contain basic elements that should not be removed
base_checks &&= !data_criteria.variable # Ensure it's not a variable
base_checks &&= data_criteria.derivation_operator.nil? # Ensure it doesn't have a derivation operator
base_checks &&= data_criteria.subset_operators.empty? # Ensure it doesn't have a subset operator
# Ensure it doesn't have Temporal References
base_checks &&= data_criteria.temporal_references.nil? || data_criteria.temporal_references.empty?
base_checks && complex_coverage(data_criteria, check_criteria)
end | ruby | def detect_criteria_covered_by_criteria(data_criteria, check_criteria)
base_checks = true
# Check whether basic features are the same
base_checks &&= data_criteria.definition == check_criteria.definition # same definition
base_checks &&= data_criteria.status == check_criteria.status # same status
# same children
base_checks &&= data_criteria.children_criteria.sort.join(',') == check_criteria.children_criteria.sort.join(',')
# Ensure it doesn't contain basic elements that should not be removed
base_checks &&= !data_criteria.variable # Ensure it's not a variable
base_checks &&= data_criteria.derivation_operator.nil? # Ensure it doesn't have a derivation operator
base_checks &&= data_criteria.subset_operators.empty? # Ensure it doesn't have a subset operator
# Ensure it doesn't have Temporal References
base_checks &&= data_criteria.temporal_references.nil? || data_criteria.temporal_references.empty?
base_checks && complex_coverage(data_criteria, check_criteria)
end | [
"def",
"detect_criteria_covered_by_criteria",
"(",
"data_criteria",
",",
"check_criteria",
")",
"base_checks",
"=",
"true",
"# Check whether basic features are the same",
"base_checks",
"&&=",
"data_criteria",
".",
"definition",
"==",
"check_criteria",
".",
"definition",
"# s... | Check if one data criteria contains the others information by checking that one has everything the other has
(or more) | [
"Check",
"if",
"one",
"data",
"criteria",
"contains",
"the",
"others",
"information",
"by",
"checking",
"that",
"one",
"has",
"everything",
"the",
"other",
"has",
"(",
"or",
"more",
")"
] | 252d4f0927c513eacde6b9ea41b76faa1423c34b | https://github.com/projectcypress/health-data-standards/blob/252d4f0927c513eacde6b9ea41b76faa1423c34b/lib/hqmf-parser/2.0/document_helpers/doc_utilities.rb#L87-L103 | train | Check whether the data criteria are covered by the check criteria | [
30522,
13366,
11487,
1035,
9181,
1035,
3139,
1035,
2011,
1035,
9181,
1006,
2951,
1035,
9181,
1010,
4638,
1035,
9181,
1007,
2918,
1035,
14148,
1027,
2995,
1001,
4638,
3251,
3937,
2838,
2024,
1996,
2168,
2918,
1035,
14148,
1004,
1004,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mojombo/chronic | lib/chronic/repeaters/repeater_week.rb | Chronic.RepeaterWeek.next | def next(pointer)
super
unless @current_week_start
case pointer
when :future
first_week_day_repeater = RepeaterDayName.new(@repeater_day_name)
first_week_day_repeater.start = @now
next_span = first_week_day_repeater.next(:future)
@current_week_start = next_span.begin
when :past
first_week_day_repeater = RepeaterDayName.new(@repeater_day_name)
first_week_day_repeater.start = (@now + RepeaterDay::DAY_SECONDS)
first_week_day_repeater.next(:past)
last_span = first_week_day_repeater.next(:past)
@current_week_start = last_span.begin
end
else
direction = pointer == :future ? 1 : -1
@current_week_start += direction * WEEK_SECONDS
end
Span.new(@current_week_start, @current_week_start + WEEK_SECONDS)
end | ruby | def next(pointer)
super
unless @current_week_start
case pointer
when :future
first_week_day_repeater = RepeaterDayName.new(@repeater_day_name)
first_week_day_repeater.start = @now
next_span = first_week_day_repeater.next(:future)
@current_week_start = next_span.begin
when :past
first_week_day_repeater = RepeaterDayName.new(@repeater_day_name)
first_week_day_repeater.start = (@now + RepeaterDay::DAY_SECONDS)
first_week_day_repeater.next(:past)
last_span = first_week_day_repeater.next(:past)
@current_week_start = last_span.begin
end
else
direction = pointer == :future ? 1 : -1
@current_week_start += direction * WEEK_SECONDS
end
Span.new(@current_week_start, @current_week_start + WEEK_SECONDS)
end | [
"def",
"next",
"(",
"pointer",
")",
"super",
"unless",
"@current_week_start",
"case",
"pointer",
"when",
":future",
"first_week_day_repeater",
"=",
"RepeaterDayName",
".",
"new",
"(",
"@repeater_day_name",
")",
"first_week_day_repeater",
".",
"start",
"=",
"@now",
"... | (7 * 24 * 60 * 60) | [
"(",
"7",
"*",
"24",
"*",
"60",
"*",
"60",
")"
] | 2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c | https://github.com/mojombo/chronic/blob/2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c/lib/chronic/repeaters/repeater_week.rb#L11-L34 | train | Returns the next span in the current calendar | [
30522,
13366,
2279,
1006,
20884,
1007,
3565,
4983,
1030,
2783,
1035,
2733,
1035,
2707,
2553,
20884,
2043,
1024,
2925,
2034,
1035,
2733,
1035,
2154,
1035,
9377,
2121,
1027,
9377,
2121,
10259,
18442,
1012,
2047,
1006,
1030,
9377,
2121,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_api_management/lib/2016-10-10/generated/azure_mgmt_api_management/group_users.rb | Azure::ApiManagement::Mgmt::V2016_10_10.GroupUsers.list_by_groups_next | def list_by_groups_next(next_page_link, custom_headers:nil)
response = list_by_groups_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_groups_next(next_page_link, custom_headers:nil)
response = list_by_groups_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_groups_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_groups_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"response... | Lists a collection of the members of the group, specified by its identifier.
@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 [UserCollection] operation results. | [
"Lists",
"a",
"collection",
"of",
"the",
"members",
"of",
"the",
"group",
"specified",
"by",
"its",
"identifier",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2016-10-10/generated/azure_mgmt_api_management/group_users.rb#L428-L431 | train | Gets the list of all the available managed managed | [
30522,
13366,
2862,
1035,
2011,
1035,
2967,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
2967,
1035,
2279,
1035,
2004,
6038,
2278,
1006,
2279,
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... |
rocketjob/symmetric-encryption | lib/symmetric_encryption/reader.rb | SymmetricEncryption.Reader.read_header | def read_header
@pos = 0
# Read first block and check for the header
buf = @ios.read(@buffer_size, @output_buffer ||= ''.b)
# Use cipher specified in header, or global cipher if it has no header
iv, key, cipher_name, cipher = nil
header = Header.new
if header.parse!(buf)
@header_present = true
@compressed = header.compressed?
@version = header.version
cipher = header.cipher
cipher_name = header.cipher_name || cipher.cipher_name
key = header.key
iv = header.iv
else
@header_present = false
@compressed = nil
cipher = SymmetricEncryption.cipher(@version)
cipher_name = cipher.cipher_name
end
@stream_cipher = ::OpenSSL::Cipher.new(cipher_name)
@stream_cipher.decrypt
@stream_cipher.key = key || cipher.send(:key)
@stream_cipher.iv = iv || cipher.iv
decrypt(buf)
end | ruby | def read_header
@pos = 0
# Read first block and check for the header
buf = @ios.read(@buffer_size, @output_buffer ||= ''.b)
# Use cipher specified in header, or global cipher if it has no header
iv, key, cipher_name, cipher = nil
header = Header.new
if header.parse!(buf)
@header_present = true
@compressed = header.compressed?
@version = header.version
cipher = header.cipher
cipher_name = header.cipher_name || cipher.cipher_name
key = header.key
iv = header.iv
else
@header_present = false
@compressed = nil
cipher = SymmetricEncryption.cipher(@version)
cipher_name = cipher.cipher_name
end
@stream_cipher = ::OpenSSL::Cipher.new(cipher_name)
@stream_cipher.decrypt
@stream_cipher.key = key || cipher.send(:key)
@stream_cipher.iv = iv || cipher.iv
decrypt(buf)
end | [
"def",
"read_header",
"@pos",
"=",
"0",
"# Read first block and check for the header",
"buf",
"=",
"@ios",
".",
"read",
"(",
"@buffer_size",
",",
"@output_buffer",
"||=",
"''",
".",
"b",
")",
"# Use cipher specified in header, or global cipher if it has no header",
"iv",
... | Read the header from the file if present | [
"Read",
"the",
"header",
"from",
"the",
"file",
"if",
"present"
] | 064ba8d57ffac44a3ed80f5e76fa1a54d660ff98 | https://github.com/rocketjob/symmetric-encryption/blob/064ba8d57ffac44a3ed80f5e76fa1a54d660ff98/lib/symmetric_encryption/reader.rb#L309-L339 | train | Read the header and return the header object | [
30522,
13366,
3191,
1035,
20346,
1030,
13433,
2015,
1027,
1014,
1001,
3191,
2034,
3796,
1998,
4638,
2005,
1996,
20346,
20934,
2546,
1027,
1030,
16380,
1012,
3191,
1006,
1030,
17698,
1035,
2946,
1010,
1030,
6434,
1035,
17698,
1064,
1064,
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... |
projectcypress/health-data-standards | lib/hqmf-parser/2.0/population_criteria.rb | HQMF2.PopulationCriteria.conjunction_code | def conjunction_code
case @type
when HQMF::PopulationCriteria::IPP, HQMF::PopulationCriteria::DENOM, HQMF::PopulationCriteria::NUMER,
HQMF::PopulationCriteria::MSRPOPL, HQMF::PopulationCriteria::STRAT
HQMF::Precondition::ALL_TRUE
when HQMF::PopulationCriteria::DENEXCEP, HQMF::PopulationCriteria::DENEX, HQMF::PopulationCriteria::MSRPOPLEX,
HQMF::PopulationCriteria::NUMEX
HQMF::Precondition::AT_LEAST_ONE_TRUE
else
fail "Unknown population type [#{@type}]"
end
end | ruby | def conjunction_code
case @type
when HQMF::PopulationCriteria::IPP, HQMF::PopulationCriteria::DENOM, HQMF::PopulationCriteria::NUMER,
HQMF::PopulationCriteria::MSRPOPL, HQMF::PopulationCriteria::STRAT
HQMF::Precondition::ALL_TRUE
when HQMF::PopulationCriteria::DENEXCEP, HQMF::PopulationCriteria::DENEX, HQMF::PopulationCriteria::MSRPOPLEX,
HQMF::PopulationCriteria::NUMEX
HQMF::Precondition::AT_LEAST_ONE_TRUE
else
fail "Unknown population type [#{@type}]"
end
end | [
"def",
"conjunction_code",
"case",
"@type",
"when",
"HQMF",
"::",
"PopulationCriteria",
"::",
"IPP",
",",
"HQMF",
"::",
"PopulationCriteria",
"::",
"DENOM",
",",
"HQMF",
"::",
"PopulationCriteria",
"::",
"NUMER",
",",
"HQMF",
"::",
"PopulationCriteria",
"::",
"M... | Get the conjunction code, ALL_TRUE or AT_LEAST_ONE_TRUE
@return [String] conjunction code | [
"Get",
"the",
"conjunction",
"code",
"ALL_TRUE",
"or",
"AT_LEAST_ONE_TRUE"
] | 252d4f0927c513eacde6b9ea41b76faa1423c34b | https://github.com/projectcypress/health-data-standards/blob/252d4f0927c513eacde6b9ea41b76faa1423c34b/lib/hqmf-parser/2.0/population_criteria.rb#L115-L126 | train | Returns the conjunction code for this population. | [
30522,
13366,
9595,
1035,
3642,
2553,
1030,
2828,
2043,
16260,
2213,
2546,
1024,
1024,
2313,
26775,
21646,
2401,
1024,
1024,
12997,
2361,
1010,
16260,
2213,
2546,
1024,
1024,
2313,
26775,
21646,
2401,
1024,
1024,
7939,
5358,
1010,
16260,
22... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/haml-lint | lib/haml_lint/linter.rb | HamlLint.Linter.tag_has_inline_script? | def tag_has_inline_script?(tag_node)
tag_with_inline_content = tag_with_inline_text(tag_node)
return false unless inline_content = inline_node_content(tag_node)
return false unless index = tag_with_inline_content.rindex(inline_content)
index -= 1
index -= 1 while [' ', '"', "'"].include?(tag_with_inline_content[index])
tag_with_inline_content[index] == '='
end | ruby | def tag_has_inline_script?(tag_node)
tag_with_inline_content = tag_with_inline_text(tag_node)
return false unless inline_content = inline_node_content(tag_node)
return false unless index = tag_with_inline_content.rindex(inline_content)
index -= 1
index -= 1 while [' ', '"', "'"].include?(tag_with_inline_content[index])
tag_with_inline_content[index] == '='
end | [
"def",
"tag_has_inline_script?",
"(",
"tag_node",
")",
"tag_with_inline_content",
"=",
"tag_with_inline_text",
"(",
"tag_node",
")",
"return",
"false",
"unless",
"inline_content",
"=",
"inline_node_content",
"(",
"tag_node",
")",
"return",
"false",
"unless",
"index",
... | Returns whether this tag node has inline script, e.g. is of the form
%tag= ...
@param tag_node [HamlLint::Tree::TagNode]
@return [true,false] | [
"Returns",
"whether",
"this",
"tag",
"node",
"has",
"inline",
"script",
"e",
".",
"g",
".",
"is",
"of",
"the",
"form",
"%tag",
"=",
"..."
] | 024c773667e54cf88db938c2b368977005d70ee8 | https://github.com/sds/haml-lint/blob/024c773667e54cf88db938c2b368977005d70ee8/lib/haml_lint/linter.rb#L95-L104 | train | Returns true if the tag has inline script | [
30522,
13366,
6415,
1035,
2038,
1035,
23881,
1035,
5896,
1029,
1006,
6415,
1035,
13045,
1007,
6415,
1035,
2007,
1035,
23881,
1035,
4180,
1027,
6415,
1035,
2007,
1035,
23881,
1035,
3793,
1006,
6415,
1035,
13045,
1007,
2709,
6270,
4983,
23881... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.rb | Puppet.Util.withenv | def withenv(hash, mode = :posix)
saved = get_environment(mode)
merge_environment(hash, mode)
yield
ensure
if saved
clear_environment(mode)
merge_environment(saved, mode)
end
end | ruby | def withenv(hash, mode = :posix)
saved = get_environment(mode)
merge_environment(hash, mode)
yield
ensure
if saved
clear_environment(mode)
merge_environment(saved, mode)
end
end | [
"def",
"withenv",
"(",
"hash",
",",
"mode",
"=",
":posix",
")",
"saved",
"=",
"get_environment",
"(",
"mode",
")",
"merge_environment",
"(",
"hash",
",",
"mode",
")",
"yield",
"ensure",
"if",
"saved",
"clear_environment",
"(",
"mode",
")",
"merge_environment... | Run some code with a specific environment. Resets the environment back to
what it was at the end of the code.
Windows can store Unicode chars in the environment as keys or values, but
Ruby's ENV tries to roundtrip them through the local codepage, which can
cause encoding problems - underlying helpers use Windows APIs on Windows
see https://bugs.ruby-lang.org/issues/8822 | [
"Run",
"some",
"code",
"with",
"a",
"specific",
"environment",
".",
"Resets",
"the",
"environment",
"back",
"to",
"what",
"it",
"was",
"at",
"the",
"end",
"of",
"the",
"code",
".",
"Windows",
"can",
"store",
"Unicode",
"chars",
"in",
"the",
"environment",
... | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/util.rb#L125-L134 | train | Yields the given hash with the current environment. | [
30522,
13366,
2007,
2368,
2615,
1006,
23325,
1010,
5549,
1027,
1024,
13433,
5332,
2595,
1007,
5552,
1027,
2131,
1035,
4044,
1006,
5549,
1007,
13590,
1035,
4044,
1006,
23325,
1010,
5549,
1007,
10750,
5676,
2065,
5552,
3154,
1035,
4044,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_graph_rbac/lib/1.6/generated/azure_graph_rbac/service_principals.rb | Azure::GraphRbac::V1_6.ServicePrincipals.list_owners | def list_owners(object_id, custom_headers:nil)
response = list_owners_async(object_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_owners(object_id, custom_headers:nil)
response = list_owners_async(object_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_owners",
"(",
"object_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_owners_async",
"(",
"object_id",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"response",
".",
"nil?",
"end... | Directory objects that are owners of this service principal.
The owners are a set of non-admin users who are allowed to modify this
object.
@param object_id [String] The object ID of the service principal for which to
get owners.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [DirectoryObjectListResult] operation results. | [
"Directory",
"objects",
"that",
"are",
"owners",
"of",
"this",
"service",
"principal",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_graph_rbac/lib/1.6/generated/azure_graph_rbac/service_principals.rb#L387-L390 | train | Gets the list of all the objects owned by the specified resource group. | [
30522,
13366,
2862,
1035,
5608,
1006,
4874,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
5608,
1035,
2004,
6038,
2278,
1006,
4874,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
piotrmurach/github | lib/github_api/client/pull_requests.rb | Github.Client::PullRequests.merge | def merge(*args)
arguments(args, required: [:user, :repo, :number])
params = arguments.params
params['accept'] ||= PREVIEW_MEDIA
put_request("/repos/#{arguments.user}/#{arguments.repo}/pulls/#{arguments.number}/merge", params)
end | ruby | def merge(*args)
arguments(args, required: [:user, :repo, :number])
params = arguments.params
params['accept'] ||= PREVIEW_MEDIA
put_request("/repos/#{arguments.user}/#{arguments.repo}/pulls/#{arguments.number}/merge", params)
end | [
"def",
"merge",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":user",
",",
":repo",
",",
":number",
"]",
")",
"params",
"=",
"arguments",
".",
"params",
"params",
"[",
"'accept'",
"]",
"||=",
"PREVIEW_MEDIA",
"put_request",... | :nodoc:
Merge a pull request(Merge Button)
@param [Hash] params
@option params [String] :commit_title
Optional string - The first line of the message that will be used for the merge commit
@option params [String] :commit_message
Optional string - The message that will be used for the merge commit
@option params [String] :sha
Optional string - The SHA that pull request head must match to allow merge
@option params [String] :merge_method
Optional string - Merge method to use.
Valid values are merge, squash, and rebase. Default is merge.
@example
github = Github.new
github.pull_requests.merge 'user-name', 'repo-name', 'number'
@api public | [
":",
"nodoc",
":",
"Merge",
"a",
"pull",
"request",
"(",
"Merge",
"Button",
")"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/pull_requests.rb#L187-L193 | train | Merge a pull request | [
30522,
13366,
13590,
1006,
1008,
12098,
5620,
1007,
9918,
1006,
12098,
5620,
1010,
3223,
1024,
1031,
1024,
5310,
1010,
1024,
16360,
2080,
1010,
1024,
2193,
1033,
1007,
11498,
5244,
1027,
9918,
1012,
11498,
5244,
11498,
5244,
1031,
1005,
513... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/traceability.rb | Decidim.Traceability.create | def create(klass, author, params, extra_log_info = {})
perform_action!(:create, klass, author, extra_log_info) do
klass.create(params)
end
end | ruby | def create(klass, author, params, extra_log_info = {})
perform_action!(:create, klass, author, extra_log_info) do
klass.create(params)
end
end | [
"def",
"create",
"(",
"klass",
",",
"author",
",",
"params",
",",
"extra_log_info",
"=",
"{",
"}",
")",
"perform_action!",
"(",
":create",
",",
"klass",
",",
"author",
",",
"extra_log_info",
")",
"do",
"klass",
".",
"create",
"(",
"params",
")",
"end",
... | Calls the `create` method to the given class and sets the author of the version.
klass - An ActiveRecord class that implements `Decidim::Traceable`
author - An object that implements `to_gid` or a String
params - a Hash with the attributes of the new resource
extra_log_info - a Hash with extra info that will be saved to the log
Returns an instance of `klass`. | [
"Calls",
"the",
"create",
"method",
"to",
"the",
"given",
"class",
"and",
"sets",
"the",
"author",
"of",
"the",
"version",
"."
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/app/services/decidim/traceability.rb#L31-L35 | train | Create a new object | [
30522,
13366,
3443,
1006,
1047,
27102,
1010,
3166,
1010,
11498,
5244,
1010,
4469,
1035,
8833,
1035,
18558,
1027,
1063,
1065,
1007,
4685,
1035,
2895,
999,
1006,
1024,
3443,
1010,
1047,
27102,
1010,
3166,
1010,
4469,
1035,
8833,
1035,
18558,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
github/linguist | samples/Ruby/sinatra.rb | Sinatra.Helpers.last_modified | def last_modified(time)
return unless time
time = time_for time
response['Last-Modified'] = time.httpdate
return if env['HTTP_IF_NONE_MATCH']
if status == 200 and env['HTTP_IF_MODIFIED_SINCE']
# compare based on seconds since epoch
since = Time.httpdate(env['HTTP_IF_MODIFIED_SINCE']).to_i
halt 304 if since >= time.to_i
end
if (success? or status == 412) and env['HTTP_IF_UNMODIFIED_SINCE']
# compare based on seconds since epoch
since = Time.httpdate(env['HTTP_IF_UNMODIFIED_SINCE']).to_i
halt 412 if since < time.to_i
end
rescue ArgumentError
end | ruby | def last_modified(time)
return unless time
time = time_for time
response['Last-Modified'] = time.httpdate
return if env['HTTP_IF_NONE_MATCH']
if status == 200 and env['HTTP_IF_MODIFIED_SINCE']
# compare based on seconds since epoch
since = Time.httpdate(env['HTTP_IF_MODIFIED_SINCE']).to_i
halt 304 if since >= time.to_i
end
if (success? or status == 412) and env['HTTP_IF_UNMODIFIED_SINCE']
# compare based on seconds since epoch
since = Time.httpdate(env['HTTP_IF_UNMODIFIED_SINCE']).to_i
halt 412 if since < time.to_i
end
rescue ArgumentError
end | [
"def",
"last_modified",
"(",
"time",
")",
"return",
"unless",
"time",
"time",
"=",
"time_for",
"time",
"response",
"[",
"'Last-Modified'",
"]",
"=",
"time",
".",
"httpdate",
"return",
"if",
"env",
"[",
"'HTTP_IF_NONE_MATCH'",
"]",
"if",
"status",
"==",
"200"... | Set the last modified time of the resource (HTTP 'Last-Modified' header)
and halt if conditional GET matches. The +time+ argument is a Time,
DateTime, or other object that responds to +to_time+.
When the current request includes an 'If-Modified-Since' header that is
equal or later than the time specified, execution is immediately halted
with a '304 Not Modified' response. | [
"Set",
"the",
"last",
"modified",
"time",
"of",
"the",
"resource",
"(",
"HTTP",
"Last",
"-",
"Modified",
"header",
")",
"and",
"halt",
"if",
"conditional",
"GET",
"matches",
".",
"The",
"+",
"time",
"+",
"argument",
"is",
"a",
"Time",
"DateTime",
"or",
... | 9116c90fcbb82ac03b4b33c58cfbde1fcf745e99 | https://github.com/github/linguist/blob/9116c90fcbb82ac03b4b33c58cfbde1fcf745e99/samples/Ruby/sinatra.rb#L411-L429 | train | Returns the last modified time for the response | [
30522,
13366,
2197,
1035,
6310,
1006,
2051,
1007,
2709,
4983,
2051,
2051,
1027,
2051,
1035,
2005,
2051,
3433,
1031,
1005,
2197,
1011,
6310,
1005,
1033,
1027,
2051,
1012,
8299,
13701,
2709,
2065,
4372,
2615,
1031,
1005,
8299,
1035,
2065,
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.get_partition_backup_list_with_http_info | def get_partition_backup_list_with_http_info(partition_id, timeout:60, latest:false, start_date_time_filter:nil, end_date_time_filter:nil, custom_headers:nil)
get_partition_backup_list_async(partition_id, timeout:timeout, latest:latest, start_date_time_filter:start_date_time_filter, end_date_time_filter:end_date_time_filter, custom_headers:custom_headers).value!
end | ruby | def get_partition_backup_list_with_http_info(partition_id, timeout:60, latest:false, start_date_time_filter:nil, end_date_time_filter:nil, custom_headers:nil)
get_partition_backup_list_async(partition_id, timeout:timeout, latest:latest, start_date_time_filter:start_date_time_filter, end_date_time_filter:end_date_time_filter, custom_headers:custom_headers).value!
end | [
"def",
"get_partition_backup_list_with_http_info",
"(",
"partition_id",
",",
"timeout",
":",
"60",
",",
"latest",
":",
"false",
",",
"start_date_time_filter",
":",
"nil",
",",
"end_date_time_filter",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"get_partition... | Gets the list of backups available for the specified partition.
Returns a list of backups available for the specified partition. The server
enumerates all the backups available in the backup store configured in the
backup policy. It also allows filtering of the result based on start and end
datetime or just fetching the latest available backup for the partition.
@param partition_id The identity of the partition.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param latest [Boolean] Specifies whether to get only the most recent backup
available for a partition for the specified time range.
@param start_date_time_filter [DateTime] Specify the start date time from
which to enumerate backups, in datetime format. The date time must be
specified in ISO8601 format. This is an optional parameter. If not specified,
all backups from the beginning are enumerated.
@param end_date_time_filter [DateTime] Specify the end date time till which
to enumerate backups, in datetime format. The date time must be specified in
ISO8601 format. This is an optional parameter. If not specified, enumeration
is done till the most recent backup.
@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",
"backups",
"available",
"for",
"the",
"specified",
"partition",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L25118-L25120 | train | Gets the backup list of the specified partition. | [
30522,
13366,
2131,
1035,
13571,
1035,
10200,
1035,
2862,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
13571,
1035,
8909,
1010,
2051,
5833,
1024,
3438,
1010,
6745,
1024,
6270,
1010,
2707,
1035,
3058,
1035,
2051,
1035,
11307,
1024,
9152,
2140,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mikel/mail | lib/mail/utilities.rb | Mail.Utilities.constantize | def constantize( str )
str.to_s.split(/[-_]/).map { |v| v.capitalize }.to_s
end | ruby | def constantize( str )
str.to_s.split(/[-_]/).map { |v| v.capitalize }.to_s
end | [
"def",
"constantize",
"(",
"str",
")",
"str",
".",
"to_s",
".",
"split",
"(",
"/",
"/",
")",
".",
"map",
"{",
"|",
"v",
"|",
"v",
".",
"capitalize",
"}",
".",
"to_s",
"end"
] | Takes an underscored word and turns it into a class name
Example:
constantize("hello") #=> "Hello"
constantize("hello-there") #=> "HelloThere"
constantize("hello-there-mate") #=> "HelloThereMate" | [
"Takes",
"an",
"underscored",
"word",
"and",
"turns",
"it",
"into",
"a",
"class",
"name"
] | fb53fb369eb2bf0494ac70675970c90cdcc3f495 | https://github.com/mikel/mail/blob/fb53fb369eb2bf0494ac70675970c90cdcc3f495/lib/mail/utilities.rb#L199-L201 | train | Convert a string to a string of the correct type. | [
30522,
13366,
5377,
4697,
1006,
2358,
2099,
1007,
2358,
2099,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_quorum_loss_progress_with_http_info | def get_quorum_loss_progress_with_http_info(service_id, partition_id, operation_id, timeout:60, custom_headers:nil)
get_quorum_loss_progress_async(service_id, partition_id, operation_id, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def get_quorum_loss_progress_with_http_info(service_id, partition_id, operation_id, timeout:60, custom_headers:nil)
get_quorum_loss_progress_async(service_id, partition_id, operation_id, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"get_quorum_loss_progress_with_http_info",
"(",
"service_id",
",",
"partition_id",
",",
"operation_id",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"get_quorum_loss_progress_async",
"(",
"service_id",
",",
"partition_id",
",",
"operation_id... | Gets the progress of a quorum loss operation on a partition started using the
StartQuorumLoss API.
Gets the progress of a quorum loss operation started with StartQuorumLoss,
using the provided OperationId.
@param service_id [String] The identity of the service. This is typically the
full name of the service without the 'fabric:' URI scheme.
Starting from version 6.0, hierarchical names are delimited with the "~"
character.
For example, if the service name is "fabric:/myapp/app1/svc1", the service
identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
versions.
@param partition_id The identity of the partition.
@param operation_id A GUID that identifies a call of this API. This is
passed into the corresponding GetProgress API
@param 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",
"progress",
"of",
"a",
"quorum",
"loss",
"operation",
"on",
"a",
"partition",
"started",
"using",
"the",
"StartQuorumLoss",
"API",
"."
] | 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#L21200-L21202 | train | Gets the quorum loss progress of the specified operation. | [
30522,
13366,
2131,
1035,
22035,
6824,
1035,
3279,
1035,
5082,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2326,
1035,
8909,
1010,
13571,
1035,
8909,
1010,
3169,
1035,
8909,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
awesome-print/awesome_print | lib/awesome_print/ext/active_record.rb | AwesomePrint.ActiveRecord.awesome_active_record_instance | def awesome_active_record_instance(object)
return object.inspect if !defined?(::ActiveSupport::OrderedHash)
return awesome_object(object) if @options[:raw]
data = if object.class.column_names != object.attributes.keys
object.attributes
else
object.class.column_names.inject(::ActiveSupport::OrderedHash.new) do |hash, name|
if object.has_attribute?(name) || object.new_record?
value = object.respond_to?(name) ? object.send(name) : object.read_attribute(name)
hash[name.to_sym] = value
end
hash
end
end
"#{object} " << awesome_hash(data)
end | ruby | def awesome_active_record_instance(object)
return object.inspect if !defined?(::ActiveSupport::OrderedHash)
return awesome_object(object) if @options[:raw]
data = if object.class.column_names != object.attributes.keys
object.attributes
else
object.class.column_names.inject(::ActiveSupport::OrderedHash.new) do |hash, name|
if object.has_attribute?(name) || object.new_record?
value = object.respond_to?(name) ? object.send(name) : object.read_attribute(name)
hash[name.to_sym] = value
end
hash
end
end
"#{object} " << awesome_hash(data)
end | [
"def",
"awesome_active_record_instance",
"(",
"object",
")",
"return",
"object",
".",
"inspect",
"if",
"!",
"defined?",
"(",
"::",
"ActiveSupport",
"::",
"OrderedHash",
")",
"return",
"awesome_object",
"(",
"object",
")",
"if",
"@options",
"[",
":raw",
"]",
"d... | Format ActiveRecord instance object.
NOTE: by default only instance attributes (i.e. columns) are shown. To format
ActiveRecord instance as regular object showing its instance variables and
accessors use :raw => true option:
ap record, :raw => true
------------------------------------------------------------------------------ | [
"Format",
"ActiveRecord",
"instance",
"object",
"."
] | 4564fd74721562cbef2443f7d97109bf9192343d | https://github.com/awesome-print/awesome_print/blob/4564fd74721562cbef2443f7d97109bf9192343d/lib/awesome_print/ext/active_record.rb#L43-L59 | train | Returns a string representation of the object. | [
30522,
13366,
12476,
1035,
3161,
1035,
2501,
1035,
6013,
1006,
4874,
1007,
2709,
4874,
1012,
22459,
2065,
999,
4225,
1029,
1006,
1024,
1024,
3161,
6342,
9397,
11589,
1024,
1024,
3641,
14949,
2232,
1007,
2709,
12476,
1035,
4874,
1006,
4874,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_recovery_services_site_recovery/lib/2018-01-10/generated/azure_mgmt_recovery_services_site_recovery/replication_protection_container_mappings.rb | Azure::RecoveryServicesSiteRecovery::Mgmt::V2018_01_10.ReplicationProtectionContainerMappings.create | def create(fabric_name, protection_container_name, mapping_name, creation_input, custom_headers:nil)
response = create_async(fabric_name, protection_container_name, mapping_name, creation_input, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create(fabric_name, protection_container_name, mapping_name, creation_input, custom_headers:nil)
response = create_async(fabric_name, protection_container_name, mapping_name, creation_input, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create",
"(",
"fabric_name",
",",
"protection_container_name",
",",
"mapping_name",
",",
"creation_input",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_async",
"(",
"fabric_name",
",",
"protection_container_name",
",",
"mapping_name",
",",
... | Create protection container mapping.
The operation to create a protection container mapping.
@param fabric_name [String] Fabric name.
@param protection_container_name [String] Protection container name.
@param mapping_name [String] Protection container mapping name.
@param creation_input [CreateProtectionContainerMappingInput] Mapping
creation input.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ProtectionContainerMapping] operation results. | [
"Create",
"protection",
"container",
"mapping",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_recovery_services_site_recovery/lib/2018-01-10/generated/azure_mgmt_recovery_services_site_recovery/replication_protection_container_mappings.rb#L243-L246 | train | Creates a new protection container mapping. | [
30522,
13366,
3443,
1006,
8313,
1035,
2171,
1010,
3860,
1035,
11661,
1035,
2171,
1010,
12375,
1035,
2171,
1010,
4325,
1035,
7953,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3443,
1035,
2004,
6038,
2278,
1006,
8313,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_recovery_services_backup/lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/item_level_recovery_connections.rb | Azure::RecoveryServicesBackup::Mgmt::V2016_06_01.ItemLevelRecoveryConnections.provision_with_http_info | def provision_with_http_info(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, recovery_point_id, resource_ilrrequest, custom_headers:nil)
provision_async(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, recovery_point_id, resource_ilrrequest, custom_headers:custom_headers).value!
end | ruby | def provision_with_http_info(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, recovery_point_id, resource_ilrrequest, custom_headers:nil)
provision_async(vault_name, resource_group_name, fabric_name, container_name, protected_item_name, recovery_point_id, resource_ilrrequest, custom_headers:custom_headers).value!
end | [
"def",
"provision_with_http_info",
"(",
"vault_name",
",",
"resource_group_name",
",",
"fabric_name",
",",
"container_name",
",",
"protected_item_name",
",",
"recovery_point_id",
",",
"resource_ilrrequest",
",",
"custom_headers",
":",
"nil",
")",
"provision_async",
"(",
... | Provisions a script which invokes an iSCSI connection to the backup data.
Executing this script opens File Explorer which displays the recoverable
files and folders. This is an asynchronous operation. To get the provisioning
status, call GetProtectedItemOperationResult API.
@param vault_name [String] The name of the Recovery Services vault.
@param resource_group_name [String] The name of the resource group associated
with the Recovery Services vault.
@param fabric_name [String] The fabric name associated with the backup items.
@param container_name [String] The container name associated with the backup
items.
@param protected_item_name [String] The name of the backup item whose files
or folders are to be restored.
@param recovery_point_id [String] The recovery point ID for backup data. The
iSCSI connection will be provisioned for this backup data.
@param resource_ilrrequest [ILRRequestResource] The resource Item Level
Recovery (ILR) request.
@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. | [
"Provisions",
"a",
"script",
"which",
"invokes",
"an",
"iSCSI",
"connection",
"to",
"the",
"backup",
"data",
".",
"Executing",
"this",
"script",
"opens",
"File",
"Explorer",
"which",
"displays",
"the",
"recoverable",
"files",
"and",
"folders",
".",
"This",
"is... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_recovery_services_backup/lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/item_level_recovery_connections.rb#L196-L198 | train | Provision a protected item. | [
30522,
30524,
2171,
1010,
7233,
1035,
2391,
1035,
8909,
1010,
7692,
1035,
6335,
14343,
15500,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
9347,
1035,
2004,
6038,
2278,
1006,
11632,
1035,
2171,
1010,
7692,
1035,
2177,
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... |
randym/axlsx | lib/axlsx/workbook/workbook.rb | Axlsx.Workbook.[] | def [](cell_def)
sheet_name = cell_def.split('!')[0] if cell_def.match('!')
worksheet = self.worksheets.select { |s| s.name == sheet_name }.first
raise ArgumentError, 'Unknown Sheet' unless sheet_name && worksheet.is_a?(Worksheet)
worksheet[cell_def.gsub(/.+!/,"")]
end | ruby | def [](cell_def)
sheet_name = cell_def.split('!')[0] if cell_def.match('!')
worksheet = self.worksheets.select { |s| s.name == sheet_name }.first
raise ArgumentError, 'Unknown Sheet' unless sheet_name && worksheet.is_a?(Worksheet)
worksheet[cell_def.gsub(/.+!/,"")]
end | [
"def",
"[]",
"(",
"cell_def",
")",
"sheet_name",
"=",
"cell_def",
".",
"split",
"(",
"'!'",
")",
"[",
"0",
"]",
"if",
"cell_def",
".",
"match",
"(",
"'!'",
")",
"worksheet",
"=",
"self",
".",
"worksheets",
".",
"select",
"{",
"|",
"s",
"|",
"s",
... | returns a range of cells in a worksheet
@param [String] cell_def The excel style reference defining the worksheet and cells. The range must specify the sheet to
retrieve the cells from. e.g. range('Sheet1!A1:B2') will return an array of four cells [A1, A2, B1, B2] while range('Sheet1!A1') will return a single Cell.
@return [Cell, Array] | [
"returns",
"a",
"range",
"of",
"cells",
"in",
"a",
"worksheet"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/workbook.rb#L344-L349 | train | Returns the index of the cell_def in the worksheet. | [
30522,
13366,
1031,
1033,
1006,
3526,
1035,
13366,
1007,
7123,
1035,
2171,
1027,
3526,
1035,
13366,
1012,
3975,
1006,
1005,
999,
1005,
1007,
1031,
1014,
1033,
2065,
3526,
1035,
13366,
1012,
2674,
1006,
1005,
999,
1005,
1007,
2573,
21030,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
github/linguist | lib/linguist/generated.rb | Linguist.Generated.generated_net_docfile? | def generated_net_docfile?
return false unless extname.downcase == ".xml"
return false unless lines.count > 3
# .NET Docfiles always open with <doc> and their first tag is an
# <assembly> tag
return lines[1].include?("<doc>") &&
lines[2].include?("<assembly>") &&
lines[-2].include?("</doc>")
end | ruby | def generated_net_docfile?
return false unless extname.downcase == ".xml"
return false unless lines.count > 3
# .NET Docfiles always open with <doc> and their first tag is an
# <assembly> tag
return lines[1].include?("<doc>") &&
lines[2].include?("<assembly>") &&
lines[-2].include?("</doc>")
end | [
"def",
"generated_net_docfile?",
"return",
"false",
"unless",
"extname",
".",
"downcase",
"==",
"\".xml\"",
"return",
"false",
"unless",
"lines",
".",
"count",
">",
"3",
"# .NET Docfiles always open with <doc> and their first tag is an",
"# <assembly> tag",
"return",
"lines... | Internal: Is this a generated documentation file for a .NET assembly?
.NET developers often check in the XML Intellisense file along with an
assembly - however, these don't have a special extension, so we have to
dig into the contents to determine if it's a docfile. Luckily, these files
are extremely structured, so recognizing them is easy.
Returns true or false | [
"Internal",
":",
"Is",
"this",
"a",
"generated",
"documentation",
"file",
"for",
"a",
".",
"NET",
"assembly?"
] | 9116c90fcbb82ac03b4b33c58cfbde1fcf745e99 | https://github.com/github/linguist/blob/9116c90fcbb82ac03b4b33c58cfbde1fcf745e99/lib/linguist/generated.rb#L213-L222 | train | Returns true if the generated net docfile is a valid net docfile. | [
30522,
13366,
7013,
1035,
5658,
1035,
9986,
8873,
2571,
1029,
2709,
6270,
4983,
4654,
2102,
18442,
1012,
2091,
18382,
1027,
1027,
1000,
1012,
20950,
1000,
2709,
6270,
4983,
3210,
1012,
4175,
1028,
1017,
1001,
1012,
5658,
9986,
8873,
4244,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-ec2/lib/aws-sdk-ec2/instance.rb | Aws::EC2.Instance.detach_classic_link_vpc | def detach_classic_link_vpc(options = {})
options = options.merge(instance_id: @id)
resp = @client.detach_classic_link_vpc(options)
resp.data
end | ruby | def detach_classic_link_vpc(options = {})
options = options.merge(instance_id: @id)
resp = @client.detach_classic_link_vpc(options)
resp.data
end | [
"def",
"detach_classic_link_vpc",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"instance_id",
":",
"@id",
")",
"resp",
"=",
"@client",
".",
"detach_classic_link_vpc",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
instance.detach_classic_link_vpc({
dry_run: false,
vpc_id: "String", # required
})
@param [Hash] options ({})
@option options [Boolean] :dry_run
Checks whether you have the required permissions for the action,
without actually making the request, and provides an error response.
If you have the required permissions, the error response is
`DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
@option options [required, String] :vpc_id
The ID of the VPC to which the instance is linked.
@return [Types::DetachClassicLinkVpcResult] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/instance.rb#L746-L750 | train | Detach a VPC from the VPC | [
30522,
13366,
20010,
6776,
1035,
4438,
1035,
4957,
1035,
21210,
2278,
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,
20010,
6776,
1035,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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.put_property_with_http_info | def put_property_with_http_info(name_id, property_description, timeout:60, custom_headers:nil)
put_property_async(name_id, property_description, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def put_property_with_http_info(name_id, property_description, timeout:60, custom_headers:nil)
put_property_async(name_id, property_description, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"put_property_with_http_info",
"(",
"name_id",
",",
"property_description",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"put_property_async",
"(",
"name_id",
",",
"property_description",
",",
"timeout",
":",
"timeout",
",",
"custom_head... | Creates or updates a Service Fabric property.
Creates or updates the specified Service Fabric property under a given name.
@param name_id [String] The Service Fabric name, without the 'fabric:' URI
scheme.
@param property_description [PropertyDescription] Describes the Service
Fabric property to be created.
@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. | [
"Creates",
"or",
"updates",
"a",
"Service",
"Fabric",
"property",
"."
] | 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#L26751-L26753 | train | Put a property in a given container. | [
30522,
13366,
2404,
1035,
3200,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2171,
1035,
8909,
1010,
3200,
1035,
6412,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2404,
1035,
3200,
1035,
2004,
6038,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rmagick/rmagick | examples/histogram.rb | Magick.Image.histogram | def histogram(fg = 'white', bg = 'black')
red = Array.new(HISTOGRAM_COLS, 0)
green = Array.new(HISTOGRAM_COLS, 0)
blue = Array.new(HISTOGRAM_COLS, 0)
alpha = Array.new(HISTOGRAM_COLS, 0)
int = Array.new(HISTOGRAM_COLS, 0)
rows.times do |row|
pixels = get_pixels(0, row, columns, 1)
pixels.each do |pixel|
red[pixel.red & MAX_QUANTUM] += 1
green[pixel.green & MAX_QUANTUM] += 1
blue[pixel.blue & MAX_QUANTUM] += 1
# Only count opacity channel if some pixels are not opaque.
alpha[pixel.opacity & MAX_QUANTUM] += 1 unless opaque?
v = pixel_intensity(pixel)
int[v] += 1
end
end
# Scale to chart size. When computing the scale, add some "air" between
# the max frequency and the top of the histogram. This makes a prettier chart.
# The RGBA and intensity histograms are all drawn to the same scale.
max = [red.max, green.max, blue.max, alpha.max, int.max].max
scale = HISTOGRAM_ROWS / (max * AIR_FACTOR)
charts = ImageList.new
# Add the thumbnail.
thumb = copy
thumb['Label'] = File.basename(filename)
charts << thumb
# Compute the channel and intensity histograms.
channel_hists = channel_histograms(red, green, blue, int, scale, fg, bg)
# Add the red, green, and blue histograms to the list
charts << channel_hists.shift
charts << channel_hists.shift
charts << channel_hists.shift
# Add Alpha channel or image stats
charts << if !opaque?
alpha_hist(alpha, scale, fg, bg)
else
info_text(fg, bg)
end
# Add the RGB histogram
charts << channel_hists.shift
# Add the intensity histogram.
charts << intensity_hist(channel_hists.shift)
# Add the color frequency histogram.
charts << color_hist(fg, bg)
# Make a montage.
histogram = charts.montage do
self.background_color = bg
self.stroke = 'transparent'
self.fill = fg
self.border_width = 1
self.tile = '4x2'
self.geometry = "#{HISTOGRAM_COLS}x#{HISTOGRAM_ROWS}+10+10"
end
histogram
end | ruby | def histogram(fg = 'white', bg = 'black')
red = Array.new(HISTOGRAM_COLS, 0)
green = Array.new(HISTOGRAM_COLS, 0)
blue = Array.new(HISTOGRAM_COLS, 0)
alpha = Array.new(HISTOGRAM_COLS, 0)
int = Array.new(HISTOGRAM_COLS, 0)
rows.times do |row|
pixels = get_pixels(0, row, columns, 1)
pixels.each do |pixel|
red[pixel.red & MAX_QUANTUM] += 1
green[pixel.green & MAX_QUANTUM] += 1
blue[pixel.blue & MAX_QUANTUM] += 1
# Only count opacity channel if some pixels are not opaque.
alpha[pixel.opacity & MAX_QUANTUM] += 1 unless opaque?
v = pixel_intensity(pixel)
int[v] += 1
end
end
# Scale to chart size. When computing the scale, add some "air" between
# the max frequency and the top of the histogram. This makes a prettier chart.
# The RGBA and intensity histograms are all drawn to the same scale.
max = [red.max, green.max, blue.max, alpha.max, int.max].max
scale = HISTOGRAM_ROWS / (max * AIR_FACTOR)
charts = ImageList.new
# Add the thumbnail.
thumb = copy
thumb['Label'] = File.basename(filename)
charts << thumb
# Compute the channel and intensity histograms.
channel_hists = channel_histograms(red, green, blue, int, scale, fg, bg)
# Add the red, green, and blue histograms to the list
charts << channel_hists.shift
charts << channel_hists.shift
charts << channel_hists.shift
# Add Alpha channel or image stats
charts << if !opaque?
alpha_hist(alpha, scale, fg, bg)
else
info_text(fg, bg)
end
# Add the RGB histogram
charts << channel_hists.shift
# Add the intensity histogram.
charts << intensity_hist(channel_hists.shift)
# Add the color frequency histogram.
charts << color_hist(fg, bg)
# Make a montage.
histogram = charts.montage do
self.background_color = bg
self.stroke = 'transparent'
self.fill = fg
self.border_width = 1
self.tile = '4x2'
self.geometry = "#{HISTOGRAM_COLS}x#{HISTOGRAM_ROWS}+10+10"
end
histogram
end | [
"def",
"histogram",
"(",
"fg",
"=",
"'white'",
",",
"bg",
"=",
"'black'",
")",
"red",
"=",
"Array",
".",
"new",
"(",
"HISTOGRAM_COLS",
",",
"0",
")",
"green",
"=",
"Array",
".",
"new",
"(",
"HISTOGRAM_COLS",
",",
"0",
")",
"blue",
"=",
"Array",
"."... | Create the histogram montage. | [
"Create",
"the",
"histogram",
"montage",
"."
] | ef6688ed9d76bf123c2ea1a483eff8635051adb7 | https://github.com/rmagick/rmagick/blob/ef6688ed9d76bf123c2ea1a483eff8635051adb7/examples/histogram.rb#L197-L267 | train | Returns a histogram of the image. | [
30522,
13366,
2010,
3406,
13113,
1006,
30524,
1006,
2010,
3406,
13113,
1035,
8902,
2015,
1010,
1014,
1007,
2665,
1027,
9140,
1012,
2047,
1006,
2010,
3406,
13113,
1035,
8902,
2015,
1010,
1014,
1007,
2630,
1027,
9140,
1012,
2047,
1006,
2010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ankane/searchkick | lib/searchkick/reindex_queue.rb | Searchkick.ReindexQueue.reserve | def reserve(limit: 1000)
record_ids = Set.new
while record_ids.size < limit && (record_id = Searchkick.with_redis { |r| r.rpop(redis_key) })
record_ids << record_id
end
record_ids.to_a
end | ruby | def reserve(limit: 1000)
record_ids = Set.new
while record_ids.size < limit && (record_id = Searchkick.with_redis { |r| r.rpop(redis_key) })
record_ids << record_id
end
record_ids.to_a
end | [
"def",
"reserve",
"(",
"limit",
":",
"1000",
")",
"record_ids",
"=",
"Set",
".",
"new",
"while",
"record_ids",
".",
"size",
"<",
"limit",
"&&",
"(",
"record_id",
"=",
"Searchkick",
".",
"with_redis",
"{",
"|",
"r",
"|",
"r",
".",
"rpop",
"(",
"redis_... | TODO use reliable queuing | [
"TODO",
"use",
"reliable",
"queuing"
] | 33ee919b56a5204d9e5c519f87e1681216be7699 | https://github.com/ankane/searchkick/blob/33ee919b56a5204d9e5c519f87e1681216be7699/lib/searchkick/reindex_queue.rb#L16-L22 | train | Reserve the given number of records in the cache | [
30522,
13366,
3914,
1006,
5787,
1024,
6694,
1007,
2501,
1035,
8909,
2015,
1027,
2275,
1012,
2047,
2096,
2501,
1035,
8909,
2015,
1012,
2946,
1026,
5787,
1004,
1004,
1006,
2501,
1035,
8909,
1027,
3945,
29493,
2243,
1012,
2007,
1035,
2417,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_storagesync/lib/2018-07-01/generated/azure_mgmt_storagesync/cloud_endpoints.rb | Azure::StorageSync::Mgmt::V2018_07_01.CloudEndpoints.post_restore | def post_restore(resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers:nil)
response = post_restore_async(resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers:custom_headers).value!
nil
end | ruby | def post_restore(resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers:nil)
response = post_restore_async(resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, parameters, custom_headers:custom_headers).value!
nil
end | [
"def",
"post_restore",
"(",
"resource_group_name",
",",
"storage_sync_service_name",
",",
"sync_group_name",
",",
"cloud_endpoint_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"post_restore_async",
"(",
"resource_group_name",
",",
"s... | Post Restore a given CloudEndpoint.
@param resource_group_name [String] The name of the resource group. The name
is case insensitive.
@param storage_sync_service_name [String] Name of Storage Sync Service
resource.
@param sync_group_name [String] Name of Sync Group resource.
@param cloud_endpoint_name [String] Name of Cloud Endpoint object.
@param parameters [PostRestoreRequest] Body of Cloud Endpoint object.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Post",
"Restore",
"a",
"given",
"CloudEndpoint",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_storagesync/lib/2018-07-01/generated/azure_mgmt_storagesync/cloud_endpoints.rb#L603-L606 | train | Restores a CloudEndpoint. | [
30522,
13366,
2695,
1035,
9239,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
5527,
1035,
26351,
1035,
2326,
1035,
2171,
1010,
26351,
1035,
2177,
1035,
2171,
1010,
6112,
1035,
2203,
8400,
1035,
2171,
1010,
11709,
1010,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-glacier/lib/aws-sdk-glacier/notification.rb | Aws::Glacier.Notification.delete | def delete(options = {})
options = options.merge(
account_id: @account_id,
vault_name: @vault_name
)
resp = @client.delete_vault_notifications(options)
resp.data
end | ruby | def delete(options = {})
options = options.merge(
account_id: @account_id,
vault_name: @vault_name
)
resp = @client.delete_vault_notifications(options)
resp.data
end | [
"def",
"delete",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"account_id",
":",
"@account_id",
",",
"vault_name",
":",
"@vault_name",
")",
"resp",
"=",
"@client",
".",
"delete_vault_notifications",
"(",
"options",
")",
... | @!group Actions
@example Request syntax with placeholder values
notification.delete()
@param [Hash] options ({})
@return [EmptyStructure] | [
"@!group",
"Actions",
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-glacier/lib/aws-sdk-glacier/notification.rb#L195-L202 | train | Delete all notifications from the vault | [
30522,
13366,
3972,
12870,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
4070,
1035,
8909,
1024,
1030,
4070,
1035,
8909,
1010,
11632,
1035,
2171,
1024,
1030,
11632,
1035,
2171,
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... |
phusion/passenger | src/ruby_supportlib/phusion_passenger/native_support.rb | PhusionPassenger.NativeSupportLoader.current_user_name_or_id | def current_user_name_or_id
require 'etc' if !defined?(Etc)
begin
user = Etc.getpwuid(Process.uid)
rescue ArgumentError
user = nil
end
if user
return user.name
else
return "##{Process.uid}"
end
end | ruby | def current_user_name_or_id
require 'etc' if !defined?(Etc)
begin
user = Etc.getpwuid(Process.uid)
rescue ArgumentError
user = nil
end
if user
return user.name
else
return "##{Process.uid}"
end
end | [
"def",
"current_user_name_or_id",
"require",
"'etc'",
"if",
"!",
"defined?",
"(",
"Etc",
")",
"begin",
"user",
"=",
"Etc",
".",
"getpwuid",
"(",
"Process",
".",
"uid",
")",
"rescue",
"ArgumentError",
"user",
"=",
"nil",
"end",
"if",
"user",
"return",
"user... | Name of the user under which we are executing, or the id as fallback
N.B. loader_shared_helpers.rb has the same method | [
"Name",
"of",
"the",
"user",
"under",
"which",
"we",
"are",
"executing",
"or",
"the",
"id",
"as",
"fallback",
"N",
".",
"B",
".",
"loader_shared_helpers",
".",
"rb",
"has",
"the",
"same",
"method"
] | 970964b53e0ba86959acdf40f06c99b0c4a128ca | https://github.com/phusion/passenger/blob/970964b53e0ba86959acdf40f06c99b0c4a128ca/src/ruby_supportlib/phusion_passenger/native_support.rb#L229-L241 | train | Returns the current user name or id | [
30522,
13366,
2783,
1035,
5310,
1035,
2171,
1035,
2030,
1035,
8909,
5478,
1005,
4385,
1005,
2065,
999,
4225,
1029,
1006,
4385,
1007,
4088,
5310,
1027,
4385,
1012,
2131,
28400,
21272,
1006,
2832,
1012,
21318,
2094,
1007,
5343,
6685,
2121,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2018-06-01-preview/generated/azure_mgmt_sql/managed_database_schemas.rb | Azure::SQL::Mgmt::V2018_06_01_preview.ManagedDatabaseSchemas.list_by_database_as_lazy | def list_by_database_as_lazy(resource_group_name, managed_instance_name, database_name, filter:nil, custom_headers:nil)
response = list_by_database_async(resource_group_name, managed_instance_name, database_name, filter:filter, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_database_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_by_database_as_lazy(resource_group_name, managed_instance_name, database_name, filter:nil, custom_headers:nil)
response = list_by_database_async(resource_group_name, managed_instance_name, database_name, filter:filter, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_database_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_by_database_as_lazy",
"(",
"resource_group_name",
",",
"managed_instance_name",
",",
"database_name",
",",
"filter",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_database_async",
"(",
"resource_group_name",
",",
"managed_ins... | List managed database schemas
@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 filter [String] An OData filter expression that filters elements in
the collection.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [DatabaseSchemaListResult] which provide lazy access to pages of the
response. | [
"List",
"managed",
"database",
"schemas"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2018-06-01-preview/generated/azure_mgmt_sql/managed_database_schemas.rb#L345-L354 | train | Gets the list of all the managed instance s managed databases. | [
30522,
13366,
2862,
1035,
2011,
1035,
7809,
1035,
2004,
1035,
13971,
1006,
7692,
30524,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3266,
1035,
6013,
1035,
2171,
1010,
7809,
1035,
2171,
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... |
petergoldstein/dalli | lib/dalli/client.rb | Dalli.Client.fetch | def fetch(key, ttl=nil, options=nil)
options = options.nil? ? CACHE_NILS : options.merge(CACHE_NILS) if @options[:cache_nils]
val = get(key, options)
not_found = @options[:cache_nils] ?
val == Dalli::Server::NOT_FOUND :
val.nil?
if not_found && block_given?
val = yield
add(key, val, ttl_or_default(ttl), options)
end
val
end | ruby | def fetch(key, ttl=nil, options=nil)
options = options.nil? ? CACHE_NILS : options.merge(CACHE_NILS) if @options[:cache_nils]
val = get(key, options)
not_found = @options[:cache_nils] ?
val == Dalli::Server::NOT_FOUND :
val.nil?
if not_found && block_given?
val = yield
add(key, val, ttl_or_default(ttl), options)
end
val
end | [
"def",
"fetch",
"(",
"key",
",",
"ttl",
"=",
"nil",
",",
"options",
"=",
"nil",
")",
"options",
"=",
"options",
".",
"nil?",
"?",
"CACHE_NILS",
":",
"options",
".",
"merge",
"(",
"CACHE_NILS",
")",
"if",
"@options",
"[",
":cache_nils",
"]",
"val",
"=... | Fetch the value associated with the key.
If a value is found, then it is returned.
If a value is not found and no block is given, then nil is returned.
If a value is not found (or if the found value is nil and :cache_nils is false)
and a block is given, the block will be invoked and its return value
written to the cache and returned. | [
"Fetch",
"the",
"value",
"associated",
"with",
"the",
"key",
".",
"If",
"a",
"value",
"is",
"found",
"then",
"it",
"is",
"returned",
"."
] | 5755dbfd06e333a8239f976d4b10492b4555b726 | https://github.com/petergoldstein/dalli/blob/5755dbfd06e333a8239f976d4b10492b4555b726/lib/dalli/client.rb#L90-L101 | train | Fetch the value for the given key. | [
30522,
13366,
18584,
1006,
3145,
1010,
23746,
2140,
1027,
9152,
2140,
1010,
7047,
1027,
9152,
2140,
1007,
7047,
1027,
7047,
1012,
9152,
2140,
1029,
1029,
17053,
1035,
27282,
1024,
7047,
1012,
13590,
1006,
17053,
1035,
27282,
1007,
2065,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/sprockets | lib/sprockets/path_utils.rb | Sprockets.PathUtils.find_upwards | def find_upwards(basename, path, root = nil)
path_parents(path, root).each do |dir|
filename = File.join(dir, basename)
return filename if file?(filename)
end
nil
end | ruby | def find_upwards(basename, path, root = nil)
path_parents(path, root).each do |dir|
filename = File.join(dir, basename)
return filename if file?(filename)
end
nil
end | [
"def",
"find_upwards",
"(",
"basename",
",",
"path",
",",
"root",
"=",
"nil",
")",
"path_parents",
"(",
"path",
",",
"root",
")",
".",
"each",
"do",
"|",
"dir",
"|",
"filename",
"=",
"File",
".",
"join",
"(",
"dir",
",",
"basename",
")",
"return",
... | Internal: Find target basename checking upwards from path.
basename - String filename: ".sprocketsrc"
path - String path to start search: "app/assets/javascripts/app.js"
root - String path to stop at (default: system root)
Returns String filename or nil. | [
"Internal",
":",
"Find",
"target",
"basename",
"checking",
"upwards",
"from",
"path",
"."
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/path_utils.rb#L273-L279 | train | Find the file that is upwards to the given basename. | [
30522,
13366,
2424,
1035,
14873,
1006,
2918,
18442,
1010,
4130,
1010,
7117,
1027,
9152,
2140,
1007,
4130,
1035,
3008,
1006,
4130,
1010,
7117,
1007,
1012,
2169,
2079,
1064,
16101,
1064,
5371,
18442,
1027,
5371,
1012,
3693,
1006,
16101,
1010,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hashicorp/vagrant | lib/vagrant/bundler.rb | Vagrant.Bundler.activate_solution | def activate_solution(solution)
retried = false
begin
@logger.debug("Activating solution set: #{solution.map(&:full_name)}")
solution.each do |activation_request|
unless activation_request.full_spec.activated?
@logger.debug("Activating gem #{activation_request.full_spec.full_name}")
activation_request.full_spec.activate
if(defined?(::Bundler))
@logger.debug("Marking gem #{activation_request.full_spec.full_name} loaded within Bundler.")
::Bundler.rubygems.mark_loaded activation_request.full_spec
end
end
end
rescue Gem::LoadError => e
# Depending on the version of Ruby, the ordering of the solution set
# will be either 0..n (molinillo) or n..0 (pre-molinillo). Instead of
# attempting to determine what's in use, or if it has some how changed
# again, just reverse order on failure and attempt again.
if retried
@logger.error("Failed to load solution set - #{e.class}: #{e}")
matcher = e.message.match(/Could not find '(?<gem_name>[^']+)'/)
if matcher && !matcher["gem_name"].empty?
desired_activation_request = solution.detect do |request|
request.name == matcher["gem_name"]
end
if desired_activation_request && !desired_activation_request.full_spec.activated?
activation_request = desired_activation_request
@logger.warn("Found misordered activation request for #{desired_activation_request.full_name}. Moving to solution HEAD.")
solution.delete(desired_activation_request)
solution.unshift(desired_activation_request)
retry
end
end
raise
else
@logger.debug("Failed to load solution set. Retrying with reverse order.")
retried = true
solution.reverse!
retry
end
end
end | ruby | def activate_solution(solution)
retried = false
begin
@logger.debug("Activating solution set: #{solution.map(&:full_name)}")
solution.each do |activation_request|
unless activation_request.full_spec.activated?
@logger.debug("Activating gem #{activation_request.full_spec.full_name}")
activation_request.full_spec.activate
if(defined?(::Bundler))
@logger.debug("Marking gem #{activation_request.full_spec.full_name} loaded within Bundler.")
::Bundler.rubygems.mark_loaded activation_request.full_spec
end
end
end
rescue Gem::LoadError => e
# Depending on the version of Ruby, the ordering of the solution set
# will be either 0..n (molinillo) or n..0 (pre-molinillo). Instead of
# attempting to determine what's in use, or if it has some how changed
# again, just reverse order on failure and attempt again.
if retried
@logger.error("Failed to load solution set - #{e.class}: #{e}")
matcher = e.message.match(/Could not find '(?<gem_name>[^']+)'/)
if matcher && !matcher["gem_name"].empty?
desired_activation_request = solution.detect do |request|
request.name == matcher["gem_name"]
end
if desired_activation_request && !desired_activation_request.full_spec.activated?
activation_request = desired_activation_request
@logger.warn("Found misordered activation request for #{desired_activation_request.full_name}. Moving to solution HEAD.")
solution.delete(desired_activation_request)
solution.unshift(desired_activation_request)
retry
end
end
raise
else
@logger.debug("Failed to load solution set. Retrying with reverse order.")
retried = true
solution.reverse!
retry
end
end
end | [
"def",
"activate_solution",
"(",
"solution",
")",
"retried",
"=",
"false",
"begin",
"@logger",
".",
"debug",
"(",
"\"Activating solution set: #{solution.map(&:full_name)}\"",
")",
"solution",
".",
"each",
"do",
"|",
"activation_request",
"|",
"unless",
"activation_reque... | Activate a given solution | [
"Activate",
"a",
"given",
"solution"
] | c22a145c59790c098f95d50141d9afb48e1ef55f | https://github.com/hashicorp/vagrant/blob/c22a145c59790c098f95d50141d9afb48e1ef55f/lib/vagrant/bundler.rb#L483-L526 | train | Activates the given solution set. | [
30522,
13366,
20544,
1035,
5576,
1006,
5576,
1007,
2128,
18886,
2098,
1027,
6270,
4088,
1030,
8833,
4590,
1012,
2139,
8569,
2290,
1006,
1000,
2552,
17441,
5576,
2275,
1024,
1001,
1063,
5576,
1012,
4949,
1006,
1004,
1024,
2440,
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... |
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.list_failover_targets_with_http_info | def list_failover_targets_with_http_info(source_device_name, parameters, resource_group_name, manager_name, custom_headers:nil)
list_failover_targets_async(source_device_name, parameters, resource_group_name, manager_name, custom_headers:custom_headers).value!
end | ruby | def list_failover_targets_with_http_info(source_device_name, parameters, resource_group_name, manager_name, custom_headers:nil)
list_failover_targets_async(source_device_name, parameters, resource_group_name, manager_name, custom_headers:custom_headers).value!
end | [
"def",
"list_failover_targets_with_http_info",
"(",
"source_device_name",
",",
"parameters",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"list_failover_targets_async",
"(",
"source_device_name",
",",
"parameters",
",",
"resource_... | Given a list of volume containers to be failed over from a source device,
this method returns the eligibility result, as a failover target, for all
devices under that resource.
@param source_device_name [String] The source device name on which failover
is performed.
@param parameters [ListFailoverTargetsRequest] ListFailoverTargetsRequest
containing the list of volume containers to be failed over.
@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. | [
"Given",
"a",
"list",
"of",
"volume",
"containers",
"to",
"be",
"failed",
"over",
"from",
"a",
"source",
"device",
"this",
"method",
"returns",
"the",
"eligibility",
"result",
"as",
"a",
"failover",
"target",
"for",
"all",
"devices",
"under",
"that",
"resour... | 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#L1124-L1126 | train | Gets the list of failover targets for the source device. | [
30522,
13366,
2862,
1035,
8246,
7840,
1035,
7889,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
3120,
1035,
5080,
1035,
2171,
1010,
11709,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
tongueroo/jets | lib/jets/logger.rb | Jets.Logger.add | def add(severity, message = nil, progname = nil)
# Taken from Logger#add source
# https://ruby-doc.org/stdlib-2.5.1/libdoc/logger/rdoc/Logger.html#method-i-add
if message.nil?
if block_given?
message = yield
else
message = progname
progname = @progname
end
end
# Put the message in the Jets::IO.buffer which will get flushed to CloudWatch.
# No need to include timestamp as CloudWatch already has a timestamp.
IO.buffer << message
super # original logical
end | ruby | def add(severity, message = nil, progname = nil)
# Taken from Logger#add source
# https://ruby-doc.org/stdlib-2.5.1/libdoc/logger/rdoc/Logger.html#method-i-add
if message.nil?
if block_given?
message = yield
else
message = progname
progname = @progname
end
end
# Put the message in the Jets::IO.buffer which will get flushed to CloudWatch.
# No need to include timestamp as CloudWatch already has a timestamp.
IO.buffer << message
super # original logical
end | [
"def",
"add",
"(",
"severity",
",",
"message",
"=",
"nil",
",",
"progname",
"=",
"nil",
")",
"# Taken from Logger#add source",
"# https://ruby-doc.org/stdlib-2.5.1/libdoc/logger/rdoc/Logger.html#method-i-add",
"if",
"message",
".",
"nil?",
"if",
"block_given?",
"message",
... | Only need to override the add method as the other calls all lead to it. | [
"Only",
"need",
"to",
"override",
"the",
"add",
"method",
"as",
"the",
"other",
"calls",
"all",
"lead",
"to",
"it",
"."
] | 46943a519224067e58aa3e2d5656e3ca083150f9 | https://github.com/tongueroo/jets/blob/46943a519224067e58aa3e2d5656e3ca083150f9/lib/jets/logger.rb#L6-L22 | train | Add a message to the log. | [
30522,
13366,
5587,
1006,
18976,
1010,
4471,
1027,
9152,
2140,
1010,
4013,
16989,
4168,
1027,
9152,
2140,
1007,
1001,
2579,
2013,
8833,
4590,
1001,
5587,
3120,
1001,
16770,
1024,
1013,
1013,
10090,
1011,
9986,
1012,
8917,
1013,
2358,
19422,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
guard/guard | lib/guard/commander.rb | Guard.Commander.start | def start(options = {})
setup(options)
UI.debug "Guard starts all plugins"
Runner.new.run(:start)
listener.start
watched = Guard.state.session.watchdirs.join("', '")
UI.info "Guard is now watching at '#{ watched }'"
exitcode = 0
begin
while interactor.foreground != :exit
Guard.queue.process while Guard.queue.pending?
end
rescue Interrupt
rescue SystemExit => e
exitcode = e.status
end
exitcode
ensure
stop
end | ruby | def start(options = {})
setup(options)
UI.debug "Guard starts all plugins"
Runner.new.run(:start)
listener.start
watched = Guard.state.session.watchdirs.join("', '")
UI.info "Guard is now watching at '#{ watched }'"
exitcode = 0
begin
while interactor.foreground != :exit
Guard.queue.process while Guard.queue.pending?
end
rescue Interrupt
rescue SystemExit => e
exitcode = e.status
end
exitcode
ensure
stop
end | [
"def",
"start",
"(",
"options",
"=",
"{",
"}",
")",
"setup",
"(",
"options",
")",
"UI",
".",
"debug",
"\"Guard starts all plugins\"",
"Runner",
".",
"new",
".",
"run",
"(",
":start",
")",
"listener",
".",
"start",
"watched",
"=",
"Guard",
".",
"state",
... | Start Guard by evaluating the `Guardfile`, initializing declared Guard
plugins and starting the available file change listener.
Main method for Guard that is called from the CLI when Guard starts.
- Setup Guard internals
- Evaluate the `Guardfile`
- Configure Notifiers
- Initialize the declared Guard plugins
- Start the available file change listener
@option options [Boolean] clear if auto clear the UI should be done
@option options [Boolean] notify if system notifications should be shown
@option options [Boolean] debug if debug output should be shown
@option options [Array<String>] group the list of groups to start
@option options [String] watchdir the director to watch
@option options [String] guardfile the path to the Guardfile
@see CLI#start | [
"Start",
"Guard",
"by",
"evaluating",
"the",
"Guardfile",
"initializing",
"declared",
"Guard",
"plugins",
"and",
"starting",
"the",
"available",
"file",
"change",
"listener",
".",
"Main",
"method",
"for",
"Guard",
"that",
"is",
"called",
"from",
"the",
"CLI",
... | e2508cd83badf0d537dbaba35d307adc35d92e4f | https://github.com/guard/guard/blob/e2508cd83badf0d537dbaba35d307adc35d92e4f/lib/guard/commander.rb#L31-L53 | train | Start the Guard | [
30522,
13366,
2707,
1006,
7047,
1027,
1063,
1065,
1007,
16437,
1006,
7047,
1007,
21318,
1012,
2139,
8569,
2290,
1000,
3457,
4627,
2035,
13354,
7076,
1000,
5479,
1012,
2047,
1012,
2448,
1006,
1024,
2707,
1007,
19373,
1012,
2707,
3427,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
projectcypress/health-data-standards | lib/hqmf-parser/2.0/document_helpers/doc_population_helper.rb | HQMF2.DocumentPopulationHelper.extract_populations_and_criteria | def extract_populations_and_criteria
has_observation = extract_observations
document_populations = @doc.xpath('cda:QualityMeasureDocument/cda:component/cda:populationCriteriaSection',
HQMF2::Document::NAMESPACES)
# Sort the populations based on the id/extension, since the populations may be out of order; there doesn't seem to
# be any other way that order is indicated in the HQMF
document_populations = document_populations.sort_by do |pop|
pop.at_xpath('cda:id/@extension', HQMF2::Document::NAMESPACES).try(:value)
end
number_of_populations = document_populations.length
document_populations.each_with_index do |population_def, population_index|
population = {}
handle_base_populations(population_def, population)
id_def = population_def.at_xpath('cda:id/@extension', HQMF2::Document::NAMESPACES)
population['id'] = id_def ? id_def.value : "Population#{population_index}"
title_def = population_def.at_xpath('cda:title/@value', HQMF2::Document::NAMESPACES)
population['title'] = title_def ? title_def.value : "Population #{population_index}"
population['OBSERV'] = 'OBSERV' if has_observation
@populations << population
handle_stratifications(population_def, number_of_populations, population, id_def, population_index)
end
# Push in the stratification populations after the unstratified populations
@populations.concat(@stratifications)
[@populations, @population_criteria]
end | ruby | def extract_populations_and_criteria
has_observation = extract_observations
document_populations = @doc.xpath('cda:QualityMeasureDocument/cda:component/cda:populationCriteriaSection',
HQMF2::Document::NAMESPACES)
# Sort the populations based on the id/extension, since the populations may be out of order; there doesn't seem to
# be any other way that order is indicated in the HQMF
document_populations = document_populations.sort_by do |pop|
pop.at_xpath('cda:id/@extension', HQMF2::Document::NAMESPACES).try(:value)
end
number_of_populations = document_populations.length
document_populations.each_with_index do |population_def, population_index|
population = {}
handle_base_populations(population_def, population)
id_def = population_def.at_xpath('cda:id/@extension', HQMF2::Document::NAMESPACES)
population['id'] = id_def ? id_def.value : "Population#{population_index}"
title_def = population_def.at_xpath('cda:title/@value', HQMF2::Document::NAMESPACES)
population['title'] = title_def ? title_def.value : "Population #{population_index}"
population['OBSERV'] = 'OBSERV' if has_observation
@populations << population
handle_stratifications(population_def, number_of_populations, population, id_def, population_index)
end
# Push in the stratification populations after the unstratified populations
@populations.concat(@stratifications)
[@populations, @population_criteria]
end | [
"def",
"extract_populations_and_criteria",
"has_observation",
"=",
"extract_observations",
"document_populations",
"=",
"@doc",
".",
"xpath",
"(",
"'cda:QualityMeasureDocument/cda:component/cda:populationCriteriaSection'",
",",
"HQMF2",
"::",
"Document",
"::",
"NAMESPACES",
")",
... | Returns the population descriptions and criteria found in this document | [
"Returns",
"the",
"population",
"descriptions",
"and",
"criteria",
"found",
"in",
"this",
"document"
] | 252d4f0927c513eacde6b9ea41b76faa1423c34b | https://github.com/projectcypress/health-data-standards/blob/252d4f0927c513eacde6b9ea41b76faa1423c34b/lib/hqmf-parser/2.0/document_helpers/doc_population_helper.rb#L33-L61 | train | Extract the populations and stratifications from the document | [
30522,
13366,
14817,
1035,
7080,
1035,
1998,
1035,
9181,
2038,
1035,
8089,
1027,
14817,
1035,
9420,
6254,
1035,
7080,
1027,
1030,
9986,
1012,
26726,
8988,
1006,
1005,
3729,
2050,
1024,
3737,
4168,
3022,
12165,
10085,
27417,
2102,
1013,
3729... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sumoheavy/jira-ruby | lib/jira/client.rb | JIRA.Client.request | def request(http_method, path, body = '', headers = {})
puts "#{http_method}: #{path} - [#{body}]" if @http_debug
@request_client.request(http_method, path, body, headers)
end | ruby | def request(http_method, path, body = '', headers = {})
puts "#{http_method}: #{path} - [#{body}]" if @http_debug
@request_client.request(http_method, path, body, headers)
end | [
"def",
"request",
"(",
"http_method",
",",
"path",
",",
"body",
"=",
"''",
",",
"headers",
"=",
"{",
"}",
")",
"puts",
"\"#{http_method}: #{path} - [#{body}]\"",
"if",
"@http_debug",
"@request_client",
".",
"request",
"(",
"http_method",
",",
"path",
",",
"bod... | Sends the specified HTTP request to the REST API through the
appropriate method (oauth, basic). | [
"Sends",
"the",
"specified",
"HTTP",
"request",
"to",
"the",
"REST",
"API",
"through",
"the",
"appropriate",
"method",
"(",
"oauth",
"basic",
")",
"."
] | 25e896f227ab81c528e9678708cb546d2f62f018 | https://github.com/sumoheavy/jira-ruby/blob/25e896f227ab81c528e9678708cb546d2f62f018/lib/jira/client.rb#L240-L243 | train | Send a request to the server | [
30522,
13366,
5227,
1006,
8299,
1035,
4118,
1010,
4130,
1010,
2303,
1027,
1005,
1005,
1010,
20346,
2015,
1027,
1063,
1065,
1007,
8509,
1000,
1001,
1063,
8299,
1035,
4118,
1065,
1024,
1001,
1063,
4130,
1065,
1011,
1031,
1001,
1063,
2303,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_cdn/lib/2015-06-01/generated/azure_mgmt_cdn/endpoints.rb | Azure::CDN::Mgmt::V2015_06_01.Endpoints.list_by_profile | def list_by_profile(profile_name, resource_group_name, custom_headers:nil)
response = list_by_profile_async(profile_name, resource_group_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_profile(profile_name, resource_group_name, custom_headers:nil)
response = list_by_profile_async(profile_name, resource_group_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_profile",
"(",
"profile_name",
",",
"resource_group_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_profile_async",
"(",
"profile_name",
",",
"resource_group_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
... | Lists existing CDN endpoints within a profile.
@param profile_name [String] Name of the CDN profile within the resource
group.
@param resource_group_name [String] Name of the resource group within the
Azure subscription.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [EndpointListResult] operation results. | [
"Lists",
"existing",
"CDN",
"endpoints",
"within",
"a",
"profile",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_cdn/lib/2015-06-01/generated/azure_mgmt_cdn/endpoints.rb#L39-L42 | train | Gets the list of all the elastic network interfaces in a resource group. | [
30522,
13366,
2862,
1035,
2011,
1035,
6337,
1006,
6337,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
6337,
1035,
2004,
6038,
2278,
1006,
6337,
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... |
meew0/discordrb | lib/discordrb/webhooks/client.rb | Discordrb::Webhooks.Client.execute | def execute(builder = nil, wait = false)
raise TypeError, 'builder needs to be nil or like a Discordrb::Webhooks::Builder!' unless
builder.respond_to?(:file) && builder.respond_to?(:to_multipart_hash) || builder.respond_to?(:to_json_hash) || builder.nil?
builder ||= Builder.new
yield builder if block_given?
if builder.file
post_multipart(builder, wait)
else
post_json(builder, wait)
end
end | ruby | def execute(builder = nil, wait = false)
raise TypeError, 'builder needs to be nil or like a Discordrb::Webhooks::Builder!' unless
builder.respond_to?(:file) && builder.respond_to?(:to_multipart_hash) || builder.respond_to?(:to_json_hash) || builder.nil?
builder ||= Builder.new
yield builder if block_given?
if builder.file
post_multipart(builder, wait)
else
post_json(builder, wait)
end
end | [
"def",
"execute",
"(",
"builder",
"=",
"nil",
",",
"wait",
"=",
"false",
")",
"raise",
"TypeError",
",",
"'builder needs to be nil or like a Discordrb::Webhooks::Builder!'",
"unless",
"builder",
".",
"respond_to?",
"(",
":file",
")",
"&&",
"builder",
".",
"respond_t... | Create a new webhook
@param url [String] The URL to post messages to.
@param id [Integer] The webhook's ID. Will only be used if `url` is not
set.
@param token [String] The webhook's authorisation token. Will only be used
if `url` is not set.
Executes the webhook this client points to with the given data.
@param builder [Builder, nil] The builder to start out with, or nil if one should be created anew.
@param wait [true, false] Whether Discord should wait for the message to be successfully received by clients, or
whether it should return immediately after sending the message.
@yield [builder] Gives the builder to the block to add additional steps, or to do the entire building process.
@yieldparam builder [Builder] The builder given as a parameter which is used as the initial step to start from.
@example Execute the webhook with an already existing builder
builder = Discordrb::Webhooks::Builder.new # ...
client.execute(builder)
@example Execute the webhook by building a new message
client.execute do |builder|
builder.content = 'Testing'
builder.username = 'discordrb'
builder.add_embed do |embed|
embed.timestamp = Time.now
embed.title = 'Testing'
embed.image = Discordrb::Webhooks::EmbedImage.new(url: 'https://i.imgur.com/PcMltU7.jpg')
end
end
@return [RestClient::Response] the response returned by Discord. | [
"Create",
"a",
"new",
"webhook"
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/webhooks/client.rb#L41-L54 | train | Execute the webhook. | [
30522,
13366,
15389,
1006,
12508,
1027,
9152,
2140,
1010,
3524,
1027,
6270,
1007,
5333,
2828,
2121,
29165,
30524,
12508,
999,
1005,
4983,
12508,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
5371,
1007,
1004,
1004,
12508,
1012,
6869,
1035,
2000... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.get_with_http_info | def get_with_http_info(resource_group_name, registry_name, replication_name, custom_headers:nil)
get_async(resource_group_name, registry_name, replication_name, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, registry_name, replication_name, custom_headers:nil)
get_async(resource_group_name, registry_name, replication_name, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"registry_name",
",",
"replication_name",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"replication_name",
",",
"custom_headers",
":custom_headers"... | Gets the properties of the specified replication.
@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 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",
"properties",
"of",
"the",
"specified",
"replication",
"."
] | 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#L53-L55 | train | Gets the specified index of the replication. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
21647,
1035,
2171,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb | Aws::EC2.Resource.volumes | def volumes(options = {})
batches = Enumerator.new do |y|
resp = @client.describe_volumes(options)
resp.each_page do |page|
batch = []
page.data.volumes.each do |v|
batch << Volume.new(
id: v.volume_id,
data: v,
client: @client
)
end
y.yield(batch)
end
end
Volume::Collection.new(batches)
end | ruby | def volumes(options = {})
batches = Enumerator.new do |y|
resp = @client.describe_volumes(options)
resp.each_page do |page|
batch = []
page.data.volumes.each do |v|
batch << Volume.new(
id: v.volume_id,
data: v,
client: @client
)
end
y.yield(batch)
end
end
Volume::Collection.new(batches)
end | [
"def",
"volumes",
"(",
"options",
"=",
"{",
"}",
")",
"batches",
"=",
"Enumerator",
".",
"new",
"do",
"|",
"y",
"|",
"resp",
"=",
"@client",
".",
"describe_volumes",
"(",
"options",
")",
"resp",
".",
"each_page",
"do",
"|",
"page",
"|",
"batch",
"=",... | @example Request syntax with placeholder values
volumes = ec2.volumes({
filters: [
{
name: "String",
values: ["String"],
},
],
volume_ids: ["String"],
dry_run: false,
})
@param [Hash] options ({})
@option options [Array<Types::Filter>] :filters
The filters.
* `attachment.attach-time` - The time stamp when the attachment
initiated.
* `attachment.delete-on-termination` - Whether the volume is deleted
on instance termination.
* `attachment.device` - The device name specified in the block device
mapping (for example, `/dev/sda1`).
* `attachment.instance-id` - The ID of the instance the volume is
attached to.
* `attachment.status` - The attachment state (`attaching` \|
`attached` \| `detaching`).
* `availability-zone` - The Availability Zone in which the volume was
created.
* `create-time` - The time stamp when the volume was created.
* `encrypted` - Indicates whether the volume is encrypted (`true` \|
`false`)
* `size` - The size of the volume, in GiB.
* `snapshot-id` - The snapshot from which the volume was created.
* `status` - The status of the volume (`creating` \| `available` \|
`in-use` \| `deleting` \| `deleted` \| `error`).
* `tag`\:<key> - The key/value combination of a tag assigned to
the resource. Use the tag key in the filter name and the tag value
as the filter value. For example, to find all resources that have a
tag with the key `Owner` and the value `TeamA`, specify `tag:Owner`
for the filter name and `TeamA` for the filter value.
* `tag-key` - The key of a tag assigned to the resource. Use this
filter to find all resources assigned a tag with a specific key,
regardless of the tag value.
* `volume-id` - The volume ID.
* `volume-type` - The Amazon EBS volume type. This can be `gp2` for
General Purpose SSD, `io1` for Provisioned IOPS SSD, `st1` for
Throughput Optimized HDD, `sc1` for Cold HDD, or `standard` for
Magnetic volumes.
@option options [Array<String>] :volume_ids
The volume IDs.
@option options [Boolean] :dry_run
Checks whether you have the required permissions for the action,
without actually making the request, and provides an error response.
If you have the required permissions, the error response is
`DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
@return [Volume::Collection] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb#L2796-L2812 | train | Returns a collection of all the volumes in the cluster. | [
30522,
13366,
6702,
1006,
7047,
1027,
1063,
1065,
1007,
14108,
2229,
1027,
4372,
17897,
16259,
1012,
2047,
2079,
1064,
1061,
1064,
24501,
2361,
1027,
1030,
7396,
1012,
6235,
1035,
6702,
1006,
7047,
1007,
24501,
2361,
1012,
2169,
1035,
3931,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb | Azure::KeyVault::V2016_10_01.KeyVaultClient.get_deleted_secrets_with_http_info | def get_deleted_secrets_with_http_info(vault_base_url, maxresults:nil, custom_headers:nil)
get_deleted_secrets_async(vault_base_url, maxresults:maxresults, custom_headers:custom_headers).value!
end | ruby | def get_deleted_secrets_with_http_info(vault_base_url, maxresults:nil, custom_headers:nil)
get_deleted_secrets_async(vault_base_url, maxresults:maxresults, custom_headers:custom_headers).value!
end | [
"def",
"get_deleted_secrets_with_http_info",
"(",
"vault_base_url",
",",
"maxresults",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"get_deleted_secrets_async",
"(",
"vault_base_url",
",",
"maxresults",
":",
"maxresults",
",",
"custom_headers",
":custom_headers",
... | Lists deleted secrets for the specified vault.
The Get Deleted Secrets operation returns the secrets that have been deleted
for a vault enabled for soft-delete. This operation requires the secrets/list
permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param maxresults [Integer] Maximum number of results to return in a page. If
not specified the service will return up to 25 results.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Lists",
"deleted",
"secrets",
"for",
"the",
"specified",
"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#L3405-L3407 | train | Gets the deleted secrets. | [
30522,
13366,
2131,
1035,
17159,
1035,
7800,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
4098,
6072,
11314,
2015,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_service_bus/lib/2017-04-01/generated/azure_mgmt_service_bus/disaster_recovery_configs.rb | Azure::ServiceBus::Mgmt::V2017_04_01.DisasterRecoveryConfigs.delete_with_http_info | def delete_with_http_info(resource_group_name, namespace_name, alias_parameter, custom_headers:nil)
delete_async(resource_group_name, namespace_name, alias_parameter, custom_headers:custom_headers).value!
end | ruby | def delete_with_http_info(resource_group_name, namespace_name, alias_parameter, custom_headers:nil)
delete_async(resource_group_name, namespace_name, alias_parameter, custom_headers:custom_headers).value!
end | [
"def",
"delete_with_http_info",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"alias_parameter",
",",
"custom_headers",
":",
"nil",
")",
"delete_async",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"alias_parameter",
",",
"custom_headers",
":custom_he... | Deletes an Alias(Disaster Recovery configuration)
@param resource_group_name [String] Name of the Resource group within the
Azure subscription.
@param namespace_name [String] The namespace name
@param alias_parameter [String] The Disaster Recovery configuration name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Deletes",
"an",
"Alias",
"(",
"Disaster",
"Recovery",
"configuration",
")"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_service_bus/lib/2017-04-01/generated/azure_mgmt_service_bus/disaster_recovery_configs.rb#L383-L385 | train | Deletes an alias from the namespace. | [
30522,
13366,
3972,
12870,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3415,
15327,
1035,
2171,
1010,
14593,
1035,
16381,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3972,
12870,
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... |
randym/axlsx | lib/axlsx/util/simple_typed_list.rb | Axlsx.SimpleTypedList.transpose | def transpose
return @list.clone if @list.size == 0
row_count = @list.size
max_column_count = @list.map{|row| row.cells.size}.max
result = Array.new(max_column_count) { Array.new(row_count) }
# yes, I know it is silly, but that warning is really annoying
row_count.times do |row_index|
max_column_count.times do |column_index|
datum = if @list[row_index].cells.size >= max_column_count
@list[row_index].cells[column_index]
elsif block_given?
yield(column_index, row_index)
end
result[column_index][row_index] = datum
end
end
result
end | ruby | def transpose
return @list.clone if @list.size == 0
row_count = @list.size
max_column_count = @list.map{|row| row.cells.size}.max
result = Array.new(max_column_count) { Array.new(row_count) }
# yes, I know it is silly, but that warning is really annoying
row_count.times do |row_index|
max_column_count.times do |column_index|
datum = if @list[row_index].cells.size >= max_column_count
@list[row_index].cells[column_index]
elsif block_given?
yield(column_index, row_index)
end
result[column_index][row_index] = datum
end
end
result
end | [
"def",
"transpose",
"return",
"@list",
".",
"clone",
"if",
"@list",
".",
"size",
"==",
"0",
"row_count",
"=",
"@list",
".",
"size",
"max_column_count",
"=",
"@list",
".",
"map",
"{",
"|",
"row",
"|",
"row",
".",
"cells",
".",
"size",
"}",
".",
"max",... | Transposes the list (without blowing up like ruby does)
any non populated cell in the matrix will be a nil value | [
"Transposes",
"the",
"list",
"(",
"without",
"blowing",
"up",
"like",
"ruby",
"does",
")",
"any",
"non",
"populated",
"cell",
"in",
"the",
"matrix",
"will",
"be",
"a",
"nil",
"value"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/util/simple_typed_list.rb#L40-L57 | train | transpose the matrix into a new array of arrays | [
30522,
13366,
9099,
20688,
2709,
1030,
2862,
1012,
17598,
2065,
1030,
2862,
1012,
2946,
1027,
1027,
1014,
5216,
1035,
4175,
1027,
1030,
2862,
1012,
2946,
4098,
1035,
5930,
1035,
4175,
1027,
1030,
2862,
1012,
4949,
1063,
1064,
5216,
1064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2018-04-01/generated/azure_mgmt_compute/virtual_machine_extensions.rb | Azure::Compute::Mgmt::V2018_04_01.VirtualMachineExtensions.list_with_http_info | def list_with_http_info(resource_group_name, vm_name, expand:nil, custom_headers:nil)
list_async(resource_group_name, vm_name, expand:expand, custom_headers:custom_headers).value!
end | ruby | def list_with_http_info(resource_group_name, vm_name, expand:nil, custom_headers:nil)
list_async(resource_group_name, vm_name, expand:expand, custom_headers:custom_headers).value!
end | [
"def",
"list_with_http_info",
"(",
"resource_group_name",
",",
"vm_name",
",",
"expand",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"list_async",
"(",
"resource_group_name",
",",
"vm_name",
",",
"expand",
":",
"expand",
",",
"custom_headers",
":custom_hea... | The operation to get all extensions of a Virtual Machine.
@param resource_group_name [String] The name of the resource group.
@param vm_name [String] The name of the virtual machine containing the
extension.
@param expand [String] The expand expression to apply on the operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"The",
"operation",
"to",
"get",
"all",
"extensions",
"of",
"a",
"Virtual",
"Machine",
"."
] | 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_extensions.rb#L297-L299 | train | Gets the list of virtual machines in a VM. | [
30522,
13366,
2862,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
2171,
1010,
7818,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2862,
1035,
2004,
6038,
2278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activemodel/lib/active_model/errors.rb | ActiveModel.Errors.where | def where(attribute, type = nil, **options)
attribute, type, options = normalize_arguments(attribute, type, options)
@errors.select { |error|
error.match?(attribute, type, options)
}
end | ruby | def where(attribute, type = nil, **options)
attribute, type, options = normalize_arguments(attribute, type, options)
@errors.select { |error|
error.match?(attribute, type, options)
}
end | [
"def",
"where",
"(",
"attribute",
",",
"type",
"=",
"nil",
",",
"**",
"options",
")",
"attribute",
",",
"type",
",",
"options",
"=",
"normalize_arguments",
"(",
"attribute",
",",
"type",
",",
"options",
")",
"@errors",
".",
"select",
"{",
"|",
"error",
... | Search for errors matching +attribute+, +type+ or +options+.
Only supplied params will be matched.
person.errors.where(:name) # => all name errors.
person.errors.where(:name, :too_short) # => all name errors being too short
person.errors.where(:name, :too_short, minimum: 2) # => all name errors being too short and minimum is 2 | [
"Search",
"for",
"errors",
"matching",
"+",
"attribute",
"+",
"+",
"type",
"+",
"or",
"+",
"options",
"+",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activemodel/lib/active_model/errors.rb#L170-L175 | train | Returns an array of errors that match the given attribute. | [
30522,
13366,
2073,
1006,
17961,
1010,
2828,
1027,
9152,
2140,
1010,
1008,
1008,
7047,
1007,
17961,
1010,
2828,
1010,
7047,
1027,
3671,
4697,
1035,
9918,
1006,
17961,
1010,
2828,
1010,
7047,
1007,
1030,
10697,
1012,
7276,
1063,
1064,
7561,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rubocop-hq/rubocop | lib/rubocop/options.rb | RuboCop.Options.option | def option(opts, *args)
long_opt_symbol = long_opt_symbol(args)
args += Array(OptionsHelp::TEXT[long_opt_symbol])
opts.on(*args) do |arg|
@options[long_opt_symbol] = arg
yield arg if block_given?
end
end | ruby | def option(opts, *args)
long_opt_symbol = long_opt_symbol(args)
args += Array(OptionsHelp::TEXT[long_opt_symbol])
opts.on(*args) do |arg|
@options[long_opt_symbol] = arg
yield arg if block_given?
end
end | [
"def",
"option",
"(",
"opts",
",",
"*",
"args",
")",
"long_opt_symbol",
"=",
"long_opt_symbol",
"(",
"args",
")",
"args",
"+=",
"Array",
"(",
"OptionsHelp",
"::",
"TEXT",
"[",
"long_opt_symbol",
"]",
")",
"opts",
".",
"on",
"(",
"args",
")",
"do",
"|",... | Sets a value in the @options hash, based on the given long option and its
value, in addition to calling the block if a block is given. | [
"Sets",
"a",
"value",
"in",
"the"
] | 2a4f4f0fdac4e1bb25891fc312af2ea60c6aa2f0 | https://github.com/rubocop-hq/rubocop/blob/2a4f4f0fdac4e1bb25891fc312af2ea60c6aa2f0/lib/rubocop/options.rb#L196-L203 | train | Add a new option to the options hash | [
30522,
13366,
5724,
1006,
23569,
2015,
1010,
1008,
12098,
5620,
1007,
2146,
1035,
23569,
1035,
6454,
1027,
2146,
1035,
23569,
1035,
6454,
1006,
12098,
5620,
1007,
12098,
5620,
1009,
1027,
9140,
1006,
7047,
16001,
2361,
1024,
1024,
3793,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_iot_central/lib/2017-07-01-privatepreview/generated/azure_mgmt_iot_central/apps.rb | Azure::IotCentral::Mgmt::V2017_07_01_privatepreview.Apps.create_or_update_async | def create_or_update_async(resource_group_name, resource_name, app, custom_headers:nil)
# Send request
promise = begin_create_or_update_async(resource_group_name, resource_name, app, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::IotCentral::Mgmt::V2017_07_01_privatepreview::Models::App.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | ruby | def create_or_update_async(resource_group_name, resource_name, app, custom_headers:nil)
# Send request
promise = begin_create_or_update_async(resource_group_name, resource_name, app, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::IotCentral::Mgmt::V2017_07_01_privatepreview::Models::App.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | [
"def",
"create_or_update_async",
"(",
"resource_group_name",
",",
"resource_name",
",",
"app",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"resource_name",
",",
"app",
",",
... | @param resource_group_name [String] The name of the resource group that
contains the IoT Central application.
@param resource_name [String] The ARM resource name of the IoT Central
application.
@param app [App] The IoT Central application metadata and security metadata.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"resource_group_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"resource",
"group",
"that",
"contains",
"the",
"IoT",
"Central",
"application",
".",
"@param",
"resource_name",
"[",
"String",
"]",
"The",
"ARM",
"resource",
"name",
"of",
"the",... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_iot_central/lib/2017-07-01-privatepreview/generated/azure_mgmt_iot_central/apps.rb#L155-L171 | train | Creates or updates an App. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7692,
1035,
2171,
1010,
10439,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,
4088,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/workflows.rb | Azure::Logic::Mgmt::V2016_06_01.Workflows.disable | def disable(resource_group_name, workflow_name, custom_headers:nil)
response = disable_async(resource_group_name, workflow_name, custom_headers:custom_headers).value!
nil
end | ruby | def disable(resource_group_name, workflow_name, custom_headers:nil)
response = disable_async(resource_group_name, workflow_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"disable",
"(",
"resource_group_name",
",",
"workflow_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"disable_async",
"(",
"resource_group_name",
",",
"workflow_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"nil",
"end"... | Disables a workflow.
@param resource_group_name [String] The resource group name.
@param workflow_name [String] The workflow name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Disables",
"a",
"workflow",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/workflows.rb#L612-L615 | train | Disables a workflow. | [
30522,
13366,
4487,
19150,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2147,
12314,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4487,
19150,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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.begin_import_with_http_info | def begin_import_with_http_info(resource_group_name, server_name, parameters, custom_headers:nil)
begin_import_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
end | ruby | def begin_import_with_http_info(resource_group_name, server_name, parameters, custom_headers:nil)
begin_import_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_import_with_http_info",
"(",
"resource_group_name",
",",
"server_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_import_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"parameters",
",",
"custom_headers",
":custom_header... | Imports a bacpac into a new database.
@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 parameters [ImportRequest] 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 [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Imports",
"a",
"bacpac",
"into",
"a",
"new",
"database",
"."
] | 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#L1790-L1792 | train | Import a single specification into a Service Fabric server. | [
30522,
13366,
4088,
1035,
12324,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
1035,
12324,
1035,
2004,
6038,
2278,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2019-03-01/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb | Azure::Compute::Mgmt::V2019_03_01.VirtualMachineScaleSets.begin_power_off_with_http_info | def begin_power_off_with_http_info(resource_group_name, vm_scale_set_name, vm_instance_ids:nil, skip_shutdown:false, custom_headers:nil)
begin_power_off_async(resource_group_name, vm_scale_set_name, vm_instance_ids:vm_instance_ids, skip_shutdown:skip_shutdown, custom_headers:custom_headers).value!
end | ruby | def begin_power_off_with_http_info(resource_group_name, vm_scale_set_name, vm_instance_ids:nil, skip_shutdown:false, custom_headers:nil)
begin_power_off_async(resource_group_name, vm_scale_set_name, vm_instance_ids:vm_instance_ids, skip_shutdown:skip_shutdown, custom_headers:custom_headers).value!
end | [
"def",
"begin_power_off_with_http_info",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"vm_instance_ids",
":",
"nil",
",",
"skip_shutdown",
":",
"false",
",",
"custom_headers",
":",
"nil",
")",
"begin_power_off_async",
"(",
"resource_group_name",
",",
"vm_s... | Power off (stop) one or more virtual machines in a VM scale set. Note that
resources are still attached and you are getting charged for the resources.
Instead, use deallocate to release resources and avoid charges.
@param resource_group_name [String] The name of the resource group.
@param vm_scale_set_name [String] The name of the VM scale set.
@param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] A list of
virtual machine instance IDs from the VM scale set.
@param skip_shutdown [Boolean] The parameter to request non-graceful VM
shutdown. True value for this flag indicates non-graceful shutdown whereas
false indicates otherwise. Default value for this flag is false if not
specified
@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. | [
"Power",
"off",
"(",
"stop",
")",
"one",
"or",
"more",
"virtual",
"machines",
"in",
"a",
"VM",
"scale",
"set",
".",
"Note",
"that",
"resources",
"are",
"still",
"attached",
"and",
"you",
"are",
"getting",
"charged",
"for",
"the",
"resources",
".",
"Inste... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2019-03-01/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb#L1884-L1886 | train | Power off the virtual machine in a VM scale set. | [
30522,
13366,
4088,
1035,
2373,
1035,
2125,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
4094,
1035,
2275,
1035,
2171,
1010,
1058,
2213,
1035,
6013,
1035,
8909,
2015,
1024,
9152,
2140,
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... |
Dynamoid/dynamoid | lib/dynamoid/persistence.rb | Dynamoid.Persistence.delete | def delete
options = range_key ? { range_key: Dumping.dump_field(read_attribute(range_key), self.class.attributes[range_key]) } : {}
# Add an optimistic locking check if the lock_version column exists
if self.class.attributes[:lock_version]
conditions = { if: {} }
conditions[:if][:lock_version] =
if changes[:lock_version].nil?
lock_version
else
changes[:lock_version][0]
end
options[:conditions] = conditions
end
Dynamoid.adapter.delete(self.class.table_name, hash_key, options)
rescue Dynamoid::Errors::ConditionalCheckFailedException
raise Dynamoid::Errors::StaleObjectError.new(self, 'delete')
end | ruby | def delete
options = range_key ? { range_key: Dumping.dump_field(read_attribute(range_key), self.class.attributes[range_key]) } : {}
# Add an optimistic locking check if the lock_version column exists
if self.class.attributes[:lock_version]
conditions = { if: {} }
conditions[:if][:lock_version] =
if changes[:lock_version].nil?
lock_version
else
changes[:lock_version][0]
end
options[:conditions] = conditions
end
Dynamoid.adapter.delete(self.class.table_name, hash_key, options)
rescue Dynamoid::Errors::ConditionalCheckFailedException
raise Dynamoid::Errors::StaleObjectError.new(self, 'delete')
end | [
"def",
"delete",
"options",
"=",
"range_key",
"?",
"{",
"range_key",
":",
"Dumping",
".",
"dump_field",
"(",
"read_attribute",
"(",
"range_key",
")",
",",
"self",
".",
"class",
".",
"attributes",
"[",
"range_key",
"]",
")",
"}",
":",
"{",
"}",
"# Add an ... | Delete this object from the datastore.
@since 0.2.0 | [
"Delete",
"this",
"object",
"from",
"the",
"datastore",
"."
] | 9e3d006b039e45877b003564ded65509b10b6354 | https://github.com/Dynamoid/dynamoid/blob/9e3d006b039e45877b003564ded65509b10b6354/lib/dynamoid/persistence.rb#L265-L282 | train | Delete the object from the database | [
30522,
13366,
3972,
12870,
7047,
1027,
2846,
1035,
3145,
1029,
1063,
2846,
1035,
3145,
1024,
23642,
1012,
15653,
1035,
2492,
1006,
3191,
1035,
17961,
1006,
2846,
1035,
3145,
1007,
1010,
2969,
1012,
2465,
1012,
12332,
1031,
2846,
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... |
Katello/katello | app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb | Katello.Api::Rhsm::CandlepinProxiesController.authorize_proxy_routes | def authorize_proxy_routes
deny_access unless (authenticate || authenticate_client)
route, params = Engine.routes.router.recognize(request) do |rte, parameters|
break rte, parameters if rte.name
end
# route names are defined in routes.rb (:as => :name)
case route.name
when "rhsm_proxy_consumer_deletionrecord_delete_path"
User.consumer? || Organization.deletable?
when "rhsm_proxy_owner_pools_path"
if params[:consumer]
User.consumer? && current_user.uuid == params[:consumer]
else
User.consumer? || ::User.current.can?(:view_organizations, self)
end
when "rhsm_proxy_owner_servicelevels_path"
(User.consumer? || ::User.current.can?(:view_organizations, self))
when "rhsm_proxy_consumer_accessible_content_path", "rhsm_proxy_consumer_certificates_path",
"rhsm_proxy_consumer_releases_path", "rhsm_proxy_certificate_serials_path",
"rhsm_proxy_consumer_entitlements_path", "rhsm_proxy_consumer_entitlements_post_path",
"rhsm_proxy_consumer_entitlements_delete_path", "rhsm_proxy_consumer_entitlements_pool_delete_path",
"rhsm_proxy_consumer_certificates_put_path", "rhsm_proxy_consumer_dryrun_path",
"rhsm_proxy_consumer_owners_path", "rhsm_proxy_consumer_compliance_path", "rhsm_proxy_consumer_purpose_compliance_path"
User.consumer? && current_user.uuid == params[:id]
when "rhsm_proxy_consumer_certificates_delete_path"
User.consumer? && current_user.uuid == params[:consumer_id]
when "rhsm_proxy_pools_path"
User.consumer? && current_user.uuid == params[:consumer]
when "rhsm_proxy_subscriptions_post_path"
User.consumer? && current_user.uuid == params[:consumer_uuid]
when "rhsm_proxy_consumer_content_overrides_path", "rhsm_proxy_consumer_content_overrides_put_path",
"rhsm_proxy_consumer_content_overrides_delete_path",
"rhsm_proxy_consumer_guestids_path", "rhsm_proxy_consumer_guestids_get_guestid_path",
"rhsm_proxy_consumer_guestids_put_path", "rhsm_proxy_consumer_guestids_put_guestid_path",
"rhsm_proxy_consumer_guestids_delete_guestid_path",
"rhsm_proxy_entitlements_path"
# These queries are restricted in Candlepin
User.consumer?
when "rhsm_proxy_deleted_consumers_path"
current_user.admin?
when "rhsm_proxy_jobs_get_path"
User.consumer? || current_user.admin?
else
Rails.logger.warn "Unknown proxy route #{request.method} #{request.fullpath}, access denied"
deny_access
end
end | ruby | def authorize_proxy_routes
deny_access unless (authenticate || authenticate_client)
route, params = Engine.routes.router.recognize(request) do |rte, parameters|
break rte, parameters if rte.name
end
# route names are defined in routes.rb (:as => :name)
case route.name
when "rhsm_proxy_consumer_deletionrecord_delete_path"
User.consumer? || Organization.deletable?
when "rhsm_proxy_owner_pools_path"
if params[:consumer]
User.consumer? && current_user.uuid == params[:consumer]
else
User.consumer? || ::User.current.can?(:view_organizations, self)
end
when "rhsm_proxy_owner_servicelevels_path"
(User.consumer? || ::User.current.can?(:view_organizations, self))
when "rhsm_proxy_consumer_accessible_content_path", "rhsm_proxy_consumer_certificates_path",
"rhsm_proxy_consumer_releases_path", "rhsm_proxy_certificate_serials_path",
"rhsm_proxy_consumer_entitlements_path", "rhsm_proxy_consumer_entitlements_post_path",
"rhsm_proxy_consumer_entitlements_delete_path", "rhsm_proxy_consumer_entitlements_pool_delete_path",
"rhsm_proxy_consumer_certificates_put_path", "rhsm_proxy_consumer_dryrun_path",
"rhsm_proxy_consumer_owners_path", "rhsm_proxy_consumer_compliance_path", "rhsm_proxy_consumer_purpose_compliance_path"
User.consumer? && current_user.uuid == params[:id]
when "rhsm_proxy_consumer_certificates_delete_path"
User.consumer? && current_user.uuid == params[:consumer_id]
when "rhsm_proxy_pools_path"
User.consumer? && current_user.uuid == params[:consumer]
when "rhsm_proxy_subscriptions_post_path"
User.consumer? && current_user.uuid == params[:consumer_uuid]
when "rhsm_proxy_consumer_content_overrides_path", "rhsm_proxy_consumer_content_overrides_put_path",
"rhsm_proxy_consumer_content_overrides_delete_path",
"rhsm_proxy_consumer_guestids_path", "rhsm_proxy_consumer_guestids_get_guestid_path",
"rhsm_proxy_consumer_guestids_put_path", "rhsm_proxy_consumer_guestids_put_guestid_path",
"rhsm_proxy_consumer_guestids_delete_guestid_path",
"rhsm_proxy_entitlements_path"
# These queries are restricted in Candlepin
User.consumer?
when "rhsm_proxy_deleted_consumers_path"
current_user.admin?
when "rhsm_proxy_jobs_get_path"
User.consumer? || current_user.admin?
else
Rails.logger.warn "Unknown proxy route #{request.method} #{request.fullpath}, access denied"
deny_access
end
end | [
"def",
"authorize_proxy_routes",
"deny_access",
"unless",
"(",
"authenticate",
"||",
"authenticate_client",
")",
"route",
",",
"params",
"=",
"Engine",
".",
"routes",
".",
"router",
".",
"recognize",
"(",
"request",
")",
"do",
"|",
"rte",
",",
"parameters",
"|... | rubocop:disable MethodLength
rubocop:disable Metrics/CyclomaticComplexity | [
"rubocop",
":",
"disable",
"MethodLength",
"rubocop",
":",
"disable",
"Metrics",
"/",
"CyclomaticComplexity"
] | a1c9280067607999cae43bab89b53ba870856b76 | https://github.com/Katello/katello/blob/a1c9280067607999cae43bab89b53ba870856b76/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb#L465-L513 | train | authorize_proxy_routes
| [
30522,
13366,
3166,
4697,
1035,
24540,
1035,
5847,
9772,
1035,
3229,
4983,
1006,
14469,
3686,
1064,
1064,
14469,
3686,
1035,
7396,
1007,
2799,
1010,
11498,
5244,
1027,
3194,
1012,
5847,
1012,
2799,
2099,
1012,
6807,
1006,
5227,
1007,
2079,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/psych | lib/psych/tree_builder.rb | Psych.TreeBuilder.end_document | def end_document implicit_end = !streaming?
@last.implicit_end = implicit_end
n = pop
set_end_location(n)
n
end | ruby | def end_document implicit_end = !streaming?
@last.implicit_end = implicit_end
n = pop
set_end_location(n)
n
end | [
"def",
"end_document",
"implicit_end",
"=",
"!",
"streaming?",
"@last",
".",
"implicit_end",
"=",
"implicit_end",
"n",
"=",
"pop",
"set_end_location",
"(",
"n",
")",
"n",
"end"
] | Handles end_document events with +version+, +tag_directives+,
and +implicit+ styling.
See Psych::Handler#start_document | [
"Handles",
"end_document",
"events",
"with",
"+",
"version",
"+",
"+",
"tag_directives",
"+",
"and",
"+",
"implicit",
"+",
"styling",
"."
] | f3a37e6bc1c2a98bfc9fafc389ea05622c744af9 | https://github.com/ruby/psych/blob/f3a37e6bc1c2a98bfc9fafc389ea05622c744af9/lib/psych/tree_builder.rb#L77-L82 | train | End a document. | [
30522,
13366,
2203,
1035,
6254,
24655,
1035,
2203,
1027,
999,
11058,
1029,
1030,
2197,
1012,
24655,
1035,
2203,
1027,
24655,
1035,
2203,
1050,
1027,
3769,
2275,
1035,
2203,
1035,
3295,
1006,
1050,
1007,
1050,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_signalr/lib/2018-03-01-preview/generated/azure_mgmt_signalr/signal_r.rb | Azure::Signalr::Mgmt::V2018_03_01_preview.SignalR.begin_regenerate_key | def begin_regenerate_key(resource_group_name, resource_name, parameters:nil, custom_headers:nil)
response = begin_regenerate_key_async(resource_group_name, resource_name, parameters:parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_regenerate_key(resource_group_name, resource_name, parameters:nil, custom_headers:nil)
response = begin_regenerate_key_async(resource_group_name, resource_name, parameters:parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_regenerate_key",
"(",
"resource_group_name",
",",
"resource_name",
",",
"parameters",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_regenerate_key_async",
"(",
"resource_group_name",
",",
"resource_name",
",",
"parameters",
... | Regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot be
regenerated at the same time.
@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 resource_name [String] The name of the SignalR resource.
@param parameters [RegenerateKeyParameters] Parameter that describes the
Regenerate Key Operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [SignalRKeys] operation results. | [
"Regenerate",
"SignalR",
"service",
"access",
"key",
".",
"PrimaryKey",
"and",
"SecondaryKey",
"cannot",
"be",
"regenerated",
"at",
"the",
"same",
"time",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_signalr/lib/2018-03-01-preview/generated/azure_mgmt_signalr/signal_r.rb#L707-L710 | train | Regenerate a key for a managed database. | [
30522,
13366,
4088,
1035,
19723,
24454,
3686,
1035,
3145,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7692,
1035,
2171,
1010,
11709,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
19723,
24454... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/row.rb | Axlsx.Row.array_to_cells | def array_to_cells(values, options={})
DataTypeValidator.validate :array_to_cells, Array, values
types, style, formula_values = options.delete(:types), options.delete(:style), options.delete(:formula_values)
values.each_with_index do |value, index|
options[:style] = style.is_a?(Array) ? style[index] : style if style
options[:type] = types.is_a?(Array) ? types[index] : types if types
options[:formula_value] = formula_values[index] if formula_values.is_a?(Array)
self[index] = Cell.new(self, value, options)
end
end | ruby | def array_to_cells(values, options={})
DataTypeValidator.validate :array_to_cells, Array, values
types, style, formula_values = options.delete(:types), options.delete(:style), options.delete(:formula_values)
values.each_with_index do |value, index|
options[:style] = style.is_a?(Array) ? style[index] : style if style
options[:type] = types.is_a?(Array) ? types[index] : types if types
options[:formula_value] = formula_values[index] if formula_values.is_a?(Array)
self[index] = Cell.new(self, value, options)
end
end | [
"def",
"array_to_cells",
"(",
"values",
",",
"options",
"=",
"{",
"}",
")",
"DataTypeValidator",
".",
"validate",
":array_to_cells",
",",
"Array",
",",
"values",
"types",
",",
"style",
",",
"formula_values",
"=",
"options",
".",
"delete",
"(",
":types",
")",... | Converts values, types, and style options into cells and associates them with this row.
A new cell is created for each item in the values array.
If value option is defined and is a symbol it is applied to all the cells created.
If the value option is an array, cell types are applied by index for each cell
If the style option is defined and is an Integer, it is applied to all cells created.
If the style option is an array, style is applied by index for each cell.
@option options [Array] values
@option options [Array, Symbol] types
@option options [Array, Integer] style | [
"Converts",
"values",
"types",
"and",
"style",
"options",
"into",
"cells",
"and",
"associates",
"them",
"with",
"this",
"row",
".",
"A",
"new",
"cell",
"is",
"created",
"for",
"each",
"item",
"in",
"the",
"values",
"array",
".",
"If",
"value",
"option",
... | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/worksheet/row.rb#L148-L158 | train | Convert an array of values to cells | [
30522,
13366,
9140,
1035,
2000,
1035,
4442,
1006,
5300,
1010,
7047,
1027,
1063,
1065,
1007,
2951,
13874,
10175,
8524,
4263,
1012,
9398,
3686,
30524,
1012,
3972,
12870,
1006,
1024,
2806,
1007,
1010,
7047,
1012,
3972,
12870,
1006,
1024,
5675,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/scaling_policy.rb | Aws::AutoScaling.ScalingPolicy.execute | def execute(options = {})
options = options.merge(policy_name: @name)
resp = @client.execute_policy(options)
resp.data
end | ruby | def execute(options = {})
options = options.merge(policy_name: @name)
resp = @client.execute_policy(options)
resp.data
end | [
"def",
"execute",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"policy_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"execute_policy",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
scaling_policy.execute({
auto_scaling_group_name: "ResourceName",
honor_cooldown: false,
metric_value: 1.0,
breach_threshold: 1.0,
})
@param [Hash] options ({})
@option options [String] :auto_scaling_group_name
The name of the Auto Scaling group.
@option options [Boolean] :honor_cooldown
Indicates whether Amazon EC2 Auto Scaling waits for the cooldown
period to complete before executing the policy.
This parameter is not supported if the policy type is `StepScaling`.
For more information, see [Scaling Cooldowns][1] in the *Amazon EC2
Auto Scaling User Guide*.
[1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/Cooldown.html
@option options [Float] :metric_value
The metric value to compare to `BreachThreshold`. This enables you to
execute a policy of type `StepScaling` and determine which step
adjustment to use. For example, if the breach threshold is 50 and you
want to use a step adjustment with a lower bound of 0 and an upper
bound of 10, you can set the metric value to 59.
If you specify a metric value that doesn't correspond to a step
adjustment for the policy, the call returns an error.
Conditional: This parameter is required if the policy type is
`StepScaling` and not supported otherwise.
@option options [Float] :breach_threshold
The breach threshold for the alarm.
Conditional: This parameter is required if the policy type is
`StepScaling` and not supported otherwise.
@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/scaling_policy.rb#L313-L317 | train | Execute the policy | [
30522,
13366,
15389,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
3343,
1035,
2171,
1024,
1030,
2171,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
15389,
1035,
3343,
1006,
7047,
1007,
24501,
2361,
1012,
2951,
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... |
decidim/decidim | decidim-core/app/jobs/decidim/email_notification_generator_job.rb | Decidim.EmailNotificationGeneratorJob.perform | def perform(event, event_class_name, resource, followers, affected_users, extra)
return if event_class_name.nil?
event_class = event_class_name.constantize
EmailNotificationGenerator.new(event, event_class, resource, followers, affected_users, extra).generate
end | ruby | def perform(event, event_class_name, resource, followers, affected_users, extra)
return if event_class_name.nil?
event_class = event_class_name.constantize
EmailNotificationGenerator.new(event, event_class, resource, followers, affected_users, extra).generate
end | [
"def",
"perform",
"(",
"event",
",",
"event_class_name",
",",
"resource",
",",
"followers",
",",
"affected_users",
",",
"extra",
")",
"return",
"if",
"event_class_name",
".",
"nil?",
"event_class",
"=",
"event_class_name",
".",
"constantize",
"EmailNotificationGener... | rubocop:disable Metrics/ParameterLists | [
"rubocop",
":",
"disable",
"Metrics",
"/",
"ParameterLists"
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/app/jobs/decidim/email_notification_generator_job.rb#L8-L13 | train | Perform an email notification | [
30522,
13366,
4685,
1006,
2724,
1010,
2724,
1035,
2465,
1035,
2171,
1010,
7692,
1010,
8771,
1010,
5360,
1035,
5198,
1010,
4469,
1007,
2709,
2065,
2724,
1035,
2465,
1035,
2171,
1012,
9152,
2140,
1029,
2724,
1035,
2465,
1027,
2724,
1035,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/api/v1_transactions_api.rb | SquareConnect.V1TransactionsApi.list_settlements | def list_settlements(location_id, opts = {})
data, _status_code, _headers = list_settlements_with_http_info(location_id, opts)
return data
end | ruby | def list_settlements(location_id, opts = {})
data, _status_code, _headers = list_settlements_with_http_info(location_id, opts)
return data
end | [
"def",
"list_settlements",
"(",
"location_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"list_settlements_with_http_info",
"(",
"location_id",
",",
"opts",
")",
"return",
"data",
"end"
] | ListSettlements
Provides summary information for all deposits and withdrawals initiated by Square to a linked bank account during a date range. Date ranges cannot exceed one year in length. *Note**: the ListSettlements endpoint does not provide entry information.
@param location_id The ID of the location to list settlements for. If you specify me, this endpoint returns payments aggregated from all of the business's locations.
@param [Hash] opts the optional parameters
@option opts [String] :order TThe order in which payments are listed in the response.
@option opts [String] :begin_time The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year.
@option opts [String] :end_time The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time.
@option opts [Integer] :limit The maximum number of payments to return in a single response. This value cannot exceed 200.
@option opts [String] :status Provide this parameter to retrieve only settlements with a particular status (SENT or FAILED).
@option opts [String] :batch_token A pagination cursor to retrieve the next set of results for your original query to the endpoint.
@return [Array<V1Settlement>] | [
"ListSettlements",
"Provides",
"summary",
"information",
"for",
"all",
"deposits",
"and",
"withdrawals",
"initiated",
"by",
"Square",
"to",
"a",
"linked",
"bank",
"account",
"during",
"a",
"date",
"range",
".",
"Date",
"ranges",
"cannot",
"exceed",
"one",
"year"... | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/v1_transactions_api.rb#L361-L364 | train | Returns a list of settlements for a location | [
30522,
13366,
2862,
1035,
7617,
1006,
3295,
1035,
8909,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
2862,
1035,
7617,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
3295,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/models/v1_update_order_request.rb | SquareConnect.V1UpdateOrderRequest.action= | def action=(action)
validator = EnumAttributeValidator.new('String', ["COMPLETE", "CANCEL", "REFUND"])
unless validator.valid?(action)
fail ArgumentError, "invalid value for 'action', must be one of #{validator.allowable_values}."
end
@action = action
end | ruby | def action=(action)
validator = EnumAttributeValidator.new('String', ["COMPLETE", "CANCEL", "REFUND"])
unless validator.valid?(action)
fail ArgumentError, "invalid value for 'action', must be one of #{validator.allowable_values}."
end
@action = action
end | [
"def",
"action",
"=",
"(",
"action",
")",
"validator",
"=",
"EnumAttributeValidator",
".",
"new",
"(",
"'String'",
",",
"[",
"\"COMPLETE\"",
",",
"\"CANCEL\"",
",",
"\"REFUND\"",
"]",
")",
"unless",
"validator",
".",
"valid?",
"(",
"action",
")",
"fail",
"... | Custom attribute writer method checking allowed values (enum).
@param [Object] action Object to be assigned | [
"Custom",
"attribute",
"writer",
"method",
"checking",
"allowed",
"values",
"(",
"enum",
")",
"."
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/models/v1_update_order_request.rb#L126-L132 | train | Set the action of the task. | [
30522,
13366,
2895,
1027,
1006,
2895,
1007,
9398,
8844,
1027,
4372,
12248,
4779,
3089,
8569,
2618,
10175,
8524,
4263,
1012,
2047,
1006,
1005,
5164,
1005,
1010,
1031,
1000,
3143,
1000,
1010,
1000,
17542,
1000,
1010,
1000,
25416,
8630,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_recovery_services_site_recovery/lib/2018-01-10/generated/azure_mgmt_recovery_services_site_recovery/replication_protection_containers.rb | Azure::RecoveryServicesSiteRecovery::Mgmt::V2018_01_10.ReplicationProtectionContainers.begin_switch_protection_with_http_info | def begin_switch_protection_with_http_info(fabric_name, protection_container_name, switch_input, custom_headers:nil)
begin_switch_protection_async(fabric_name, protection_container_name, switch_input, custom_headers:custom_headers).value!
end | ruby | def begin_switch_protection_with_http_info(fabric_name, protection_container_name, switch_input, custom_headers:nil)
begin_switch_protection_async(fabric_name, protection_container_name, switch_input, custom_headers:custom_headers).value!
end | [
"def",
"begin_switch_protection_with_http_info",
"(",
"fabric_name",
",",
"protection_container_name",
",",
"switch_input",
",",
"custom_headers",
":",
"nil",
")",
"begin_switch_protection_async",
"(",
"fabric_name",
",",
"protection_container_name",
",",
"switch_input",
",",... | Switches protection from one container to another or one replication provider
to another.
Operation to switch protection from one container to another or one
replication provider to another.
@param fabric_name [String] Unique fabric name.
@param protection_container_name [String] Protection container name.
@param switch_input [SwitchProtectionInput] Switch protection input.
@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. | [
"Switches",
"protection",
"from",
"one",
"container",
"to",
"another",
"or",
"one",
"replication",
"provider",
"to",
"another",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_recovery_services_site_recovery/lib/2018-01-10/generated/azure_mgmt_recovery_services_site_recovery/replication_protection_containers.rb#L862-L864 | train | Creates a protection container for the switch. | [
30522,
13366,
4088,
1035,
6942,
1035,
3860,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
8313,
1035,
2171,
1010,
3860,
1035,
11661,
1035,
2171,
1010,
6942,
1035,
7953,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
1035,
6942,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
activeadmin/activeadmin | lib/active_admin/resource_dsl.rb | ActiveAdmin.ResourceDSL.permit_params | def permit_params(*args, &block)
param_key = config.param_key.to_sym
belongs_to_param = config.belongs_to_param
create_another_param = :create_another if config.create_another
controller do
define_method :permitted_params do
permitted_params =
active_admin_namespace.permitted_params +
Array.wrap(belongs_to_param) +
Array.wrap(create_another_param)
params.permit(*permitted_params, param_key => block ? instance_exec(&block) : args)
end
private :permitted_params
end
end | ruby | def permit_params(*args, &block)
param_key = config.param_key.to_sym
belongs_to_param = config.belongs_to_param
create_another_param = :create_another if config.create_another
controller do
define_method :permitted_params do
permitted_params =
active_admin_namespace.permitted_params +
Array.wrap(belongs_to_param) +
Array.wrap(create_another_param)
params.permit(*permitted_params, param_key => block ? instance_exec(&block) : args)
end
private :permitted_params
end
end | [
"def",
"permit_params",
"(",
"*",
"args",
",",
"&",
"block",
")",
"param_key",
"=",
"config",
".",
"param_key",
".",
"to_sym",
"belongs_to_param",
"=",
"config",
".",
"belongs_to_param",
"create_another_param",
"=",
":create_another",
"if",
"config",
".",
"creat... | Keys included in the `permitted_params` setting are automatically whitelisted.
Either
permit_params :title, :author, :body, tags: []
Or
permit_params do
defaults = [:title, :body]
if current_user.admin?
defaults + [:author]
else
defaults
end
end | [
"Keys",
"included",
"in",
"the",
"permitted_params",
"setting",
"are",
"automatically",
"whitelisted",
"."
] | 0759c8dcf97865748c9344459162ac3c7e65a6cd | https://github.com/activeadmin/activeadmin/blob/0759c8dcf97865748c9344459162ac3c7e65a6cd/lib/active_admin/resource_dsl.rb#L63-L80 | train | permit params | [
30522,
13366,
9146,
1035,
11498,
5244,
1006,
1008,
12098,
5620,
1010,
1004,
3796,
1007,
11498,
2213,
1035,
3145,
1027,
9530,
8873,
2290,
1012,
11498,
2213,
1035,
3145,
1012,
2000,
1035,
25353,
2213,
7460,
1035,
2000,
1035,
11498,
2213,
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_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.update_regex_entity_role | def update_regex_entity_role(app_id, version_id, entity_id, role_id, entity_role_update_object, custom_headers:nil)
response = update_regex_entity_role_async(app_id, version_id, entity_id, role_id, entity_role_update_object, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def update_regex_entity_role(app_id, version_id, entity_id, role_id, entity_role_update_object, custom_headers:nil)
response = update_regex_entity_role_async(app_id, version_id, entity_id, role_id, entity_role_update_object, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"update_regex_entity_role",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"role_id",
",",
"entity_role_update_object",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"update_regex_entity_role_async",
"(",
"app_id",
",",
"version_id",
",",
... | Update a role for a given regular expression entity in a version of the
application
@param app_id The application ID.
@param version_id [String] The version ID.
@param entity_id The entity ID.
@param role_id The entity role ID.
@param entity_role_update_object [EntityRoleUpdateObject] The new entity
role.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OperationStatus] operation results. | [
"Update",
"a",
"role",
"for",
"a",
"given",
"regular",
"expression",
"entity",
"in",
"a",
"version",
"of",
"the",
"application"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L9819-L9822 | train | Updates an existing regex entity role. | [
30522,
13366,
10651,
1035,
19723,
10288,
1035,
9178,
1035,
2535,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
9178,
1035,
8909,
1010,
2535,
1035,
8909,
1010,
9178,
1035,
2535,
1035,
10651,
1035,
4874,
1010,
7661,
1035,
20346,
2015... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_storage/lib/2018-07-01/generated/azure_mgmt_storage/usages.rb | Azure::Storage::Mgmt::V2018_07_01.Usages.list_by_location | def list_by_location(location, custom_headers:nil)
response = list_by_location_async(location, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_location(location, custom_headers:nil)
response = list_by_location_async(location, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_location",
"(",
"location",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_location_async",
"(",
"location",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"response",
".",
"nil?"... | Gets the current usage count and the limit for the resources of the location
under the subscription.
@param location [String] The location of the Azure Storage resource.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [UsageListResult] operation results. | [
"Gets",
"the",
"current",
"usage",
"count",
"and",
"the",
"limit",
"for",
"the",
"resources",
"of",
"the",
"location",
"under",
"the",
"subscription",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_storage/lib/2018-07-01/generated/azure_mgmt_storage/usages.rb#L34-L37 | train | Gets the list of the elastic search terms. | [
30522,
13366,
2862,
1035,
2011,
1035,
3295,
1006,
3295,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
3295,
1035,
2004,
6038,
2278,
1006,
3295,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb | Azure::CognitiveServices::ComputerVision::V2_0.ComputerVisionClient.recognize_printed_text_in_stream | def recognize_printed_text_in_stream(detect_orientation, image, language:nil, custom_headers:nil)
response = recognize_printed_text_in_stream_async(detect_orientation, image, language:language, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def recognize_printed_text_in_stream(detect_orientation, image, language:nil, custom_headers:nil)
response = recognize_printed_text_in_stream_async(detect_orientation, image, language:language, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"recognize_printed_text_in_stream",
"(",
"detect_orientation",
",",
"image",
",",
"language",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"recognize_printed_text_in_stream_async",
"(",
"detect_orientation",
",",
"image",
",",
"language",
... | Optical Character Recognition (OCR) detects text in an image and extracts the
recognized characters into a machine-usable character stream.
Upon success, the OCR results will be returned.
Upon failure, the error code together with an error message will be returned.
The error code can be one of InvalidImageUrl, InvalidImageFormat,
InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or
InternalServerError.
@param detect_orientation [Boolean] Whether detect the text orientation in
the image. With detectOrientation=true the OCR service tries to detect the
image orientation and correct it before further processing (e.g. if it's
upside-down).
@param image An image stream.
@param language [OcrLanguages] The BCP-47 language code of the text to be
detected in the image. The default value is 'unk'. Possible values include:
'unk', 'zh-Hans', 'zh-Hant', 'cs', 'da', 'nl', 'en', 'fi', 'fr', 'de', 'el',
'hu', 'it', 'ja', 'ko', 'nb', 'pl', 'pt', 'ru', 'es', 'sv', 'tr', 'ar', 'ro',
'sr-Cyrl', 'sr-Latn', 'sk'
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OcrResult] operation results. | [
"Optical",
"Character",
"Recognition",
"(",
"OCR",
")",
"detects",
"text",
"in",
"an",
"image",
"and",
"extracts",
"the",
"recognized",
"characters",
"into",
"a",
"machine",
"-",
"usable",
"character",
"stream",
".",
"Upon",
"success",
"the",
"OCR",
"results",... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb#L2690-L2693 | train | Recognizes the printed text in a given image. | [
30522,
13366,
6807,
1035,
6267,
1035,
3793,
30524,
6038,
2278,
1006,
11487,
1035,
10296,
1010,
3746,
1010,
2653,
1024,
2653,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
20346,
2015,
1007,
1012,
3643,
999,
3433,
1012,
2303,
4983,
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... |
meew0/discordrb | lib/discordrb/data/member.rb | Discordrb.Member.set_roles | def set_roles(role, reason = nil)
role_ids = role_id_array(role)
API::Server.update_member(@bot.token, @server.id, @user.id, roles: role_ids, reason: reason)
end | ruby | def set_roles(role, reason = nil)
role_ids = role_id_array(role)
API::Server.update_member(@bot.token, @server.id, @user.id, roles: role_ids, reason: reason)
end | [
"def",
"set_roles",
"(",
"role",
",",
"reason",
"=",
"nil",
")",
"role_ids",
"=",
"role_id_array",
"(",
"role",
")",
"API",
"::",
"Server",
".",
"update_member",
"(",
"@bot",
".",
"token",
",",
"@server",
".",
"id",
",",
"@user",
".",
"id",
",",
"rol... | Bulk sets a member's roles.
@param role [Role, Array<Role>] The role(s) to set.
@param reason [String] The reason the user's roles are being changed. | [
"Bulk",
"sets",
"a",
"member",
"s",
"roles",
"."
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/data/member.rb#L94-L97 | train | Set the roles of the user | [
30522,
13366,
2275,
1035,
4395,
1006,
2535,
1010,
3114,
1027,
9152,
2140,
1007,
2535,
1035,
8909,
2015,
1027,
2535,
1035,
8909,
1035,
9140,
1006,
2535,
1007,
17928,
1024,
1024,
8241,
1012,
10651,
1035,
2266,
1006,
1030,
28516,
1012,
19204,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/job_operations.rb | Azure::Automation::Mgmt::V2015_10_31.JobOperations.get_output_with_http_info | def get_output_with_http_info(resource_group_name, automation_account_name, job_id, custom_headers:nil)
get_output_async(resource_group_name, automation_account_name, job_id, custom_headers:custom_headers).value!
end | ruby | def get_output_with_http_info(resource_group_name, automation_account_name, job_id, custom_headers:nil)
get_output_async(resource_group_name, automation_account_name, job_id, custom_headers:custom_headers).value!
end | [
"def",
"get_output_with_http_info",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"job_id",
",",
"custom_headers",
":",
"nil",
")",
"get_output_async",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"job_id",
",",
"custom_headers",
":c... | Retrieve the job output identified by job id.
@param resource_group_name [String] Name of an Azure Resource group.
@param automation_account_name [String] The name of the automation account.
@param job_id [String] The job id.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Retrieve",
"the",
"job",
"output",
"identified",
"by",
"job",
"id",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/job_operations.rb#L51-L53 | train | Gets the output of the job. | [
30522,
13366,
2131,
1035,
6434,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
19309,
1035,
4070,
1035,
2171,
1010,
3105,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
6434,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.import_async | def import_async(resource_group_name, server_name, parameters, custom_headers:nil)
# Send request
promise = begin_import_async(resource_group_name, server_name, parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::SQL::Mgmt::V2014_04_01::Models::ImportExportResponse.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | ruby | def import_async(resource_group_name, server_name, parameters, custom_headers:nil)
# Send request
promise = begin_import_async(resource_group_name, server_name, parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::SQL::Mgmt::V2014_04_01::Models::ImportExportResponse.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | [
"def",
"import_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_import_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"parameters",
",",
"custom_he... | @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 parameters [ImportRequest] 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 [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"resource_group_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"resource",
"group",
"that",
"contains",
"the",
"resource",
".",
"You",
"can",
"obtain",
"this",
"value",
"from",
"the",
"Azure",
"Resource",
"Manager",
"API",
"or",
"the",
"por... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/databases.rb#L996-L1012 | train | Import a server into a new database. | [
30522,
13366,
12324,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,
4088,
1035,
12324,
1035,
2004,
6038,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-10-01/generated/azure_mgmt_network/connection_monitors.rb | Azure::Network::Mgmt::V2018_10_01.ConnectionMonitors.begin_start | def begin_start(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
response = begin_start_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers).value!
nil
end | ruby | def begin_start(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
response = begin_start_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_start",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"connection_monitor_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_start_async",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"connection_monitor_nam... | Starts the specified connection monitor.
@param resource_group_name [String] The name of the resource group containing
Network Watcher.
@param network_watcher_name [String] The name of the Network Watcher
resource.
@param connection_monitor_name [String] The name of the connection monitor.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Starts",
"the",
"specified",
"connection",
"monitor",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-10-01/generated/azure_mgmt_network/connection_monitors.rb#L778-L781 | train | Starts a connection monitor. | [
30522,
13366,
4088,
1035,
2707,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2897,
1035,
3422,
2121,
1035,
2171,
1010,
4434,
1035,
8080,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
2707,
1035,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_recovery_services_site_recovery/lib/2016-08-10/generated/azure_mgmt_recovery_services_site_recovery/replication_storage_classification_mappings.rb | Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10.ReplicationStorageClassificationMappings.list_by_replication_storage_classifications_next | def list_by_replication_storage_classifications_next(next_page_link, custom_headers:nil)
response = list_by_replication_storage_classifications_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_replication_storage_classifications_next(next_page_link, custom_headers:nil)
response = list_by_replication_storage_classifications_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_replication_storage_classifications_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_replication_storage_classifications_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value... | Gets the list of storage classification mappings objects under a storage.
Lists the storage classification mappings for the fabric.
@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 [StorageClassificationMappingCollection] operation results. | [
"Gets",
"the",
"list",
"of",
"storage",
"classification",
"mappings",
"objects",
"under",
"a",
"storage",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_recovery_services_site_recovery/lib/2016-08-10/generated/azure_mgmt_recovery_services_site_recovery/replication_storage_classification_mappings.rb#L643-L646 | train | Gets the list of all the elastic storage classifications in a service resource group. | [
30522,
13366,
2862,
1035,
2011,
1035,
21647,
1035,
5527,
1035,
26739,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
21647,
1035,
5527,
1035,
26739,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
samvera/hyrax | app/helpers/hyrax/hyrax_helper_behavior.rb | Hyrax.HyraxHelperBehavior.link_to_each_facet_field | def link_to_each_facet_field(options)
config = options.fetch(:config)
separator = config.fetch(:separator, ' > ')
output_separator = config.fetch(:output_separator, separator)
facet_search = config.fetch(:helper_facet)
facet_fields = Array.wrap(options.fetch(:value)).first.split(separator).map(&:strip)
facet_links = facet_fields.map do |type|
link_to(type, main_app.search_catalog_path(f: { facet_search => [type] }))
end
safe_join(facet_links, output_separator)
end | ruby | def link_to_each_facet_field(options)
config = options.fetch(:config)
separator = config.fetch(:separator, ' > ')
output_separator = config.fetch(:output_separator, separator)
facet_search = config.fetch(:helper_facet)
facet_fields = Array.wrap(options.fetch(:value)).first.split(separator).map(&:strip)
facet_links = facet_fields.map do |type|
link_to(type, main_app.search_catalog_path(f: { facet_search => [type] }))
end
safe_join(facet_links, output_separator)
end | [
"def",
"link_to_each_facet_field",
"(",
"options",
")",
"config",
"=",
"options",
".",
"fetch",
"(",
":config",
")",
"separator",
"=",
"config",
".",
"fetch",
"(",
":separator",
",",
"' > '",
")",
"output_separator",
"=",
"config",
".",
"fetch",
"(",
":outpu... | A Blacklight helper_method
@example
link_to_each_facet_field({ value: "Imaging > Object Photography", config: { helper_facet: :document_types_sim }})
```html
<a href=\"/catalog?f%5Bdocument_types_sim%5D%5B%5D=Imaging\">Imaging</a> > <a href=\"/catalog?f%5Bdocument_types_sim%5D%5B%5D=Object+Photography\">Object Photography</a>
```
@param options [Hash] from blacklight invocation of helper_method
@option options [Array<#strip>] :value
@option options [Hash>] :config Example: { separator: '>', helper_facet: :document_types_sim, output_separator: '::' }
@return the html_safe facet links separated by the given separator (default: ' > ') to indicate facet hierarchy
@raise KeyError when the options are note properly configured | [
"A",
"Blacklight",
"helper_method"
] | e2b4f56e829a53b1f11296324736e9d5b8c9ee5f | https://github.com/samvera/hyrax/blob/e2b4f56e829a53b1f11296324736e9d5b8c9ee5f/app/helpers/hyrax/hyrax_helper_behavior.rb#L148-L159 | train | Link to each facet field | [
30522,
13366,
4957,
1035,
2000,
1035,
2169,
1035,
2227,
2102,
1035,
2492,
1006,
7047,
1007,
9530,
8873,
2290,
1027,
7047,
1012,
18584,
1006,
1024,
9530,
8873,
2290,
1007,
19802,
25879,
2953,
1027,
9530,
8873,
2290,
1012,
18584,
1006,
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_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/global_users.rb | Azure::Labservices::Mgmt::V2018_10_15.GlobalUsers.stop_environment | def stop_environment(user_name, environment_operations_payload, custom_headers:nil)
response = stop_environment_async(user_name, environment_operations_payload, custom_headers:custom_headers).value!
nil
end | ruby | def stop_environment(user_name, environment_operations_payload, custom_headers:nil)
response = stop_environment_async(user_name, environment_operations_payload, custom_headers:custom_headers).value!
nil
end | [
"def",
"stop_environment",
"(",
"user_name",
",",
"environment_operations_payload",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"stop_environment_async",
"(",
"user_name",
",",
"environment_operations_payload",
",",
"custom_headers",
":custom_headers",
")",
"... | Stops an environment by stopping all resources inside the environment This
operation can take a while to complete
@param user_name [String] The name of the user.
@param environment_operations_payload [EnvironmentOperationsPayload]
Represents payload for any Environment operations like get, start, stop,
connect
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Stops",
"an",
"environment",
"by",
"stopping",
"all",
"resources",
"inside",
"the",
"environment",
"This",
"operation",
"can",
"take",
"a",
"while",
"to",
"complete"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/global_users.rb#L813-L816 | train | Stops the specified user s environment. | [
30522,
13366,
2644,
1035,
4044,
1006,
5310,
1035,
2171,
1010,
4044,
1035,
3136,
1035,
18093,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2644,
1035,
4044,
1035,
2004,
6038,
2278,
1006,
5310,
1035,
2171,
1010,
4044,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ruby/rake | lib/rake/task.rb | Rake.Task.invoke_prerequisites | def invoke_prerequisites(task_args, invocation_chain) # :nodoc:
if application.options.always_multitask
invoke_prerequisites_concurrently(task_args, invocation_chain)
else
prerequisite_tasks.each { |p|
prereq_args = task_args.new_scope(p.arg_names)
p.invoke_with_call_chain(prereq_args, invocation_chain)
}
end
end | ruby | def invoke_prerequisites(task_args, invocation_chain) # :nodoc:
if application.options.always_multitask
invoke_prerequisites_concurrently(task_args, invocation_chain)
else
prerequisite_tasks.each { |p|
prereq_args = task_args.new_scope(p.arg_names)
p.invoke_with_call_chain(prereq_args, invocation_chain)
}
end
end | [
"def",
"invoke_prerequisites",
"(",
"task_args",
",",
"invocation_chain",
")",
"# :nodoc:",
"if",
"application",
".",
"options",
".",
"always_multitask",
"invoke_prerequisites_concurrently",
"(",
"task_args",
",",
"invocation_chain",
")",
"else",
"prerequisite_tasks",
"."... | Invoke all the prerequisites of a task. | [
"Invoke",
"all",
"the",
"prerequisites",
"of",
"a",
"task",
"."
] | 1c22b490ee6cb8bd614fa8d0d6145f671466206b | https://github.com/ruby/rake/blob/1c22b490ee6cb8bd614fa8d0d6145f671466206b/lib/rake/task.rb#L232-L241 | train | Invoke prerequisites for the current task | [
30522,
13366,
1999,
6767,
3489,
1035,
3653,
2890,
24871,
2015,
1006,
4708,
1035,
12098,
5620,
1010,
1999,
19152,
1035,
4677,
1007,
1001,
1024,
7293,
10085,
1024,
2065,
4646,
1012,
7047,
1012,
2467,
1035,
4800,
10230,
2243,
1999,
6767,
3489,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machines.rb | Azure::Compute::Mgmt::V2016_04_30_preview.VirtualMachines.deallocate | def deallocate(resource_group_name, vm_name, custom_headers:nil)
response = deallocate_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def deallocate(resource_group_name, vm_name, custom_headers:nil)
response = deallocate_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"deallocate",
"(",
"resource_group_name",
",",
"vm_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"deallocate_async",
"(",
"resource_group_name",
",",
"vm_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
... | Shuts down the virtual machine and releases the compute resources. You are
not billed for the compute resources that this virtual machine uses.
@param resource_group_name [String] The name of the resource group.
@param vm_name [String] The name of the virtual machine.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OperationStatusResponse] operation results. | [
"Shuts",
"down",
"the",
"virtual",
"machine",
"and",
"releases",
"the",
"compute",
"resources",
".",
"You",
"are",
"not",
"billed",
"for",
"the",
"compute",
"resources",
"that",
"this",
"virtual",
"machine",
"uses",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machines.rb#L412-L415 | train | Deallocate a virtual machine. | [
30522,
13366,
3066,
4135,
16280,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3066,
4135,
16280,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
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... |
mongodb/mongo-ruby-driver | lib/mongo/collection.rb | Mongo.Collection.drop | def drop(opts = {})
client.send(:with_session, opts) do |session|
Operation::Drop.new({
selector: { :drop => name },
db_name: database.name,
write_concern: write_concern,
session: session
}).execute(next_primary)
end
rescue Error::OperationFailure => ex
raise ex unless ex.message =~ /ns not found/
false
end | ruby | def drop(opts = {})
client.send(:with_session, opts) do |session|
Operation::Drop.new({
selector: { :drop => name },
db_name: database.name,
write_concern: write_concern,
session: session
}).execute(next_primary)
end
rescue Error::OperationFailure => ex
raise ex unless ex.message =~ /ns not found/
false
end | [
"def",
"drop",
"(",
"opts",
"=",
"{",
"}",
")",
"client",
".",
"send",
"(",
":with_session",
",",
"opts",
")",
"do",
"|",
"session",
"|",
"Operation",
"::",
"Drop",
".",
"new",
"(",
"{",
"selector",
":",
"{",
":drop",
"=>",
"name",
"}",
",",
"db_... | Drop the collection. Will also drop all indexes associated with the
collection.
@note An error returned if the collection doesn't exist is suppressed.
@example Drop the collection.
collection.drop
@param [ Hash ] opts The options for the drop operation.
@option options [ Session ] :session The session to use for the operation.
@return [ Result ] The result of the command.
@since 2.0.0 | [
"Drop",
"the",
"collection",
".",
"Will",
"also",
"drop",
"all",
"indexes",
"associated",
"with",
"the",
"collection",
"."
] | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/collection.rb#L216-L228 | train | Drop the database from the database. | [
30522,
13366,
4530,
1006,
23569,
2015,
1027,
1063,
1065,
1007,
7396,
1012,
4604,
1006,
1024,
2007,
1035,
5219,
1010,
23569,
2015,
1007,
2079,
1064,
5219,
1064,
3169,
1024,
1024,
4530,
1012,
2047,
1006,
1063,
27000,
1024,
1063,
1024,
4530,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/http_utils.rb | Sprockets.HTTPUtils.match_mime_type? | def match_mime_type?(value, matcher)
v1, v2 = value.split('/'.freeze, 2)
m1, m2 = matcher.split('/'.freeze, 2)
(m1 == '*'.freeze || v1 == m1) && (m2.nil? || m2 == '*'.freeze || m2 == v2)
end | ruby | def match_mime_type?(value, matcher)
v1, v2 = value.split('/'.freeze, 2)
m1, m2 = matcher.split('/'.freeze, 2)
(m1 == '*'.freeze || v1 == m1) && (m2.nil? || m2 == '*'.freeze || m2 == v2)
end | [
"def",
"match_mime_type?",
"(",
"value",
",",
"matcher",
")",
"v1",
",",
"v2",
"=",
"value",
".",
"split",
"(",
"'/'",
".",
"freeze",
",",
"2",
")",
"m1",
",",
"m2",
"=",
"matcher",
".",
"split",
"(",
"'/'",
".",
"freeze",
",",
"2",
")",
"(",
"... | Public: Test mime type against mime range.
match_mime_type?('text/html', 'text/*') => true
match_mime_type?('text/plain', '*') => true
match_mime_type?('text/html', 'application/json') => false
Returns true if the given value is a mime match for the given mime match
specification, false otherwise. | [
"Public",
":",
"Test",
"mime",
"type",
"against",
"mime",
"range",
"."
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/http_utils.rb#L16-L20 | train | Returns true if the value matches the matcher | [
30522,
13366,
2674,
1035,
2771,
4168,
1035,
2828,
1029,
1006,
3643,
1010,
2674,
2121,
1007,
1058,
2487,
1010,
1058,
2475,
1027,
3643,
1012,
3975,
1006,
1005,
1013,
1005,
1012,
13184,
1010,
1016,
1007,
23290,
1010,
25525,
1027,
2674,
2121,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SamSaffron/message_bus | lib/message_bus/http_client.rb | MessageBus.HTTPClient.start | def start
@mutex.synchronize do
return if started?
@status = STARTED
thread = Thread.new do
begin
while started?
unless @channels.empty?
poll
@stats.success += 1
@stats.failed = 0
end
sleep interval
end
rescue StandardError => e
@stats.failed += 1
warn("#{e.class} #{e.message}: #{e.backtrace.join("\n")}")
sleep interval
retry
ensure
stop
end
end
thread.abort_on_exception = true
end
self
end | ruby | def start
@mutex.synchronize do
return if started?
@status = STARTED
thread = Thread.new do
begin
while started?
unless @channels.empty?
poll
@stats.success += 1
@stats.failed = 0
end
sleep interval
end
rescue StandardError => e
@stats.failed += 1
warn("#{e.class} #{e.message}: #{e.backtrace.join("\n")}")
sleep interval
retry
ensure
stop
end
end
thread.abort_on_exception = true
end
self
end | [
"def",
"start",
"@mutex",
".",
"synchronize",
"do",
"return",
"if",
"started?",
"@status",
"=",
"STARTED",
"thread",
"=",
"Thread",
".",
"new",
"do",
"begin",
"while",
"started?",
"unless",
"@channels",
".",
"empty?",
"poll",
"@stats",
".",
"success",
"+=",
... | @param base_url [String] Base URL of the message_bus server to connect to
@param enable_long_polling [Boolean] Enable long polling
@param enable_chunked_encoding [Boolean] Enable chunk encoding
@param min_poll_interval [Float, Integer] Min poll interval when long polling in seconds
@param max_poll_interval [Float, Integer] Max poll interval when long polling in seconds.
When requests fail, the client will backoff and this is the upper limit.
@param background_callback_interval [Float, Integer] Interval to poll when
when polling in seconds.
@param headers [Hash] extra HTTP headers to be set on the polling requests.
@return [Object] Instance of MessageBus::HTTPClient
Starts a background thread that polls the message bus endpoint
for the given base_url.
Intervals for long polling can be configured via min_poll_interval and
max_poll_interval.
Intervals for polling can be configured via background_callback_interval.
@return [Object] Instance of MessageBus::HTTPClient | [
"@param",
"base_url",
"[",
"String",
"]",
"Base",
"URL",
"of",
"the",
"message_bus",
"server",
"to",
"connect",
"to",
"@param",
"enable_long_polling",
"[",
"Boolean",
"]",
"Enable",
"long",
"polling",
"@param",
"enable_chunked_encoding",
"[",
"Boolean",
"]",
"En... | 90fba639eb5d332ca8e87fd35f1d603a5743076d | https://github.com/SamSaffron/message_bus/blob/90fba639eb5d332ca8e87fd35f1d603a5743076d/lib/message_bus/http_client.rb#L96-L127 | train | Start a new cluster | [
30522,
13366,
2707,
1030,
20101,
2595,
1012,
26351,
8093,
10698,
4371,
2079,
2709,
2065,
2318,
1029,
1030,
3570,
1027,
2318,
11689,
1027,
11689,
1012,
2047,
2079,
4088,
2096,
2318,
1029,
4983,
1030,
6833,
1012,
4064,
1029,
8554,
1030,
26319... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.iso8601 | def iso8601(str)
parts = Date._iso8601(str)
raise ArgumentError, "invalid date" if parts.empty?
time = Time.new(
parts.fetch(:year),
parts.fetch(:mon),
parts.fetch(:mday),
parts.fetch(:hour, 0),
parts.fetch(:min, 0),
parts.fetch(:sec, 0) + parts.fetch(:sec_fraction, 0),
parts.fetch(:offset, 0)
)
if parts[:offset]
TimeWithZone.new(time.utc, self)
else
TimeWithZone.new(nil, self, time)
end
end | ruby | def iso8601(str)
parts = Date._iso8601(str)
raise ArgumentError, "invalid date" if parts.empty?
time = Time.new(
parts.fetch(:year),
parts.fetch(:mon),
parts.fetch(:mday),
parts.fetch(:hour, 0),
parts.fetch(:min, 0),
parts.fetch(:sec, 0) + parts.fetch(:sec_fraction, 0),
parts.fetch(:offset, 0)
)
if parts[:offset]
TimeWithZone.new(time.utc, self)
else
TimeWithZone.new(nil, self, time)
end
end | [
"def",
"iso8601",
"(",
"str",
")",
"parts",
"=",
"Date",
".",
"_iso8601",
"(",
"str",
")",
"raise",
"ArgumentError",
",",
"\"invalid date\"",
"if",
"parts",
".",
"empty?",
"time",
"=",
"Time",
".",
"new",
"(",
"parts",
".",
"fetch",
"(",
":year",
")",
... | Method for creating new ActiveSupport::TimeWithZone instance in time zone
of +self+ from an ISO 8601 string.
Time.zone = 'Hawaii' # => "Hawaii"
Time.zone.iso8601('1999-12-31T14:00:00') # => Fri, 31 Dec 1999 14:00:00 HST -10:00
If the time components are missing then they will be set to zero.
Time.zone = 'Hawaii' # => "Hawaii"
Time.zone.iso8601('1999-12-31') # => Fri, 31 Dec 1999 00:00:00 HST -10:00
If the string is invalid then an +ArgumentError+ will be raised unlike +parse+
which usually returns +nil+ when given an invalid date string. | [
"Method",
"for",
"creating",
"new",
"ActiveSupport",
"::",
"TimeWithZone",
"instance",
"in",
"time",
"zone",
"of",
"+",
"self",
"+",
"from",
"an",
"ISO",
"8601",
"string",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/values/time_zone.rb#L380-L400 | train | Returns a new object with the ISO 8601 date | [
30522,
13366,
11163,
20842,
24096,
1006,
2358,
2099,
1007,
3033,
1027,
3058,
1012,
1035,
11163,
20842,
24096,
1006,
2358,
2099,
1007,
5333,
6685,
2121,
29165,
1010,
1000,
19528,
3058,
1000,
2065,
3033,
1012,
4064,
1029,
2051,
1027,
2051,
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-01-01/generated/azure_mgmt_network/inbound_nat_rules.rb | Azure::Network::Mgmt::V2018_01_01.InboundNatRules.create_or_update_async | def create_or_update_async(resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers:nil)
# Send request
promise = begin_create_or_update_async(resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::InboundNatRule.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | ruby | def create_or_update_async(resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers:nil)
# Send request
promise = begin_create_or_update_async(resource_group_name, load_balancer_name, inbound_nat_rule_name, inbound_nat_rule_parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Network::Mgmt::V2018_01_01::Models::InboundNatRule.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | [
"def",
"create_or_update_async",
"(",
"resource_group_name",
",",
"load_balancer_name",
",",
"inbound_nat_rule_name",
",",
"inbound_nat_rule_parameters",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_create_or_update_async",
"(",
"resource_g... | @param resource_group_name [String] The name of the resource group.
@param load_balancer_name [String] The name of the load balancer.
@param inbound_nat_rule_name [String] The name of the inbound nat rule.
@param inbound_nat_rule_parameters [InboundNatRule] Parameters supplied to
the create or update inbound nat rule operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"resource_group_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"resource",
"group",
".",
"@param",
"load_balancer_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"load",
"balancer",
".",
"@param",
"inbound_nat_rule_name",
"[",
"String",
... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-01-01/generated/azure_mgmt_network/inbound_nat_rules.rb#L285-L301 | train | Creates or updates an existing inbound nat rule. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7170,
1035,
5703,
2099,
1035,
2171,
1010,
1999,
15494,
1035,
14085,
1035,
3627,
1035,
2171,
1010,
1999,
15494,
1035,
14085,
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... |
alexreisner/geocoder | lib/geocoder/sql.rb | Geocoder.Sql.full_distance | def full_distance(latitude, longitude, lat_attr, lon_attr, options = {})
units = options[:units] || Geocoder.config.units
earth = Geocoder::Calculations.earth_radius(units)
"#{earth} * 2 * ASIN(SQRT(" +
"POWER(SIN((#{latitude.to_f} - #{lat_attr}) * PI() / 180 / 2), 2) + " +
"COS(#{latitude.to_f} * PI() / 180) * COS(#{lat_attr} * PI() / 180) * " +
"POWER(SIN((#{longitude.to_f} - #{lon_attr}) * PI() / 180 / 2), 2)" +
"))"
end | ruby | def full_distance(latitude, longitude, lat_attr, lon_attr, options = {})
units = options[:units] || Geocoder.config.units
earth = Geocoder::Calculations.earth_radius(units)
"#{earth} * 2 * ASIN(SQRT(" +
"POWER(SIN((#{latitude.to_f} - #{lat_attr}) * PI() / 180 / 2), 2) + " +
"COS(#{latitude.to_f} * PI() / 180) * COS(#{lat_attr} * PI() / 180) * " +
"POWER(SIN((#{longitude.to_f} - #{lon_attr}) * PI() / 180 / 2), 2)" +
"))"
end | [
"def",
"full_distance",
"(",
"latitude",
",",
"longitude",
",",
"lat_attr",
",",
"lon_attr",
",",
"options",
"=",
"{",
"}",
")",
"units",
"=",
"options",
"[",
":units",
"]",
"||",
"Geocoder",
".",
"config",
".",
"units",
"earth",
"=",
"Geocoder",
"::",
... | Distance calculation for use with a database that supports POWER(),
SQRT(), PI(), and trigonometric functions SIN(), COS(), ASIN(),
ATAN2().
Based on the excellent tutorial at:
http://www.scribd.com/doc/2569355/Geo-Distance-Search-with-MySQL | [
"Distance",
"calculation",
"for",
"use",
"with",
"a",
"database",
"that",
"supports",
"POWER",
"()",
"SQRT",
"()",
"PI",
"()",
"and",
"trigonometric",
"functions",
"SIN",
"()",
"COS",
"()",
"ASIN",
"()",
"ATAN2",
"()",
"."
] | e087dc2759264ee6f307b926bb2de4ec2406859e | https://github.com/alexreisner/geocoder/blob/e087dc2759264ee6f307b926bb2de4ec2406859e/lib/geocoder/sql.rb#L13-L22 | train | Returns the full distance between two points | [
30522,
13366,
2440,
1035,
3292,
1006,
15250,
1010,
20413,
1010,
2474,
2102,
1035,
2012,
16344,
1010,
8840,
2078,
1035,
2012,
16344,
1010,
7047,
1027,
1063,
1065,
1007,
3197,
1027,
7047,
1031,
1024,
3197,
1033,
1064,
1064,
20248,
16044,
2099... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.write_outfile | def write_outfile(method_name, file)
schema = @load_schema.call(self)
context = @load_context.call(self)
result = schema.public_send(method_name, only: @only, except: @except, context: context)
dir = File.dirname(file)
FileUtils.mkdir_p(dir)
File.write(file, result)
end | ruby | def write_outfile(method_name, file)
schema = @load_schema.call(self)
context = @load_context.call(self)
result = schema.public_send(method_name, only: @only, except: @except, context: context)
dir = File.dirname(file)
FileUtils.mkdir_p(dir)
File.write(file, result)
end | [
"def",
"write_outfile",
"(",
"method_name",
",",
"file",
")",
"schema",
"=",
"@load_schema",
".",
"call",
"(",
"self",
")",
"context",
"=",
"@load_context",
".",
"call",
"(",
"self",
")",
"result",
"=",
"schema",
".",
"public_send",
"(",
"method_name",
","... | Use the provided `method_name` to generate a string from the specified schema
then write it to `file`. | [
"Use",
"the",
"provided",
"method_name",
"to",
"generate",
"a",
"string",
"from",
"the",
"specified",
"schema",
"then",
"write",
"it",
"to",
"file",
"."
] | d5be13a816f220b9efbabeaa69a3e56fedf311f5 | https://github.com/rmosolgo/graphql-ruby/blob/d5be13a816f220b9efbabeaa69a3e56fedf311f5/lib/graphql/rake_task.rb#L103-L110 | train | Write the output to a file | [
30522,
13366,
4339,
1035,
2041,
8873,
2571,
1006,
4118,
1035,
2171,
1010,
5371,
1007,
8040,
28433,
1027,
1030,
7170,
1035,
8040,
28433,
1012,
2655,
1006,
2969,
1007,
6123,
1027,
1030,
7170,
1035,
6123,
1012,
2655,
1006,
2969,
1007,
2765,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adimichele/hubspot-ruby | lib/hubspot/contact_list.rb | Hubspot.ContactList.add | def add(contacts)
contact_ids = [contacts].flatten.uniq.compact.map(&:id)
response = Hubspot::Connection.post_json(ADD_CONTACT_PATH, params: { list_id: @id }, body: { vids: contact_ids })
response['updated'].sort == contact_ids.sort
end | ruby | def add(contacts)
contact_ids = [contacts].flatten.uniq.compact.map(&:id)
response = Hubspot::Connection.post_json(ADD_CONTACT_PATH, params: { list_id: @id }, body: { vids: contact_ids })
response['updated'].sort == contact_ids.sort
end | [
"def",
"add",
"(",
"contacts",
")",
"contact_ids",
"=",
"[",
"contacts",
"]",
".",
"flatten",
".",
"uniq",
".",
"compact",
".",
"map",
"(",
":id",
")",
"response",
"=",
"Hubspot",
"::",
"Connection",
".",
"post_json",
"(",
"ADD_CONTACT_PATH",
",",
"param... | {http://developers.hubspot.com/docs/methods/lists/add_contact_to_list} | [
"{",
"http",
":",
"//",
"developers",
".",
"hubspot",
".",
"com",
"/",
"docs",
"/",
"methods",
"/",
"lists",
"/",
"add_contact_to_list",
"}"
] | 8eb0a64dd0c14c79e631e81bfdc169583e775a46 | https://github.com/adimichele/hubspot-ruby/blob/8eb0a64dd0c14c79e631e81bfdc169583e775a46/lib/hubspot/contact_list.rb#L102-L106 | train | Add a list of contacts to the list | [
30522,
13366,
5587,
1006,
10402,
1007,
3967,
1035,
8909,
2015,
1027,
1031,
10402,
1033,
1012,
4257,
6528,
1012,
4895,
18515,
1012,
9233,
1012,
4949,
1006,
1004,
1024,
8909,
1007,
3433,
1027,
9594,
13102,
4140,
1024,
1024,
4434,
1012,
2695,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
resque/resque | lib/resque/worker.rb | Resque.Worker.working_on | def working_on(job)
data = encode \
:queue => job.queue,
:run_at => Time.now.utc.iso8601,
:payload => job.payload
data_store.set_worker_payload(self,data)
end | ruby | def working_on(job)
data = encode \
:queue => job.queue,
:run_at => Time.now.utc.iso8601,
:payload => job.payload
data_store.set_worker_payload(self,data)
end | [
"def",
"working_on",
"(",
"job",
")",
"data",
"=",
"encode",
":queue",
"=>",
"job",
".",
"queue",
",",
":run_at",
"=>",
"Time",
".",
"now",
".",
"utc",
".",
"iso8601",
",",
":payload",
"=>",
"job",
".",
"payload",
"data_store",
".",
"set_worker_payload",... | Given a job, tells Redis we're working on it. Useful for seeing
what workers are doing and when. | [
"Given",
"a",
"job",
"tells",
"Redis",
"we",
"re",
"working",
"on",
"it",
".",
"Useful",
"for",
"seeing",
"what",
"workers",
"are",
"doing",
"and",
"when",
"."
] | adb633a0f6b98b1eb5a5a85bb36ebac9309978fd | https://github.com/resque/resque/blob/adb633a0f6b98b1eb5a5a85bb36ebac9309978fd/lib/resque/worker.rb#L701-L707 | train | Set the worker payload to be used for the job | [
30522,
13366,
2551,
1035,
2006,
1006,
3105,
1007,
2951,
1027,
4372,
16044,
1032,
1024,
24240,
1027,
1028,
3105,
1012,
24240,
1010,
1024,
2448,
1035,
2012,
1027,
1028,
2051,
1012,
2085,
1012,
11396,
1012,
11163,
20842,
24096,
1010,
1024,
180... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/s3_event.rb | Jets::Job::Dsl.S3Event.declare_s3_bucket_resources | def declare_s3_bucket_resources(bucket_name)
# If shared s3 bucket resources have already been declared.
# We will not generate them again. However, we still need to always
# add the depends_on declaration to ensure that the shared stack parameters
# are properly passed to the nested child stack.
stack_name = s3_events[bucket_name] # already registered
if stack_name
depends_on stack_name.underscore.to_sym, class_prefix: true # always add this
return stack_name
end
# Create shared resources - one time
stack_name = declare_shared_s3_event_resources(bucket_name)
depends_on stack_name.underscore.to_sym, class_prefix: true # always add this
self.s3_events[bucket_name] = stack_name # tracks buckets already set up
end | ruby | def declare_s3_bucket_resources(bucket_name)
# If shared s3 bucket resources have already been declared.
# We will not generate them again. However, we still need to always
# add the depends_on declaration to ensure that the shared stack parameters
# are properly passed to the nested child stack.
stack_name = s3_events[bucket_name] # already registered
if stack_name
depends_on stack_name.underscore.to_sym, class_prefix: true # always add this
return stack_name
end
# Create shared resources - one time
stack_name = declare_shared_s3_event_resources(bucket_name)
depends_on stack_name.underscore.to_sym, class_prefix: true # always add this
self.s3_events[bucket_name] = stack_name # tracks buckets already set up
end | [
"def",
"declare_s3_bucket_resources",
"(",
"bucket_name",
")",
"# If shared s3 bucket resources have already been declared.",
"# We will not generate them again. However, we still need to always",
"# add the depends_on declaration to ensure that the shared stack parameters",
"# are properly passed t... | Returns stack_name | [
"Returns",
"stack_name"
] | 46943a519224067e58aa3e2d5656e3ca083150f9 | https://github.com/tongueroo/jets/blob/46943a519224067e58aa3e2d5656e3ca083150f9/lib/jets/job/dsl/s3_event.rb#L9-L24 | train | Declare the resources for the given bucket. | [
30522,
13366,
13520,
1035,
1055,
2509,
1035,
13610,
1035,
4219,
1006,
13610,
1035,
2171,
1007,
1001,
2065,
4207,
1055,
2509,
13610,
4219,
2031,
2525,
2042,
4161,
1012,
1001,
2057,
2097,
2025,
9699,
2068,
2153,
1012,
2174,
1010,
2057,
2145,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.