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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
meew0/discordrb | lib/discordrb/data/member.rb | Discordrb.Member.update_roles | def update_roles(role_ids)
@roles = []
role_ids.each do |id|
# It is posible for members to have roles that do not exist
# on the server any longer. See https://github.com/meew0/discordrb/issues/371
role = @server.role(id)
@roles << role if role
end
end | ruby | def update_roles(role_ids)
@roles = []
role_ids.each do |id|
# It is posible for members to have roles that do not exist
# on the server any longer. See https://github.com/meew0/discordrb/issues/371
role = @server.role(id)
@roles << role if role
end
end | [
"def",
"update_roles",
"(",
"role_ids",
")",
"@roles",
"=",
"[",
"]",
"role_ids",
".",
"each",
"do",
"|",
"id",
"|",
"# It is posible for members to have roles that do not exist",
"# on the server any longer. See https://github.com/meew0/discordrb/issues/371",
"role",
"=",
"@... | Update this member's roles
@note For internal use only.
@!visibility private | [
"Update",
"this",
"member",
"s",
"roles"
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/data/member.rb#L228-L236 | train | Update the roles of the group. | [
30522,
13366,
10651,
1035,
4395,
1006,
2535,
1035,
8909,
2015,
1007,
1030,
4395,
1027,
1031,
1033,
2535,
1035,
8909,
2015,
1012,
2169,
2079,
1064,
8909,
1064,
1001,
2009,
2003,
13433,
19307,
2005,
2372,
2000,
2031,
4395,
2008,
2079,
2025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb | Azure::Web::Mgmt::V2018_02_01.AppServiceEnvironments.list_web_worker_metric_definitions_as_lazy | def list_web_worker_metric_definitions_as_lazy(resource_group_name, name, worker_pool_name, custom_headers:nil)
response = list_web_worker_metric_definitions_async(resource_group_name, name, worker_pool_name, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_web_worker_metric_definitions_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_web_worker_metric_definitions_as_lazy(resource_group_name, name, worker_pool_name, custom_headers:nil)
response = list_web_worker_metric_definitions_async(resource_group_name, name, worker_pool_name, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_web_worker_metric_definitions_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_web_worker_metric_definitions_as_lazy",
"(",
"resource_group_name",
",",
"name",
",",
"worker_pool_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_web_worker_metric_definitions_async",
"(",
"resource_group_name",
",",
"name",
",",
"worker_... | Get metric definitions for a worker pool of an App Service Environment.
Get metric definitions for a worker pool of an App Service Environment.
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param name [String] Name of the App Service Environment.
@param worker_pool_name [String] Name of the worker pool.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ResourceMetricDefinitionCollection] which provide lazy access to
pages of the response. | [
"Get",
"metric",
"definitions",
"for",
"a",
"worker",
"pool",
"of",
"an",
"App",
"Service",
"Environment",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb#L7916-L7925 | train | Gets the metric definitions for a worker pool. | [
30522,
13366,
2862,
1035,
4773,
1035,
7309,
1035,
12046,
1035,
15182,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
7309,
1035,
4770,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
etewiah/property_web_builder | app/controllers/pwb/api/v1/page_controller.rb | Pwb.Api::V1::PageController.show | def show
if params[:page_name] == "website"
return render json: Website.unique_instance.as_json_for_page
end
page = Pwb::Page.find_by_slug(params[:page_name])
if page
render json: page.as_json_for_admin
else
render json: {}
end
end | ruby | def show
if params[:page_name] == "website"
return render json: Website.unique_instance.as_json_for_page
end
page = Pwb::Page.find_by_slug(params[:page_name])
if page
render json: page.as_json_for_admin
else
render json: {}
end
end | [
"def",
"show",
"if",
"params",
"[",
":page_name",
"]",
"==",
"\"website\"",
"return",
"render",
"json",
":",
"Website",
".",
"unique_instance",
".",
"as_json_for_page",
"end",
"page",
"=",
"Pwb",
"::",
"Page",
".",
"find_by_slug",
"(",
"params",
"[",
":page_... | protect_from_forgery with: :null_session | [
"protect_from_forgery",
"with",
":",
":",
"null_session"
] | fba4e6d4ffa7bc1f4d3b50dfa5a6a9fbfee23f21 | https://github.com/etewiah/property_web_builder/blob/fba4e6d4ffa7bc1f4d3b50dfa5a6a9fbfee23f21/app/controllers/pwb/api/v1/page_controller.rb#L6-L17 | train | show a page object | [
30522,
13366,
2265,
2065,
11498,
5244,
1031,
1024,
3931,
1035,
2171,
1033,
1027,
1027,
1000,
4037,
1000,
2709,
17552,
1046,
3385,
1024,
30524,
1046,
3385,
1035,
2005,
1035,
3931,
2203,
3931,
1027,
1052,
2860,
2497,
1024,
1024,
3931,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
roo-rb/roo | lib/roo/excelx.rb | Roo.Excelx.column | def column(column_number, sheet = nil)
if column_number.is_a?(::String)
column_number = ::Roo::Utils.letter_to_number(column_number)
end
sheet_for(sheet).column(column_number)
end | ruby | def column(column_number, sheet = nil)
if column_number.is_a?(::String)
column_number = ::Roo::Utils.letter_to_number(column_number)
end
sheet_for(sheet).column(column_number)
end | [
"def",
"column",
"(",
"column_number",
",",
"sheet",
"=",
"nil",
")",
"if",
"column_number",
".",
"is_a?",
"(",
"::",
"String",
")",
"column_number",
"=",
"::",
"Roo",
"::",
"Utils",
".",
"letter_to_number",
"(",
"column_number",
")",
"end",
"sheet_for",
"... | returns all values in this column as an array
column numbers are 1,2,3,... like in the spreadsheet | [
"returns",
"all",
"values",
"in",
"this",
"column",
"as",
"an",
"array",
"column",
"numbers",
"are",
"1",
"2",
"3",
"...",
"like",
"in",
"the",
"spreadsheet"
] | 4ec1104f0c3c2a29711c0c907371cd2be12bcc3c | https://github.com/roo-rb/roo/blob/4ec1104f0c3c2a29711c0c907371cd2be12bcc3c/lib/roo/excelx.rb#L124-L129 | train | Returns the column number in the current row | [
30522,
13366,
5930,
1006,
5930,
1035,
2193,
1010,
7123,
1027,
9152,
2140,
1007,
2065,
5930,
1035,
2193,
1012,
2003,
1035,
1037,
1029,
1006,
1024,
1024,
5164,
1007,
5930,
1035,
2193,
1027,
1024,
1024,
20996,
2080,
1024,
1024,
21183,
12146,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/diagnostics.rb | Azure::Web::Mgmt::V2018_02_01.Diagnostics.list_site_analyses_slot | def list_site_analyses_slot(resource_group_name, site_name, diagnostic_category, slot, custom_headers:nil)
first_page = list_site_analyses_slot_as_lazy(resource_group_name, site_name, diagnostic_category, slot, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_site_analyses_slot(resource_group_name, site_name, diagnostic_category, slot, custom_headers:nil)
first_page = list_site_analyses_slot_as_lazy(resource_group_name, site_name, diagnostic_category, slot, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_site_analyses_slot",
"(",
"resource_group_name",
",",
"site_name",
",",
"diagnostic_category",
",",
"slot",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_site_analyses_slot_as_lazy",
"(",
"resource_group_name",
",",
"site_name",
",",
"dia... | Get Site Analyses
Get Site Analyses
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param site_name [String] Site Name
@param diagnostic_category [String] Diagnostic Category
@param slot [String] Slot Name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<AnalysisDefinition>] operation results. | [
"Get",
"Site",
"Analyses"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/diagnostics.rb#L1829-L1832 | train | Gets all the analyses for a site. | [
30522,
13366,
2862,
1035,
2609,
1035,
16478,
1035,
10453,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2609,
1035,
2171,
1010,
16474,
1035,
4696,
1010,
10453,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2862,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
watir/watir | lib/watir/elements/select.rb | Watir.Select.select_all | def select_all(*str_or_rx)
results = str_or_rx.flatten.map { |v| select_all_by v }
results.first
end | ruby | def select_all(*str_or_rx)
results = str_or_rx.flatten.map { |v| select_all_by v }
results.first
end | [
"def",
"select_all",
"(",
"*",
"str_or_rx",
")",
"results",
"=",
"str_or_rx",
".",
"flatten",
".",
"map",
"{",
"|",
"v",
"|",
"select_all_by",
"v",
"}",
"results",
".",
"first",
"end"
] | Select all options whose text or label matches the given string.
@param [String, Regexp] str_or_rx
@raise [Watir::Exception::NoValueFoundException] if the value does not exist.
@return [String] The text of the first option selected. | [
"Select",
"all",
"options",
"whose",
"text",
"or",
"label",
"matches",
"the",
"given",
"string",
"."
] | 2d8db09811c6221ae401b85b2f61f5fa66e463a3 | https://github.com/watir/watir/blob/2d8db09811c6221ae401b85b2f61f5fa66e463a3/lib/watir/elements/select.rb#L45-L48 | train | Select all the elements in the list | [
30522,
13366,
7276,
1035,
2035,
1006,
1008,
2358,
2099,
1035,
2030,
1035,
1054,
2595,
1007,
3463,
1027,
2358,
2099,
1035,
2030,
1035,
1054,
2595,
1012,
4257,
6528,
1012,
4949,
1063,
1064,
1058,
1064,
7276,
1035,
2035,
1035,
2011,
1058,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/virtual_network_gateways.rb | Azure::Network::Mgmt::V2018_07_01.VirtualNetworkGateways.get_vpn_profile_package_url | def get_vpn_profile_package_url(resource_group_name, virtual_network_gateway_name, custom_headers:nil)
response = get_vpn_profile_package_url_async(resource_group_name, virtual_network_gateway_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_vpn_profile_package_url(resource_group_name, virtual_network_gateway_name, custom_headers:nil)
response = get_vpn_profile_package_url_async(resource_group_name, virtual_network_gateway_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_vpn_profile_package_url",
"(",
"resource_group_name",
",",
"virtual_network_gateway_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_vpn_profile_package_url_async",
"(",
"resource_group_name",
",",
"virtual_network_gateway_name",
",",
"custom_hea... | Gets pre-generated VPN profile for P2S client of the virtual network gateway
in the specified resource group. The profile needs to be generated first
using generateVpnProfile.
@param resource_group_name [String] The name of the resource group.
@param virtual_network_gateway_name [String] The name of the virtual network
gateway.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [String] operation results. | [
"Gets",
"pre",
"-",
"generated",
"VPN",
"profile",
"for",
"P2S",
"client",
"of",
"the",
"virtual",
"network",
"gateway",
"in",
"the",
"specified",
"resource",
"group",
".",
"The",
"profile",
"needs",
"to",
"be",
"generated",
"first",
"using",
"generateVpnProfi... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/virtual_network_gateways.rb#L675-L678 | train | Gets the VPN profile package URL for the specified virtual network gateway. | [
30522,
13366,
2131,
1035,
21210,
2078,
1035,
6337,
1035,
7427,
1035,
24471,
2140,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7484,
1035,
2897,
1035,
11909,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/sprockets | lib/sprockets/transformers.rb | Sprockets.Transformers.register_transformer_suffix | def register_transformer_suffix(types, type_format, extname, processor)
Array(types).each do |type|
extensions, charset = mime_types[type].values_at(:extensions, :charset)
parts = type.split('/')
suffix_type = type_format.sub('\1', parts[0]).sub('\2', parts[1])
extensions = extensions.map { |ext| "#{ext}#{extname}" }
register_mime_type(suffix_type, extensions: extensions, charset: charset)
register_transformer(suffix_type, type, processor)
end
end | ruby | def register_transformer_suffix(types, type_format, extname, processor)
Array(types).each do |type|
extensions, charset = mime_types[type].values_at(:extensions, :charset)
parts = type.split('/')
suffix_type = type_format.sub('\1', parts[0]).sub('\2', parts[1])
extensions = extensions.map { |ext| "#{ext}#{extname}" }
register_mime_type(suffix_type, extensions: extensions, charset: charset)
register_transformer(suffix_type, type, processor)
end
end | [
"def",
"register_transformer_suffix",
"(",
"types",
",",
"type_format",
",",
"extname",
",",
"processor",
")",
"Array",
"(",
"types",
")",
".",
"each",
"do",
"|",
"type",
"|",
"extensions",
",",
"charset",
"=",
"mime_types",
"[",
"type",
"]",
".",
"values_... | Internal: Register transformer for existing type adding a suffix.
types - Array of existing mime type Strings
type_format - String suffix formatting string
extname - String extension to append
processor - Callable block that accepts an input Hash.
Returns nothing. | [
"Internal",
":",
"Register",
"transformer",
"for",
"existing",
"type",
"adding",
"a",
"suffix",
"."
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/transformers.rb#L53-L63 | train | Register a transformer suffix for a given type | [
30522,
13366,
4236,
1035,
10938,
2121,
1035,
16809,
1006,
4127,
1010,
2828,
1035,
4289,
1010,
4654,
2102,
18442,
1010,
13151,
1007,
9140,
1006,
4127,
1007,
1012,
2169,
2079,
1064,
2828,
1064,
14305,
1010,
25869,
13462,
1027,
2771,
4168,
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_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/device_settings.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.DeviceSettings.get_network_settings_with_http_info | def get_network_settings_with_http_info(device_name, resource_group_name, manager_name, custom_headers:nil)
get_network_settings_async(device_name, resource_group_name, manager_name, custom_headers:custom_headers).value!
end | ruby | def get_network_settings_with_http_info(device_name, resource_group_name, manager_name, custom_headers:nil)
get_network_settings_async(device_name, resource_group_name, manager_name, custom_headers:custom_headers).value!
end | [
"def",
"get_network_settings_with_http_info",
"(",
"device_name",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"get_network_settings_async",
"(",
"device_name",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers... | Gets the network settings of the specified device.
@param device_name [String] The device name
@param resource_group_name [String] The resource group name
@param manager_name [String] The manager name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"network",
"settings",
"of",
"the",
"specified",
"device",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/device_settings.rb#L195-L197 | train | Gets the network settings of the specified device. | [
30522,
13366,
2131,
1035,
2897,
1035,
10906,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
5080,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
2897,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_mixedreality/lib/2019-02-28-preview/generated/azure_mgmt_mixedreality/spatial_anchors_accounts.rb | Azure::MixedReality::Mgmt::V2019_02_28_preview.SpatialAnchorsAccounts.regenerate_keys | def regenerate_keys(resource_group_name, spatial_anchors_account_name, spatial_anchors_account_key_regenerate, custom_headers:nil)
response = regenerate_keys_async(resource_group_name, spatial_anchors_account_name, spatial_anchors_account_key_regenerate, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def regenerate_keys(resource_group_name, spatial_anchors_account_name, spatial_anchors_account_key_regenerate, custom_headers:nil)
response = regenerate_keys_async(resource_group_name, spatial_anchors_account_name, spatial_anchors_account_key_regenerate, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"regenerate_keys",
"(",
"resource_group_name",
",",
"spatial_anchors_account_name",
",",
"spatial_anchors_account_key_regenerate",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"regenerate_keys_async",
"(",
"resource_group_name",
",",
"spatial_anchors_account_... | Regenerate 1 Key of a Spatial Anchors Account
@param resource_group_name [String] Name of an Azure resource group.
@param spatial_anchors_account_name [String] Name of an Mixed Reality Spatial
Anchors Account.
@param spatial_anchors_account_key_regenerate
[SpatialAnchorsAccountKeyRegenerateRequest] Specifying which key to be
regenerated.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [SpatialAnchorsAccountKeys] operation results. | [
"Regenerate",
"1",
"Key",
"of",
"a",
"Spatial",
"Anchors",
"Account"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_mixedreality/lib/2019-02-28-preview/generated/azure_mgmt_mixedreality/spatial_anchors_accounts.rb#L745-L748 | train | Regenerate the key for the specified spatial anchors account. | [
30522,
13366,
19723,
24454,
3686,
1035,
6309,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
13589,
1035,
24674,
1035,
4070,
1035,
2171,
1010,
13589,
1035,
24674,
1035,
4070,
1035,
3145,
1035,
19723,
24454,
3686,
1010,
7661,
1035,
20346,
2015,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_customvisiontraining/lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb | Azure::CognitiveServices::Customvisiontraining::V3_0.CustomvisiontrainingClient.create_images_from_files | def create_images_from_files(project_id, batch, custom_headers:nil)
response = create_images_from_files_async(project_id, batch, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_images_from_files(project_id, batch, custom_headers:nil)
response = create_images_from_files_async(project_id, batch, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_images_from_files",
"(",
"project_id",
",",
"batch",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_images_from_files_async",
"(",
"project_id",
",",
"batch",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
... | Add the provided batch of images to the set of training images.
This API accepts a batch of files, and optionally tags, to create images.
There is a limit of 64 images and 20 tags.
@param project_id The project id.
@param batch [ImageFileCreateBatch] The batch of image files to add. Limited
to 64 images and 20 tags per batch.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ImageCreateSummary] operation results. | [
"Add",
"the",
"provided",
"batch",
"of",
"images",
"to",
"the",
"set",
"of",
"training",
"images",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_customvisiontraining/lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb#L1583-L1586 | train | Creates a list of images from the specified files. | [
30522,
13366,
3443,
1035,
4871,
1035,
2013,
1035,
6764,
1006,
2622,
1035,
8909,
1010,
14108,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3443,
1035,
4871,
1035,
2013,
1035,
6764,
1035,
2004,
6038,
2278,
1006,
2622,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cloudfoundry/bosh | src/bosh-director/lib/bosh/director/disk_manager.rb | Bosh::Director.DiskManager.sync_persistent_disk | def sync_persistent_disk(instance_plan)
instance = instance_plan.instance
return if instance.model.persistent_disks.empty?
agent_disk_cid = agent_mounted_disks(instance.model).first
if agent_disk_cid.nil? && !instance_plan.needs_disk?
@logger.debug('Disk is already detached')
elsif agent_disk_cid != instance.model.managed_persistent_disk_cid
handle_disk_mismatch(agent_disk_cid, instance, instance_plan)
end
instance.model.persistent_disks.each do |disk|
unless disk.active
@logger.warn("'#{instance}' has inactive disk #{disk.disk_cid}")
end
end
end | ruby | def sync_persistent_disk(instance_plan)
instance = instance_plan.instance
return if instance.model.persistent_disks.empty?
agent_disk_cid = agent_mounted_disks(instance.model).first
if agent_disk_cid.nil? && !instance_plan.needs_disk?
@logger.debug('Disk is already detached')
elsif agent_disk_cid != instance.model.managed_persistent_disk_cid
handle_disk_mismatch(agent_disk_cid, instance, instance_plan)
end
instance.model.persistent_disks.each do |disk|
unless disk.active
@logger.warn("'#{instance}' has inactive disk #{disk.disk_cid}")
end
end
end | [
"def",
"sync_persistent_disk",
"(",
"instance_plan",
")",
"instance",
"=",
"instance_plan",
".",
"instance",
"return",
"if",
"instance",
".",
"model",
".",
"persistent_disks",
".",
"empty?",
"agent_disk_cid",
"=",
"agent_mounted_disks",
"(",
"instance",
".",
"model"... | Synchronizes persistent_disks with the agent.
(Currently assumes that we only have 1 persistent disk.)
@return [void] | [
"Synchronizes",
"persistent_disks",
"with",
"the",
"agent",
".",
"(",
"Currently",
"assumes",
"that",
"we",
"only",
"have",
"1",
"persistent",
"disk",
".",
")"
] | 2eaa7100879ddd20cd909cd698514746195e28b7 | https://github.com/cloudfoundry/bosh/blob/2eaa7100879ddd20cd909cd698514746195e28b7/src/bosh-director/lib/bosh/director/disk_manager.rb#L109-L126 | train | Syncs the persistent disk with the agent | [
30522,
13366,
26351,
1035,
14516,
1035,
9785,
1006,
6013,
1035,
2933,
1007,
6013,
1027,
6013,
1035,
2933,
1012,
6013,
2709,
2065,
6013,
1012,
2944,
1012,
14516,
1035,
23999,
1012,
4064,
1029,
4005,
1035,
9785,
1035,
28744,
1027,
4005,
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... |
watir/watir | lib/watir/capabilities.rb | Watir.Capabilities.process_browser_options | def process_browser_options
browser_options = @options.delete(:options) || {}
case @selenium_browser
when :chrome
if @options.key?(:args) || @options.key?(:switches)
browser_options ||= {}
browser_options[:args] = (@options.delete(:args) || @options.delete(:switches)).dup
end
if @options.delete(:headless)
browser_options ||= {}
browser_options[:args] ||= []
browser_options[:args] += ['--headless', '--disable-gpu']
end
@selenium_opts[:options] = browser_options if browser_options.is_a? Selenium::WebDriver::Chrome::Options
@selenium_opts[:options] ||= Selenium::WebDriver::Chrome::Options.new(browser_options)
when :firefox
profile = @options.delete(:profile)
if browser_options.is_a? Selenium::WebDriver::Firefox::Options
@selenium_opts[:options] = browser_options
if profile
msg = 'Initializing Browser with both :profile and :option', ':profile as a key inside :option'
Watir.logger.deprecate msg, ids: [:firefox_profile]
end
end
if @options.delete(:headless)
browser_options ||= {}
browser_options[:args] ||= []
browser_options[:args] += ['--headless']
end
@selenium_opts[:options] ||= Selenium::WebDriver::Firefox::Options.new(browser_options)
@selenium_opts[:options].profile = profile if profile
when :safari
Selenium::WebDriver::Safari.technology_preview! if @options.delete(:technology_preview)
when :remote
if @browser == :chrome && @options.delete(:headless)
args = @options.delete(:args) || @options.delete(:switches) || []
@options['chromeOptions'] = {'args' => args + ['--headless', '--disable-gpu']}
end
if @browser == :firefox && @options.delete(:headless)
args = @options.delete(:args) || @options.delete(:switches) || []
@options[Selenium::WebDriver::Firefox::Options::KEY] = {'args' => args + ['--headless']}
end
if @browser == :safari && @options.delete(:technology_preview)
@options['safari.options'] = {'technologyPreview' => true}
end
when :ie
if @options.key?(:args)
browser_options ||= {}
browser_options[:args] = @options.delete(:args).dup
end
unless browser_options.is_a? Selenium::WebDriver::IE::Options
ie_caps = browser_options.select { |k| Selenium::WebDriver::IE::Options::CAPABILITIES.include?(k) }
browser_options = Selenium::WebDriver::IE::Options.new(browser_options)
ie_caps.each { |k, v| browser_options.add_option(k, v) }
end
@selenium_opts[:options] = browser_options
end
end | ruby | def process_browser_options
browser_options = @options.delete(:options) || {}
case @selenium_browser
when :chrome
if @options.key?(:args) || @options.key?(:switches)
browser_options ||= {}
browser_options[:args] = (@options.delete(:args) || @options.delete(:switches)).dup
end
if @options.delete(:headless)
browser_options ||= {}
browser_options[:args] ||= []
browser_options[:args] += ['--headless', '--disable-gpu']
end
@selenium_opts[:options] = browser_options if browser_options.is_a? Selenium::WebDriver::Chrome::Options
@selenium_opts[:options] ||= Selenium::WebDriver::Chrome::Options.new(browser_options)
when :firefox
profile = @options.delete(:profile)
if browser_options.is_a? Selenium::WebDriver::Firefox::Options
@selenium_opts[:options] = browser_options
if profile
msg = 'Initializing Browser with both :profile and :option', ':profile as a key inside :option'
Watir.logger.deprecate msg, ids: [:firefox_profile]
end
end
if @options.delete(:headless)
browser_options ||= {}
browser_options[:args] ||= []
browser_options[:args] += ['--headless']
end
@selenium_opts[:options] ||= Selenium::WebDriver::Firefox::Options.new(browser_options)
@selenium_opts[:options].profile = profile if profile
when :safari
Selenium::WebDriver::Safari.technology_preview! if @options.delete(:technology_preview)
when :remote
if @browser == :chrome && @options.delete(:headless)
args = @options.delete(:args) || @options.delete(:switches) || []
@options['chromeOptions'] = {'args' => args + ['--headless', '--disable-gpu']}
end
if @browser == :firefox && @options.delete(:headless)
args = @options.delete(:args) || @options.delete(:switches) || []
@options[Selenium::WebDriver::Firefox::Options::KEY] = {'args' => args + ['--headless']}
end
if @browser == :safari && @options.delete(:technology_preview)
@options['safari.options'] = {'technologyPreview' => true}
end
when :ie
if @options.key?(:args)
browser_options ||= {}
browser_options[:args] = @options.delete(:args).dup
end
unless browser_options.is_a? Selenium::WebDriver::IE::Options
ie_caps = browser_options.select { |k| Selenium::WebDriver::IE::Options::CAPABILITIES.include?(k) }
browser_options = Selenium::WebDriver::IE::Options.new(browser_options)
ie_caps.each { |k, v| browser_options.add_option(k, v) }
end
@selenium_opts[:options] = browser_options
end
end | [
"def",
"process_browser_options",
"browser_options",
"=",
"@options",
".",
"delete",
"(",
":options",
")",
"||",
"{",
"}",
"case",
"@selenium_browser",
"when",
":chrome",
"if",
"@options",
".",
"key?",
"(",
":args",
")",
"||",
"@options",
".",
"key?",
"(",
"... | TODO: - this will get addressed with Capabilities Update
rubocop:disable Metrics/AbcSize
rubocop:disable Metrics/MethodLength
rubocop:disable Metrics/PerceivedComplexity:
rubocop:disable Metrics/CyclomaticComplexity:: | [
"TODO",
":",
"-",
"this",
"will",
"get",
"addressed",
"with",
"Capabilities",
"Update",
"rubocop",
":",
"disable",
"Metrics",
"/",
"AbcSize",
"rubocop",
":",
"disable",
"Metrics",
"/",
"MethodLength",
"rubocop",
":",
"disable",
"Metrics",
"/",
"PerceivedComplexi... | 2d8db09811c6221ae401b85b2f61f5fa66e463a3 | https://github.com/watir/watir/blob/2d8db09811c6221ae401b85b2f61f5fa66e463a3/lib/watir/capabilities.rb#L70-L128 | train | Process the browser options | [
30522,
13366,
2832,
1035,
16602,
1035,
7047,
16602,
1035,
7047,
1027,
1030,
7047,
1012,
3972,
12870,
1006,
1024,
7047,
1007,
1064,
1064,
1063,
1065,
2553,
1030,
7367,
7770,
5007,
1035,
16602,
2043,
1024,
18546,
2065,
1030,
7047,
1012,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-opsworks/lib/aws-sdk-opsworks/layer.rb | Aws::OpsWorks.Layer.delete | def delete(options = {})
options = options.merge(layer_id: @id)
resp = @client.delete_layer(options)
resp.data
end | ruby | def delete(options = {})
options = options.merge(layer_id: @id)
resp = @client.delete_layer(options)
resp.data
end | [
"def",
"delete",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"layer_id",
":",
"@id",
")",
"resp",
"=",
"@client",
".",
"delete_layer",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @!group Actions
@example Request syntax with placeholder values
layer.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-opsworks/lib/aws-sdk-opsworks/layer.rb#L361-L365 | train | Delete a layer | [
30522,
13366,
3972,
12870,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
6741,
1035,
8909,
1024,
1030,
8909,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
3972,
12870,
1035,
6741,
1006,
7047,
1007,
24501,
2361,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/overcommit | lib/overcommit/git_repo.rb | Overcommit.GitRepo.extract_modified_lines | def extract_modified_lines(file_path, options)
lines = Set.new
flags = '--cached' if options[:staged]
refs = options[:refs]
subcmd = options[:subcmd] || 'diff'
`git #{subcmd} --no-color --no-ext-diff -U0 #{flags} #{refs} -- "#{file_path}"`.
scan(DIFF_HUNK_REGEX) do |start_line, lines_added|
lines_added = (lines_added || 1).to_i # When blank, one line was added
cur_line = start_line.to_i
lines_added.times do
lines.add cur_line
cur_line += 1
end
end
lines
end | ruby | def extract_modified_lines(file_path, options)
lines = Set.new
flags = '--cached' if options[:staged]
refs = options[:refs]
subcmd = options[:subcmd] || 'diff'
`git #{subcmd} --no-color --no-ext-diff -U0 #{flags} #{refs} -- "#{file_path}"`.
scan(DIFF_HUNK_REGEX) do |start_line, lines_added|
lines_added = (lines_added || 1).to_i # When blank, one line was added
cur_line = start_line.to_i
lines_added.times do
lines.add cur_line
cur_line += 1
end
end
lines
end | [
"def",
"extract_modified_lines",
"(",
"file_path",
",",
"options",
")",
"lines",
"=",
"Set",
".",
"new",
"flags",
"=",
"'--cached'",
"if",
"options",
"[",
":staged",
"]",
"refs",
"=",
"options",
"[",
":refs",
"]",
"subcmd",
"=",
"options",
"[",
":subcmd",
... | Extract the set of modified lines from a given file.
@param file_path [String]
@param options [Hash]
@return [Set] line numbers that have been modified in file | [
"Extract",
"the",
"set",
"of",
"modified",
"lines",
"from",
"a",
"given",
"file",
"."
] | 35d60adb41da942178b789560968e3ad030b0ac7 | https://github.com/sds/overcommit/blob/35d60adb41da942178b789560968e3ad030b0ac7/lib/overcommit/git_repo.rb#L67-L86 | train | Extract modified lines from a file | [
30522,
13366,
14817,
1035,
6310,
1035,
3210,
1006,
5371,
1035,
4130,
1010,
7047,
1007,
3210,
1027,
2275,
1012,
2047,
9245,
1027,
1005,
1011,
1011,
17053,
2094,
1005,
2065,
7047,
1031,
1024,
9813,
1033,
25416,
2015,
1027,
7047,
1031,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
wearefine/fae | app/controllers/fae/static_pages_controller.rb | Fae.StaticPagesController.item_params | def item_params
model = @item.class.name.split('::').last.underscore
params.require(:"#{model}").permit!
end | ruby | def item_params
model = @item.class.name.split('::').last.underscore
params.require(:"#{model}").permit!
end | [
"def",
"item_params",
"model",
"=",
"@item",
".",
"class",
".",
"name",
".",
"split",
"(",
"'::'",
")",
".",
"last",
".",
"underscore",
"params",
".",
"require",
"(",
":\"",
"#{",
"model",
"}",
"\"",
")",
".",
"permit!",
"end"
] | Only allow a trusted parameter "white list" through. | [
"Only",
"allow",
"a",
"trusted",
"parameter",
"white",
"list",
"through",
"."
] | 645d6b66945aeff54e27af6a95c4f8a1f7a67d39 | https://github.com/wearefine/fae/blob/645d6b66945aeff54e27af6a95c4f8a1f7a67d39/app/controllers/fae/static_pages_controller.rb#L43-L46 | train | Returns the params for the item object. | [
30522,
13366,
8875,
1035,
11498,
5244,
2944,
1027,
1030,
8875,
1012,
2465,
1012,
2171,
1012,
3975,
1006,
1005,
1024,
1024,
1005,
1007,
1012,
2197,
1012,
2104,
9363,
2890,
11498,
5244,
1012,
5478,
1006,
1024,
1000,
1001,
1063,
2944,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
twitter/secure_headers | lib/secure_headers/middleware.rb | SecureHeaders.Middleware.flag_cookies! | def flag_cookies!(headers, config)
if cookies = headers["Set-Cookie"]
# Support Rails 2.3 / Rack 1.1 arrays as headers
cookies = cookies.split("\n") unless cookies.is_a?(Array)
headers["Set-Cookie"] = cookies.map do |cookie|
SecureHeaders::Cookie.new(cookie, config).to_s
end.join("\n")
end
end | ruby | def flag_cookies!(headers, config)
if cookies = headers["Set-Cookie"]
# Support Rails 2.3 / Rack 1.1 arrays as headers
cookies = cookies.split("\n") unless cookies.is_a?(Array)
headers["Set-Cookie"] = cookies.map do |cookie|
SecureHeaders::Cookie.new(cookie, config).to_s
end.join("\n")
end
end | [
"def",
"flag_cookies!",
"(",
"headers",
",",
"config",
")",
"if",
"cookies",
"=",
"headers",
"[",
"\"Set-Cookie\"",
"]",
"# Support Rails 2.3 / Rack 1.1 arrays as headers",
"cookies",
"=",
"cookies",
".",
"split",
"(",
"\"\\n\"",
")",
"unless",
"cookies",
".",
"is... | inspired by https://github.com/tobmatth/rack-ssl-enforcer/blob/6c014/lib/rack/ssl-enforcer.rb#L183-L194 | [
"inspired",
"by",
"https",
":",
"//",
"github",
".",
"com",
"/",
"tobmatth",
"/",
"rack",
"-",
"ssl",
"-",
"enforcer",
"/",
"blob",
"/",
"6c014",
"/",
"lib",
"/",
"rack",
"/",
"ssl",
"-",
"enforcer",
".",
"rb#L183",
"-",
"L194"
] | 543e6712aadae08f1653ed973e6b6204f7eac26a | https://github.com/twitter/secure_headers/blob/543e6712aadae08f1653ed973e6b6204f7eac26a/lib/secure_headers/middleware.rb#L22-L31 | train | Flag cookies in the headers | [
30522,
13366,
5210,
1035,
16324,
999,
1006,
20346,
2015,
1010,
9530,
8873,
2290,
1007,
2065,
16324,
1027,
20346,
2015,
1031,
1000,
2275,
1011,
17387,
1000,
1033,
1001,
2490,
30524,
1012,
4949,
2079,
1064,
17387,
1064,
5851,
4974,
2545,
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... |
mojombo/chronic | lib/chronic/dictionary.rb | Chronic.Dictionary.definitions | def definitions
defined_items.each_with_object({}) do |word, defs|
word_type = "#{word.capitalize.to_s + 'Definitions'}"
defs[word] = Chronic.const_get(word_type).new(options).definitions
end
end | ruby | def definitions
defined_items.each_with_object({}) do |word, defs|
word_type = "#{word.capitalize.to_s + 'Definitions'}"
defs[word] = Chronic.const_get(word_type).new(options).definitions
end
end | [
"def",
"definitions",
"defined_items",
".",
"each_with_object",
"(",
"{",
"}",
")",
"do",
"|",
"word",
",",
"defs",
"|",
"word_type",
"=",
"\"#{word.capitalize.to_s + 'Definitions'}\"",
"defs",
"[",
"word",
"]",
"=",
"Chronic",
".",
"const_get",
"(",
"word_type"... | returns a hash of each word's Definitions | [
"returns",
"a",
"hash",
"of",
"each",
"word",
"s",
"Definitions"
] | 2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c | https://github.com/mojombo/chronic/blob/2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c/lib/chronic/dictionary.rb#L14-L19 | train | Returns the array of definitions for the current language | [
30522,
13366,
15182,
4225,
1035,
5167,
1012,
2169,
1035,
2007,
1035,
4874,
1006,
1063,
1065,
1007,
2079,
1064,
2773,
1010,
13366,
2015,
1064,
2773,
1035,
2828,
1027,
1000,
1001,
1063,
2773,
1012,
3007,
4697,
1012,
2000,
1035,
1055,
1009,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | fastlane_core/lib/fastlane_core/itunes_transporter.rb | FastlaneCore.ItunesTransporter.download | def download(app_id, dir = nil)
dir ||= "/tmp"
UI.message("Going to download app metadata from App Store Connect")
command = @transporter_executor.build_download_command(@user, @password, app_id, dir, @provider_short_name)
UI.verbose(@transporter_executor.build_download_command(@user, 'YourPassword', app_id, dir, @provider_short_name))
begin
result = @transporter_executor.execute(command, ItunesTransporter.hide_transporter_output?)
rescue TransporterRequiresApplicationSpecificPasswordError => ex
handle_two_step_failure(ex)
return download(app_id, dir)
end
return result if Helper.test?
itmsp_path = File.join(dir, "#{app_id}.itmsp")
successful = result && File.directory?(itmsp_path)
if successful
UI.success("✅ Successfully downloaded the latest package from App Store Connect to #{itmsp_path}")
else
handle_error(@password)
end
successful
end | ruby | def download(app_id, dir = nil)
dir ||= "/tmp"
UI.message("Going to download app metadata from App Store Connect")
command = @transporter_executor.build_download_command(@user, @password, app_id, dir, @provider_short_name)
UI.verbose(@transporter_executor.build_download_command(@user, 'YourPassword', app_id, dir, @provider_short_name))
begin
result = @transporter_executor.execute(command, ItunesTransporter.hide_transporter_output?)
rescue TransporterRequiresApplicationSpecificPasswordError => ex
handle_two_step_failure(ex)
return download(app_id, dir)
end
return result if Helper.test?
itmsp_path = File.join(dir, "#{app_id}.itmsp")
successful = result && File.directory?(itmsp_path)
if successful
UI.success("✅ Successfully downloaded the latest package from App Store Connect to #{itmsp_path}")
else
handle_error(@password)
end
successful
end | [
"def",
"download",
"(",
"app_id",
",",
"dir",
"=",
"nil",
")",
"dir",
"||=",
"\"/tmp\"",
"UI",
".",
"message",
"(",
"\"Going to download app metadata from App Store Connect\"",
")",
"command",
"=",
"@transporter_executor",
".",
"build_download_command",
"(",
"@user",
... | Returns a new instance of the iTunesTransporter.
If no username or password given, it will be taken from
the #{CredentialsManager::AccountManager}
@param use_shell_script if true, forces use of the iTMSTransporter shell script.
if false, allows a direct call to the iTMSTransporter Java app (preferred).
see: https://github.com/fastlane/fastlane/pull/4003
@param provider_short_name The provider short name to be given to the iTMSTransporter to identify the
correct team for this work. The provider short name is usually your Developer
Portal team ID, but in certain cases it is different!
see: https://github.com/fastlane/fastlane/issues/1524#issuecomment-196370628
for more information about how to use the iTMSTransporter to list your provider
short names
Downloads the latest version of the app metadata package from iTC.
@param app_id [Integer] The unique App ID
@param dir [String] the path in which the package file should be stored
@return (Bool) True if everything worked fine
@raise [Deliver::TransporterTransferError] when something went wrong
when transferring | [
"Returns",
"a",
"new",
"instance",
"of",
"the",
"iTunesTransporter",
".",
"If",
"no",
"username",
"or",
"password",
"given",
"it",
"will",
"be",
"taken",
"from",
"the",
"#",
"{",
"CredentialsManager",
"::",
"AccountManager",
"}"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/fastlane_core/lib/fastlane_core/itunes_transporter.rb#L376-L402 | train | Download the app metadata from the App Store Connect | [
30522,
13366,
8816,
1006,
10439,
1035,
8909,
1010,
16101,
1027,
9152,
2140,
1007,
16101,
1064,
1064,
1027,
1000,
1013,
1056,
8737,
1000,
21318,
1012,
4471,
1006,
1000,
2183,
2000,
8816,
10439,
27425,
2013,
10439,
3573,
7532,
1000,
1007,
309... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb | Azure::SQL::Mgmt::V2015_05_01_preview.SyncGroups.begin_refresh_hub_schema_with_http_info | def begin_refresh_hub_schema_with_http_info(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil)
begin_refresh_hub_schema_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:custom_headers).value!
end | ruby | def begin_refresh_hub_schema_with_http_info(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil)
begin_refresh_hub_schema_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:custom_headers).value!
end | [
"def",
"begin_refresh_hub_schema_with_http_info",
"(",
"resource_group_name",
",",
"server_name",
",",
"database_name",
",",
"sync_group_name",
",",
"custom_headers",
":",
"nil",
")",
"begin_refresh_hub_schema_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"da... | Refreshes a hub database schema.
@param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param server_name [String] The name of the server.
@param database_name [String] The name of the database on which the sync
group is hosted.
@param sync_group_name [String] The name of the sync group.
@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. | [
"Refreshes",
"a",
"hub",
"database",
"schema",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb#L1002-L1004 | train | Refresh hub schema. | [
30522,
13366,
4088,
1035,
25416,
21898,
1035,
9594,
1035,
8040,
28433,
1035,
2007,
30524,
8241,
1035,
2171,
1010,
7809,
1035,
2171,
1010,
26351,
1035,
2177,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
1035,
2541... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2019-03-01/generated/azure_mgmt_compute/virtual_machine_scale_set_extensions.rb | Azure::Compute::Mgmt::V2019_03_01.VirtualMachineScaleSetExtensions.create_or_update | def create_or_update(resource_group_name, vm_scale_set_name, vmss_extension_name, extension_parameters, custom_headers:nil)
response = create_or_update_async(resource_group_name, vm_scale_set_name, vmss_extension_name, extension_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_or_update(resource_group_name, vm_scale_set_name, vmss_extension_name, extension_parameters, custom_headers:nil)
response = create_or_update_async(resource_group_name, vm_scale_set_name, vmss_extension_name, extension_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_or_update",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"vmss_extension_name",
",",
"extension_parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_or_update_async",
"(",
"resource_group_name",
",",
"vm_scale_set_name",... | The operation to create or update an extension.
@param resource_group_name [String] The name of the resource group.
@param vm_scale_set_name [String] The name of the VM scale set where the
extension should be create or updated.
@param vmss_extension_name [String] The name of the VM scale set extension.
@param extension_parameters [VirtualMachineScaleSetExtension] Parameters
supplied to the Create VM scale set Extension operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [VirtualMachineScaleSetExtension] operation results. | [
"The",
"operation",
"to",
"create",
"or",
"update",
"an",
"extension",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2019-03-01/generated/azure_mgmt_compute/virtual_machine_scale_set_extensions.rb#L38-L41 | train | Creates or updates an extension. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
4094,
1035,
2275,
1035,
2171,
1010,
1058,
5244,
2015,
1035,
5331,
1035,
2171,
1010,
5331,
1035,
11709,
1010,
7661,
1035,
20346,
2015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mongodb/mongoid | lib/mongoid/shardable.rb | Mongoid.Shardable.shard_key_selector | def shard_key_selector
selector = {}
shard_key_fields.each do |field|
selector[field.to_s] = new_record? ? send(field) : attribute_was(field)
end
selector
end | ruby | def shard_key_selector
selector = {}
shard_key_fields.each do |field|
selector[field.to_s] = new_record? ? send(field) : attribute_was(field)
end
selector
end | [
"def",
"shard_key_selector",
"selector",
"=",
"{",
"}",
"shard_key_fields",
".",
"each",
"do",
"|",
"field",
"|",
"selector",
"[",
"field",
".",
"to_s",
"]",
"=",
"new_record?",
"?",
"send",
"(",
"field",
")",
":",
"attribute_was",
"(",
"field",
")",
"en... | Get the document selector with the defined shard keys.
@example Get the selector for the shard keys.
person.shard_key_selector
@return [ Hash ] The shard key selector.
@since 2.0.0 | [
"Get",
"the",
"document",
"selector",
"with",
"the",
"defined",
"shard",
"keys",
"."
] | 56976e32610f4c2450882b0bfe14da099f0703f4 | https://github.com/mongodb/mongoid/blob/56976e32610f4c2450882b0bfe14da099f0703f4/lib/mongoid/shardable.rb#L38-L44 | train | Returns the shard key selector for this record. | [
30522,
13366,
21146,
4103,
1035,
3145,
1035,
27000,
27000,
1027,
1063,
1065,
21146,
4103,
1035,
3145,
1035,
4249,
1012,
2169,
2079,
1064,
2492,
1064,
27000,
1031,
2492,
1012,
2000,
1035,
1055,
1033,
1027,
2047,
1035,
2501,
1029,
1029,
4604,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activesupport/lib/active_support/inflector/methods.rb | ActiveSupport.Inflector.apply_inflections | def apply_inflections(word, rules, locale = :en)
result = word.to_s.dup
if word.empty? || inflections(locale).uncountables.uncountable?(result)
result
else
rules.each { |(rule, replacement)| break if result.sub!(rule, replacement) }
result
end
end | ruby | def apply_inflections(word, rules, locale = :en)
result = word.to_s.dup
if word.empty? || inflections(locale).uncountables.uncountable?(result)
result
else
rules.each { |(rule, replacement)| break if result.sub!(rule, replacement) }
result
end
end | [
"def",
"apply_inflections",
"(",
"word",
",",
"rules",
",",
"locale",
"=",
":en",
")",
"result",
"=",
"word",
".",
"to_s",
".",
"dup",
"if",
"word",
".",
"empty?",
"||",
"inflections",
"(",
"locale",
")",
".",
"uncountables",
".",
"uncountable?",
"(",
... | Applies inflection rules for +singularize+ and +pluralize+.
If passed an optional +locale+ parameter, the uncountables will be
found for that locale.
apply_inflections('post', inflections.plurals, :en) # => "posts"
apply_inflections('posts', inflections.singulars, :en) # => "post" | [
"Applies",
"inflection",
"rules",
"for",
"+",
"singularize",
"+",
"and",
"+",
"pluralize",
"+",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/inflector/methods.rb#L387-L396 | train | Apply inflections to a word | [
30522,
13366,
6611,
1035,
1999,
21031,
22014,
1006,
2773,
1010,
3513,
1010,
2334,
2063,
1027,
1024,
4372,
1007,
2765,
1027,
2773,
1012,
2000,
1035,
1055,
1012,
4241,
2361,
2065,
2773,
1012,
4064,
1029,
1064,
1064,
1999,
21031,
22014,
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... |
uken/fluent-plugin-elasticsearch | lib/fluent/plugin/out_elasticsearch.rb | Fluent::Plugin.ElasticsearchOutput.get_parent_of | def get_parent_of(record, path)
parent_object = path[0..-2].reduce(record) { |a, e| a.is_a?(Hash) ? a[e] : nil }
[parent_object, path[-1]]
end | ruby | def get_parent_of(record, path)
parent_object = path[0..-2].reduce(record) { |a, e| a.is_a?(Hash) ? a[e] : nil }
[parent_object, path[-1]]
end | [
"def",
"get_parent_of",
"(",
"record",
",",
"path",
")",
"parent_object",
"=",
"path",
"[",
"0",
"..",
"-",
"2",
"]",
".",
"reduce",
"(",
"record",
")",
"{",
"|",
"a",
",",
"e",
"|",
"a",
".",
"is_a?",
"(",
"Hash",
")",
"?",
"a",
"[",
"e",
"]... | returns [parent, child_key] of child described by path array in record's tree
returns [nil, child_key] if path doesnt exist in record | [
"returns",
"[",
"parent",
"child_key",
"]",
"of",
"child",
"described",
"by",
"path",
"array",
"in",
"record",
"s",
"tree",
"returns",
"[",
"nil",
"child_key",
"]",
"if",
"path",
"doesnt",
"exist",
"in",
"record"
] | 9f9e51ddd012acb36c7f9d7a16e00970004098bc | https://github.com/uken/fluent-plugin-elasticsearch/blob/9f9e51ddd012acb36c7f9d7a16e00970004098bc/lib/fluent/plugin/out_elasticsearch.rb#L702-L705 | train | Get the parent of the given record | [
30522,
13366,
2131,
1035,
6687,
1035,
1997,
1006,
2501,
1010,
4130,
1007,
6687,
1035,
4874,
1027,
4130,
1031,
1014,
1012,
1012,
1011,
1016,
1033,
1012,
5547,
1006,
2501,
1007,
1063,
1064,
1037,
1010,
1041,
1064,
1037,
1012,
2003,
1035,
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... |
jekyll/jekyll | lib/jekyll/utils.rb | Jekyll.Utils.has_liquid_construct? | def has_liquid_construct?(content)
return false if content.nil? || content.empty?
content.include?("{%") || content.include?("{{")
end | ruby | def has_liquid_construct?(content)
return false if content.nil? || content.empty?
content.include?("{%") || content.include?("{{")
end | [
"def",
"has_liquid_construct?",
"(",
"content",
")",
"return",
"false",
"if",
"content",
".",
"nil?",
"||",
"content",
".",
"empty?",
"content",
".",
"include?",
"(",
"\"{%\"",
")",
"||",
"content",
".",
"include?",
"(",
"\"{{\"",
")",
"end"
] | Determine whether the given content string contains Liquid Tags or Vaiables
Returns true is the string contains sequences of `{%` or `{{` | [
"Determine",
"whether",
"the",
"given",
"content",
"string",
"contains",
"Liquid",
"Tags",
"or",
"Vaiables"
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/utils.rb#L146-L150 | train | Returns true if the given content has a liquid construct. | [
30522,
13366,
2038,
1035,
6381,
1035,
9570,
1029,
1006,
4180,
1007,
2709,
6270,
2065,
4180,
1012,
9152,
2140,
1029,
1064,
1064,
4180,
1012,
4064,
1029,
4180,
1012,
2421,
1029,
1006,
1000,
1063,
1003,
1000,
1007,
1064,
1064,
4180,
1012,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jekyll/jekyll | lib/jekyll/cleaner.rb | Jekyll.Cleaner.keep_file_regex | def keep_file_regex
%r!\A#{Regexp.quote(site.dest)}\/(#{Regexp.union(site.keep_files).source})!
end | ruby | def keep_file_regex
%r!\A#{Regexp.quote(site.dest)}\/(#{Regexp.union(site.keep_files).source})!
end | [
"def",
"keep_file_regex",
"%r!",
"\\A",
"#{",
"Regexp",
".",
"quote",
"(",
"site",
".",
"dest",
")",
"}",
"\\/",
"#{",
"Regexp",
".",
"union",
"(",
"site",
".",
"keep_files",
")",
".",
"source",
"}",
"!",
"end"
] | Private: Creates a regular expression from the config's keep_files array
Examples
['.git','.svn'] with site.dest "/myblog/_site" creates
the following regex: /\A\/myblog\/_site\/(\.git|\/.svn)/
Returns the regular expression | [
"Private",
":",
"Creates",
"a",
"regular",
"expression",
"from",
"the",
"config",
"s",
"keep_files",
"array"
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/cleaner.rb#L107-L109 | train | Returns the regex that matches the keep_files option in the site. | [
30522,
13366,
2562,
1035,
5371,
1035,
19723,
10288,
1003,
1054,
999,
1032,
1037,
1001,
1063,
19723,
10288,
2361,
1012,
14686,
1006,
2609,
1012,
4078,
2102,
1007,
1065,
1032,
1013,
1006,
1001,
1063,
19723,
10288,
2361,
1012,
2586,
1006,
2609... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
anycable/anycable | lib/anycable/rpc_handler.rb | AnyCable.RPCHandler.connect | def connect(request, _unused_call)
logger.debug("RPC Connect: #{request.inspect}")
socket = build_socket(env: rack_env(request))
connection = factory.call(socket)
connection.handle_open
if socket.closed?
AnyCable::ConnectionResponse.new(status: AnyCable::Status::FAILURE)
else
AnyCable::ConnectionResponse.new(
status: AnyCable::Status::SUCCESS,
identifiers: connection.identifiers_json,
transmissions: socket.transmissions
)
end
rescue StandardError => exp
notify_exception(exp, :connect, request)
AnyCable::ConnectionResponse.new(
status: AnyCable::Status::ERROR,
error_msg: exp.message
)
end | ruby | def connect(request, _unused_call)
logger.debug("RPC Connect: #{request.inspect}")
socket = build_socket(env: rack_env(request))
connection = factory.call(socket)
connection.handle_open
if socket.closed?
AnyCable::ConnectionResponse.new(status: AnyCable::Status::FAILURE)
else
AnyCable::ConnectionResponse.new(
status: AnyCable::Status::SUCCESS,
identifiers: connection.identifiers_json,
transmissions: socket.transmissions
)
end
rescue StandardError => exp
notify_exception(exp, :connect, request)
AnyCable::ConnectionResponse.new(
status: AnyCable::Status::ERROR,
error_msg: exp.message
)
end | [
"def",
"connect",
"(",
"request",
",",
"_unused_call",
")",
"logger",
".",
"debug",
"(",
"\"RPC Connect: #{request.inspect}\"",
")",
"socket",
"=",
"build_socket",
"(",
"env",
":",
"rack_env",
"(",
"request",
")",
")",
"connection",
"=",
"factory",
".",
"call"... | Handle connection request from WebSocket server | [
"Handle",
"connection",
"request",
"from",
"WebSocket",
"server"
] | d7515e8e034d42e86ebeb09786a92aad2a11b25f | https://github.com/anycable/anycable/blob/d7515e8e034d42e86ebeb09786a92aad2a11b25f/lib/anycable/rpc_handler.rb#L14-L39 | train | Connect to the server | [
30522,
13366,
7532,
1006,
5227,
1010,
1035,
15171,
1035,
2655,
1007,
8833,
4590,
1012,
2139,
8569,
2290,
1006,
1000,
1054,
15042,
7532,
1024,
1001,
1063,
5227,
1012,
22459,
1065,
1000,
1007,
22278,
1027,
3857,
1035,
22278,
1006,
4372,
2615,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.create_or_update | def create_or_update(resource_group_name, activity_log_alert_name, activity_log_alert, custom_headers:nil)
response = create_or_update_async(resource_group_name, activity_log_alert_name, activity_log_alert, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_or_update(resource_group_name, activity_log_alert_name, activity_log_alert, custom_headers:nil)
response = create_or_update_async(resource_group_name, activity_log_alert_name, activity_log_alert, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_or_update",
"(",
"resource_group_name",
",",
"activity_log_alert_name",
",",
"activity_log_alert",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_or_update_async",
"(",
"resource_group_name",
",",
"activity_log_alert_name",
",",
"activity_lo... | Create a new activity log alert or update an existing one.
@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 [ActivityLogAlertResource] The activity log alert
to create or use for the update.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ActivityLogAlertResource] operation results. | [
"Create",
"a",
"new",
"activity",
"log",
"alert",
"or",
"update",
"an",
"existing",
"one",
"."
] | 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#L36-L39 | train | Creates or updates an activity log alert. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4023,
1035,
8833,
1035,
9499,
1035,
2171,
1010,
4023,
1035,
8833,
1035,
9499,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3443,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
randym/axlsx | lib/axlsx/workbook/worksheet/cell.rb | Axlsx.Cell.autowidth | def autowidth
return if is_formula? || value.nil?
if contains_rich_text?
string_width('', font_size) + value.autowidth
elsif styles.cellXfs[style].alignment && styles.cellXfs[style].alignment.wrap_text
max_width = 0
value.to_s.split(/\r?\n/).each do |line|
width = string_width(line, font_size)
max_width = width if width > max_width
end
max_width
else
string_width(value, font_size)
end
end | ruby | def autowidth
return if is_formula? || value.nil?
if contains_rich_text?
string_width('', font_size) + value.autowidth
elsif styles.cellXfs[style].alignment && styles.cellXfs[style].alignment.wrap_text
max_width = 0
value.to_s.split(/\r?\n/).each do |line|
width = string_width(line, font_size)
max_width = width if width > max_width
end
max_width
else
string_width(value, font_size)
end
end | [
"def",
"autowidth",
"return",
"if",
"is_formula?",
"||",
"value",
".",
"nil?",
"if",
"contains_rich_text?",
"string_width",
"(",
"''",
",",
"font_size",
")",
"+",
"value",
".",
"autowidth",
"elsif",
"styles",
".",
"cellXfs",
"[",
"style",
"]",
".",
"alignmen... | Attempts to determine the correct width for this cell's content
@return [Float] | [
"Attempts",
"to",
"determine",
"the",
"correct",
"width",
"for",
"this",
"cell",
"s",
"content"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/worksheet/cell.rb#L354-L368 | train | autowidth
returns the width of the formula. | [
30522,
13366,
8285,
9148,
11927,
2232,
2709,
2065,
2003,
1035,
5675,
1029,
1064,
1064,
3643,
1012,
9152,
30524,
1031,
2806,
1033,
1012,
12139,
1004,
1004,
6782,
1012,
3526,
2595,
10343,
1031,
2806,
1033,
1012,
12139,
1012,
10236,
1035,
3793... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.generate_plugin_set | def generate_plugin_set(*args)
plugin_path = args.detect{|i| i.is_a?(Pathname) } || plugin_gem_path
skip = args.detect{|i| i.is_a?(Array) } || []
plugin_set = PluginSet.new
@logger.debug("Generating new plugin set instance. Skip gems - #{skip}")
Dir.glob(plugin_path.join('specifications/*.gemspec').to_s).each do |spec_path|
spec = Gem::Specification.load(spec_path)
desired_spec_path = File.join(spec.gem_dir, "#{spec.name}.gemspec")
# Vendor set requires the spec to be within the gem directory. Some gems will package their
# spec file, and that's not what we want to load.
if !File.exist?(desired_spec_path) || !FileUtils.cmp(spec.spec_file, desired_spec_path)
File.write(desired_spec_path, spec.to_ruby)
end
next if skip.include?(spec.name) || skip.include?(spec.full_name)
plugin_set.add_vendor_gem(spec.name, spec.gem_dir)
end
plugin_set
end | ruby | def generate_plugin_set(*args)
plugin_path = args.detect{|i| i.is_a?(Pathname) } || plugin_gem_path
skip = args.detect{|i| i.is_a?(Array) } || []
plugin_set = PluginSet.new
@logger.debug("Generating new plugin set instance. Skip gems - #{skip}")
Dir.glob(plugin_path.join('specifications/*.gemspec').to_s).each do |spec_path|
spec = Gem::Specification.load(spec_path)
desired_spec_path = File.join(spec.gem_dir, "#{spec.name}.gemspec")
# Vendor set requires the spec to be within the gem directory. Some gems will package their
# spec file, and that's not what we want to load.
if !File.exist?(desired_spec_path) || !FileUtils.cmp(spec.spec_file, desired_spec_path)
File.write(desired_spec_path, spec.to_ruby)
end
next if skip.include?(spec.name) || skip.include?(spec.full_name)
plugin_set.add_vendor_gem(spec.name, spec.gem_dir)
end
plugin_set
end | [
"def",
"generate_plugin_set",
"(",
"*",
"args",
")",
"plugin_path",
"=",
"args",
".",
"detect",
"{",
"|",
"i",
"|",
"i",
".",
"is_a?",
"(",
"Pathname",
")",
"}",
"||",
"plugin_gem_path",
"skip",
"=",
"args",
".",
"detect",
"{",
"|",
"i",
"|",
"i",
... | Generate the plugin resolver set. Optionally provide specification names (short or
full) that should be ignored
@param [Pathname] path to plugins
@param [Array<String>] gems to skip
@return [PluginSet] | [
"Generate",
"the",
"plugin",
"resolver",
"set",
".",
"Optionally",
"provide",
"specification",
"names",
"(",
"short",
"or",
"full",
")",
"that",
"should",
"be",
"ignored"
] | c22a145c59790c098f95d50141d9afb48e1ef55f | https://github.com/hashicorp/vagrant/blob/c22a145c59790c098f95d50141d9afb48e1ef55f/lib/vagrant/bundler.rb#L463-L480 | train | Generate a new plugin set | [
30522,
13366,
9699,
1035,
13354,
2378,
1035,
2275,
1006,
1008,
12098,
5620,
1007,
13354,
2378,
1035,
4130,
1027,
12098,
5620,
1012,
11487,
1063,
1064,
1045,
1064,
1045,
1012,
2003,
1035,
1037,
1029,
1006,
4130,
18442,
1007,
1065,
1064,
1064... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb | Aws::EC2.Resource.create_route_table | def create_route_table(options = {})
resp = @client.create_route_table(options)
RouteTable.new(
id: resp.data.route_table.route_table_id,
data: resp.data.route_table,
client: @client
)
end | ruby | def create_route_table(options = {})
resp = @client.create_route_table(options)
RouteTable.new(
id: resp.data.route_table.route_table_id,
data: resp.data.route_table,
client: @client
)
end | [
"def",
"create_route_table",
"(",
"options",
"=",
"{",
"}",
")",
"resp",
"=",
"@client",
".",
"create_route_table",
"(",
"options",
")",
"RouteTable",
".",
"new",
"(",
"id",
":",
"resp",
".",
"data",
".",
"route_table",
".",
"route_table_id",
",",
"data",
... | @example Request syntax with placeholder values
routetable = ec2.create_route_table({
dry_run: false,
vpc_id: "String", # required
})
@param [Hash] options ({})
@option options [Boolean] :dry_run
Checks whether you have the required permissions for the action,
without actually making the request, and provides an error response.
If you have the required permissions, the error response is
`DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
@option options [required, String] :vpc_id
The ID of the VPC.
@return [RouteTable] | [
"@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#L671-L678 | train | Create a route table | [
30522,
13366,
3443,
1035,
2799,
1035,
2795,
1006,
7047,
1027,
1063,
1065,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
3443,
1035,
2799,
1035,
2795,
1006,
7047,
1007,
2799,
10880,
1012,
2047,
1006,
8909,
1024,
24501,
2361,
1012,
2951,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | fastlane_core/lib/fastlane_core/configuration/configuration.rb | FastlaneCore.Configuration.set | def set(key, value)
UI.crash!("Key '#{key}' must be a symbol. Example :#{key}.") unless key.kind_of?(Symbol)
option = option_for_key(key)
unless option
UI.user_error!("Could not find option '#{key}' in the list of available options: #{@available_options.collect(&:key).join(', ')}")
end
option.verify!(value)
@values[key] = value
true
end | ruby | def set(key, value)
UI.crash!("Key '#{key}' must be a symbol. Example :#{key}.") unless key.kind_of?(Symbol)
option = option_for_key(key)
unless option
UI.user_error!("Could not find option '#{key}' in the list of available options: #{@available_options.collect(&:key).join(', ')}")
end
option.verify!(value)
@values[key] = value
true
end | [
"def",
"set",
"(",
"key",
",",
"value",
")",
"UI",
".",
"crash!",
"(",
"\"Key '#{key}' must be a symbol. Example :#{key}.\"",
")",
"unless",
"key",
".",
"kind_of?",
"(",
"Symbol",
")",
"option",
"=",
"option_for_key",
"(",
"key",
")",
"unless",
"option",
"UI",... | rubocop:enable Metrics/PerceivedComplexity
Overwrites or sets a new value for a given key
@param key [Symbol] Must be a symbol | [
"rubocop",
":",
"enable",
"Metrics",
"/",
"PerceivedComplexity",
"Overwrites",
"or",
"sets",
"a",
"new",
"value",
"for",
"a",
"given",
"key"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/fastlane_core/lib/fastlane_core/configuration/configuration.rb#L266-L278 | train | Set the value of a key. | [
30522,
13366,
2275,
1006,
3145,
1010,
3643,
1007,
21318,
1012,
5823,
999,
1006,
1000,
3145,
1005,
1001,
1063,
3145,
1065,
1005,
2442,
2022,
1037,
6454,
1012,
2742,
1024,
1001,
1063,
3145,
1065,
1012,
1000,
1007,
4983,
3145,
1012,
2785,
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... |
puppetlabs/puppet | lib/puppet/util.rb | Puppet.Util.exit_on_fail | def exit_on_fail(message, code = 1)
yield
# First, we need to check and see if we are catching a SystemExit error. These will be raised
# when we daemonize/fork, and they do not necessarily indicate a failure case.
rescue SystemExit => err
raise err
# Now we need to catch *any* other kind of exception, because we may be calling third-party
# code (e.g. webrick), and we have no idea what they might throw.
rescue Exception => err
## NOTE: when debugging spec failures, these two lines can be very useful
#puts err.inspect
#puts Puppet::Util.pretty_backtrace(err.backtrace)
Puppet.log_exception(err, "#{message}: #{err}")
Puppet::Util::Log.force_flushqueue()
exit(code)
end | ruby | def exit_on_fail(message, code = 1)
yield
# First, we need to check and see if we are catching a SystemExit error. These will be raised
# when we daemonize/fork, and they do not necessarily indicate a failure case.
rescue SystemExit => err
raise err
# Now we need to catch *any* other kind of exception, because we may be calling third-party
# code (e.g. webrick), and we have no idea what they might throw.
rescue Exception => err
## NOTE: when debugging spec failures, these two lines can be very useful
#puts err.inspect
#puts Puppet::Util.pretty_backtrace(err.backtrace)
Puppet.log_exception(err, "#{message}: #{err}")
Puppet::Util::Log.force_flushqueue()
exit(code)
end | [
"def",
"exit_on_fail",
"(",
"message",
",",
"code",
"=",
"1",
")",
"yield",
"# First, we need to check and see if we are catching a SystemExit error. These will be raised",
"# when we daemonize/fork, and they do not necessarily indicate a failure case.",
"rescue",
"SystemExit",
"=>",
... | Executes a block of code, wrapped with some special exception handling. Causes the ruby interpreter to
exit if the block throws an exception.
@api public
@param [String] message a message to log if the block fails
@param [Integer] code the exit code that the ruby interpreter should return if the block fails
@yield | [
"Executes",
"a",
"block",
"of",
"code",
"wrapped",
"with",
"some",
"special",
"exception",
"handling",
".",
"Causes",
"the",
"ruby",
"interpreter",
"to",
"exit",
"if",
"the",
"block",
"throws",
"an",
"exception",
"."
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/util.rb#L683-L699 | train | This method is called by the exit_on_fail method of the spec. | [
30522,
13366,
6164,
1035,
2006,
1035,
8246,
1006,
4471,
1010,
3642,
1027,
1015,
1007,
10750,
1001,
2034,
1010,
2057,
2342,
2000,
4638,
1998,
2156,
2065,
2057,
2024,
9105,
1037,
2291,
10288,
4183,
7561,
1012,
2122,
2097,
2022,
2992,
1001,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ankane/pgsync | lib/pgsync/table_sync.rb | PgSync.TableSync.apply_strategy | def apply_strategy(rule, table, column, primary_key)
if rule.is_a?(Hash)
if rule.key?("value")
escape(rule["value"])
elsif rule.key?("statement")
rule["statement"]
else
raise PgSync::Error, "Unknown rule #{rule.inspect} for column #{column}"
end
else
case rule
when "untouched"
quote_ident(column)
when "unique_email"
"'email' || #{quoted_primary_key(table, primary_key, rule)}::text || '@example.org'"
when "unique_phone"
"(#{quoted_primary_key(table, primary_key, rule)}::bigint + 1000000000)::text"
when "unique_secret"
"'secret' || #{quoted_primary_key(table, primary_key, rule)}::text"
when "random_int", "random_number"
"(RANDOM() * 100)::int"
when "random_date"
"date '1970-01-01' + (RANDOM() * 10000)::int"
when "random_time"
"NOW() - (RANDOM() * 100000000)::int * INTERVAL '1 second'"
when "random_ip"
"(1 + RANDOM() * 254)::int::text || '.0.0.1'"
when "random_letter"
"chr(65 + (RANDOM() * 26)::int)"
when "random_string"
"RIGHT(MD5(RANDOM()::text), 10)"
when "null", nil
"NULL"
else
raise PgSync::Error, "Unknown rule #{rule} for column #{column}"
end
end
end | ruby | def apply_strategy(rule, table, column, primary_key)
if rule.is_a?(Hash)
if rule.key?("value")
escape(rule["value"])
elsif rule.key?("statement")
rule["statement"]
else
raise PgSync::Error, "Unknown rule #{rule.inspect} for column #{column}"
end
else
case rule
when "untouched"
quote_ident(column)
when "unique_email"
"'email' || #{quoted_primary_key(table, primary_key, rule)}::text || '@example.org'"
when "unique_phone"
"(#{quoted_primary_key(table, primary_key, rule)}::bigint + 1000000000)::text"
when "unique_secret"
"'secret' || #{quoted_primary_key(table, primary_key, rule)}::text"
when "random_int", "random_number"
"(RANDOM() * 100)::int"
when "random_date"
"date '1970-01-01' + (RANDOM() * 10000)::int"
when "random_time"
"NOW() - (RANDOM() * 100000000)::int * INTERVAL '1 second'"
when "random_ip"
"(1 + RANDOM() * 254)::int::text || '.0.0.1'"
when "random_letter"
"chr(65 + (RANDOM() * 26)::int)"
when "random_string"
"RIGHT(MD5(RANDOM()::text), 10)"
when "null", nil
"NULL"
else
raise PgSync::Error, "Unknown rule #{rule} for column #{column}"
end
end
end | [
"def",
"apply_strategy",
"(",
"rule",
",",
"table",
",",
"column",
",",
"primary_key",
")",
"if",
"rule",
".",
"is_a?",
"(",
"Hash",
")",
"if",
"rule",
".",
"key?",
"(",
"\"value\"",
")",
"escape",
"(",
"rule",
"[",
"\"value\"",
"]",
")",
"elsif",
"r... | TODO wildcard rules | [
"TODO",
"wildcard",
"rules"
] | 2aa4741538ca09070efe86de6dd1281e13a1b5c5 | https://github.com/ankane/pgsync/blob/2aa4741538ca09070efe86de6dd1281e13a1b5c5/lib/pgsync/table_sync.rb#L168-L205 | train | Apply a strategy to a column | [
30522,
13366,
6611,
1035,
5656,
1006,
3627,
1010,
2795,
1010,
5930,
1010,
3078,
1035,
3145,
1007,
2065,
3627,
30524,
1006,
1000,
3643,
1000,
1007,
4019,
1006,
3627,
1031,
1000,
3643,
1000,
1033,
1007,
3449,
5332,
2546,
3627,
1012,
3145,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
piotrmurach/github | lib/github_api/client/gists.rb | Github.Client::Gists.list | def list(*args)
params = arguments(args).params
response = if (user = params.delete('user'))
get_request("/users/#{user}/gists", params)
elsif args.map(&:to_s).include?('public')
get_request("/gists/public", params)
else
get_request("/gists", params)
end
return response unless block_given?
response.each { |el| yield el }
end | ruby | def list(*args)
params = arguments(args).params
response = if (user = params.delete('user'))
get_request("/users/#{user}/gists", params)
elsif args.map(&:to_s).include?('public')
get_request("/gists/public", params)
else
get_request("/gists", params)
end
return response unless block_given?
response.each { |el| yield el }
end | [
"def",
"list",
"(",
"*",
"args",
")",
"params",
"=",
"arguments",
"(",
"args",
")",
".",
"params",
"response",
"=",
"if",
"(",
"user",
"=",
"params",
".",
"delete",
"(",
"'user'",
")",
")",
"get_request",
"(",
"\"/users/#{user}/gists\"",
",",
"params",
... | List a user's gists
@see https://developer.github.com/v3/gists/#list-a-users-gists
@example
github = Github.new
github.gists.list user: 'user-name'
List the authenticated user’s gists or if called anonymously,
this will returns all public gists
@example
github = Github.new oauth_token: '...'
github.gists.list
List all public gists
@see https://developer.github.com/v3/gists/#list-all-public-gists
github = Github.new
github.gists.list :public
@return [Hash]
@api public | [
"List",
"a",
"user",
"s",
"gists"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/gists.rb#L38-L50 | train | Get a list of all gists | [
30522,
13366,
2862,
1006,
1008,
12098,
5620,
1007,
11498,
5244,
1027,
9918,
1006,
12098,
5620,
1007,
1012,
11498,
5244,
3433,
1027,
2065,
1006,
5310,
1027,
11498,
5244,
1012,
3972,
12870,
1006,
1005,
5310,
1005,
1007,
1007,
2131,
1035,
5227... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_cdn/lib/2016-04-02/generated/azure_mgmt_cdn/profiles.rb | Azure::CDN::Mgmt::V2016_04_02.Profiles.delete_if_exists | def delete_if_exists(profile_name, resource_group_name, custom_headers:nil)
response = delete_if_exists_async(profile_name, resource_group_name, custom_headers:custom_headers).value!
nil
end | ruby | def delete_if_exists(profile_name, resource_group_name, custom_headers:nil)
response = delete_if_exists_async(profile_name, resource_group_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"delete_if_exists",
"(",
"profile_name",
",",
"resource_group_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_if_exists_async",
"(",
"profile_name",
",",
"resource_group_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
... | Deletes an existing CDN profile with the specified parameters. Deleting a
profile will result in the deletion of all subresources including endpoints,
origins and custom domains.
@param profile_name [String] Name of the CDN profile within the resource
group.
@param resource_group_name [String] Name of the resource group within the
Azure subscription.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Deletes",
"an",
"existing",
"CDN",
"profile",
"with",
"the",
"specified",
"parameters",
".",
"Deleting",
"a",
"profile",
"will",
"result",
"in",
"the",
"deletion",
"of",
"all",
"subresources",
"including",
"endpoints",
"origins",
"and",
"custom",
"domains",
"."... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_cdn/lib/2016-04-02/generated/azure_mgmt_cdn/profiles.rb#L412-L415 | train | Deletes the specified managed network interface. | [
30522,
13366,
3972,
12870,
1035,
2065,
1035,
6526,
1006,
6337,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
1035,
2065,
1035,
6526,
1035,
2004,
6038,
2278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb | Azure::Web::Mgmt::V2018_02_01.AppServiceEnvironments.update_with_http_info | def update_with_http_info(resource_group_name, name, hosting_environment_envelope, custom_headers:nil)
update_async(resource_group_name, name, hosting_environment_envelope, custom_headers:custom_headers).value!
end | ruby | def update_with_http_info(resource_group_name, name, hosting_environment_envelope, custom_headers:nil)
update_async(resource_group_name, name, hosting_environment_envelope, custom_headers:custom_headers).value!
end | [
"def",
"update_with_http_info",
"(",
"resource_group_name",
",",
"name",
",",
"hosting_environment_envelope",
",",
"custom_headers",
":",
"nil",
")",
"update_async",
"(",
"resource_group_name",
",",
"name",
",",
"hosting_environment_envelope",
",",
"custom_headers",
":cus... | Create or update an App Service Environment.
Create or update an App Service Environment.
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param name [String] Name of the App Service Environment.
@param hosting_environment_envelope [AppServiceEnvironmentPatchResource]
Configuration details of the App Service Environment.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Create",
"or",
"update",
"an",
"App",
"Service",
"Environment",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb#L451-L453 | train | Updates an existing hosting environment envelope. | [
30522,
13366,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
9936,
1035,
4044,
1035,
11255,
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... |
rails/rails | actionview/lib/action_view/renderer/partial_renderer.rb | ActionView.PartialRenderer.setup | def setup(context, options, as, block)
@options = options
@block = block
@locals = options[:locals] || {}
@details = extract_details(options)
partial = options[:partial]
if String === partial
@has_object = options.key?(:object)
@object = options[:object]
@collection = collection_from_options
@path = partial
else
@has_object = true
@object = partial
@collection = collection_from_object || collection_from_options
if @collection
paths = @collection_data = @collection.map { |o| partial_path(o, context) }
if paths.uniq.length == 1
@path = paths.first
else
paths.map! { |path| retrieve_variable(path, as).unshift(path) }
@path = nil
end
else
@path = partial_path(@object, context)
end
end
self
end | ruby | def setup(context, options, as, block)
@options = options
@block = block
@locals = options[:locals] || {}
@details = extract_details(options)
partial = options[:partial]
if String === partial
@has_object = options.key?(:object)
@object = options[:object]
@collection = collection_from_options
@path = partial
else
@has_object = true
@object = partial
@collection = collection_from_object || collection_from_options
if @collection
paths = @collection_data = @collection.map { |o| partial_path(o, context) }
if paths.uniq.length == 1
@path = paths.first
else
paths.map! { |path| retrieve_variable(path, as).unshift(path) }
@path = nil
end
else
@path = partial_path(@object, context)
end
end
self
end | [
"def",
"setup",
"(",
"context",
",",
"options",
",",
"as",
",",
"block",
")",
"@options",
"=",
"options",
"@block",
"=",
"block",
"@locals",
"=",
"options",
"[",
":locals",
"]",
"||",
"{",
"}",
"@details",
"=",
"extract_details",
"(",
"options",
")",
"... | Sets up instance variables needed for rendering a partial. This method
finds the options and details and extracts them. The method also contains
logic that handles the type of object passed in as the partial.
If +options[:partial]+ is a string, then the <tt>@path</tt> instance variable is
set to that string. Otherwise, the +options[:partial]+ object must
respond to +to_partial_path+ in order to setup the path. | [
"Sets",
"up",
"instance",
"variables",
"needed",
"for",
"rendering",
"a",
"partial",
".",
"This",
"method",
"finds",
"the",
"options",
"and",
"details",
"and",
"extracts",
"them",
".",
"The",
"method",
"also",
"contains",
"logic",
"that",
"handles",
"the",
"... | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/actionview/lib/action_view/renderer/partial_renderer.rb#L378-L411 | train | Setup the object and collection from the options hash | [
30522,
13366,
16437,
1006,
6123,
1010,
7047,
1010,
2004,
1010,
3796,
1007,
1030,
7047,
1027,
7047,
1030,
3796,
1027,
3796,
1030,
10575,
1027,
7047,
1031,
1024,
10575,
1033,
1064,
1064,
1063,
1065,
1030,
4751,
1027,
14817,
1035,
4751,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/overcommit | lib/overcommit/configuration.rb | Overcommit.Configuration.enabled_ad_hoc_hooks | def enabled_ad_hoc_hooks(hook_context)
@hash[hook_context.hook_class_name].keys.
reject { |hook_name| hook_name == 'ALL' }.
select { |hook_name| ad_hoc_hook?(hook_context, hook_name) }.
select { |hook_name| hook_enabled?(hook_context, hook_name) }
end | ruby | def enabled_ad_hoc_hooks(hook_context)
@hash[hook_context.hook_class_name].keys.
reject { |hook_name| hook_name == 'ALL' }.
select { |hook_name| ad_hoc_hook?(hook_context, hook_name) }.
select { |hook_name| hook_enabled?(hook_context, hook_name) }
end | [
"def",
"enabled_ad_hoc_hooks",
"(",
"hook_context",
")",
"@hash",
"[",
"hook_context",
".",
"hook_class_name",
"]",
".",
"keys",
".",
"reject",
"{",
"|",
"hook_name",
"|",
"hook_name",
"==",
"'ALL'",
"}",
".",
"select",
"{",
"|",
"hook_name",
"|",
"ad_hoc_ho... | Returns the ad hoc hooks that have been enabled for a hook type. | [
"Returns",
"the",
"ad",
"hoc",
"hooks",
"that",
"have",
"been",
"enabled",
"for",
"a",
"hook",
"type",
"."
] | 35d60adb41da942178b789560968e3ad030b0ac7 | https://github.com/sds/overcommit/blob/35d60adb41da942178b789560968e3ad030b0ac7/lib/overcommit/configuration.rb#L123-L128 | train | Returns a list of enabled ad hoc hooks | [
30522,
13366,
9124,
1035,
4748,
1035,
21929,
1035,
18008,
1006,
8103,
1035,
6123,
1007,
1030,
23325,
1031,
8103,
1035,
6123,
1012,
8103,
1035,
2465,
1035,
2171,
1033,
1012,
6309,
1012,
15454,
1063,
1064,
8103,
1035,
2171,
1064,
8103,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
decidim/decidim | decidim-core/app/services/decidim/resource_search.rb | Decidim.ResourceSearch.category_ids | def category_ids
component
.categories
.where(id: category_id)
.or(component.categories.where(parent_id: category_id))
.pluck(:id)
end | ruby | def category_ids
component
.categories
.where(id: category_id)
.or(component.categories.where(parent_id: category_id))
.pluck(:id)
end | [
"def",
"category_ids",
"component",
".",
"categories",
".",
"where",
"(",
"id",
":",
"category_id",
")",
".",
"or",
"(",
"component",
".",
"categories",
".",
"where",
"(",
"parent_id",
":",
"category_id",
")",
")",
".",
"pluck",
"(",
":id",
")",
"end"
] | Private: Creates an array of category ids.
It contains categories' subcategories ids as well. | [
"Private",
":",
"Creates",
"an",
"array",
"of",
"category",
"ids",
".",
"It",
"contains",
"categories",
"subcategories",
"ids",
"as",
"well",
"."
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/app/services/decidim/resource_search.rb#L58-L64 | train | Returns the category ids of the component in the hierarchy. | [
30522,
13366,
4696,
1035,
8909,
2015,
6922,
1012,
7236,
1012,
2073,
1006,
8909,
1024,
4696,
1035,
8909,
1007,
1012,
2030,
1006,
6922,
1012,
7236,
1012,
2073,
1006,
6687,
1035,
8909,
1024,
4696,
1035,
8909,
1007,
1007,
1012,
20228,
12722,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
plum-umd/rdl | lib/rdl/types/method.rb | RDL::Type.MethodType.pre_cond? | def pre_cond?(blk, slf, inst, bind, *args)
states = [[0, 0]] # [position in @arg, position in args]
preds = []
until states.empty?
formal, actual = states.pop
if formal == @args.size && actual == args.size then # Matched all actuals, no formals left over
check_arg_preds(bind, preds) if preds.size > 0
@args.each_with_index {|a,i| args[i] = block_wrap(slf, inst, a, bind, &args[i]) if a.is_a? MethodType }
if @block then
if @block.is_a? OptionalType
blk = block_wrap(slf, inst, @block.type.instantiate(inst), bind, &blk) if blk
else
next unless blk
blk = block_wrap(slf, inst, @block, bind, &blk)
end
elsif blk then
next
end
return [true, args, blk, bind]
end
next if formal >= @args.size # Too many actuals to match
t = @args[formal]
if t.instance_of? AnnotatedArgType then
bind.local_variable_set(t.name.to_sym,args[actual])
t = t.type
end
case t
when OptionalType
t = t.type.instantiate(inst)
if actual == args.size
states << [formal+1, actual] # skip to allow extra formal optionals at end
elsif t.is_a? MethodType
if args[actual].is_a? Proc
args[actual] = block_wrap(slf, inst, t, bind, &args[actual])
states << [formal+1, actual+1]
elsif args[actual].nil?
states << [formal+1, actual+1] # match
states << [formal+1, actual] # skip
else
states << [formal+1, actual]
end
elsif t.member?(args[actual], vars_wild: true)
states << [formal+1, actual+1] # match
states << [formal+1, actual] # skip
else
states << [formal+1, actual] # types don't match; must skip this formal
end
when VarargType
t = t.type.instantiate(inst)
if actual == args.size
states << [formal+1, actual] # skip to allow empty vararg at end
elsif t.member?(args[actual], vars_wild: true)
states << [formal, actual+1] # match, more varargs coming
states << [formal+1, actual+1] # match, no more varargs
states << [formal+1, actual] # skip over even though matches
else
states << [formal+1, actual] # doesn't match, must skip
end
when DependentArgType
bind.local_variable_set(t.name.to_sym,args[actual])
preds.push(t)
t = t.type.instantiate(inst)
the_actual = nil
if actual == args.size
next unless t.instance_of? FiniteHashType
if t.member?({}, vars_wild: true) # try matching against the empty hash
states << [formal+1, actual]
end
elsif t.member?(args[actual], vars_wild: true)
states << [formal+1, actual+1] # match
# no else case; if there is no match, this is a dead end
end
else
t = NominalType.new 'Proc' if t.instance_of? MethodType
t = t.instantiate(inst)
the_actual = nil
if actual == args.size
next unless t.instance_of? FiniteHashType
if t.member?({}, vars_wild: true) # try matching against the empty hash
states << [formal+1, actual]
end
elsif t.member?(args[actual], vars_wild: true)
states << [formal+1, actual+1] # match
# no else case; if there is no match, this is a dead end
end
end
end
return [false, args, blk, bind]
end | ruby | def pre_cond?(blk, slf, inst, bind, *args)
states = [[0, 0]] # [position in @arg, position in args]
preds = []
until states.empty?
formal, actual = states.pop
if formal == @args.size && actual == args.size then # Matched all actuals, no formals left over
check_arg_preds(bind, preds) if preds.size > 0
@args.each_with_index {|a,i| args[i] = block_wrap(slf, inst, a, bind, &args[i]) if a.is_a? MethodType }
if @block then
if @block.is_a? OptionalType
blk = block_wrap(slf, inst, @block.type.instantiate(inst), bind, &blk) if blk
else
next unless blk
blk = block_wrap(slf, inst, @block, bind, &blk)
end
elsif blk then
next
end
return [true, args, blk, bind]
end
next if formal >= @args.size # Too many actuals to match
t = @args[formal]
if t.instance_of? AnnotatedArgType then
bind.local_variable_set(t.name.to_sym,args[actual])
t = t.type
end
case t
when OptionalType
t = t.type.instantiate(inst)
if actual == args.size
states << [formal+1, actual] # skip to allow extra formal optionals at end
elsif t.is_a? MethodType
if args[actual].is_a? Proc
args[actual] = block_wrap(slf, inst, t, bind, &args[actual])
states << [formal+1, actual+1]
elsif args[actual].nil?
states << [formal+1, actual+1] # match
states << [formal+1, actual] # skip
else
states << [formal+1, actual]
end
elsif t.member?(args[actual], vars_wild: true)
states << [formal+1, actual+1] # match
states << [formal+1, actual] # skip
else
states << [formal+1, actual] # types don't match; must skip this formal
end
when VarargType
t = t.type.instantiate(inst)
if actual == args.size
states << [formal+1, actual] # skip to allow empty vararg at end
elsif t.member?(args[actual], vars_wild: true)
states << [formal, actual+1] # match, more varargs coming
states << [formal+1, actual+1] # match, no more varargs
states << [formal+1, actual] # skip over even though matches
else
states << [formal+1, actual] # doesn't match, must skip
end
when DependentArgType
bind.local_variable_set(t.name.to_sym,args[actual])
preds.push(t)
t = t.type.instantiate(inst)
the_actual = nil
if actual == args.size
next unless t.instance_of? FiniteHashType
if t.member?({}, vars_wild: true) # try matching against the empty hash
states << [formal+1, actual]
end
elsif t.member?(args[actual], vars_wild: true)
states << [formal+1, actual+1] # match
# no else case; if there is no match, this is a dead end
end
else
t = NominalType.new 'Proc' if t.instance_of? MethodType
t = t.instantiate(inst)
the_actual = nil
if actual == args.size
next unless t.instance_of? FiniteHashType
if t.member?({}, vars_wild: true) # try matching against the empty hash
states << [formal+1, actual]
end
elsif t.member?(args[actual], vars_wild: true)
states << [formal+1, actual+1] # match
# no else case; if there is no match, this is a dead end
end
end
end
return [false, args, blk, bind]
end | [
"def",
"pre_cond?",
"(",
"blk",
",",
"slf",
",",
"inst",
",",
"bind",
",",
"*",
"args",
")",
"states",
"=",
"[",
"[",
"0",
",",
"0",
"]",
"]",
"# [position in @arg, position in args]",
"preds",
"=",
"[",
"]",
"until",
"states",
".",
"empty?",
"formal",... | Create a new MethodType
[+args+] List of types of the arguments of the procedure (use [] for no args).
[+block+] The type of the block passed to this method, if it takes one.
[+ret+] The type that the procedure returns.
TODO: Check blk
Very similar to Typecheck.check_arg_types | [
"Create",
"a",
"new",
"MethodType"
] | c00134413f7a600fd395e7e7cd8b01f57f850830 | https://github.com/plum-umd/rdl/blob/c00134413f7a600fd395e7e7cd8b01f57f850830/lib/rdl/types/method.rb#L59-L147 | train | Check if the block is valid for the given argument | [
30522,
13366,
3653,
1035,
9530,
2094,
1029,
1006,
1038,
13687,
1010,
22889,
2546,
1010,
16021,
2102,
1010,
14187,
1010,
1008,
12098,
5620,
1007,
2163,
1027,
1031,
1031,
1014,
1010,
1014,
1033,
1033,
1001,
1031,
2597,
1999,
1030,
12098,
2290... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_recovery_plans.rb | Azure::RecoveryServicesSiteRecovery::Mgmt::V2018_01_10.ReplicationRecoveryPlans.begin_reprotect | def begin_reprotect(recovery_plan_name, custom_headers:nil)
response = begin_reprotect_async(recovery_plan_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_reprotect(recovery_plan_name, custom_headers:nil)
response = begin_reprotect_async(recovery_plan_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_reprotect",
"(",
"recovery_plan_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_reprotect_async",
"(",
"recovery_plan_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"response... | Execute reprotect of the recovery plan.
The operation to reprotect(reverse replicate) a recovery plan.
@param recovery_plan_name [String] Recovery plan name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [RecoveryPlan] operation results. | [
"Execute",
"reprotect",
"of",
"the",
"recovery",
"plan",
"."
] | 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_recovery_plans.rb#L1113-L1116 | train | Reprotect the specified recovery plan. | [
30522,
13366,
4088,
1035,
16360,
21709,
22471,
1006,
7233,
1035,
2933,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
16360,
21709,
22471,
1035,
2004,
6038,
2278,
1006,
7233,
1035,
2933,
1035,
217... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
roo-rb/roo | lib/roo/open_office.rb | Roo.OpenOffice.formulas | def formulas(sheet = nil)
sheet ||= default_sheet
read_cells(sheet)
return [] unless @formula[sheet]
@formula[sheet].each.collect do |elem|
[elem[0][0], elem[0][1], elem[1]]
end
end | ruby | def formulas(sheet = nil)
sheet ||= default_sheet
read_cells(sheet)
return [] unless @formula[sheet]
@formula[sheet].each.collect do |elem|
[elem[0][0], elem[0][1], elem[1]]
end
end | [
"def",
"formulas",
"(",
"sheet",
"=",
"nil",
")",
"sheet",
"||=",
"default_sheet",
"read_cells",
"(",
"sheet",
")",
"return",
"[",
"]",
"unless",
"@formula",
"[",
"sheet",
"]",
"@formula",
"[",
"sheet",
"]",
".",
"each",
".",
"collect",
"do",
"|",
"ele... | returns each formula in the selected sheet as an array of elements
[row, col, formula] | [
"returns",
"each",
"formula",
"in",
"the",
"selected",
"sheet",
"as",
"an",
"array",
"of",
"elements",
"[",
"row",
"col",
"formula",
"]"
] | 4ec1104f0c3c2a29711c0c907371cd2be12bcc3c | https://github.com/roo-rb/roo/blob/4ec1104f0c3c2a29711c0c907371cd2be12bcc3c/lib/roo/open_office.rb#L124-L131 | train | Returns an array of the formula objects in the given sheet. | [
30522,
13366,
25814,
1006,
7123,
1027,
9152,
2140,
1007,
7123,
1064,
1064,
1027,
12398,
1035,
7123,
3191,
1035,
4442,
1006,
7123,
1007,
2709,
1031,
1033,
4983,
1030,
5675,
1031,
7123,
1033,
1030,
5675,
1031,
7123,
1033,
1012,
2169,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_policy/lib/2017-06-01-preview/generated/azure_mgmt_policy/policy_set_definitions.rb | Azure::Policy::Mgmt::V2017_06_01_preview.PolicySetDefinitions.delete_at_management_group | def delete_at_management_group(policy_set_definition_name, management_group_id, custom_headers:nil)
response = delete_at_management_group_async(policy_set_definition_name, management_group_id, custom_headers:custom_headers).value!
nil
end | ruby | def delete_at_management_group(policy_set_definition_name, management_group_id, custom_headers:nil)
response = delete_at_management_group_async(policy_set_definition_name, management_group_id, custom_headers:custom_headers).value!
nil
end | [
"def",
"delete_at_management_group",
"(",
"policy_set_definition_name",
",",
"management_group_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_at_management_group_async",
"(",
"policy_set_definition_name",
",",
"management_group_id",
",",
"custom_headers",... | Deletes a policy set definition at management group level.
@param policy_set_definition_name [String] The name of the policy set
definition to delete.
@param management_group_id [String] The ID of the management group.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Deletes",
"a",
"policy",
"set",
"definition",
"at",
"management",
"group",
"level",
"."
] | 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#L689-L692 | train | Deletes the policy set definition at management group level. | [
30522,
13366,
3972,
12870,
1035,
2012,
1035,
2968,
1035,
2177,
1006,
3343,
1035,
2275,
1035,
6210,
1035,
2171,
1010,
2968,
1035,
2177,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
1035,
2012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/api/v1_items_api.rb | SquareConnect.V1ItemsApi.delete_page | def delete_page(location_id, page_id, opts = {})
data, _status_code, _headers = delete_page_with_http_info(location_id, page_id, opts)
return data
end | ruby | def delete_page(location_id, page_id, opts = {})
data, _status_code, _headers = delete_page_with_http_info(location_id, page_id, opts)
return data
end | [
"def",
"delete_page",
"(",
"location_id",
",",
"page_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"delete_page_with_http_info",
"(",
"location_id",
",",
"page_id",
",",
"opts",
")",
"return",
"data",
"end"
] | DeletePage
Deletes an existing Favorites page and all of its cells. *Note**: DeletePage returns nothing on success but Connect SDKs map the empty response to an empty `V1DeletePageRequest` object as documented below.
@param location_id The ID of the Favorites page's associated location.
@param page_id The ID of the page to delete.
@param [Hash] opts the optional parameters
@return [V1Page] | [
"DeletePage",
"Deletes",
"an",
"existing",
"Favorites",
"page",
"and",
"all",
"of",
"its",
"cells",
".",
"*",
"Note",
"**",
":",
"DeletePage",
"returns",
"nothing",
"on",
"success",
"but",
"Connect",
"SDKs",
"map",
"the",
"empty",
"response",
"to",
"an",
"... | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/v1_items_api.rb#L1053-L1056 | train | Delete a page | [
30522,
13366,
3972,
12870,
1035,
3931,
1006,
3295,
1035,
8909,
1010,
3931,
1035,
8909,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
30524,
18558,
1006,
3295,
1035,
8909,
1010,
3931,
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... |
opal/opal | opal/corelib/marshal/read_buffer.rb | Marshal.ReadBuffer.read_object | def read_object
klass_name = read(cache: false)
klass = safe_const_get(klass_name)
object = klass.allocate
@object_cache << object
ivars = read_hash(cache: false)
ivars.each do |name, value|
if name[0] == '@'
object.instance_variable_set(name, value)
else
# MRI allows an object to have ivars that do not start from '@'
# https://github.com/ruby/ruby/blob/ab3a40c1031ff3a0535f6bcf26de40de37dbb1db/range.c#L1225
`object[name] = value`
end
end
object
end | ruby | def read_object
klass_name = read(cache: false)
klass = safe_const_get(klass_name)
object = klass.allocate
@object_cache << object
ivars = read_hash(cache: false)
ivars.each do |name, value|
if name[0] == '@'
object.instance_variable_set(name, value)
else
# MRI allows an object to have ivars that do not start from '@'
# https://github.com/ruby/ruby/blob/ab3a40c1031ff3a0535f6bcf26de40de37dbb1db/range.c#L1225
`object[name] = value`
end
end
object
end | [
"def",
"read_object",
"klass_name",
"=",
"read",
"(",
"cache",
":",
"false",
")",
"klass",
"=",
"safe_const_get",
"(",
"klass_name",
")",
"object",
"=",
"klass",
".",
"allocate",
"@object_cache",
"<<",
"object",
"ivars",
"=",
"read_hash",
"(",
"cache",
":",
... | Reads and returns an abstract object from an input stream
@example
obj = Object.new
obj.instance_variable_set(:@ivar, 100)
obj
is encoded as
'o', :Object, {:@ivar => 100}
The only exception is a Range class (and its subclasses)
For some reason in MRI isntances of this class have instance variables
- begin
- end
- excl
without '@' perfix. | [
"Reads",
"and",
"returns",
"an",
"abstract",
"object",
"from",
"an",
"input",
"stream"
] | 41aedc0fd62aab00d3c117ba0caf00206bedd981 | https://github.com/opal/opal/blob/41aedc0fd62aab00d3c117ba0caf00206bedd981/opal/corelib/marshal/read_buffer.rb#L388-L407 | train | Read an object sequence number from the file. | [
30522,
13366,
3191,
1035,
4874,
1047,
27102,
1035,
2171,
1027,
3191,
1006,
17053,
1024,
6270,
1007,
1047,
27102,
1027,
3647,
1035,
9530,
3367,
1035,
2131,
1006,
1047,
27102,
1035,
2171,
1007,
4874,
1027,
1047,
27102,
1012,
2035,
24755,
2618... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
restforce/restforce | lib/restforce/middleware/authentication.rb | Restforce.Middleware::Authentication.connection | def connection
@connection ||= Faraday.new(faraday_options) do |builder|
builder.use Faraday::Request::UrlEncoded
builder.use Restforce::Middleware::Mashify, nil, @options
builder.response :json
if Restforce.log?
builder.use Restforce::Middleware::Logger,
Restforce.configuration.logger,
@options
end
builder.adapter @options[:adapter]
end
end | ruby | def connection
@connection ||= Faraday.new(faraday_options) do |builder|
builder.use Faraday::Request::UrlEncoded
builder.use Restforce::Middleware::Mashify, nil, @options
builder.response :json
if Restforce.log?
builder.use Restforce::Middleware::Logger,
Restforce.configuration.logger,
@options
end
builder.adapter @options[:adapter]
end
end | [
"def",
"connection",
"@connection",
"||=",
"Faraday",
".",
"new",
"(",
"faraday_options",
")",
"do",
"|",
"builder",
"|",
"builder",
".",
"use",
"Faraday",
"::",
"Request",
"::",
"UrlEncoded",
"builder",
".",
"use",
"Restforce",
"::",
"Middleware",
"::",
"Ma... | Internal: Faraday connection to use when sending an authentication request. | [
"Internal",
":",
"Faraday",
"connection",
"to",
"use",
"when",
"sending",
"an",
"authentication",
"request",
"."
] | 74cbc9c745320dbea5117e2e3cc8d54d66db6562 | https://github.com/restforce/restforce/blob/74cbc9c745320dbea5117e2e3cc8d54d66db6562/lib/restforce/middleware/authentication.rb#L47-L61 | train | Returns a connection to the API | [
30522,
13366,
4434,
1030,
4434,
1064,
1064,
1027,
2521,
28039,
1012,
2047,
1006,
2521,
28039,
1035,
7047,
1007,
2079,
1064,
12508,
1064,
12508,
1012,
2224,
2521,
28039,
1024,
1024,
5227,
1024,
1024,
24471,
7770,
16044,
2094,
12508,
1012,
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... |
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.begin_update | def begin_update(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers:nil)
response = begin_update_async(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_update(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers:nil)
response = begin_update_async(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_update",
"(",
"endpoint_name",
",",
"endpoint_properties",
",",
"profile_name",
",",
"resource_group_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_update_async",
"(",
"endpoint_name",
",",
"endpoint_properties",
",",
"profile_name"... | Updates an existing CDN endpoint with the specified parameters. Only tags and
OriginHostHeader can be updated after creating an endpoint. To update
origins, use the Update Origin operation. To update custom domains, use the
Update Custom Domain operation.
@param endpoint_name [String] Name of the endpoint within the CDN profile.
@param endpoint_properties [EndpointUpdateParameters] Endpoint properties
@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 [Endpoint] operation results. | [
"Updates",
"an",
"existing",
"CDN",
"endpoint",
"with",
"the",
"specified",
"parameters",
".",
"Only",
"tags",
"and",
"OriginHostHeader",
"can",
"be",
"updated",
"after",
"creating",
"an",
"endpoint",
".",
"To",
"update",
"origins",
"use",
"the",
"Update",
"Or... | 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#L835-L838 | train | Updates an endpoint. | [
30522,
13366,
4088,
1035,
10651,
1006,
2203,
8400,
1035,
2171,
1010,
2203,
8400,
1035,
5144,
1010,
6337,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
10651,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_monitor/lib/2016-03-01/generated/azure_mgmt_monitor/alert_rule_incidents.rb | Azure::Monitor::Mgmt::V2016_03_01.AlertRuleIncidents.get_with_http_info | def get_with_http_info(resource_group_name, rule_name, incident_name, custom_headers:nil)
get_async(resource_group_name, rule_name, incident_name, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, rule_name, incident_name, custom_headers:nil)
get_async(resource_group_name, rule_name, incident_name, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"rule_name",
",",
"incident_name",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"rule_name",
",",
"incident_name",
",",
"custom_headers",
":custom_headers",
")",
"."... | Gets an incident associated to an alert rule
@param resource_group_name [String] The name of the resource group.
@param rule_name [String] The name of the rule.
@param incident_name [String] The name of the incident to retrieve.
@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",
"an",
"incident",
"associated",
"to",
"an",
"alert",
"rule"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_monitor/lib/2016-03-01/generated/azure_mgmt_monitor/alert_rule_incidents.rb#L51-L53 | train | Gets the specified rule incident. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3627,
1035,
2171,
1010,
5043,
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... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.delete_hierarchical_entity_child | def delete_hierarchical_entity_child(app_id, version_id, h_entity_id, h_child_id, custom_headers:nil)
response = delete_hierarchical_entity_child_async(app_id, version_id, h_entity_id, h_child_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def delete_hierarchical_entity_child(app_id, version_id, h_entity_id, h_child_id, custom_headers:nil)
response = delete_hierarchical_entity_child_async(app_id, version_id, h_entity_id, h_child_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"delete_hierarchical_entity_child",
"(",
"app_id",
",",
"version_id",
",",
"h_entity_id",
",",
"h_child_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_hierarchical_entity_child_async",
"(",
"app_id",
",",
"version_id",
",",
"h_entity_id",
... | Deletes a hierarchical entity extractor child in a version of the
application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param h_entity_id The hierarchical entity extractor ID.
@param h_child_id The hierarchical entity extractor child ID.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OperationStatus] operation results. | [
"Deletes",
"a",
"hierarchical",
"entity",
"extractor",
"child",
"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#L5208-L5211 | train | Deletes a hierarchical entity child. | [
30522,
13366,
3972,
12870,
1035,
25835,
1035,
9178,
1035,
2775,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
1044,
1035,
9178,
1035,
8909,
1010,
1044,
1035,
2775,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
daddyz/phonelib | lib/phonelib/phone_analyzer_helper.rb | Phonelib.PhoneAnalyzerHelper.passed_country | def passed_country(country)
code = country_prefix(country)
if Core::PLUS_SIGN == @original[0] && code && !sanitized.start_with?(code)
# in case number passed with + but it doesn't start with passed
# country prefix
country = nil
end
country
end | ruby | def passed_country(country)
code = country_prefix(country)
if Core::PLUS_SIGN == @original[0] && code && !sanitized.start_with?(code)
# in case number passed with + but it doesn't start with passed
# country prefix
country = nil
end
country
end | [
"def",
"passed_country",
"(",
"country",
")",
"code",
"=",
"country_prefix",
"(",
"country",
")",
"if",
"Core",
"::",
"PLUS_SIGN",
"==",
"@original",
"[",
"0",
"]",
"&&",
"code",
"&&",
"!",
"sanitized",
".",
"start_with?",
"(",
"code",
")",
"# in case numb... | defines if to validate against single country or not | [
"defines",
"if",
"to",
"validate",
"against",
"single",
"country",
"or",
"not"
] | aa0023eab7c896b71275bf342bc7f49735cbdbbf | https://github.com/daddyz/phonelib/blob/aa0023eab7c896b71275bf342bc7f49735cbdbbf/lib/phonelib/phone_analyzer_helper.rb#L25-L33 | train | Returns the passed country | [
30522,
13366,
2979,
1035,
2406,
1006,
2406,
1007,
3642,
1027,
2406,
1035,
17576,
1006,
2406,
1007,
2065,
4563,
1024,
1024,
4606,
1035,
3696,
1027,
1027,
1030,
2434,
1031,
1014,
1033,
1004,
1004,
3642,
1004,
1004,
999,
2624,
25090,
5422,
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_iot_hub/lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb | Azure::IotHub::Mgmt::V2017_01_19.IotHubResource.list_jobs_next | def list_jobs_next(next_page_link, custom_headers:nil)
response = list_jobs_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_jobs_next(next_page_link, custom_headers:nil)
response = list_jobs_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_jobs_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_jobs_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"response",
".",
... | Get a list of all the jobs in an IoT hub. For more information, see:
https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
Get a list of all the jobs in an IoT hub. For more information, see:
https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
@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 [JobResponseListResult] operation results. | [
"Get",
"a",
"list",
"of",
"all",
"the",
"jobs",
"in",
"an",
"IoT",
"hub",
".",
"For",
"more",
"information",
"see",
":",
"https",
":",
"//",
"docs",
".",
"microsoft",
".",
"com",
"/",
"azure",
"/",
"iot",
"-",
"hub",
"/",
"iot",
"-",
"hub",
"-",
... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_iot_hub/lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb#L2607-L2610 | train | Gets the list of jobs for a subscription. | [
30522,
13366,
2862,
1035,
5841,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
5841,
1035,
2279,
1035,
2004,
6038,
2278,
1006,
2279,
1035,
3931,
1035,
4957,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
tongueroo/ufo | lib/ufo/dsl.rb | Ufo.DSL.task_definition_error | def task_definition_error(e)
error_info = e.backtrace.first
path, line_no, _ = error_info.split(':')
line_no = line_no.to_i
puts "Error evaluating #{path}:".color(:red)
puts e.message
puts "Here's the line in #{path} with the error:\n\n"
contents = IO.read(path)
content_lines = contents.split("\n")
context = 5 # lines of context
top, bottom = [line_no-context-1, 0].max, line_no+context-1
spacing = content_lines.size.to_s.size
content_lines[top..bottom].each_with_index do |line_content, index|
line_number = top+index+1
if line_number == line_no
printf("%#{spacing}d %s\n".color(:red), line_number, line_content)
else
printf("%#{spacing}d %s\n", line_number, line_content)
end
end
end | ruby | def task_definition_error(e)
error_info = e.backtrace.first
path, line_no, _ = error_info.split(':')
line_no = line_no.to_i
puts "Error evaluating #{path}:".color(:red)
puts e.message
puts "Here's the line in #{path} with the error:\n\n"
contents = IO.read(path)
content_lines = contents.split("\n")
context = 5 # lines of context
top, bottom = [line_no-context-1, 0].max, line_no+context-1
spacing = content_lines.size.to_s.size
content_lines[top..bottom].each_with_index do |line_content, index|
line_number = top+index+1
if line_number == line_no
printf("%#{spacing}d %s\n".color(:red), line_number, line_content)
else
printf("%#{spacing}d %s\n", line_number, line_content)
end
end
end | [
"def",
"task_definition_error",
"(",
"e",
")",
"error_info",
"=",
"e",
".",
"backtrace",
".",
"first",
"path",
",",
"line_no",
",",
"_",
"=",
"error_info",
".",
"split",
"(",
"':'",
")",
"line_no",
"=",
"line_no",
".",
"to_i",
"puts",
"\"Error evaluating #... | Prints out a user friendly task_definition error message | [
"Prints",
"out",
"a",
"user",
"friendly",
"task_definition",
"error",
"message"
] | 16ac3dad28edcab2693c0e7d89a1971aca65b8f9 | https://github.com/tongueroo/ufo/blob/16ac3dad28edcab2693c0e7d89a1971aca65b8f9/lib/ufo/dsl.rb#L41-L62 | train | This function is used to print the error message | [
30522,
13366,
4708,
1035,
6210,
1035,
7561,
1006,
1041,
1007,
7561,
1035,
18558,
1027,
1041,
1012,
2067,
6494,
3401,
1012,
2034,
4130,
1010,
2240,
1035,
2053,
1010,
1035,
1027,
7561,
1035,
18558,
1012,
3975,
1006,
1005,
1024,
1005,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/route_tables.rb | Azure::Network::Mgmt::V2018_07_01.RouteTables.begin_update_tags_with_http_info | def begin_update_tags_with_http_info(resource_group_name, route_table_name, parameters, custom_headers:nil)
begin_update_tags_async(resource_group_name, route_table_name, parameters, custom_headers:custom_headers).value!
end | ruby | def begin_update_tags_with_http_info(resource_group_name, route_table_name, parameters, custom_headers:nil)
begin_update_tags_async(resource_group_name, route_table_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_update_tags_with_http_info",
"(",
"resource_group_name",
",",
"route_table_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_update_tags_async",
"(",
"resource_group_name",
",",
"route_table_name",
",",
"parameters",
",",
"custom_headers... | Updates a route table tags.
@param resource_group_name [String] The name of the resource group.
@param route_table_name [String] The name of the route table.
@param parameters [TagsObject] Parameters supplied to update route table
tags.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Updates",
"a",
"route",
"table",
"tags",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/route_tables.rb#L647-L649 | train | Updates a route table tags. | [
30522,
13366,
4088,
1035,
10651,
1035,
22073,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2799,
1035,
2795,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
1035,
10651... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Shopify/liquid | lib/liquid/standardfilters.rb | Liquid.StandardFilters.abs | def abs(input)
result = Utils.to_number(input).abs
result.is_a?(BigDecimal) ? result.to_f : result
end | ruby | def abs(input)
result = Utils.to_number(input).abs
result.is_a?(BigDecimal) ? result.to_f : result
end | [
"def",
"abs",
"(",
"input",
")",
"result",
"=",
"Utils",
".",
"to_number",
"(",
"input",
")",
".",
"abs",
"result",
".",
"is_a?",
"(",
"BigDecimal",
")",
"?",
"result",
".",
"to_f",
":",
"result",
"end"
] | absolute value | [
"absolute",
"value"
] | b3b63a683f6daaea7e70f1602ee829abdf970ef3 | https://github.com/Shopify/liquid/blob/b3b63a683f6daaea7e70f1602ee829abdf970ef3/lib/liquid/standardfilters.rb#L352-L355 | train | Returns the absolute value of the input | [
30522,
13366,
14689,
1006,
7953,
1007,
2765,
1027,
21183,
12146,
1012,
2000,
1035,
2193,
1006,
7953,
1007,
1012,
14689,
2765,
1012,
2003,
1035,
1037,
1029,
1006,
2502,
3207,
6895,
9067,
1007,
1029,
2765,
1012,
2000,
1035,
1042,
1024,
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... |
rails/rails | railties/lib/rails/application.rb | Rails.Application.secret_key_base | def secret_key_base
if Rails.env.development? || Rails.env.test?
secrets.secret_key_base ||= generate_development_secret
else
validate_secret_key_base(
ENV["SECRET_KEY_BASE"] || credentials.secret_key_base || secrets.secret_key_base
)
end
end | ruby | def secret_key_base
if Rails.env.development? || Rails.env.test?
secrets.secret_key_base ||= generate_development_secret
else
validate_secret_key_base(
ENV["SECRET_KEY_BASE"] || credentials.secret_key_base || secrets.secret_key_base
)
end
end | [
"def",
"secret_key_base",
"if",
"Rails",
".",
"env",
".",
"development?",
"||",
"Rails",
".",
"env",
".",
"test?",
"secrets",
".",
"secret_key_base",
"||=",
"generate_development_secret",
"else",
"validate_secret_key_base",
"(",
"ENV",
"[",
"\"SECRET_KEY_BASE\"",
"]... | The secret_key_base is used as the input secret to the application's key generator, which in turn
is used to create all MessageVerifiers/MessageEncryptors, including the ones that sign and encrypt cookies.
In development and test, this is randomly generated and stored in a
temporary file in <tt>tmp/development_secret.txt</tt>.
In all other environments, we look for it first in ENV["SECRET_KEY_BASE"],
then credentials.secret_key_base, and finally secrets.secret_key_base. For most applications,
the correct place to store it is in the encrypted credentials file. | [
"The",
"secret_key_base",
"is",
"used",
"as",
"the",
"input",
"secret",
"to",
"the",
"application",
"s",
"key",
"generator",
"which",
"in",
"turn",
"is",
"used",
"to",
"create",
"all",
"MessageVerifiers",
"/",
"MessageEncryptors",
"including",
"the",
"ones",
"... | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/railties/lib/rails/application.rb#L418-L426 | train | Generate the secret key base for the current application. | [
30522,
13366,
3595,
1035,
3145,
1035,
2918,
2065,
15168,
1012,
4372,
2615,
1012,
2458,
1029,
1064,
1064,
15168,
1012,
4372,
2615,
1012,
3231,
1029,
7800,
1012,
3595,
1035,
3145,
1035,
2918,
1064,
1064,
1027,
9699,
1035,
2458,
1035,
3595,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.[]= | def []=(index, v)
DataTypeValidator.validate :SimpleTypedList_insert, @allowed_types, v
raise ArgumentError, "Item is protected and cannot be changed" if protected? index
@list[index] = v
v
end | ruby | def []=(index, v)
DataTypeValidator.validate :SimpleTypedList_insert, @allowed_types, v
raise ArgumentError, "Item is protected and cannot be changed" if protected? index
@list[index] = v
v
end | [
"def",
"[]=",
"(",
"index",
",",
"v",
")",
"DataTypeValidator",
".",
"validate",
":SimpleTypedList_insert",
",",
"@allowed_types",
",",
"v",
"raise",
"ArgumentError",
",",
"\"Item is protected and cannot be changed\"",
"if",
"protected?",
"index",
"@list",
"[",
"index... | positional assignment. Adds the item at the index specified
@param [Integer] index
@param [Any] v
@raise [ArgumentError] if the index is protected by locking
@raise [ArgumentError] if the item is not one of the allowed types | [
"positional",
"assignment",
".",
"Adds",
"the",
"item",
"at",
"the",
"index",
"specified"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/util/simple_typed_list.rb#L128-L133 | train | Insert an item at the given index. | [
30522,
13366,
1031,
1033,
1027,
1006,
5950,
1010,
1058,
1007,
2951,
13874,
10175,
8524,
4263,
1012,
9398,
3686,
1024,
3722,
13874,
19422,
2923,
1035,
19274,
1010,
1030,
3039,
1035,
4127,
1010,
1058,
5333,
6685,
2121,
29165,
1010,
1000,
8875... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.get_service_manifest_with_http_info | def get_service_manifest_with_http_info(application_type_name, application_type_version, service_manifest_name, timeout:60, custom_headers:nil)
get_service_manifest_async(application_type_name, application_type_version, service_manifest_name, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def get_service_manifest_with_http_info(application_type_name, application_type_version, service_manifest_name, timeout:60, custom_headers:nil)
get_service_manifest_async(application_type_name, application_type_version, service_manifest_name, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"get_service_manifest_with_http_info",
"(",
"application_type_name",
",",
"application_type_version",
",",
"service_manifest_name",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"get_service_manifest_async",
"(",
"application_type_name",
",",
"ap... | Gets the manifest describing a service type.
Gets the manifest describing a service type. The response contains the
service manifest XML as a string.
@param application_type_name [String] The name of the application type.
@param application_type_version [String] The version of the application type.
@param service_manifest_name [String] The name of a service manifest
registered as part of an application type in a Service Fabric cluster.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"manifest",
"describing",
"a",
"service",
"type",
"."
] | 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#L5623-L5625 | train | Gets the specified service manifest. | [
30522,
13366,
2131,
1035,
2326,
1035,
19676,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
4646,
1035,
2828,
1035,
2171,
1010,
4646,
1035,
2828,
1035,
2544,
1010,
2326,
1035,
19676,
1035,
2171,
1010,
2051,
5833,
1024,
3438,
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... |
guard/guard | lib/guard/watcher.rb | Guard.Watcher.call_action | def call_action(matches)
@action.arity > 0 ? @action.call(matches) : @action.call
rescue => ex
UI.error "Problem with watch action!\n#{ex.message}"
UI.error ex.backtrace.join("\n")
end | ruby | def call_action(matches)
@action.arity > 0 ? @action.call(matches) : @action.call
rescue => ex
UI.error "Problem with watch action!\n#{ex.message}"
UI.error ex.backtrace.join("\n")
end | [
"def",
"call_action",
"(",
"matches",
")",
"@action",
".",
"arity",
">",
"0",
"?",
"@action",
".",
"call",
"(",
"matches",
")",
":",
"@action",
".",
"call",
"rescue",
"=>",
"ex",
"UI",
".",
"error",
"\"Problem with watch action!\\n#{ex.message}\"",
"UI",
"."... | Executes a watcher action.
@param [String, MatchData] matches the matched path or the match from the
Regex
@return [String] the final paths | [
"Executes",
"a",
"watcher",
"action",
"."
] | e2508cd83badf0d537dbaba35d307adc35d92e4f | https://github.com/guard/guard/blob/e2508cd83badf0d537dbaba35d307adc35d92e4f/lib/guard/watcher.rb#L81-L86 | train | Call the action | [
30522,
13366,
2655,
1035,
2895,
1006,
3503,
1007,
1030,
2895,
1012,
10488,
3723,
1028,
1014,
1029,
1030,
2895,
1012,
2655,
1006,
3503,
1007,
1024,
1030,
2895,
1012,
2655,
5343,
1027,
1028,
4654,
21318,
1012,
7561,
1000,
3291,
2007,
3422,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
httprb/http | lib/http/headers.rb | HTTP.Headers.validate_value | def validate_value(value)
v = value.to_s
return v unless v.include?("\n")
raise HeaderError, "Invalid HTTP header field value: #{v.inspect}"
end | ruby | def validate_value(value)
v = value.to_s
return v unless v.include?("\n")
raise HeaderError, "Invalid HTTP header field value: #{v.inspect}"
end | [
"def",
"validate_value",
"(",
"value",
")",
"v",
"=",
"value",
".",
"to_s",
"return",
"v",
"unless",
"v",
".",
"include?",
"(",
"\"\\n\"",
")",
"raise",
"HeaderError",
",",
"\"Invalid HTTP header field value: #{v.inspect}\"",
"end"
] | Ensures there is no new line character in the header value
@param [String] value
@raise [HeaderError] if value includes new line character
@return [String] stringified header value | [
"Ensures",
"there",
"is",
"no",
"new",
"line",
"character",
"in",
"the",
"header",
"value"
] | f37a10ea4fab3ee411907ea2e4251ddf0ca33a93 | https://github.com/httprb/http/blob/f37a10ea4fab3ee411907ea2e4251ddf0ca33a93/lib/http/headers.rb#L218-L222 | train | Validate the value of the header field | [
30522,
13366,
9398,
3686,
1035,
3643,
1006,
3643,
1007,
1058,
1027,
3643,
1012,
2000,
1035,
1055,
2709,
1058,
4983,
1058,
1012,
2421,
1029,
1006,
1000,
1032,
1050,
1000,
1007,
5333,
20346,
2121,
29165,
1010,
1000,
19528,
8299,
20346,
2492,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
puppetlabs/puppet | lib/puppet/type.rb | Puppet.Type.autorelation | def autorelation(rel_type, rel_catalog = nil)
rel_catalog ||= catalog
raise Puppet::DevError, _("You cannot add relationships without a catalog") unless rel_catalog
reqs = []
auto_rel = "eachauto#{rel_type}".to_sym
self.class.send(auto_rel) { |type, block|
# Ignore any types we can't find, although that would be a bit odd.
next unless Puppet::Type.type(type)
# Retrieve the list of names from the block.
next unless list = self.instance_eval(&block)
list = [list] unless list.is_a?(Array)
# Collect the current prereqs
list.each { |dep|
next if dep.nil?
# Support them passing objects directly, to save some effort.
unless dep.is_a?(Puppet::Type)
# Skip autorelation that we aren't managing
unless dep = rel_catalog.resource(type, dep)
next
end
end
if [:require, :subscribe].include?(rel_type)
reqs << Puppet::Relationship.new(dep, self)
else
reqs << Puppet::Relationship.new(self, dep)
end
}
}
reqs
end | ruby | def autorelation(rel_type, rel_catalog = nil)
rel_catalog ||= catalog
raise Puppet::DevError, _("You cannot add relationships without a catalog") unless rel_catalog
reqs = []
auto_rel = "eachauto#{rel_type}".to_sym
self.class.send(auto_rel) { |type, block|
# Ignore any types we can't find, although that would be a bit odd.
next unless Puppet::Type.type(type)
# Retrieve the list of names from the block.
next unless list = self.instance_eval(&block)
list = [list] unless list.is_a?(Array)
# Collect the current prereqs
list.each { |dep|
next if dep.nil?
# Support them passing objects directly, to save some effort.
unless dep.is_a?(Puppet::Type)
# Skip autorelation that we aren't managing
unless dep = rel_catalog.resource(type, dep)
next
end
end
if [:require, :subscribe].include?(rel_type)
reqs << Puppet::Relationship.new(dep, self)
else
reqs << Puppet::Relationship.new(self, dep)
end
}
}
reqs
end | [
"def",
"autorelation",
"(",
"rel_type",
",",
"rel_catalog",
"=",
"nil",
")",
"rel_catalog",
"||=",
"catalog",
"raise",
"Puppet",
"::",
"DevError",
",",
"_",
"(",
"\"You cannot add relationships without a catalog\"",
")",
"unless",
"rel_catalog",
"reqs",
"=",
"[",
... | Adds dependencies to the catalog from added autorelations.
See {autorequire} for how to add an auto-requirement.
@todo needs details - see the param rel_catalog, and type of this param
@param rel_catalog [Puppet::Resource::Catalog, nil] the catalog to
add dependencies to. Defaults to the current catalog (set when the
type instance was added to a catalog)
@raise [Puppet::DevError] if there is no catalog | [
"Adds",
"dependencies",
"to",
"the",
"catalog",
"from",
"added",
"autorelations",
".",
"See",
"{",
"autorequire",
"}",
"for",
"how",
"to",
"add",
"an",
"auto",
"-",
"requirement",
"."
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/type.rb#L2136-L2173 | train | Add relationships to a given relationship type. | [
30522,
13366,
8285,
16570,
3370,
1006,
2128,
2140,
1035,
2828,
1010,
2128,
2140,
1035,
12105,
1027,
9152,
2140,
1007,
2128,
2140,
1035,
12105,
1064,
1064,
1027,
12105,
5333,
13997,
1024,
1024,
16475,
2121,
29165,
1010,
1035,
1006,
1000,
201... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
seejohnrun/ice_cube | lib/ice_cube/occurrence.rb | IceCube.Occurrence.to_s | def to_s(format=nil)
if format && to_time.public_method(:to_s).arity != 0
t0, t1 = start_time.to_s(format), end_time.to_s(format)
else
t0, t1 = start_time.to_s, end_time.to_s
end
duration > 0 ? "#{t0} - #{t1}" : t0
end | ruby | def to_s(format=nil)
if format && to_time.public_method(:to_s).arity != 0
t0, t1 = start_time.to_s(format), end_time.to_s(format)
else
t0, t1 = start_time.to_s, end_time.to_s
end
duration > 0 ? "#{t0} - #{t1}" : t0
end | [
"def",
"to_s",
"(",
"format",
"=",
"nil",
")",
"if",
"format",
"&&",
"to_time",
".",
"public_method",
"(",
":to_s",
")",
".",
"arity",
"!=",
"0",
"t0",
",",
"t1",
"=",
"start_time",
".",
"to_s",
"(",
"format",
")",
",",
"end_time",
".",
"to_s",
"("... | Shows both the start and end time if there is a duration.
Optional format argument (e.g. :long, :short) supports Rails
time formats and is only used when ActiveSupport is available. | [
"Shows",
"both",
"the",
"start",
"and",
"end",
"time",
"if",
"there",
"is",
"a",
"duration",
".",
"Optional",
"format",
"argument",
"(",
"e",
".",
"g",
".",
":",
"long",
":",
"short",
")",
"supports",
"Rails",
"time",
"formats",
"and",
"is",
"only",
... | fb6c657bdc4f87dfda2bf83f15c5f487b78ccabd | https://github.com/seejohnrun/ice_cube/blob/fb6c657bdc4f87dfda2bf83f15c5f487b78ccabd/lib/ice_cube/occurrence.rb#L88-L95 | train | Returns the string representation of the time. | [
30522,
13366,
2000,
1035,
1055,
1006,
4289,
1027,
9152,
2140,
1007,
2065,
4289,
1004,
1004,
2000,
1035,
2051,
1012,
2270,
1035,
4118,
1006,
1024,
2000,
1035,
1055,
1007,
1012,
10488,
3723,
999,
1027,
1014,
1056,
2692,
1010,
1056,
2487,
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_iot_hub/lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb | Azure::IotHub::Mgmt::V2017_01_19.IotHubResource.list_event_hub_consumer_groups_next | def list_event_hub_consumer_groups_next(next_page_link, custom_headers:nil)
response = list_event_hub_consumer_groups_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_event_hub_consumer_groups_next(next_page_link, custom_headers:nil)
response = list_event_hub_consumer_groups_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_event_hub_consumer_groups_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_event_hub_consumer_groups_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
... | Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
endpoint in an IoT hub.
Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
endpoint in an IoT hub.
@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 [EventHubConsumerGroupsListResult] operation results. | [
"Get",
"a",
"list",
"of",
"the",
"consumer",
"groups",
"in",
"the",
"Event",
"Hub",
"-",
"compatible",
"device",
"-",
"to",
"-",
"cloud",
"endpoint",
"in",
"an",
"IoT",
"hub",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_iot_hub/lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb#L2507-L2510 | train | Gets the list of consumer groups in an Event Hub. | [
30522,
13366,
2862,
1035,
2724,
1035,
9594,
1035,
7325,
1035,
2967,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2724,
1035,
9594,
1035,
7325,
1035,
2967,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_recovery_services_backup/lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/backup_engines.rb | Azure::RecoveryServicesBackup::Mgmt::V2016_12_01.BackupEngines.get | def get(vault_name, resource_group_name, backup_engine_name, filter:nil, skip_token:nil, custom_headers:nil)
response = get_async(vault_name, resource_group_name, backup_engine_name, filter:filter, skip_token:skip_token, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get(vault_name, resource_group_name, backup_engine_name, filter:nil, skip_token:nil, custom_headers:nil)
response = get_async(vault_name, resource_group_name, backup_engine_name, filter:filter, skip_token:skip_token, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get",
"(",
"vault_name",
",",
"resource_group_name",
",",
"backup_engine_name",
",",
"filter",
":",
"nil",
",",
"skip_token",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_async",
"(",
"vault_name",
",",
"resource_group_name",... | Returns backup management server registered to Recovery Services Vault.
@param vault_name [String] The name of the recovery services vault.
@param resource_group_name [String] The name of the resource group where the
recovery services vault is present.
@param backup_engine_name [String] Name of the backup management server.
@param filter [String] OData filter options.
@param skip_token [String] skipToken Filter.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [BackupEngineBaseResource] operation results. | [
"Returns",
"backup",
"management",
"server",
"registered",
"to",
"Recovery",
"Services",
"Vault",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_recovery_services_backup/lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/backup_engines.rb#L146-L149 | train | Gets the specified backup engine s primary backup specification. | [
30522,
13366,
2131,
1006,
11632,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
10200,
1035,
3194,
1035,
2171,
1010,
11307,
1024,
9152,
2140,
1010,
13558,
1035,
19204,
1024,
9152,
2140,
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... |
randym/axlsx | lib/axlsx/workbook/worksheet/cell.rb | Axlsx.Cell.clean_value | def clean_value
if (type == :string || type == :text) && !Axlsx::trust_input
Axlsx::sanitize(::CGI.escapeHTML(@value.to_s))
else
@value.to_s
end
end | ruby | def clean_value
if (type == :string || type == :text) && !Axlsx::trust_input
Axlsx::sanitize(::CGI.escapeHTML(@value.to_s))
else
@value.to_s
end
end | [
"def",
"clean_value",
"if",
"(",
"type",
"==",
":string",
"||",
"type",
"==",
":text",
")",
"&&",
"!",
"Axlsx",
"::",
"trust_input",
"Axlsx",
"::",
"sanitize",
"(",
"::",
"CGI",
".",
"escapeHTML",
"(",
"@value",
".",
"to_s",
")",
")",
"else",
"@value",... | Returns the sanatized value
TODO find a better way to do this as it accounts for 30% of
processing time in benchmarking... | [
"Returns",
"the",
"sanatized",
"value",
"TODO",
"find",
"a",
"better",
"way",
"to",
"do",
"this",
"as",
"it",
"accounts",
"for",
"30%",
"of",
"processing",
"time",
"in",
"benchmarking",
"..."
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/worksheet/cell.rb#L373-L379 | train | clean value
| [
30522,
13366,
4550,
1035,
30524,
1027,
1027,
1024,
5164,
1064,
1064,
2828,
1027,
1027,
1024,
3793,
1007,
1004,
1004,
999,
22260,
4877,
2595,
1024,
1024,
3404,
1035,
7953,
22260,
4877,
2595,
1024,
1024,
2624,
25090,
4371,
1006,
1024,
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_policy_insights/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/remediations.rb | Azure::PolicyInsights::Mgmt::V2018_07_01_preview.Remediations.get_at_resource_group | def get_at_resource_group(resource_group_name, remediation_name, custom_headers:nil)
response = get_at_resource_group_async(resource_group_name, remediation_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_at_resource_group(resource_group_name, remediation_name, custom_headers:nil)
response = get_at_resource_group_async(resource_group_name, remediation_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_at_resource_group",
"(",
"resource_group_name",
",",
"remediation_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_at_resource_group_async",
"(",
"resource_group_name",
",",
"remediation_name",
",",
"custom_headers",
":custom_headers",
")",
... | Gets an existing remediation at resource group scope.
@param resource_group_name [String] Resource group name.
@param remediation_name [String] The name of the remediation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Remediation] operation results. | [
"Gets",
"an",
"existing",
"remediation",
"at",
"resource",
"group",
"scope",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_policy_insights/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/remediations.rb#L1587-L1590 | train | Gets the specified remediation at resource group scope. | [
30522,
13366,
2131,
1035,
2012,
1035,
7692,
1035,
2177,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2128,
16969,
3508,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
2012,
1035,
7692,
1035,
2177,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/train.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Train.train_version | def train_version(app_id, version_id, custom_headers:nil)
response = train_version_async(app_id, version_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def train_version(app_id, version_id, custom_headers:nil)
response = train_version_async(app_id, version_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"train_version",
"(",
"app_id",
",",
"version_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"train_version_async",
"(",
"app_id",
",",
"version_id",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"un... | Sends a training request for a version of a specified LUIS app. This POST
request initiates a request asynchronously. To determine whether the training
request is successful, submit a GET request to get training status. Note: The
application version is not fully trained unless all the models (intents and
entities) are trained successfully or are up to date. To verify training
success, get the training status at least once after training is complete.
@param app_id The application ID.
@param version_id [String] The version ID.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [EnqueueTrainingResponse] operation results. | [
"Sends",
"a",
"training",
"request",
"for",
"a",
"version",
"of",
"a",
"specified",
"LUIS",
"app",
".",
"This",
"POST",
"request",
"initiates",
"a",
"request",
"asynchronously",
".",
"To",
"determine",
"whether",
"the",
"training",
"request",
"is",
"successful... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/train.rb#L39-L42 | train | Train a version of the application. | [
30522,
13366,
3345,
1035,
2544,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3345,
1035,
2544,
1035,
2004,
6038,
2278,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_container_service/lib/2019-02-01/generated/azure_mgmt_container_service/agent_pools.rb | Azure::ContainerService::Mgmt::V2019_02_01.AgentPools.begin_delete_with_http_info | def begin_delete_with_http_info(resource_group_name, managed_cluster_name, agent_pool_name, custom_headers:nil)
begin_delete_async(resource_group_name, managed_cluster_name, agent_pool_name, custom_headers:custom_headers).value!
end | ruby | def begin_delete_with_http_info(resource_group_name, managed_cluster_name, agent_pool_name, custom_headers:nil)
begin_delete_async(resource_group_name, managed_cluster_name, agent_pool_name, custom_headers:custom_headers).value!
end | [
"def",
"begin_delete_with_http_info",
"(",
"resource_group_name",
",",
"managed_cluster_name",
",",
"agent_pool_name",
",",
"custom_headers",
":",
"nil",
")",
"begin_delete_async",
"(",
"resource_group_name",
",",
"managed_cluster_name",
",",
"agent_pool_name",
",",
"custom... | Deletes an agent pool.
Deletes the agent pool in the specified managed cluster.
@param resource_group_name [String] The name of the resource group.
@param managed_cluster_name [String] The name of the managed cluster
resource.
@param agent_pool_name [String] The name of the agent pool.
@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",
"agent",
"pool",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_service/lib/2019-02-01/generated/azure_mgmt_container_service/agent_pools.rb#L493-L495 | train | Deletes the managed cluster agent pool. | [
30522,
13366,
4088,
1035,
3972,
12870,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3266,
1035,
9324,
1035,
2171,
1010,
4005,
1035,
4770,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hashicorp/vagrant | lib/vagrant/bundler.rb | Vagrant.Bundler.update | def update(plugins, specific, **opts)
specific ||= []
update = opts.merge({gems: specific.empty? ? true : specific})
internal_install(plugins, update)
end | ruby | def update(plugins, specific, **opts)
specific ||= []
update = opts.merge({gems: specific.empty? ? true : specific})
internal_install(plugins, update)
end | [
"def",
"update",
"(",
"plugins",
",",
"specific",
",",
"**",
"opts",
")",
"specific",
"||=",
"[",
"]",
"update",
"=",
"opts",
".",
"merge",
"(",
"{",
"gems",
":",
"specific",
".",
"empty?",
"?",
"true",
":",
"specific",
"}",
")",
"internal_install",
... | Update updates the given plugins, or every plugin if none is given.
@param [Hash] plugins
@param [Array<String>] specific Specific plugin names to update. If
empty or nil, all plugins will be updated. | [
"Update",
"updates",
"the",
"given",
"plugins",
"or",
"every",
"plugin",
"if",
"none",
"is",
"given",
"."
] | c22a145c59790c098f95d50141d9afb48e1ef55f | https://github.com/hashicorp/vagrant/blob/c22a145c59790c098f95d50141d9afb48e1ef55f/lib/vagrant/bundler.rb#L159-L163 | train | Update the plugin list | [
30522,
13366,
10651,
1006,
13354,
7076,
1010,
3563,
1010,
1008,
1008,
23569,
2015,
1007,
3563,
1064,
1064,
1027,
1031,
1033,
10651,
1027,
23569,
2015,
1012,
13590,
1006,
1063,
20296,
1024,
3563,
1012,
4064,
1029,
1029,
2995,
1024,
3563,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
heroku/legacy-cli | lib/heroku/command/keys.rb | Heroku::Command.Keys.add | def add
keyfile = shift_argument
validate_arguments!
if keyfile
Heroku::Auth.associate_key(keyfile)
else
# make sure we have credentials
Heroku::Auth.get_credentials
Heroku::Auth.associate_or_generate_ssh_key
end
end | ruby | def add
keyfile = shift_argument
validate_arguments!
if keyfile
Heroku::Auth.associate_key(keyfile)
else
# make sure we have credentials
Heroku::Auth.get_credentials
Heroku::Auth.associate_or_generate_ssh_key
end
end | [
"def",
"add",
"keyfile",
"=",
"shift_argument",
"validate_arguments!",
"if",
"keyfile",
"Heroku",
"::",
"Auth",
".",
"associate_key",
"(",
"keyfile",
")",
"else",
"# make sure we have credentials",
"Heroku",
"::",
"Auth",
".",
"get_credentials",
"Heroku",
"::",
"Aut... | keys:add [KEY]
add a key for the current user
if no KEY is specified, will try to find ~/.ssh/id_[rd]sa.pub
Examples:
$ heroku keys:add
Could not find an existing public key.
Would you like to generate one? [Yn] y
Generating new SSH public key.
Uploading SSH public key /.ssh/id_rsa.pub... done
$ heroku keys:add /my/key.pub
Uploading SSH public key /my/key.pub... done | [
"keys",
":",
"add",
"[",
"KEY",
"]"
] | 6f18521a258394bfb79e6b36f7160ad8559a8e16 | https://github.com/heroku/legacy-cli/blob/6f18521a258394bfb79e6b36f7160ad8559a8e16/lib/heroku/command/keys.rb#L58-L69 | train | Adds a new key to the keygen | [
30522,
13366,
5587,
3145,
8873,
2571,
1027,
5670,
1035,
6685,
9398,
3686,
1035,
9918,
999,
2065,
3145,
8873,
2571,
5394,
5283,
1024,
1024,
8740,
2705,
1012,
5482,
1035,
3145,
1006,
3145,
8873,
2571,
1007,
2842,
1001,
2191,
2469,
2057,
203... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-dynamodb/lib/aws-sdk-dynamodb/table.rb | Aws::DynamoDB.Table.update | def update(options = {})
options = options.merge(table_name: @name)
resp = @client.update_table(options)
Table.new(
name: @name,
data: resp.data.table_description,
client: @client
)
end | ruby | def update(options = {})
options = options.merge(table_name: @name)
resp = @client.update_table(options)
Table.new(
name: @name,
data: resp.data.table_description,
client: @client
)
end | [
"def",
"update",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"table_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"update_table",
"(",
"options",
")",
"Table",
".",
"new",
"(",
"name",
":",
"@name",
",",... | @example Request syntax with placeholder values
table = table.update({
attribute_definitions: [
{
attribute_name: "KeySchemaAttributeName", # required
attribute_type: "S", # required, accepts S, N, B
},
],
billing_mode: "PROVISIONED", # accepts PROVISIONED, PAY_PER_REQUEST
provisioned_throughput: {
read_capacity_units: 1, # required
write_capacity_units: 1, # required
},
global_secondary_index_updates: [
{
update: {
index_name: "IndexName", # required
provisioned_throughput: { # required
read_capacity_units: 1, # required
write_capacity_units: 1, # required
},
},
create: {
index_name: "IndexName", # required
key_schema: [ # required
{
attribute_name: "KeySchemaAttributeName", # required
key_type: "HASH", # required, accepts HASH, RANGE
},
],
projection: { # required
projection_type: "ALL", # accepts ALL, KEYS_ONLY, INCLUDE
non_key_attributes: ["NonKeyAttributeName"],
},
provisioned_throughput: {
read_capacity_units: 1, # required
write_capacity_units: 1, # required
},
},
delete: {
index_name: "IndexName", # required
},
},
],
stream_specification: {
stream_enabled: false,
stream_view_type: "NEW_IMAGE", # accepts NEW_IMAGE, OLD_IMAGE, NEW_AND_OLD_IMAGES, KEYS_ONLY
},
sse_specification: {
enabled: false,
sse_type: "AES256", # accepts AES256, KMS
kms_master_key_id: "KMSMasterKeyId",
},
})
@param [Hash] options ({})
@option options [Array<Types::AttributeDefinition>] :attribute_definitions
An array of attributes that describe the key schema for the table and
indexes. If you are adding a new global secondary index to the table,
`AttributeDefinitions` must include the key element(s) of the new
index.
@option options [String] :billing_mode
Controls how you are charged for read and write throughput and how you
manage capacity. When switching from pay-per-request to provisioned
capacity, initial provisioned capacity values must be set. The initial
provisioned capacity values are estimated based on the consumed read
and write capacity of your table and global secondary indexes over the
past 30 minutes.
* `PROVISIONED` - Sets the billing mode to `PROVISIONED`. We recommend
using `PROVISIONED` for predictable workloads.
* `PAY_PER_REQUEST` - Sets the billing mode to `PAY_PER_REQUEST`. We
recommend using `PAY_PER_REQUEST` for unpredictable workloads.
@option options [Types::ProvisionedThroughput] :provisioned_throughput
The new provisioned throughput settings for the specified table or
index.
@option options [Array<Types::GlobalSecondaryIndexUpdate>] :global_secondary_index_updates
An array of one or more global secondary indexes for the table. For
each index in the array, you can request one action:
* `Create` - add a new global secondary index to the table.
* `Update` - modify the provisioned throughput settings of an existing
global secondary index.
* `Delete` - remove a global secondary index from the table.
For more information, see [Managing Global Secondary Indexes][1] in
the *Amazon DynamoDB Developer Guide*.
[1]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.OnlineOps.html
@option options [Types::StreamSpecification] :stream_specification
Represents the DynamoDB Streams configuration for the table.
<note markdown="1"> You will receive a `ResourceInUseException` if you attempt to enable a
stream on a table that already has a stream, or if you attempt to
disable a stream on a table which does not have a stream.
</note>
@option options [Types::SSESpecification] :sse_specification
The new server-side encryption settings for the specified table.
@return [Table] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-dynamodb/lib/aws-sdk-dynamodb/table.rb#L1781-L1789 | train | Update the table | [
30522,
13366,
10651,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
2795,
1035,
2171,
1024,
1030,
2171,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
10651,
1035,
2795,
1006,
7047,
1007,
2795,
1012,
2047,
1006,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-s3/lib/aws-sdk-s3/bucket_versioning.rb | Aws::S3.BucketVersioning.enable | def enable(options = {})
options = Aws::Util.deep_merge(options,
bucket: @bucket_name,
versioning_configuration: {
status: "Enabled"
}
)
resp = @client.put_bucket_versioning(options)
resp.data
end | ruby | def enable(options = {})
options = Aws::Util.deep_merge(options,
bucket: @bucket_name,
versioning_configuration: {
status: "Enabled"
}
)
resp = @client.put_bucket_versioning(options)
resp.data
end | [
"def",
"enable",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"Aws",
"::",
"Util",
".",
"deep_merge",
"(",
"options",
",",
"bucket",
":",
"@bucket_name",
",",
"versioning_configuration",
":",
"{",
"status",
":",
"\"Enabled\"",
"}",
")",
"resp",
"=... | @!group Actions
@example Request syntax with placeholder values
bucket_versioning.enable({
content_md5: "ContentMD5",
mfa: "MFA",
})
@param [Hash] options ({})
@option options [String] :content_md5
@option options [String] :mfa
The concatenation of the authentication device's serial number, a
space, and the value that is displayed on your authentication device.
@return [EmptyStructure] | [
"@!group",
"Actions",
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-s3/lib/aws-sdk-s3/bucket_versioning.rb#L192-L201 | train | Enables the versioning of the bucket | [
30522,
13366,
9585,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
22091,
2015,
1024,
1024,
21183,
4014,
1012,
2784,
1035,
13590,
1006,
7047,
1010,
13610,
1024,
1030,
13610,
1035,
2171,
1010,
2544,
2075,
1035,
9563,
1024,
1063,
3570,
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_web/lib/2016-03-01/generated/azure_mgmt_web/web_site_management_client.rb | Azure::Web::Mgmt::V2016_03_01.WebSiteManagementClient.list_geo_regions | def list_geo_regions(sku:nil, linux_workers_enabled:nil, custom_headers:nil)
first_page = list_geo_regions_as_lazy(sku:sku, linux_workers_enabled:linux_workers_enabled, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_geo_regions(sku:nil, linux_workers_enabled:nil, custom_headers:nil)
first_page = list_geo_regions_as_lazy(sku:sku, linux_workers_enabled:linux_workers_enabled, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_geo_regions",
"(",
"sku",
":",
"nil",
",",
"linux_workers_enabled",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_geo_regions_as_lazy",
"(",
"sku",
":",
"sku",
",",
"linux_workers_enabled",
":linux_workers_enabled",
",",
... | Get a list of available geographical regions.
Get a list of available geographical regions.
@param sku [SkuName] Name of SKU used to filter the regions. Possible values
include: 'Free', 'Shared', 'Basic', 'Standard', 'Premium', 'PremiumV2',
'Dynamic', 'Isolated'
@param linux_workers_enabled [Boolean] Specify <code>true</code> if you want
to filter to only regions that support Linux workers.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<GeoRegion>] operation results. | [
"Get",
"a",
"list",
"of",
"available",
"geographical",
"regions",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2016-03-01/generated/azure_mgmt_web/web_site_management_client.rb#L846-L849 | train | Gets all the geo regions in a product. | [
30522,
13366,
2862,
1035,
20248,
1035,
4655,
1006,
15315,
2226,
1024,
9152,
2140,
1010,
11603,
1035,
3667,
1035,
9124,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2862,
1035,
20248,
1035,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
randym/axlsx | lib/axlsx/rels/relationships.rb | Axlsx.Relationships.to_xml_string | def to_xml_string(str = '')
str << '<?xml version="1.0" encoding="UTF-8"?>'
str << ('<Relationships xmlns="' << RELS_R << '">')
each{ |rel| rel.to_xml_string(str) }
str << '</Relationships>'
end | ruby | def to_xml_string(str = '')
str << '<?xml version="1.0" encoding="UTF-8"?>'
str << ('<Relationships xmlns="' << RELS_R << '">')
each{ |rel| rel.to_xml_string(str) }
str << '</Relationships>'
end | [
"def",
"to_xml_string",
"(",
"str",
"=",
"''",
")",
"str",
"<<",
"'<?xml version=\"1.0\" encoding=\"UTF-8\"?>'",
"str",
"<<",
"(",
"'<Relationships xmlns=\"'",
"<<",
"RELS_R",
"<<",
"'\">'",
")",
"each",
"{",
"|",
"rel",
"|",
"rel",
".",
"to_xml_string",
"(",
... | serialize relationships
@param [String] str
@return [String] | [
"serialize",
"relationships"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/rels/relationships.rb#L24-L29 | train | Convert the Relationships object to XML string. | [
30522,
13366,
2000,
1035,
20950,
1035,
5164,
1006,
2358,
2099,
1027,
1005,
1005,
1007,
2358,
2099,
1026,
1026,
1005,
1026,
1029,
20950,
2544,
1027,
1000,
1015,
1012,
1014,
1000,
17181,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1029,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
watir/watir | lib/watir/browser.rb | Watir.Browser.inspect | def inspect
if alert.exists?
format('#<%s:0x%x alert=true>', self.class, hash * 2)
else
format('#<%s:0x%x url=%s title=%s>', self.class, hash * 2, url.inspect, title.inspect)
end
rescue Errno::ECONNREFUSED
format('#<%s:0x%x closed=true>', self.class, hash * 2)
end | ruby | def inspect
if alert.exists?
format('#<%s:0x%x alert=true>', self.class, hash * 2)
else
format('#<%s:0x%x url=%s title=%s>', self.class, hash * 2, url.inspect, title.inspect)
end
rescue Errno::ECONNREFUSED
format('#<%s:0x%x closed=true>', self.class, hash * 2)
end | [
"def",
"inspect",
"if",
"alert",
".",
"exists?",
"format",
"(",
"'#<%s:0x%x alert=true>'",
",",
"self",
".",
"class",
",",
"hash",
"*",
"2",
")",
"else",
"format",
"(",
"'#<%s:0x%x url=%s title=%s>'",
",",
"self",
".",
"class",
",",
"hash",
"*",
"2",
",",
... | Creates a Watir::Browser instance.
@param [Symbol, Selenium::WebDriver] browser :firefox, :ie, :chrome, :remote or Selenium::WebDriver instance
@param args Passed to the underlying driver | [
"Creates",
"a",
"Watir",
"::",
"Browser",
"instance",
"."
] | 2d8db09811c6221ae401b85b2f61f5fa66e463a3 | https://github.com/watir/watir/blob/2d8db09811c6221ae401b85b2f61f5fa66e463a3/lib/watir/browser.rb#L58-L66 | train | inspect the object | [
30522,
13366,
22459,
2065,
9499,
1012,
6526,
1029,
4289,
1006,
1005,
1001,
1026,
1003,
1055,
1024,
1014,
2595,
1003,
1060,
9499,
1027,
2995,
1028,
1005,
1010,
2969,
1012,
2465,
1010,
23325,
1008,
1016,
1007,
2842,
4289,
1006,
1005,
1001,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sunspot/sunspot | sunspot/lib/sunspot/indexer.rb | Sunspot.Indexer.remove | def remove(*models)
@connection.delete_by_id(
models.map { |model| Adapters::InstanceAdapter.adapt(model).index_id }
)
end | ruby | def remove(*models)
@connection.delete_by_id(
models.map { |model| Adapters::InstanceAdapter.adapt(model).index_id }
)
end | [
"def",
"remove",
"(",
"*",
"models",
")",
"@connection",
".",
"delete_by_id",
"(",
"models",
".",
"map",
"{",
"|",
"model",
"|",
"Adapters",
"::",
"InstanceAdapter",
".",
"adapt",
"(",
"model",
")",
".",
"index_id",
"}",
")",
"end"
] | Remove the given model from the Solr index | [
"Remove",
"the",
"given",
"model",
"from",
"the",
"Solr",
"index"
] | 31dd76cd7a14a4ef7bd541de97483d8cd72ff685 | https://github.com/sunspot/sunspot/blob/31dd76cd7a14a4ef7bd541de97483d8cd72ff685/sunspot/lib/sunspot/indexer.rb#L47-L51 | train | Remove the given models from the index | [
30522,
13366,
6366,
1006,
1008,
4275,
1007,
1030,
4434,
1012,
3972,
12870,
1035,
2011,
1035,
8909,
1006,
4275,
1012,
4949,
1063,
1064,
2944,
1064,
15581,
2545,
1024,
1024,
6013,
8447,
13876,
2121,
1012,
15581,
1006,
2944,
1007,
1012,
5950,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
slim-template/slim | lib/slim/command.rb | Slim.Command.set_opts | def set_opts(opts)
opts.on('-s', '--stdin', 'Read input from standard input instead of an input file') do
@options[:input] = $stdin
end
opts.on('--trace', 'Show a full traceback on error') do
@options[:trace] = true
end
opts.on('-c', '--compile', 'Compile only but do not run') do
@options[:compile] = true
end
opts.on('-e', '--erb', 'Convert to ERB') do
@options[:erb] = true
end
opts.on('--rails', 'Generate rails compatible code (Implies --compile)') do
Engine.set_options disable_capture: true, generator: Temple::Generators::RailsOutputBuffer
@options[:compile] = true
end
opts.on('-r', '--require library', "Load library or plugin with -r slim/plugin") do |lib|
require lib.strip
end
opts.on('-p', '--pretty', 'Produce pretty html') do
Engine.set_options pretty: true
end
opts.on('-o', '--option name=code', String, 'Set slim option') do |str|
parts = str.split('=', 2)
Engine.options[parts.first.gsub(/\A:/, '').to_sym] = eval(parts.last)
end
opts.on('-l', '--locals Hash|YAML|JSON', String, 'Set local variables') do |locals|
@options[:locals] =
if locals =~ /\A\s*\{\s*\p{Word}+:/
eval(locals)
else
require 'yaml'
if RUBY_ENGINE == 'rbx'
begin
require 'psych'
rescue LoadError
$stderr.puts 'Please install psych gem as Rubunius ships with an old YAML engine.'
end
end
YAML.load(locals)
end
end
opts.on_tail('-h', '--help', 'Show this message') do
puts opts
exit
end
opts.on_tail('-v', '--version', 'Print version') do
puts "Slim #{VERSION}"
exit
end
end | ruby | def set_opts(opts)
opts.on('-s', '--stdin', 'Read input from standard input instead of an input file') do
@options[:input] = $stdin
end
opts.on('--trace', 'Show a full traceback on error') do
@options[:trace] = true
end
opts.on('-c', '--compile', 'Compile only but do not run') do
@options[:compile] = true
end
opts.on('-e', '--erb', 'Convert to ERB') do
@options[:erb] = true
end
opts.on('--rails', 'Generate rails compatible code (Implies --compile)') do
Engine.set_options disable_capture: true, generator: Temple::Generators::RailsOutputBuffer
@options[:compile] = true
end
opts.on('-r', '--require library', "Load library or plugin with -r slim/plugin") do |lib|
require lib.strip
end
opts.on('-p', '--pretty', 'Produce pretty html') do
Engine.set_options pretty: true
end
opts.on('-o', '--option name=code', String, 'Set slim option') do |str|
parts = str.split('=', 2)
Engine.options[parts.first.gsub(/\A:/, '').to_sym] = eval(parts.last)
end
opts.on('-l', '--locals Hash|YAML|JSON', String, 'Set local variables') do |locals|
@options[:locals] =
if locals =~ /\A\s*\{\s*\p{Word}+:/
eval(locals)
else
require 'yaml'
if RUBY_ENGINE == 'rbx'
begin
require 'psych'
rescue LoadError
$stderr.puts 'Please install psych gem as Rubunius ships with an old YAML engine.'
end
end
YAML.load(locals)
end
end
opts.on_tail('-h', '--help', 'Show this message') do
puts opts
exit
end
opts.on_tail('-v', '--version', 'Print version') do
puts "Slim #{VERSION}"
exit
end
end | [
"def",
"set_opts",
"(",
"opts",
")",
"opts",
".",
"on",
"(",
"'-s'",
",",
"'--stdin'",
",",
"'Read input from standard input instead of an input file'",
")",
"do",
"@options",
"[",
":input",
"]",
"=",
"$stdin",
"end",
"opts",
".",
"on",
"(",
"'--trace'",
",",
... | Configure OptionParser | [
"Configure",
"OptionParser"
] | ae8e7338fcfb67256d2f6b50c64fc317210e31a2 | https://github.com/slim-template/slim/blob/ae8e7338fcfb67256d2f6b50c64fc317210e31a2/lib/slim/command.rb#L25-L86 | train | Set options for the command line | [
30522,
13366,
2275,
1035,
23569,
2015,
1006,
23569,
2015,
1007,
23569,
2015,
1012,
2006,
1006,
1005,
1011,
1055,
1005,
1010,
1005,
1011,
1011,
2358,
8718,
1005,
1010,
1005,
3191,
7953,
2013,
3115,
7953,
2612,
1997,
2019,
7953,
5371,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cheezy/page-object | lib/page-object/accessors.rb | PageObject.Accessors.in_frame | def in_frame(identifier, frame=nil, &block)
frame = frame.nil? ? [] : frame.dup
frame << {frame: identifier}
block.call(frame)
end | ruby | def in_frame(identifier, frame=nil, &block)
frame = frame.nil? ? [] : frame.dup
frame << {frame: identifier}
block.call(frame)
end | [
"def",
"in_frame",
"(",
"identifier",
",",
"frame",
"=",
"nil",
",",
"&",
"block",
")",
"frame",
"=",
"frame",
".",
"nil?",
"?",
"[",
"]",
":",
"frame",
".",
"dup",
"frame",
"<<",
"{",
"frame",
":",
"identifier",
"}",
"block",
".",
"call",
"(",
"... | Identify an element as existing within a frame . A frame parameter
is passed to the block and must be passed to the other calls to PageObject.
You can nest calls to in_frame by passing the frame to the next level.
@example
in_frame(:id => 'frame_id') do |frame|
text_field(:first_name, :id => 'fname', :frame => frame)
end
@param [Hash] identifier how we find the frame. The valid keys are:
* :id
* :index
* :name
* :regexp
@param frame passed from a previous call to in_frame. Used to nest calls
@param block that contains the calls to elements that exist inside the frame. | [
"Identify",
"an",
"element",
"as",
"existing",
"within",
"a",
"frame",
".",
"A",
"frame",
"parameter",
"is",
"passed",
"to",
"the",
"block",
"and",
"must",
"be",
"passed",
"to",
"the",
"other",
"calls",
"to",
"PageObject",
".",
"You",
"can",
"nest",
"cal... | 850d775bf63768fbb1551a34480195785fe8e193 | https://github.com/cheezy/page-object/blob/850d775bf63768fbb1551a34480195785fe8e193/lib/page-object/accessors.rb#L152-L156 | train | Adds a frame to the current frame. | [
30522,
13366,
1999,
1035,
4853,
1006,
8909,
4765,
18095,
1010,
4853,
1027,
9152,
2140,
1010,
1004,
3796,
1007,
4853,
1027,
4853,
1012,
9152,
2140,
1029,
1029,
1031,
1033,
1024,
4853,
1012,
4241,
2361,
4853,
1026,
1026,
1063,
4853,
1024,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/express_route_circuits.rb | Azure::Network::Mgmt::V2019_02_01.ExpressRouteCircuits.begin_list_routes_table_with_http_info | def begin_list_routes_table_with_http_info(resource_group_name, circuit_name, peering_name, device_path, custom_headers:nil)
begin_list_routes_table_async(resource_group_name, circuit_name, peering_name, device_path, custom_headers:custom_headers).value!
end | ruby | def begin_list_routes_table_with_http_info(resource_group_name, circuit_name, peering_name, device_path, custom_headers:nil)
begin_list_routes_table_async(resource_group_name, circuit_name, peering_name, device_path, custom_headers:custom_headers).value!
end | [
"def",
"begin_list_routes_table_with_http_info",
"(",
"resource_group_name",
",",
"circuit_name",
",",
"peering_name",
",",
"device_path",
",",
"custom_headers",
":",
"nil",
")",
"begin_list_routes_table_async",
"(",
"resource_group_name",
",",
"circuit_name",
",",
"peering... | Gets the currently advertised routes table associated with the express route
circuit in a resource group.
@param resource_group_name [String] The name of the resource group.
@param circuit_name [String] The name of the express route circuit.
@param peering_name [String] The name of the peering.
@param device_path [String] The path of the device.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"currently",
"advertised",
"routes",
"table",
"associated",
"with",
"the",
"express",
"route",
"circuit",
"in",
"a",
"resource",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/express_route_circuits.rb#L1184-L1186 | train | Gets the route table associated with the express route circuit. | [
30522,
13366,
4088,
1035,
2862,
1035,
5847,
1035,
2795,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4984,
1035,
2171,
1010,
16740,
1035,
2171,
1010,
5080,
1035,
4130,
1010,
7661,
1035,
20346,
2015,
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... |
guard/guard | lib/guard/cli.rb | Guard.CLI.show | def show
Cli::Environments::EvaluateOnly.new(options).evaluate
DslDescriber.new.show
end | ruby | def show
Cli::Environments::EvaluateOnly.new(options).evaluate
DslDescriber.new.show
end | [
"def",
"show",
"Cli",
"::",
"Environments",
"::",
"EvaluateOnly",
".",
"new",
"(",
"options",
")",
".",
"evaluate",
"DslDescriber",
".",
"new",
".",
"show",
"end"
] | Shows all Guard plugins and their options that are defined in
the `Guardfile`
@see Guard::DslDescriber.show | [
"Shows",
"all",
"Guard",
"plugins",
"and",
"their",
"options",
"that",
"are",
"defined",
"in",
"the",
"Guardfile"
] | e2508cd83badf0d537dbaba35d307adc35d92e4f | https://github.com/guard/guard/blob/e2508cd83badf0d537dbaba35d307adc35d92e4f/lib/guard/cli.rb#L195-L198 | train | Show the sequence number of documents in the current project. | [
30522,
13366,
2265,
18856,
2072,
1024,
1024,
10058,
1024,
1024,
16157,
2239,
2135,
1012,
2047,
1006,
7047,
1007,
1012,
16157,
16233,
17920,
29234,
2099,
1012,
2047,
1012,
2265,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_datalake_analytics/lib/2015-10-01-preview/generated/azure_mgmt_datalake_analytics/account.rb | Azure::DataLakeAnalytics::Mgmt::V2015_10_01_preview.Account.get_data_lake_store_account | def get_data_lake_store_account(resource_group_name, account_name, data_lake_store_account_name, custom_headers:nil)
response = get_data_lake_store_account_async(resource_group_name, account_name, data_lake_store_account_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_data_lake_store_account(resource_group_name, account_name, data_lake_store_account_name, custom_headers:nil)
response = get_data_lake_store_account_async(resource_group_name, account_name, data_lake_store_account_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_data_lake_store_account",
"(",
"resource_group_name",
",",
"account_name",
",",
"data_lake_store_account_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_data_lake_store_account_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"d... | Gets the specified Data Lake Store account details in the specified Data Lake
Analytics account.
@param resource_group_name [String] The name of the Azure resource group that
contains the Data Lake Analytics account.
@param account_name [String] The name of the Data Lake Analytics account from
which to retrieve the Data Lake Store account details.
@param data_lake_store_account_name [String] The name of the Data Lake Store
account to retrieve
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [DataLakeStoreAccountInfo] operation results. | [
"Gets",
"the",
"specified",
"Data",
"Lake",
"Store",
"account",
"details",
"in",
"the",
"specified",
"Data",
"Lake",
"Analytics",
"account",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_datalake_analytics/lib/2015-10-01-preview/generated/azure_mgmt_datalake_analytics/account.rb#L804-L807 | train | Gets the specified Data Lake Store account. | [
30522,
13366,
2131,
1035,
2951,
1035,
2697,
1035,
3573,
1035,
4070,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
2951,
1035,
2697,
1035,
3573,
1035,
4070,
1035,
2171,
1010,
7661,
1035,
20346,
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... |
mikel/mail | lib/mail/network/retriever_methods/imap.rb | Mail.IMAP.start | def start(config=Mail::Configuration.instance, &block)
raise ArgumentError.new("Mail::Retrievable#imap_start takes a block") unless block_given?
if settings[:enable_starttls] && settings[:enable_ssl]
raise ArgumentError, ":enable_starttls and :enable_ssl are mutually exclusive. Set :enable_ssl if you're on an IMAPS connection. Set :enable_starttls if you're on an IMAP connection and using STARTTLS for secure TLS upgrade."
end
imap = Net::IMAP.new(settings[:address], settings[:port], settings[:enable_ssl], nil, false)
imap.starttls if settings[:enable_starttls]
if settings[:authentication].nil?
imap.login(settings[:user_name], settings[:password])
else
# Note that Net::IMAP#authenticate('LOGIN', ...) is not equal with Net::IMAP#login(...)!
# (see also http://www.ensta.fr/~diam/ruby/online/ruby-doc-stdlib/libdoc/net/imap/rdoc/classes/Net/IMAP.html#M000718)
imap.authenticate(settings[:authentication], settings[:user_name], settings[:password])
end
yield imap
ensure
if defined?(imap) && imap && !imap.disconnected?
imap.disconnect
end
end | ruby | def start(config=Mail::Configuration.instance, &block)
raise ArgumentError.new("Mail::Retrievable#imap_start takes a block") unless block_given?
if settings[:enable_starttls] && settings[:enable_ssl]
raise ArgumentError, ":enable_starttls and :enable_ssl are mutually exclusive. Set :enable_ssl if you're on an IMAPS connection. Set :enable_starttls if you're on an IMAP connection and using STARTTLS for secure TLS upgrade."
end
imap = Net::IMAP.new(settings[:address], settings[:port], settings[:enable_ssl], nil, false)
imap.starttls if settings[:enable_starttls]
if settings[:authentication].nil?
imap.login(settings[:user_name], settings[:password])
else
# Note that Net::IMAP#authenticate('LOGIN', ...) is not equal with Net::IMAP#login(...)!
# (see also http://www.ensta.fr/~diam/ruby/online/ruby-doc-stdlib/libdoc/net/imap/rdoc/classes/Net/IMAP.html#M000718)
imap.authenticate(settings[:authentication], settings[:user_name], settings[:password])
end
yield imap
ensure
if defined?(imap) && imap && !imap.disconnected?
imap.disconnect
end
end | [
"def",
"start",
"(",
"config",
"=",
"Mail",
"::",
"Configuration",
".",
"instance",
",",
"&",
"block",
")",
"raise",
"ArgumentError",
".",
"new",
"(",
"\"Mail::Retrievable#imap_start takes a block\"",
")",
"unless",
"block_given?",
"if",
"settings",
"[",
":enable_... | Start an IMAP session and ensures that it will be closed in any case. | [
"Start",
"an",
"IMAP",
"session",
"and",
"ensures",
"that",
"it",
"will",
"be",
"closed",
"in",
"any",
"case",
"."
] | fb53fb369eb2bf0494ac70675970c90cdcc3f495 | https://github.com/mikel/mail/blob/fb53fb369eb2bf0494ac70675970c90cdcc3f495/lib/mail/network/retriever_methods/imap.rb#L160-L184 | train | Start the IMAP connection | [
30522,
13366,
2707,
1006,
9530,
8873,
2290,
1027,
5653,
1024,
1024,
9563,
1012,
6013,
1010,
1004,
3796,
1007,
5333,
6685,
2121,
29165,
1012,
2047,
1006,
1000,
5653,
1024,
1024,
2128,
18886,
13331,
3468,
1001,
10047,
9331,
1035,
2707,
3138,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-10-01/generated/azure_mgmt_container_registry/registries.rb | Azure::ContainerRegistry::Mgmt::V2017_10_01.Registries.begin_import_image_with_http_info | def begin_import_image_with_http_info(resource_group_name, registry_name, parameters, custom_headers:nil)
begin_import_image_async(resource_group_name, registry_name, parameters, custom_headers:custom_headers).value!
end | ruby | def begin_import_image_with_http_info(resource_group_name, registry_name, parameters, custom_headers:nil)
begin_import_image_async(resource_group_name, registry_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_import_image_with_http_info",
"(",
"resource_group_name",
",",
"registry_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_import_image_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"parameters",
",",
"custom_headers",
... | Copies an image to this container registry from the specified container
registry.
@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 parameters [ImportImageParameters] The parameters specifying the image
to copy and the source container registry.
@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. | [
"Copies",
"an",
"image",
"to",
"this",
"container",
"registry",
"from",
"the",
"specified",
"container",
"registry",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_registry/lib/2017-10-01/generated/azure_mgmt_container_registry/registries.rb#L1078-L1080 | train | Import an image into an image registry. | [
30522,
13366,
4088,
1035,
12324,
1035,
3746,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
1035,
12324,
1035,
3746... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_cdn/lib/2017-04-02/generated/azure_mgmt_cdn/endpoints.rb | Azure::CDN::Mgmt::V2017_04_02.Endpoints.list_resource_usage_as_lazy | def list_resource_usage_as_lazy(resource_group_name, profile_name, endpoint_name, custom_headers:nil)
response = list_resource_usage_async(resource_group_name, profile_name, endpoint_name, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_resource_usage_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_resource_usage_as_lazy(resource_group_name, profile_name, endpoint_name, custom_headers:nil)
response = list_resource_usage_async(resource_group_name, profile_name, endpoint_name, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_resource_usage_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_resource_usage_as_lazy",
"(",
"resource_group_name",
",",
"profile_name",
",",
"endpoint_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_resource_usage_async",
"(",
"resource_group_name",
",",
"profile_name",
",",
"endpoint_name",
",",
... | Checks the quota and usage of geo filters and custom domains under the given
endpoint.
@param resource_group_name [String] Name of the Resource group within the
Azure subscription.
@param profile_name [String] Name of the CDN profile which is unique within
the resource group.
@param endpoint_name [String] Name of the endpoint under the profile which is
unique globally.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ResourceUsageListResult] which provide lazy access to pages of the
response. | [
"Checks",
"the",
"quota",
"and",
"usage",
"of",
"geo",
"filters",
"and",
"custom",
"domains",
"under",
"the",
"given",
"endpoint",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_cdn/lib/2017-04-02/generated/azure_mgmt_cdn/endpoints.rb#L1910-L1919 | train | Gets the resource usage information for the specified endpoint. | [
30522,
13366,
2862,
1035,
7692,
1035,
8192,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
6337,
1035,
2171,
1010,
2203,
8400,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
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_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.delete_custom_entity_role | def delete_custom_entity_role(app_id, version_id, entity_id, role_id, custom_headers:nil)
response = delete_custom_entity_role_async(app_id, version_id, entity_id, role_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def delete_custom_entity_role(app_id, version_id, entity_id, role_id, custom_headers:nil)
response = delete_custom_entity_role_async(app_id, version_id, entity_id, role_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"delete_custom_entity_role",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"role_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_custom_entity_role_async",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"role_id",
... | Delete a role for a given prebuilt 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 custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OperationStatus] operation results. | [
"Delete",
"a",
"role",
"for",
"a",
"given",
"prebuilt",
"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#L11179-L11182 | train | Deletes a role from an entity in a version of the application. | [
30522,
13366,
3972,
12870,
1035,
7661,
1035,
9178,
1035,
2535,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
9178,
1035,
8909,
1010,
2535,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Sorcery/sorcery | lib/sorcery/model.rb | Sorcery.Model.init_orm_hooks! | def init_orm_hooks!
sorcery_adapter.define_callback :before, :validation, :encrypt_password, if: proc { |record|
record.send(sorcery_config.password_attribute_name).present?
}
sorcery_adapter.define_callback :after, :save, :clear_virtual_password, if: proc { |record|
record.send(sorcery_config.password_attribute_name).present?
}
attr_accessor sorcery_config.password_attribute_name
end | ruby | def init_orm_hooks!
sorcery_adapter.define_callback :before, :validation, :encrypt_password, if: proc { |record|
record.send(sorcery_config.password_attribute_name).present?
}
sorcery_adapter.define_callback :after, :save, :clear_virtual_password, if: proc { |record|
record.send(sorcery_config.password_attribute_name).present?
}
attr_accessor sorcery_config.password_attribute_name
end | [
"def",
"init_orm_hooks!",
"sorcery_adapter",
".",
"define_callback",
":before",
",",
":validation",
",",
":encrypt_password",
",",
"if",
":",
"proc",
"{",
"|",
"record",
"|",
"record",
".",
"send",
"(",
"sorcery_config",
".",
"password_attribute_name",
")",
".",
... | add virtual password accessor and ORM callbacks. | [
"add",
"virtual",
"password",
"accessor",
"and",
"ORM",
"callbacks",
"."
] | ae4141e7059fa5c79d4135e81efb839a016d39ac | https://github.com/Sorcery/sorcery/blob/ae4141e7059fa5c79d4135e81efb839a016d39ac/lib/sorcery/model.rb#L64-L74 | train | Initialize orm hooks | [
30522,
13366,
1999,
4183,
1035,
2030,
2213,
1035,
18008,
999,
2061,
19170,
2854,
1035,
15581,
30524,
1012,
2556,
1029,
1065,
2061,
19170,
2854,
1035,
15581,
2121,
1012,
9375,
1035,
2655,
5963,
1024,
2044,
1010,
1024,
3828,
1010,
1024,
3154,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/workflow_triggers.rb | Azure::Logic::Mgmt::V2016_06_01.WorkflowTriggers.list_callback_url_with_http_info | def list_callback_url_with_http_info(resource_group_name, workflow_name, trigger_name, custom_headers:nil)
list_callback_url_async(resource_group_name, workflow_name, trigger_name, custom_headers:custom_headers).value!
end | ruby | def list_callback_url_with_http_info(resource_group_name, workflow_name, trigger_name, custom_headers:nil)
list_callback_url_async(resource_group_name, workflow_name, trigger_name, custom_headers:custom_headers).value!
end | [
"def",
"list_callback_url_with_http_info",
"(",
"resource_group_name",
",",
"workflow_name",
",",
"trigger_name",
",",
"custom_headers",
":",
"nil",
")",
"list_callback_url_async",
"(",
"resource_group_name",
",",
"workflow_name",
",",
"trigger_name",
",",
"custom_headers",... | Get the callback URL for a workflow trigger.
@param resource_group_name [String] The resource group name.
@param workflow_name [String] The workflow name.
@param trigger_name [String] The workflow trigger name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Get",
"the",
"callback",
"URL",
"for",
"a",
"workflow",
"trigger",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/workflow_triggers.rb#L611-L613 | train | Gets the callback URL for the specified workflow trigger. | [
30522,
13366,
2862,
1035,
2655,
5963,
1035,
24471,
2140,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2147,
12314,
1035,
2171,
1010,
9495,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb | Aws::AutoScaling.Resource.scheduled_actions | def scheduled_actions(options = {})
batches = Enumerator.new do |y|
resp = @client.describe_scheduled_actions(options)
resp.each_page do |page|
batch = []
page.data.scheduled_update_group_actions.each do |s|
batch << ScheduledAction.new(
name: s.scheduled_action_name,
data: s,
client: @client
)
end
y.yield(batch)
end
end
ScheduledAction::Collection.new(batches)
end | ruby | def scheduled_actions(options = {})
batches = Enumerator.new do |y|
resp = @client.describe_scheduled_actions(options)
resp.each_page do |page|
batch = []
page.data.scheduled_update_group_actions.each do |s|
batch << ScheduledAction.new(
name: s.scheduled_action_name,
data: s,
client: @client
)
end
y.yield(batch)
end
end
ScheduledAction::Collection.new(batches)
end | [
"def",
"scheduled_actions",
"(",
"options",
"=",
"{",
"}",
")",
"batches",
"=",
"Enumerator",
".",
"new",
"do",
"|",
"y",
"|",
"resp",
"=",
"@client",
".",
"describe_scheduled_actions",
"(",
"options",
")",
"resp",
".",
"each_page",
"do",
"|",
"page",
"|... | @example Request syntax with placeholder values
scheduled_actions = auto_scaling.scheduled_actions({
auto_scaling_group_name: "ResourceName",
scheduled_action_names: ["ResourceName"],
start_time: Time.now,
end_time: Time.now,
})
@param [Hash] options ({})
@option options [String] :auto_scaling_group_name
The name of the Auto Scaling group.
@option options [Array<String>] :scheduled_action_names
The names of one or more scheduled actions. You can specify up to 50
actions. If you omit this parameter, all scheduled actions are
described. If you specify an unknown scheduled action, it is ignored
with no error.
@option options [Time,DateTime,Date,Integer,String] :start_time
The earliest scheduled start time to return. If scheduled action names
are provided, this parameter is ignored.
@option options [Time,DateTime,Date,Integer,String] :end_time
The latest scheduled start time to return. If scheduled action names
are provided, this parameter is ignored.
@return [ScheduledAction::Collection] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb#L751-L767 | train | Returns an array of ScheduledAction objects | [
30522,
13366,
5115,
1035,
4506,
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,
5115,
1035,
4506,
1006,
7047,
1007,
24501,
2361,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_resources/lib/2016-02-01/generated/azure_mgmt_resources/resources.rb | Azure::Resources::Mgmt::V2016_02_01.Resources.move_resources | def move_resources(source_resource_group_name, parameters, custom_headers:nil)
response = move_resources_async(source_resource_group_name, parameters, custom_headers:custom_headers).value!
nil
end | ruby | def move_resources(source_resource_group_name, parameters, custom_headers:nil)
response = move_resources_async(source_resource_group_name, parameters, custom_headers:custom_headers).value!
nil
end | [
"def",
"move_resources",
"(",
"source_resource_group_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"move_resources_async",
"(",
"source_resource_group_name",
",",
"parameters",
",",
"custom_headers",
":custom_headers",
")",
".",
"val... | Move resources from one resource group to another. The resources being moved
should all be in the same resource group.
@param source_resource_group_name [String] Source resource group name.
@param parameters [ResourcesMoveInfo] move resources' parameters.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Move",
"resources",
"from",
"one",
"resource",
"group",
"to",
"another",
".",
"The",
"resources",
"being",
"moved",
"should",
"all",
"be",
"in",
"the",
"same",
"resource",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_resources/lib/2016-02-01/generated/azure_mgmt_resources/resources.rb#L33-L36 | train | Moves the resources from one resource group to another resource group. | [
30522,
13366,
2693,
1035,
4219,
1006,
3120,
1035,
7692,
1035,
2177,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2693,
1035,
4219,
1035,
2004,
6038,
2278,
1006,
3120,
1035,
7692,
1035,
2177,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kpumuk/meta-tags | lib/meta_tags/meta_tags_collection.rb | MetaTags.MetaTagsCollection.group_attributes_by_key | def group_attributes_by_key(attributes)
Hash[attributes.group_by(&:first).map { |k, v| [k, v.map(&:last).tap(&:compact!).join(', ')] }]
end | ruby | def group_attributes_by_key(attributes)
Hash[attributes.group_by(&:first).map { |k, v| [k, v.map(&:last).tap(&:compact!).join(', ')] }]
end | [
"def",
"group_attributes_by_key",
"(",
"attributes",
")",
"Hash",
"[",
"attributes",
".",
"group_by",
"(",
":first",
")",
".",
"map",
"{",
"|",
"k",
",",
"v",
"|",
"[",
"k",
",",
"v",
".",
"map",
"(",
":last",
")",
".",
"tap",
"(",
":compact!",
")"... | Convert array of arrays to hashes and concatenate values
@param [Array<Array>] attributes list of noindex keys and values
@return [Hash<String, String>] hash of grouped noindex keys and values | [
"Convert",
"array",
"of",
"arrays",
"to",
"hashes",
"and",
"concatenate",
"values"
] | 03585f95edf96cd17024c5c155ce46ec8bc47232 | https://github.com/kpumuk/meta-tags/blob/03585f95edf96cd17024c5c155ce46ec8bc47232/lib/meta_tags/meta_tags_collection.rb#L228-L230 | train | Group attributes by key | [
30522,
13366,
2177,
1035,
12332,
1035,
2011,
1035,
3145,
1006,
12332,
1007,
23325,
1031,
12332,
1012,
2177,
1035,
2011,
1006,
1004,
1024,
2034,
1007,
1012,
4949,
1063,
1064,
1047,
1010,
1058,
1064,
1031,
1047,
1010,
1058,
1012,
4949,
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... |
fastlane/fastlane | fastlane_core/lib/fastlane_core/ui/github_issue_inspector_reporter.rb | Fastlane.InspectorReporter.inspector_started_query | def inspector_started_query(query, inspector)
puts("")
puts("Looking for related GitHub issues on #{inspector.repo_owner}/#{inspector.repo_name}...")
puts("Search query: #{query}") if FastlaneCore::Globals.verbose?
puts("")
end | ruby | def inspector_started_query(query, inspector)
puts("")
puts("Looking for related GitHub issues on #{inspector.repo_owner}/#{inspector.repo_name}...")
puts("Search query: #{query}") if FastlaneCore::Globals.verbose?
puts("")
end | [
"def",
"inspector_started_query",
"(",
"query",
",",
"inspector",
")",
"puts",
"(",
"\"\"",
")",
"puts",
"(",
"\"Looking for related GitHub issues on #{inspector.repo_owner}/#{inspector.repo_name}...\"",
")",
"puts",
"(",
"\"Search query: #{query}\"",
")",
"if",
"FastlaneCore... | Called just as the investigation has begun. | [
"Called",
"just",
"as",
"the",
"investigation",
"has",
"begun",
"."
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/fastlane_core/lib/fastlane_core/ui/github_issue_inspector_reporter.rb#L11-L16 | train | Called when a search is started | [
30522,
13366,
7742,
1035,
2318,
1035,
23032,
1006,
23032,
1010,
7742,
1007,
8509,
1006,
1000,
1000,
1007,
8509,
1006,
1000,
2559,
2005,
3141,
21025,
2705,
12083,
3314,
2006,
1001,
1063,
7742,
1012,
16360,
2080,
1035,
3954,
1065,
1013,
1001,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-cloudwatch/lib/aws-sdk-cloudwatch/metric.rb | Aws::CloudWatch.Metric.put_data | def put_data(options = {})
options = Aws::Util.deep_merge(options,
namespace: @namespace,
metric_data: [{ metric_name: @name }]
)
resp = @client.put_metric_data(options)
resp.data
end | ruby | def put_data(options = {})
options = Aws::Util.deep_merge(options,
namespace: @namespace,
metric_data: [{ metric_name: @name }]
)
resp = @client.put_metric_data(options)
resp.data
end | [
"def",
"put_data",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"Aws",
"::",
"Util",
".",
"deep_merge",
"(",
"options",
",",
"namespace",
":",
"@namespace",
",",
"metric_data",
":",
"[",
"{",
"metric_name",
":",
"@name",
"}",
"]",
")",
"resp",
... | @example Request syntax with placeholder values
metric.put_data({
metric_data: [ # required
{
metric_name: "MetricName", # required
dimensions: [
{
name: "DimensionName", # required
value: "DimensionValue", # required
},
],
timestamp: Time.now,
value: 1.0,
statistic_values: {
sample_count: 1.0, # required
sum: 1.0, # required
minimum: 1.0, # required
maximum: 1.0, # required
},
values: [1.0],
counts: [1.0],
unit: "Seconds", # accepts Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None
storage_resolution: 1,
},
],
})
@param [Hash] options ({})
@option options [required, Array<Types::MetricDatum>] :metric_data
The data for the metric. The array can include no more than 20 metrics
per call.
@return [EmptyStructure] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-cloudwatch/lib/aws-sdk-cloudwatch/metric.rb#L583-L590 | train | Put metric data | [
30522,
13366,
2404,
1035,
2951,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
22091,
2015,
1024,
1024,
21183,
4014,
1012,
2784,
1035,
13590,
1006,
7047,
1010,
3415,
15327,
1024,
1030,
3415,
15327,
1010,
12046,
1035,
2951,
1024,
1031,
1063... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Katello/katello | app/controllers/katello/api/registry/registry_proxies_controller.rb | Katello.Api::Registry::RegistryProxiesController.force_include_layer | def force_include_layer(repository, digest, layer)
unless File.exist? tmp_file(layer)
logger.debug "Getting blob #{digest} to write to #{layer}"
fullpath = "/v2/#{repository}/blobs/#{digest}"
request = Resources::Registry::Proxy.get(fullpath)
File.open(tmp_file(layer), 'wb', 0600) do |file|
file.write request.body
end
logger.debug "Wrote blob #{digest} to #{layer}"
end
end | ruby | def force_include_layer(repository, digest, layer)
unless File.exist? tmp_file(layer)
logger.debug "Getting blob #{digest} to write to #{layer}"
fullpath = "/v2/#{repository}/blobs/#{digest}"
request = Resources::Registry::Proxy.get(fullpath)
File.open(tmp_file(layer), 'wb', 0600) do |file|
file.write request.body
end
logger.debug "Wrote blob #{digest} to #{layer}"
end
end | [
"def",
"force_include_layer",
"(",
"repository",
",",
"digest",
",",
"layer",
")",
"unless",
"File",
".",
"exist?",
"tmp_file",
"(",
"layer",
")",
"logger",
".",
"debug",
"\"Getting blob #{digest} to write to #{layer}\"",
"fullpath",
"=",
"\"/v2/#{repository}/blobs/#{di... | TODO: Until pulp supports optional upload of layers, include all layers
https://pulp.plan.io/issues/3497 | [
"TODO",
":",
"Until",
"pulp",
"supports",
"optional",
"upload",
"of",
"layers",
"include",
"all",
"layers",
"https",
":",
"//",
"pulp",
".",
"plan",
".",
"io",
"/",
"issues",
"/",
"3497"
] | a1c9280067607999cae43bab89b53ba870856b76 | https://github.com/Katello/katello/blob/a1c9280067607999cae43bab89b53ba870856b76/app/controllers/katello/api/registry/registry_proxies_controller.rb#L436-L446 | train | Force the layer to be included in the generated image. | [
30522,
13366,
2486,
1035,
2421,
1035,
6741,
1006,
22409,
1010,
17886,
1010,
6741,
1007,
4983,
5371,
1012,
4839,
1029,
1056,
8737,
1035,
5371,
1006,
6741,
1007,
8833,
4590,
1012,
2139,
8569,
2290,
1000,
2893,
1038,
4135,
2497,
1001,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
watir/watir | lib/watir/elements/file_field.rb | Watir.FileField.value= | def value=(path)
path = path.gsub(File::SEPARATOR, File::ALT_SEPARATOR) if File::ALT_SEPARATOR
element_call { @element.send_keys path }
end | ruby | def value=(path)
path = path.gsub(File::SEPARATOR, File::ALT_SEPARATOR) if File::ALT_SEPARATOR
element_call { @element.send_keys path }
end | [
"def",
"value",
"=",
"(",
"path",
")",
"path",
"=",
"path",
".",
"gsub",
"(",
"File",
"::",
"SEPARATOR",
",",
"File",
"::",
"ALT_SEPARATOR",
")",
"if",
"File",
"::",
"ALT_SEPARATOR",
"element_call",
"{",
"@element",
".",
"send_keys",
"path",
"}",
"end"
] | Sets the file field to the given path
@param [String] path | [
"Sets",
"the",
"file",
"field",
"to",
"the",
"given",
"path"
] | 2d8db09811c6221ae401b85b2f61f5fa66e463a3 | https://github.com/watir/watir/blob/2d8db09811c6221ae401b85b2f61f5fa66e463a3/lib/watir/elements/file_field.rb#L22-L25 | train | Set the value of the element. | [
30522,
13366,
3643,
1027,
1006,
4130,
1007,
4130,
1027,
4130,
1012,
28177,
12083,
1006,
5371,
1024,
1024,
19802,
25879,
2953,
1010,
5371,
1024,
1024,
12456,
1035,
19802,
25879,
2953,
1007,
2065,
5371,
1024,
1024,
12456,
1035,
19802,
25879,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mongodb/mongoid | lib/mongoid/traversable.rb | Mongoid.Traversable.remove_child | def remove_child(child)
name = child.association_name
if child.embedded_one?
remove_ivar(name)
else
relation = send(name)
relation.send(:delete_one, child)
end
end | ruby | def remove_child(child)
name = child.association_name
if child.embedded_one?
remove_ivar(name)
else
relation = send(name)
relation.send(:delete_one, child)
end
end | [
"def",
"remove_child",
"(",
"child",
")",
"name",
"=",
"child",
".",
"association_name",
"if",
"child",
".",
"embedded_one?",
"remove_ivar",
"(",
"name",
")",
"else",
"relation",
"=",
"send",
"(",
"name",
")",
"relation",
".",
"send",
"(",
":delete_one",
"... | Remove a child document from this parent. If an embeds one then set to
nil, otherwise remove from the embeds many.
This is called from the +RemoveEmbedded+ persistence command.
@example Remove the child.
document.remove_child(child)
@param [ Document ] child The child (embedded) document to remove.
@since 2.0.0.beta.1 | [
"Remove",
"a",
"child",
"document",
"from",
"this",
"parent",
".",
"If",
"an",
"embeds",
"one",
"then",
"set",
"to",
"nil",
"otherwise",
"remove",
"from",
"the",
"embeds",
"many",
"."
] | 56976e32610f4c2450882b0bfe14da099f0703f4 | https://github.com/mongodb/mongoid/blob/56976e32610f4c2450882b0bfe14da099f0703f4/lib/mongoid/traversable.rb#L104-L112 | train | Remove a child from the current object | [
30522,
13366,
6366,
1035,
2775,
1006,
2775,
1007,
2171,
1027,
2775,
1012,
2523,
1035,
2171,
2065,
2775,
1012,
11157,
1035,
2028,
1029,
6366,
1035,
4921,
2906,
1006,
2171,
1007,
2842,
7189,
1027,
4604,
1006,
2171,
1007,
7189,
1012,
4604,
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_compute/lib/2018-04-01/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb | Azure::Compute::Mgmt::V2018_04_01.VirtualMachineScaleSets.get_osupgrade_history_as_lazy | def get_osupgrade_history_as_lazy(resource_group_name, vm_scale_set_name, custom_headers:nil)
response = get_osupgrade_history_async(resource_group_name, vm_scale_set_name, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
get_osupgrade_history_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def get_osupgrade_history_as_lazy(resource_group_name, vm_scale_set_name, custom_headers:nil)
response = get_osupgrade_history_async(resource_group_name, vm_scale_set_name, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
get_osupgrade_history_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"get_osupgrade_history_as_lazy",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_osupgrade_history_async",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"custom_headers",
":custom_headers"... | Gets list of OS upgrades on a VM scale set instance.
@param resource_group_name [String] The name of the resource group.
@param vm_scale_set_name [String] The name of the VM scale set.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [VirtualMachineScaleSetListOSUpgradeHistory] which provide lazy
access to pages of the response. | [
"Gets",
"list",
"of",
"OS",
"upgrades",
"on",
"a",
"VM",
"scale",
"set",
"instance",
"."
] | 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#L2955-L2964 | train | Gets the history of the virtual machine scale sets in a VM scale set. | [
30522,
13366,
2131,
1035,
9808,
6279,
24170,
1035,
2381,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
4094,
1035,
2275,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/ddos_protection_plans.rb | Azure::Network::Mgmt::V2019_02_01.DdosProtectionPlans.delete | def delete(resource_group_name, ddos_protection_plan_name, custom_headers:nil)
response = delete_async(resource_group_name, ddos_protection_plan_name, custom_headers:custom_headers).value!
nil
end | ruby | def delete(resource_group_name, ddos_protection_plan_name, custom_headers:nil)
response = delete_async(resource_group_name, ddos_protection_plan_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"delete",
"(",
"resource_group_name",
",",
"ddos_protection_plan_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_async",
"(",
"resource_group_name",
",",
"ddos_protection_plan_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"val... | Deletes the specified DDoS protection plan.
@param resource_group_name [String] The name of the resource group.
@param ddos_protection_plan_name [String] The name of the DDoS protection
plan.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Deletes",
"the",
"specified",
"DDoS",
"protection",
"plan",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/ddos_protection_plans.rb#L33-L36 | train | Deletes the specified DDoS protection plan. | [
30522,
13366,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
20315,
2891,
1035,
3860,
1035,
2933,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
1035,
2004,
6038,
2278,
1006,
7692,
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... |
ruby/rake | lib/rake/cloneable.rb | Rake.Cloneable.initialize_copy | def initialize_copy(source)
super
source.instance_variables.each do |var|
src_value = source.instance_variable_get(var)
value = src_value.clone rescue src_value
instance_variable_set(var, value)
end
end | ruby | def initialize_copy(source)
super
source.instance_variables.each do |var|
src_value = source.instance_variable_get(var)
value = src_value.clone rescue src_value
instance_variable_set(var, value)
end
end | [
"def",
"initialize_copy",
"(",
"source",
")",
"super",
"source",
".",
"instance_variables",
".",
"each",
"do",
"|",
"var",
"|",
"src_value",
"=",
"source",
".",
"instance_variable_get",
"(",
"var",
")",
"value",
"=",
"src_value",
".",
"clone",
"rescue",
"src... | :nodoc:
The hook that is invoked by 'clone' and 'dup' methods. | [
":",
"nodoc",
":",
"The",
"hook",
"that",
"is",
"invoked",
"by",
"clone",
"and",
"dup",
"methods",
"."
] | 1c22b490ee6cb8bd614fa8d0d6145f671466206b | https://github.com/ruby/rake/blob/1c22b490ee6cb8bd614fa8d0d6145f671466206b/lib/rake/cloneable.rb#L8-L15 | train | Initialize a copy of the source object. | [
30522,
13366,
3988,
4697,
1035,
6100,
1006,
3120,
1007,
3565,
3120,
1012,
6013,
1035,
10857,
1012,
2169,
2079,
1064,
13075,
1064,
5034,
2278,
1035,
3643,
1027,
3120,
1012,
6013,
1035,
8023,
1035,
2131,
1006,
13075,
1007,
3643,
1027,
5034,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kmuto/review | lib/review/yamlloader.rb | ReVIEW.YAMLLoader.load_file | def load_file(yamlfile)
file_queue = [File.expand_path(yamlfile)]
loaded_files = {}
yaml = {}
loop do
# Check exit condition
return yaml if file_queue.empty?
current_file = file_queue.shift
current_yaml = YAML.load_file(current_file)
yaml = current_yaml.deep_merge(yaml)
next unless yaml.key?('inherit')
buf = []
yaml['inherit'].reverse_each do |item|
inherit_file = File.expand_path(item, File.dirname(yamlfile))
# Check loop
if loaded_files[inherit_file]
raise "Found circular YAML inheritance '#{inherit_file}' in #{yamlfile}."
end
loaded_files[inherit_file] = true
buf << inherit_file
end
yaml.delete('inherit')
file_queue = buf + file_queue
end
end | ruby | def load_file(yamlfile)
file_queue = [File.expand_path(yamlfile)]
loaded_files = {}
yaml = {}
loop do
# Check exit condition
return yaml if file_queue.empty?
current_file = file_queue.shift
current_yaml = YAML.load_file(current_file)
yaml = current_yaml.deep_merge(yaml)
next unless yaml.key?('inherit')
buf = []
yaml['inherit'].reverse_each do |item|
inherit_file = File.expand_path(item, File.dirname(yamlfile))
# Check loop
if loaded_files[inherit_file]
raise "Found circular YAML inheritance '#{inherit_file}' in #{yamlfile}."
end
loaded_files[inherit_file] = true
buf << inherit_file
end
yaml.delete('inherit')
file_queue = buf + file_queue
end
end | [
"def",
"load_file",
"(",
"yamlfile",
")",
"file_queue",
"=",
"[",
"File",
".",
"expand_path",
"(",
"yamlfile",
")",
"]",
"loaded_files",
"=",
"{",
"}",
"yaml",
"=",
"{",
"}",
"loop",
"do",
"# Check exit condition",
"return",
"yaml",
"if",
"file_queue",
"."... | load YAML files
`inherit: [3.yml, 6.yml]` in 7.yml; `inherit: [1.yml, 2.yml]` in 3.yml; `inherit: [4.yml, 5.yml]` in 6.yml
=> 7.yml > 6.yml > 5.yml > 4.yml > 3.yml > 2.yml > 1.yml | [
"load",
"YAML",
"files"
] | 77d1273e671663f05db2992281fd891b776badf0 | https://github.com/kmuto/review/blob/77d1273e671663f05db2992281fd891b776badf0/lib/review/yamlloader.rb#L13-L43 | train | Load YAML file | [
30522,
13366,
7170,
1035,
5371,
1006,
8038,
19968,
8873,
2571,
1007,
5371,
1035,
24240,
1027,
1031,
5371,
1012,
7818,
1035,
4130,
1006,
8038,
19968,
8873,
2571,
1007,
1033,
8209,
1035,
6764,
1027,
1063,
1065,
8038,
19968,
1027,
1063,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2019-03-01/generated/azure_mgmt_compute/galleries.rb | Azure::Compute::Mgmt::V2019_03_01.Galleries.begin_create_or_update_with_http_info | def begin_create_or_update_with_http_info(resource_group_name, gallery_name, gallery, custom_headers:nil)
begin_create_or_update_async(resource_group_name, gallery_name, gallery, custom_headers:custom_headers).value!
end | ruby | def begin_create_or_update_with_http_info(resource_group_name, gallery_name, gallery, custom_headers:nil)
begin_create_or_update_async(resource_group_name, gallery_name, gallery, custom_headers:custom_headers).value!
end | [
"def",
"begin_create_or_update_with_http_info",
"(",
"resource_group_name",
",",
"gallery_name",
",",
"gallery",
",",
"custom_headers",
":",
"nil",
")",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"gallery_name",
",",
"gallery",
",",
"custom_headers",
... | Create or update a Shared Image Gallery.
@param resource_group_name [String] The name of the resource group.
@param gallery_name [String] The name of the Shared Image Gallery. The
allowed characters are alphabets and numbers with dots and periods allowed in
the middle. The maximum length is 80 characters.
@param gallery [Gallery] Parameters supplied to the create or update Shared
Image Gallery 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. | [
"Create",
"or",
"update",
"a",
"Shared",
"Image",
"Gallery",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2019-03-01/generated/azure_mgmt_compute/galleries.rb#L411-L413 | train | Creates or updates a gallery. | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3916,
1035,
2171,
1010,
3916,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
1035,
3443,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.