repo stringclasses 237 values | path stringlengths 11 168 | func_name stringlengths 10 147 | original_string stringlengths 79 124k | language stringclasses 1 value | code stringlengths 79 124k | code_tokens listlengths 16 45.3k | docstring stringlengths 4 23.5k | docstring_tokens listlengths 1 452 | sha stringclasses 237 values | url stringlengths 95 268 | partition stringclasses 1 value | summary stringlengths 8 229 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_agents.rb | Azure::SQL::Mgmt::V2015_05_01_preview.SyncAgents.generate_key | def generate_key(resource_group_name, server_name, sync_agent_name, custom_headers:nil)
response = generate_key_async(resource_group_name, server_name, sync_agent_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def generate_key(resource_group_name, server_name, sync_agent_name, custom_headers:nil)
response = generate_key_async(resource_group_name, server_name, sync_agent_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"generate_key",
"(",
"resource_group_name",
",",
"server_name",
",",
"sync_agent_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"generate_key_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"sync_agent_name",
",",
"custom_headers",
... | Generates a sync agent key.
@param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param server_name [String] The name of the server on which the sync agent is
hosted.
@param sync_agent_name [String] The name of the sync agent.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [SyncAgentKeyProperties] operation results. | [
"Generates",
"a",
"sync",
"agent",
"key",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_agents.rb#L345-L348 | train | Generate a key for a given sync agent. | [
30522,
13366,
9699,
1035,
3145,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
26351,
1035,
4005,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
9699,
1035,
3145,
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... |
appium/ruby_lib | lib/appium_lib/ios/common/helper.rb | Appium.Ios._all_pred | def _all_pred(opts)
predicate = opts[:predicate]
raise 'predicate must be provided' unless predicate
visible = opts.fetch :visible, true
%($.mainApp().getAllWithPredicate("#{predicate}", #{visible});)
end | ruby | def _all_pred(opts)
predicate = opts[:predicate]
raise 'predicate must be provided' unless predicate
visible = opts.fetch :visible, true
%($.mainApp().getAllWithPredicate("#{predicate}", #{visible});)
end | [
"def",
"_all_pred",
"(",
"opts",
")",
"predicate",
"=",
"opts",
"[",
":predicate",
"]",
"raise",
"'predicate must be provided'",
"unless",
"predicate",
"visible",
"=",
"opts",
".",
"fetch",
":visible",
",",
"true",
"%($.mainApp().getAllWithPredicate(\"#{predicate}\", #{... | predicate - the predicate to evaluate on the main app
visible - if true, only visible elements are returned. default true | [
"predicate",
"-",
"the",
"predicate",
"to",
"evaluate",
"on",
"the",
"main",
"app"
] | 1f5898400dd1928bfe42ddd5f842d1f8738f2f76 | https://github.com/appium/ruby_lib/blob/1f5898400dd1928bfe42ddd5f842d1f8738f2f76/lib/appium_lib/ios/common/helper.rb#L376-L382 | train | Returns all the terms that match the predicate | [
30522,
13366,
1035,
2035,
1035,
3653,
2094,
1006,
23569,
2015,
1007,
3653,
16467,
1027,
23569,
2015,
1031,
1024,
3653,
16467,
1033,
5333,
1005,
3653,
16467,
2442,
2022,
3024,
1005,
4983,
3653,
16467,
5710,
1027,
23569,
2015,
1012,
18584,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_policy_insights/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/remediations.rb | Azure::PolicyInsights::Mgmt::V2018_07_01_preview.Remediations.list_deployments_at_resource_group_next | def list_deployments_at_resource_group_next(next_page_link, custom_headers:nil)
response = list_deployments_at_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_deployments_at_resource_group_next(next_page_link, custom_headers:nil)
response = list_deployments_at_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_deployments_at_resource_group_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_deployments_at_resource_group_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
... | Gets all deployments for a remediation at resource group scope.
@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 [RemediationDeploymentsListResult] operation results. | [
"Gets",
"all",
"deployments",
"for",
"a",
"remediation",
"at",
"resource",
"group",
"scope",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_policy_insights/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/remediations.rb#L2709-L2712 | train | Gets the list of deployments at resource group scope. | [
30522,
13366,
2862,
1035,
10813,
2015,
1035,
2012,
1035,
7692,
1035,
2177,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
10813,
2015,
1035,
2012,
1035,
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... |
randym/axlsx | lib/axlsx/workbook/workbook.rb | Axlsx.Workbook.sheet_by_name | def sheet_by_name(name)
index = @worksheets.index { |sheet| sheet.name == name }
@worksheets[index] if index
end | ruby | def sheet_by_name(name)
index = @worksheets.index { |sheet| sheet.name == name }
@worksheets[index] if index
end | [
"def",
"sheet_by_name",
"(",
"name",
")",
"index",
"=",
"@worksheets",
".",
"index",
"{",
"|",
"sheet",
"|",
"sheet",
".",
"name",
"==",
"name",
"}",
"@worksheets",
"[",
"index",
"]",
"if",
"index",
"end"
] | A quick helper to retrive a worksheet by name
@param [String] name The name of the sheet you are looking for
@return [Worksheet] The sheet found, or nil | [
"A",
"quick",
"helper",
"to",
"retrive",
"a",
"worksheet",
"by",
"name"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/workbook.rb#L195-L198 | train | Returns the sheet with the given name. | [
30522,
13366,
7123,
1035,
2011,
1035,
2171,
1006,
2171,
1007,
5950,
1027,
1030,
2573,
21030,
3215,
1012,
5950,
1063,
1064,
7123,
1064,
7123,
1012,
2171,
1027,
1027,
2171,
1065,
1030,
2573,
21030,
3215,
1031,
5950,
1033,
2065,
5950,
2203,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
randym/axlsx | lib/axlsx/stylesheet/styles.rb | Axlsx.Styles.add_style | def add_style(options={})
# Default to :xf
options[:type] ||= :xf
raise ArgumentError, "Type must be one of [:xf, :dxf]" unless [:xf, :dxf].include?(options[:type] )
fill = parse_fill_options options
font = parse_font_options options
numFmt = parse_num_fmt_options options
border = parse_border_options options
alignment = parse_alignment_options options
protection = parse_protection_options options
case options[:type]
when :dxf
style = Dxf.new :fill => fill, :font => font, :numFmt => numFmt, :border => border, :alignment => alignment, :protection => protection
else
style = Xf.new :fillId=>fill || 0, :fontId=>font || 0, :numFmtId=>numFmt || 0, :borderId=>border || 0, :alignment => alignment, :protection => protection, :applyFill=>!fill.nil?, :applyFont=>!font.nil?, :applyNumberFormat =>!numFmt.nil?, :applyBorder=>!border.nil?, :applyAlignment => !alignment.nil?, :applyProtection => !protection.nil?
end
options[:type] == :xf ? cellXfs << style : dxfs << style
end | ruby | def add_style(options={})
# Default to :xf
options[:type] ||= :xf
raise ArgumentError, "Type must be one of [:xf, :dxf]" unless [:xf, :dxf].include?(options[:type] )
fill = parse_fill_options options
font = parse_font_options options
numFmt = parse_num_fmt_options options
border = parse_border_options options
alignment = parse_alignment_options options
protection = parse_protection_options options
case options[:type]
when :dxf
style = Dxf.new :fill => fill, :font => font, :numFmt => numFmt, :border => border, :alignment => alignment, :protection => protection
else
style = Xf.new :fillId=>fill || 0, :fontId=>font || 0, :numFmtId=>numFmt || 0, :borderId=>border || 0, :alignment => alignment, :protection => protection, :applyFill=>!fill.nil?, :applyFont=>!font.nil?, :applyNumberFormat =>!numFmt.nil?, :applyBorder=>!border.nil?, :applyAlignment => !alignment.nil?, :applyProtection => !protection.nil?
end
options[:type] == :xf ? cellXfs << style : dxfs << style
end | [
"def",
"add_style",
"(",
"options",
"=",
"{",
"}",
")",
"# Default to :xf",
"options",
"[",
":type",
"]",
"||=",
":xf",
"raise",
"ArgumentError",
",",
"\"Type must be one of [:xf, :dxf]\"",
"unless",
"[",
":xf",
",",
":dxf",
"]",
".",
"include?",
"(",
"options... | Creates a new Styles object and prepopulates it with the requires objects to generate a valid package style part.
Drastically simplifies style creation and management.
@return [Integer]
@option options [String] fg_color The text color
@option options [Integer] sz The text size
@option options [Boolean] b Indicates if the text should be bold
@option options [Boolean] i Indicates if the text should be italicised
@option options [Boolean] u Indicates if the text should be underlined
@option options [Boolean] strike Indicates if the text should be rendered with a strikethrough
@option options [Boolean] shadow Indicates if the text should be rendered with a shadow
@option options [Integer] charset The character set to use.
@option options [Integer] family The font family to use.
@option options [String] font_name The name of the font to use
@option options [Integer] num_fmt The number format to apply
@option options [String] format_code The formatting to apply.
@option options [Integer|Hash] border The border style to use.
borders support style, color and edges options @see parse_border_options
@option options [String] bg_color The background color to apply to the cell
@option options [Boolean] hidden Indicates if the cell should be hidden
@option options [Boolean] locked Indicates if the cell should be locked
@option options [Symbol] type What type of style is this. Options are [:dxf, :xf]. :xf is default
@option options [Hash] alignment A hash defining any of the attributes used in CellAlignment
@see CellAlignment
@example You Got Style
require "rubygems" # if that is your preferred way to manage gems!
require "axlsx"
p = Axlsx::Package.new
ws = p.workbook.add_worksheet
# black text on a white background at 14pt with thin borders!
title = ws.styles.add_style(:bg_color => "FFFF0000", :fg_color=>"#FF000000", :sz=>14, :border=> {:style => :thin, :color => "FFFF0000"}
ws.add_row ["Least Popular Pets"]
ws.add_row ["", "Dry Skinned Reptiles", "Bald Cats", "Violent Parrots"], :style=>title
ws.add_row ["Votes", 6, 4, 1], :style=>Axlsx::STYLE_THIN_BORDER
f = File.open('example_you_got_style.xlsx', 'w')
p.serialize(f)
@example Styling specifically
# an example of applying specific styles to specific cells
require "rubygems" # if that is your preferred way to manage gems!
require "axlsx"
p = Axlsx::Package.new
ws = p.workbook.add_worksheet
# define your styles
title = ws.styles.add_style(:bg_color => "FFFF0000",
:fg_color=>"#FF000000",
:border=>Axlsx::STYLE_THIN_BORDER,
:alignment=>{:horizontal => :center})
date_time = ws.styles.add_style(:num_fmt => Axlsx::NUM_FMT_YYYYMMDDHHMMSS,
:border=>Axlsx::STYLE_THIN_BORDER)
percent = ws.styles.add_style(:num_fmt => Axlsx::NUM_FMT_PERCENT,
:border=>Axlsx::STYLE_THIN_BORDER)
currency = ws.styles.add_style(:format_code=>"¥#,##0;[Red]¥-#,##0",
:border=>Axlsx::STYLE_THIN_BORDER)
# build your rows
ws.add_row ["Generated At:", Time.now], :styles=>[nil, date_time]
ws.add_row ["Previous Year Quarterly Profits (JPY)"], :style=>title
ws.add_row ["Quarter", "Profit", "% of Total"], :style=>title
ws.add_row ["Q1", 4000, 40], :style=>[title, currency, percent]
ws.add_row ["Q2", 3000, 30], :style=>[title, currency, percent]
ws.add_row ["Q3", 1000, 10], :style=>[title, currency, percent]
ws.add_row ["Q4", 2000, 20], :style=>[title, currency, percent]
f = File.open('example_you_got_style.xlsx', 'w')
p.serialize(f)
@example Differential styling
# Differential styles apply on top of cell styles. Used in Conditional Formatting. Must specify :type => :dxf, and you can't use :num_fmt.
require "rubygems" # if that is your preferred way to manage gems!
require "axlsx"
p = Axlsx::Package.new
wb = p.workbook
ws = wb.add_worksheet
# define your styles
profitable = wb.styles.add_style(:bg_color => "FFFF0000",
:fg_color=>"#FF000000",
:type => :dxf)
ws.add_row ["Genreated At:", Time.now], :styles=>[nil, date_time]
ws.add_row ["Previous Year Quarterly Profits (JPY)"], :style=>title
ws.add_row ["Quarter", "Profit", "% of Total"], :style=>title
ws.add_row ["Q1", 4000, 40], :style=>[title, currency, percent]
ws.add_row ["Q2", 3000, 30], :style=>[title, currency, percent]
ws.add_row ["Q3", 1000, 10], :style=>[title, currency, percent]
ws.add_row ["Q4", 2000, 20], :style=>[title, currency, percent]
ws.add_conditional_formatting("A1:A7", { :type => :cellIs, :operator => :greaterThan, :formula => "2000", :dxfId => profitable, :priority => 1 })
f = File.open('example_differential_styling', 'w')
p.serialize(f) | [
"Creates",
"a",
"new",
"Styles",
"object",
"and",
"prepopulates",
"it",
"with",
"the",
"requires",
"objects",
"to",
"generate",
"a",
"valid",
"package",
"style",
"part",
".",
"Drastically",
"simplifies",
"style",
"creation",
"and",
"management",
".",
"@return",
... | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/stylesheet/styles.rb#L222-L242 | train | Adds a style to the cell. | [
30522,
13366,
5587,
1035,
2806,
1006,
7047,
1027,
1063,
1065,
1007,
1001,
12398,
2000,
1024,
1060,
2546,
7047,
1031,
1024,
2828,
1033,
1064,
1064,
1027,
1024,
1060,
2546,
5333,
6685,
2121,
29165,
1010,
1000,
2828,
2442,
2022,
2028,
1997,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/message_verifier.rb | ActiveSupport.MessageVerifier.verified | def verified(signed_message, purpose: nil, **)
if valid_message?(signed_message)
begin
data = signed_message.split("--")[0]
message = Messages::Metadata.verify(decode(data), purpose)
@serializer.load(message) if message
rescue ArgumentError => argument_error
return if argument_error.message.include?("invalid base64")
raise
end
end
end | ruby | def verified(signed_message, purpose: nil, **)
if valid_message?(signed_message)
begin
data = signed_message.split("--")[0]
message = Messages::Metadata.verify(decode(data), purpose)
@serializer.load(message) if message
rescue ArgumentError => argument_error
return if argument_error.message.include?("invalid base64")
raise
end
end
end | [
"def",
"verified",
"(",
"signed_message",
",",
"purpose",
":",
"nil",
",",
"**",
")",
"if",
"valid_message?",
"(",
"signed_message",
")",
"begin",
"data",
"=",
"signed_message",
".",
"split",
"(",
"\"--\"",
")",
"[",
"0",
"]",
"message",
"=",
"Messages",
... | Decodes the signed message using the +MessageVerifier+'s secret.
verifier = ActiveSupport::MessageVerifier.new 's3Krit'
signed_message = verifier.generate 'a private message'
verifier.verified(signed_message) # => 'a private message'
Returns +nil+ if the message was not signed with the same secret.
other_verifier = ActiveSupport::MessageVerifier.new 'd1ff3r3nt-s3Krit'
other_verifier.verified(signed_message) # => nil
Returns +nil+ if the message is not Base64-encoded.
invalid_message = "f--46a0120593880c733a53b6dad75b42ddc1c8996d"
verifier.verified(invalid_message) # => nil
Raises any error raised while decoding the signed message.
incompatible_message = "test--dad7b06c94abba8d46a15fafaef56c327665d5ff"
verifier.verified(incompatible_message) # => TypeError: incompatible marshal file format | [
"Decodes",
"the",
"signed",
"message",
"using",
"the",
"+",
"MessageVerifier",
"+",
"s",
"secret",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/message_verifier.rb#L150-L161 | train | verify the message | [
30522,
13366,
20119,
1006,
2772,
1035,
4471,
1010,
3800,
1024,
9152,
2140,
1010,
1008,
1008,
1007,
2065,
9398,
1035,
4471,
1029,
1006,
2772,
1035,
4471,
1007,
4088,
2951,
1027,
2772,
1035,
4471,
1012,
3975,
1006,
1000,
1011,
1011,
1000,
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... |
devise-security/devise-security | lib/devise-security/routes.rb | ActionDispatch::Routing.Mapper.devise_verification_code | def devise_verification_code(mapping, controllers)
resource :paranoid_verification_code, only: [:show, :update], path: mapping.path_names[:verification_code], controller: controllers[:paranoid_verification_code]
end | ruby | def devise_verification_code(mapping, controllers)
resource :paranoid_verification_code, only: [:show, :update], path: mapping.path_names[:verification_code], controller: controllers[:paranoid_verification_code]
end | [
"def",
"devise_verification_code",
"(",
"mapping",
",",
"controllers",
")",
"resource",
":paranoid_verification_code",
",",
"only",
":",
"[",
":show",
",",
":update",
"]",
",",
"path",
":",
"mapping",
".",
"path_names",
"[",
":verification_code",
"]",
",",
"cont... | route for handle paranoid verification | [
"route",
"for",
"handle",
"paranoid",
"verification"
] | d0b44a7bb249f6763641f45d34dd52e7fda3fca2 | https://github.com/devise-security/devise-security/blob/d0b44a7bb249f6763641f45d34dd52e7fda3fca2/lib/devise-security/routes.rb#L14-L16 | train | This method is used to devise the verification code of a page | [
30522,
13366,
14386,
3366,
1035,
22616,
1035,
3642,
1006,
12375,
1010,
21257,
1007,
7692,
1024,
19810,
1035,
22616,
1035,
3642,
1010,
2069,
1024,
1031,
1024,
2265,
1010,
1024,
10651,
1033,
1010,
4130,
1024,
12375,
1012,
4130,
1035,
3415,
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_sql/lib/2014-04-01/generated/azure_mgmt_sql/server_azure_adadministrators.rb | Azure::SQL::Mgmt::V2014_04_01.ServerAzureADAdministrators.create_or_update_async | def create_or_update_async(resource_group_name, server_name, properties, custom_headers:nil)
# Send request
promise = begin_create_or_update_async(resource_group_name, server_name, properties, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::SQL::Mgmt::V2014_04_01::Models::ServerAzureADAdministrator.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | ruby | def create_or_update_async(resource_group_name, server_name, properties, custom_headers:nil)
# Send request
promise = begin_create_or_update_async(resource_group_name, server_name, properties, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::SQL::Mgmt::V2014_04_01::Models::ServerAzureADAdministrator.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | [
"def",
"create_or_update_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"properties",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"properties",... | @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 properties [ServerAzureADAdministrator] The required parameters for
creating or updating an Active Directory Administrator.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"resource_group_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"resource",
"group",
"that",
"contains",
"the",
"resource",
".",
"You",
"can",
"obtain",
"this",
"value",
"from",
"the",
"Azure",
"Resource",
"Manager",
"API",
"or",
"the",
"por... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/server_azure_adadministrators.rb#L60-L76 | train | Creates or updates a server in the specified subscription. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
5144,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,
4088,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mislav/will_paginate | lib/will_paginate/collection.rb | WillPaginate.Collection.replace | def replace(array)
result = super
# The collection is shorter then page limit? Rejoice, because
# then we know that we are on the last page!
if total_entries.nil? and length < per_page and (current_page == 1 or length > 0)
self.total_entries = offset + length
end
result
end | ruby | def replace(array)
result = super
# The collection is shorter then page limit? Rejoice, because
# then we know that we are on the last page!
if total_entries.nil? and length < per_page and (current_page == 1 or length > 0)
self.total_entries = offset + length
end
result
end | [
"def",
"replace",
"(",
"array",
")",
"result",
"=",
"super",
"# The collection is shorter then page limit? Rejoice, because",
"# then we know that we are on the last page!",
"if",
"total_entries",
".",
"nil?",
"and",
"length",
"<",
"per_page",
"and",
"(",
"current_page",
"=... | This is a magic wrapper for the original Array#replace method. It serves
for populating the paginated collection after initialization.
Why magic? Because it tries to guess the total number of entries judging
by the size of given array. If it is shorter than +per_page+ limit, then we
know we're on the last page. This trick is very useful for avoiding
unnecessary hits to the database to do the counting after we fetched the
data for the current page.
However, after using +replace+ you should always test the value of
+total_entries+ and set it to a proper value if it's +nil+. See the example
in +create+. | [
"This",
"is",
"a",
"magic",
"wrapper",
"for",
"the",
"original",
"Array#replace",
"method",
".",
"It",
"serves",
"for",
"populating",
"the",
"paginated",
"collection",
"after",
"initialization",
"."
] | 63e84fb7e7508231ca83d94c524bfab5fbe9a578 | https://github.com/mislav/will_paginate/blob/63e84fb7e7508231ca83d94c524bfab5fbe9a578/lib/will_paginate/collection.rb#L124-L134 | train | Replace the array with the current array. | [
30522,
13366,
5672,
1006,
9140,
1007,
2765,
1027,
3565,
1001,
1996,
3074,
2003,
7820,
2059,
3931,
5787,
1029,
2128,
5558,
6610,
1010,
2138,
1001,
2059,
2057,
2113,
2008,
2057,
2024,
2006,
1996,
2197,
3931,
999,
2065,
2561,
1035,
10445,
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_signalr/lib/2018-03-01-preview/generated/azure_mgmt_signalr/signal_r.rb | Azure::Signalr::Mgmt::V2018_03_01_preview.SignalR.create_or_update_async | def create_or_update_async(resource_group_name, resource_name, parameters:nil, custom_headers:nil)
# Send request
promise = begin_create_or_update_async(resource_group_name, resource_name, parameters:parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Signalr::Mgmt::V2018_03_01_preview::Models::SignalRResource.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | ruby | def create_or_update_async(resource_group_name, resource_name, parameters:nil, custom_headers:nil)
# Send request
promise = begin_create_or_update_async(resource_group_name, resource_name, parameters:parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Signalr::Mgmt::V2018_03_01_preview::Models::SignalRResource.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | [
"def",
"create_or_update_async",
"(",
"resource_group_name",
",",
"resource_name",
",",
"parameters",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"resource_name",
... | @param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param resource_name [String] The name of the SignalR resource.
@param parameters [SignalRCreateParameters] Parameters for the create or
update operation
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"resource_group_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"resource",
"group",
"that",
"contains",
"the",
"resource",
".",
"You",
"can",
"obtain",
"this",
"value",
"from",
"the",
"Azure",
"Resource",
"Manager",
"API",
"or",
"the",
"por... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_signalr/lib/2018-03-01-preview/generated/azure_mgmt_signalr/signal_r.rb#L582-L598 | train | Creates or updates a signalr resource. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7692,
1035,
2171,
1010,
11709,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.vpn_device_configuration_script_with_http_info | def vpn_device_configuration_script_with_http_info(resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers:nil)
vpn_device_configuration_script_async(resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers:custom_headers).value!
end | ruby | def vpn_device_configuration_script_with_http_info(resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers:nil)
vpn_device_configuration_script_async(resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"vpn_device_configuration_script_with_http_info",
"(",
"resource_group_name",
",",
"virtual_network_gateway_connection_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"vpn_device_configuration_script_async",
"(",
"resource_group_name",
",",
"virtual_network... | Gets a xml format representation for vpn device configuration script.
@param resource_group_name [String] The name of the resource group.
@param virtual_network_gateway_connection_name [String] The name of the
virtual network gateway connection for which the configuration script is
generated.
@param parameters [VpnDeviceScriptParameters] Parameters supplied to the
generate vpn device script 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. | [
"Gets",
"a",
"xml",
"format",
"representation",
"for",
"vpn",
"device",
"configuration",
"script",
"."
] | 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#L1086-L1088 | train | Gets the vpn device configuration script for the specified virtual network gateway connection. | [
30522,
13366,
21210,
2078,
1035,
5080,
1035,
9563,
1035,
5896,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7484,
1035,
2897,
1035,
11909,
1035,
4434,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-01-01/generated/azure_mgmt_network/application_gateways.rb | Azure::Network::Mgmt::V2018_01_01.ApplicationGateways.stop_async | def stop_async(resource_group_name, application_gateway_name, custom_headers:nil)
# Send request
promise = begin_stop_async(resource_group_name, application_gateway_name, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | ruby | def stop_async(resource_group_name, application_gateway_name, custom_headers:nil)
# Send request
promise = begin_stop_async(resource_group_name, application_gateway_name, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | [
"def",
"stop_async",
"(",
"resource_group_name",
",",
"application_gateway_name",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_stop_async",
"(",
"resource_group_name",
",",
"application_gateway_name",
",",
"custom_headers",
":custom_heade... | @param resource_group_name [String] The name of the resource group.
@param application_gateway_name [String] The name of the application gateway.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"resource_group_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"resource",
"group",
".",
"@param",
"application_gateway_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"application",
"gateway",
".",
"@param",
"custom_headers",
"[",
"Hash... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-01-01/generated/azure_mgmt_network/application_gateways.rb#L478-L492 | train | Stops an application gateway in an application group. | [
30522,
13366,
2644,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4646,
1035,
11909,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,
4088,
1035,
2644,
1035,
2004,
6038,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
chloerei/alipay | lib/alipay/client.rb | Alipay.Client.sign | def sign(params)
string = params_to_string(params)
case @sign_type
when 'RSA'
::Alipay::Sign::RSA.sign(@app_private_key, string)
when 'RSA2'
::Alipay::Sign::RSA2.sign(@app_private_key, string)
else
raise "Unsupported sign_type: #{@sign_type}"
end
end | ruby | def sign(params)
string = params_to_string(params)
case @sign_type
when 'RSA'
::Alipay::Sign::RSA.sign(@app_private_key, string)
when 'RSA2'
::Alipay::Sign::RSA2.sign(@app_private_key, string)
else
raise "Unsupported sign_type: #{@sign_type}"
end
end | [
"def",
"sign",
"(",
"params",
")",
"string",
"=",
"params_to_string",
"(",
"params",
")",
"case",
"@sign_type",
"when",
"'RSA'",
"::",
"Alipay",
"::",
"Sign",
"::",
"RSA",
".",
"sign",
"(",
"@app_private_key",
",",
"string",
")",
"when",
"'RSA2'",
"::",
... | Generate sign for params. | [
"Generate",
"sign",
"for",
"params",
"."
] | a525989b659da970e08bc8fcd1b004453bfed89f | https://github.com/chloerei/alipay/blob/a525989b659da970e08bc8fcd1b004453bfed89f/lib/alipay/client.rb#L133-L144 | train | Sign the params | [
30522,
13366,
3696,
1006,
11498,
5244,
1007,
5164,
1027,
11498,
5244,
1035,
2000,
1035,
5164,
1006,
11498,
5244,
1007,
2553,
1030,
3696,
1035,
2828,
2043,
1005,
12667,
2050,
1005,
1024,
1024,
4862,
4502,
2100,
1024,
1024,
3696,
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... |
jekyll/jekyll | lib/jekyll/cleaner.rb | Jekyll.Cleaner.obsolete_files | def obsolete_files
out = (existing_files - new_files - new_dirs + replaced_files).to_a
Jekyll::Hooks.trigger :clean, :on_obsolete, out
out
end | ruby | def obsolete_files
out = (existing_files - new_files - new_dirs + replaced_files).to_a
Jekyll::Hooks.trigger :clean, :on_obsolete, out
out
end | [
"def",
"obsolete_files",
"out",
"=",
"(",
"existing_files",
"-",
"new_files",
"-",
"new_dirs",
"+",
"replaced_files",
")",
".",
"to_a",
"Jekyll",
"::",
"Hooks",
".",
"trigger",
":clean",
",",
":on_obsolete",
",",
"out",
"out",
"end"
] | Private: The list of files and directories to be deleted during cleanup process
Returns an Array of the file and directory paths | [
"Private",
":",
"The",
"list",
"of",
"files",
"and",
"directories",
"to",
"be",
"deleted",
"during",
"cleanup",
"process"
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/cleaner.rb#L24-L28 | train | Returns the array of the obsolete files. | [
30522,
13366,
15832,
1035,
6764,
2041,
1027,
1006,
4493,
1035,
6764,
1011,
2047,
1035,
6764,
1011,
2047,
1035,
16101,
2015,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/readers/data_reader.rb | Jekyll.DataReader.read_data_file | def read_data_file(path)
case File.extname(path).downcase
when ".csv"
CSV.read(path,
:headers => true,
:encoding => site.config["encoding"]).map(&:to_hash)
when ".tsv"
CSV.read(path,
:col_sep => "\t",
:headers => true,
:encoding => site.config["encoding"]).map(&:to_hash)
else
SafeYAML.load_file(path)
end
end | ruby | def read_data_file(path)
case File.extname(path).downcase
when ".csv"
CSV.read(path,
:headers => true,
:encoding => site.config["encoding"]).map(&:to_hash)
when ".tsv"
CSV.read(path,
:col_sep => "\t",
:headers => true,
:encoding => site.config["encoding"]).map(&:to_hash)
else
SafeYAML.load_file(path)
end
end | [
"def",
"read_data_file",
"(",
"path",
")",
"case",
"File",
".",
"extname",
"(",
"path",
")",
".",
"downcase",
"when",
"\".csv\"",
"CSV",
".",
"read",
"(",
"path",
",",
":headers",
"=>",
"true",
",",
":encoding",
"=>",
"site",
".",
"config",
"[",
"\"enc... | Determines how to read a data file.
Returns the contents of the data file. | [
"Determines",
"how",
"to",
"read",
"a",
"data",
"file",
"."
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/readers/data_reader.rb#L54-L68 | train | Reads a data file from a file | [
30522,
13366,
3191,
1035,
2951,
1035,
5371,
1006,
4130,
1007,
2553,
5371,
1012,
4654,
2102,
18442,
1006,
4130,
1007,
1012,
2091,
18382,
2043,
1000,
1012,
20116,
2615,
1000,
20116,
2615,
1012,
3191,
1006,
4130,
1010,
1024,
20346,
2015,
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_event_grid/lib/2019-02-01-preview/generated/azure_mgmt_event_grid/topics.rb | Azure::EventGrid::Mgmt::V2019_02_01_preview.Topics.begin_update | def begin_update(resource_group_name, topic_name, topic_update_parameters, custom_headers:nil)
response = begin_update_async(resource_group_name, topic_name, topic_update_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_update(resource_group_name, topic_name, topic_update_parameters, custom_headers:nil)
response = begin_update_async(resource_group_name, topic_name, topic_update_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_update",
"(",
"resource_group_name",
",",
"topic_name",
",",
"topic_update_parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_update_async",
"(",
"resource_group_name",
",",
"topic_name",
",",
"topic_update_parameters",
",",
"cust... | Update a topic
Asynchronously updates a topic with the specified parameters.
@param resource_group_name [String] The name of the resource group within the
user's subscription.
@param topic_name [String] Name of the topic
@param topic_update_parameters [TopicUpdateParameters] Topic update
information
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Topic] operation results. | [
"Update",
"a",
"topic"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_event_grid/lib/2019-02-01-preview/generated/azure_mgmt_event_grid/topics.rb#L1006-L1009 | train | Updates a topic. | [
30522,
13366,
4088,
1035,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8476,
1035,
2171,
1010,
8476,
1035,
10651,
1035,
11709,
1010,
7661,
1035,
20346,
30524,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8476,
1035,
2171,
1010,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_container_registry/lib/2018-09-01/generated/azure_mgmt_container_registry/runs.rb | Azure::ContainerRegistry::Mgmt::V2018_09_01.Runs.cancel | def cancel(resource_group_name, registry_name, run_id, custom_headers:nil)
response = cancel_async(resource_group_name, registry_name, run_id, custom_headers:custom_headers).value!
nil
end | ruby | def cancel(resource_group_name, registry_name, run_id, custom_headers:nil)
response = cancel_async(resource_group_name, registry_name, run_id, custom_headers:custom_headers).value!
nil
end | [
"def",
"cancel",
"(",
"resource_group_name",
",",
"registry_name",
",",
"run_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"cancel_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"run_id",
",",
"custom_headers",
":custom_headers",
")",... | Cancel an existing run.
@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 run_id [String] The run ID.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Cancel",
"an",
"existing",
"run",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_registry/lib/2018-09-01/generated/azure_mgmt_container_registry/runs.rb#L402-L405 | train | Cancels a run. | [
30522,
13366,
17542,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
2448,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
17542,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-ec2/lib/aws-sdk-ec2/vpc.rb | Aws::EC2.Vpc.detach_internet_gateway | def detach_internet_gateway(options = {})
options = options.merge(vpc_id: @id)
resp = @client.detach_internet_gateway(options)
resp.data
end | ruby | def detach_internet_gateway(options = {})
options = options.merge(vpc_id: @id)
resp = @client.detach_internet_gateway(options)
resp.data
end | [
"def",
"detach_internet_gateway",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"vpc_id",
":",
"@id",
")",
"resp",
"=",
"@client",
".",
"detach_internet_gateway",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
vpc.detach_internet_gateway({
dry_run: false,
internet_gateway_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] :internet_gateway_id
The ID of the internet gateway.
@return [EmptyStructure] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/vpc.rb#L575-L579 | train | Detaches the internet gateway from this VPC | [
30522,
13366,
20010,
6776,
1035,
4274,
1035,
11909,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
21210,
2278,
1035,
8909,
1024,
1030,
8909,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
20010,
6776,
1035,
4274,
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_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb | Azure::KeyVault::V2016_10_01.KeyVaultClient.get_storage_accounts_as_lazy | def get_storage_accounts_as_lazy(vault_base_url, maxresults:nil, custom_headers:nil)
first_page = get_storage_accounts_as_lazy_as_lazy(vault_base_url, maxresults:maxresults, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def get_storage_accounts_as_lazy(vault_base_url, maxresults:nil, custom_headers:nil)
first_page = get_storage_accounts_as_lazy_as_lazy(vault_base_url, maxresults:maxresults, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"get_storage_accounts_as_lazy",
"(",
"vault_base_url",
",",
"maxresults",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"get_storage_accounts_as_lazy_as_lazy",
"(",
"vault_base_url",
",",
"maxresults",
":",
"maxresults",
",",
"custom_head... | List storage accounts managed by the specified key vault. This operation
requires the storage/list permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param maxresults [Integer] Maximum number of results to return in a page. If
not specified the service will return up to 25 results.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [StorageListResult] operation results. | [
"List",
"storage",
"accounts",
"managed",
"by",
"the",
"specified",
"key",
"vault",
".",
"This",
"operation",
"requires",
"the",
"storage",
"/",
"list",
"permission",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb#L10553-L10556 | train | Gets all the Azure Storage accounts in a specified vault. | [
30522,
13366,
2131,
1035,
5527,
1035,
6115,
1035,
2004,
1035,
13971,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
4098,
6072,
11314,
2015,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
30524,
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... |
comfy/comfortable-mexican-sofa | lib/comfortable_mexican_sofa/seeds/page/importer.rb | ComfortableMexicanSofa::Seeds::Page.Importer.construct_fragments_attributes | def construct_fragments_attributes(hash, record, path)
frag_identifiers = []
frag_attributes = hash.collect do |frag_header, frag_content|
tag, identifier = frag_header.split
frag_hash = {
identifier: identifier,
tag: tag
}
# tracking fragments that need removing later
frag_identifiers << identifier
# based on tag we need to cram content in proper place and proper format
case tag
when "date", "datetime"
frag_hash[:datetime] = frag_content
when "checkbox"
frag_hash[:boolean] = frag_content
when "file", "files"
files, file_ids_destroy = files_content(record, identifier, path, frag_content)
frag_hash[:files] = files
frag_hash[:file_ids_destroy] = file_ids_destroy
else
frag_hash[:content] = frag_content
end
frag_hash
end
[frag_identifiers, frag_attributes]
end | ruby | def construct_fragments_attributes(hash, record, path)
frag_identifiers = []
frag_attributes = hash.collect do |frag_header, frag_content|
tag, identifier = frag_header.split
frag_hash = {
identifier: identifier,
tag: tag
}
# tracking fragments that need removing later
frag_identifiers << identifier
# based on tag we need to cram content in proper place and proper format
case tag
when "date", "datetime"
frag_hash[:datetime] = frag_content
when "checkbox"
frag_hash[:boolean] = frag_content
when "file", "files"
files, file_ids_destroy = files_content(record, identifier, path, frag_content)
frag_hash[:files] = files
frag_hash[:file_ids_destroy] = file_ids_destroy
else
frag_hash[:content] = frag_content
end
frag_hash
end
[frag_identifiers, frag_attributes]
end | [
"def",
"construct_fragments_attributes",
"(",
"hash",
",",
"record",
",",
"path",
")",
"frag_identifiers",
"=",
"[",
"]",
"frag_attributes",
"=",
"hash",
".",
"collect",
"do",
"|",
"frag_header",
",",
"frag_content",
"|",
"tag",
",",
"identifier",
"=",
"frag_h... | Constructing frag attributes hash that can be assigned to page or translation
also returning list of frag identifiers so we can destroy old ones | [
"Constructing",
"frag",
"attributes",
"hash",
"that",
"can",
"be",
"assigned",
"to",
"page",
"or",
"translation",
"also",
"returning",
"list",
"of",
"frag",
"identifiers",
"so",
"we",
"can",
"destroy",
"old",
"ones"
] | 38a31428f6e2c07d5bda64f0371eebfb29a3abc4 | https://github.com/comfy/comfortable-mexican-sofa/blob/38a31428f6e2c07d5bda64f0371eebfb29a3abc4/lib/comfortable_mexican_sofa/seeds/page/importer.rb#L154-L184 | train | constructs the attributes for a fragment | [
30522,
13366,
9570,
1035,
10341,
1035,
12332,
1006,
23325,
1010,
2501,
1010,
4130,
1007,
25312,
2290,
1035,
8909,
4765,
28295,
1027,
1031,
1033,
25312,
2290,
1035,
12332,
1027,
23325,
1012,
8145,
2079,
1064,
25312,
2290,
1035,
20346,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_policy_insights/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/policy_tracked_resources.rb | Azure::PolicyInsights::Mgmt::V2018_07_01_preview.PolicyTrackedResources.list_query_results_for_subscription_next | def list_query_results_for_subscription_next(next_page_link, custom_headers:nil)
response = list_query_results_for_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_query_results_for_subscription_next(next_page_link, custom_headers:nil)
response = list_query_results_for_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_query_results_for_subscription_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_query_results_for_subscription_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response"... | Queries policy tracked resources under the subscription.
@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 [PolicyTrackedResourcesQueryResults] operation results. | [
"Queries",
"policy",
"tracked",
"resources",
"under",
"the",
"subscription",
"."
] | 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/policy_tracked_resources.rb#L518-L521 | train | Gets the list of query results for the subscription. | [
30522,
13366,
2862,
1035,
23032,
1035,
3463,
1035,
30524,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
20346,
2015,
1007,
1012,
3643,
999,
3433,
1012,
2303,
4983,
3433,
1012,
9152,
2140,
1029,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/databases.rb | Azure::SQL::Mgmt::V2014_04_01.Databases.get_by_elastic_pool_with_http_info | def get_by_elastic_pool_with_http_info(resource_group_name, server_name, elastic_pool_name, database_name, custom_headers:nil)
get_by_elastic_pool_async(resource_group_name, server_name, elastic_pool_name, database_name, custom_headers:custom_headers).value!
end | ruby | def get_by_elastic_pool_with_http_info(resource_group_name, server_name, elastic_pool_name, database_name, custom_headers:nil)
get_by_elastic_pool_async(resource_group_name, server_name, elastic_pool_name, database_name, custom_headers:custom_headers).value!
end | [
"def",
"get_by_elastic_pool_with_http_info",
"(",
"resource_group_name",
",",
"server_name",
",",
"elastic_pool_name",
",",
"database_name",
",",
"custom_headers",
":",
"nil",
")",
"get_by_elastic_pool_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"elastic_po... | Gets a database inside of an elastic pool.
@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 elastic_pool_name [String] The name of the elastic pool to be
retrieved.
@param database_name [String] The name of the database to be retrieved.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"a",
"database",
"inside",
"of",
"an",
"elastic",
"pool",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/databases.rb#L571-L573 | train | Gets the elastic pool information. | [
30522,
13366,
2131,
1035,
2011,
1035,
21274,
1035,
4770,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
21274,
1035,
4770,
1035,
2171,
1010,
7809,
1035,
2171,
1010,
7661,
1035,
20346,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-kinesisvideoarchivedmedia/lib/aws-sdk-kinesisvideoarchivedmedia/client.rb | Aws::KinesisVideoArchivedMedia.Client.get_media_for_fragment_list | def get_media_for_fragment_list(params = {}, options = {}, &block)
req = build_request(:get_media_for_fragment_list, params)
req.send_request(options, &block)
end | ruby | def get_media_for_fragment_list(params = {}, options = {}, &block)
req = build_request(:get_media_for_fragment_list, params)
req.send_request(options, &block)
end | [
"def",
"get_media_for_fragment_list",
"(",
"params",
"=",
"{",
"}",
",",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"req",
"=",
"build_request",
"(",
":get_media_for_fragment_list",
",",
"params",
")",
"req",
".",
"send_request",
"(",
"options",
",",
... | Gets media for a list of fragments (specified by fragment number) from
the archived data in an Amazon Kinesis video stream.
<note markdown="1"> You must first call the `GetDataEndpoint` API to get an endpoint. Then
send the `GetMediaForFragmentList` requests to this endpoint using the
[--endpoint-url parameter][1].
</note>
The following limits apply when using the `GetMediaForFragmentList`
API:
* A client can call `GetMediaForFragmentList` up to five times per
second per stream.
* Kinesis Video Streams sends media data at a rate of up to 25
megabytes per second (or 200 megabits per second) during a
`GetMediaForFragmentList` session.
[1]: https://docs.aws.amazon.com/cli/latest/reference/
@option params [required, String] :stream_name
The name of the stream from which to retrieve fragment media.
@option params [required, Array<String>] :fragments
A list of the numbers of fragments for which to retrieve media. You
retrieve these values with ListFragments.
@return [Types::GetMediaForFragmentListOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
* {Types::GetMediaForFragmentListOutput#content_type #content_type} => String
* {Types::GetMediaForFragmentListOutput#payload #payload} => IO
@example Request syntax with placeholder values
resp = client.get_media_for_fragment_list({
stream_name: "StreamName", # required
fragments: ["FragmentNumberString"], # required
})
@example Response structure
resp.content_type #=> String
resp.payload #=> IO
@see http://docs.aws.amazon.com/goto/WebAPI/kinesis-video-archived-media-2017-09-30/GetMediaForFragmentList AWS API Documentation
@overload get_media_for_fragment_list(params = {})
@param [Hash] params ({}) | [
"Gets",
"media",
"for",
"a",
"list",
"of",
"fragments",
"(",
"specified",
"by",
"fragment",
"number",
")",
"from",
"the",
"archived",
"data",
"in",
"an",
"Amazon",
"Kinesis",
"video",
"stream",
"."
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-kinesisvideoarchivedmedia/lib/aws-sdk-kinesisvideoarchivedmedia/client.rb#L655-L658 | train | Get media for fragment list | [
30522,
13366,
2131,
1035,
2865,
1035,
2005,
1035,
15778,
1035,
2862,
1006,
11498,
5244,
1027,
1063,
1065,
1010,
7047,
1027,
1063,
1065,
1010,
1004,
3796,
1007,
2128,
4160,
1027,
3857,
1035,
5227,
1006,
1024,
2131,
1035,
2865,
1035,
2005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ruby2d/ruby2d | lib/ruby2d/sprite.rb | Ruby2D.Sprite.play | def play(opts = {}, &done_proc)
animation = opts[:animation]
loop = opts[:loop]
flip = opts[:flip]
if !@playing || (animation != @playing_animation && animation != nil) || flip != @flip
@playing = true
@playing_animation = animation || :default
frames = @animations[@playing_animation]
flip_sprite(flip)
@done_proc = done_proc
case frames
# When animation is a range, play through frames horizontally
when Range
@first_frame = frames.first || @defaults[:frame]
@current_frame = frames.first || @defaults[:frame]
@last_frame = frames.last
# When array...
when Array
@first_frame = 0
@current_frame = 0
@last_frame = frames.length - 1
end
# Set looping
@loop = loop == true || @defaults[:loop] ? true : false
set_frame
restart_time
end
end | ruby | def play(opts = {}, &done_proc)
animation = opts[:animation]
loop = opts[:loop]
flip = opts[:flip]
if !@playing || (animation != @playing_animation && animation != nil) || flip != @flip
@playing = true
@playing_animation = animation || :default
frames = @animations[@playing_animation]
flip_sprite(flip)
@done_proc = done_proc
case frames
# When animation is a range, play through frames horizontally
when Range
@first_frame = frames.first || @defaults[:frame]
@current_frame = frames.first || @defaults[:frame]
@last_frame = frames.last
# When array...
when Array
@first_frame = 0
@current_frame = 0
@last_frame = frames.length - 1
end
# Set looping
@loop = loop == true || @defaults[:loop] ? true : false
set_frame
restart_time
end
end | [
"def",
"play",
"(",
"opts",
"=",
"{",
"}",
",",
"&",
"done_proc",
")",
"animation",
"=",
"opts",
"[",
":animation",
"]",
"loop",
"=",
"opts",
"[",
":loop",
"]",
"flip",
"=",
"opts",
"[",
":flip",
"]",
"if",
"!",
"@playing",
"||",
"(",
"animation",
... | Play an animation | [
"Play",
"an",
"animation"
] | 43ce9805a7ae8b82b7ab8c50bf6d4c845d395dc4 | https://github.com/ruby2d/ruby2d/blob/43ce9805a7ae8b82b7ab8c50bf6d4c845d395dc4/lib/ruby2d/sprite.rb#L111-L144 | train | Play the current frame of the current frame of the current frame. | [
30522,
13366,
2377,
1006,
23569,
2015,
1027,
1063,
1065,
1010,
1004,
2589,
1035,
4013,
2278,
1007,
7284,
1027,
23569,
2015,
1031,
1024,
7284,
1033,
7077,
1027,
23569,
2015,
1031,
1024,
7077,
1033,
11238,
1027,
23569,
2015,
1031,
1024,
11238... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-10-01/generated/azure_mgmt_network/connection_monitors.rb | Azure::Network::Mgmt::V2018_10_01.ConnectionMonitors.get_with_http_info | def get_with_http_info(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
get_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
get_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"connection_monitor_name",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"connection_monitor_name",
",",
"custom_h... | Gets a connection monitor by name.
@param resource_group_name [String] The name of the resource group containing
Network Watcher.
@param network_watcher_name [String] The name of the Network Watcher
resource.
@param connection_monitor_name [String] The name of the connection monitor.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"a",
"connection",
"monitor",
"by",
"name",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-10-01/generated/azure_mgmt_network/connection_monitors.rb#L107-L109 | train | Gets the specified network connection monitor. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2897,
1035,
3422,
2121,
1035,
2171,
1010,
4434,
1035,
8080,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-sqs/lib/aws-sdk-sqs/queue.rb | Aws::SQS.Queue.add_permission | def add_permission(options = {})
options = options.merge(queue_url: @url)
resp = @client.add_permission(options)
resp.data
end | ruby | def add_permission(options = {})
options = options.merge(queue_url: @url)
resp = @client.add_permission(options)
resp.data
end | [
"def",
"add_permission",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"queue_url",
":",
"@url",
")",
"resp",
"=",
"@client",
".",
"add_permission",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @!group Actions
@example Request syntax with placeholder values
queue.add_permission({
label: "String", # required
aws_account_ids: ["String"], # required
actions: ["String"], # required
})
@param [Hash] options ({})
@option options [required, String] :label
The unique identification of the permission you're setting (for
example, `AliceSendMessage`). Maximum 80 characters. Allowed
characters include alphanumeric characters, hyphens (`-`), and
underscores (`_`).
@option options [required, Array<String>] :aws_account_ids
The AWS account number of the [principal][1] who is given permission.
The principal must have an AWS account, but does not need to be signed
up for Amazon SQS. For information about locating the AWS account
identification, see [Your AWS Identifiers][2] in the *Amazon Simple
Queue Service Developer Guide*.
[1]: http://docs.aws.amazon.com/general/latest/gr/glos-chap.html#P
[2]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-making-api-requests.html#sqs-api-request-authentication
@option options [required, Array<String>] :actions
The action the client wants to allow for the specified principal.
Valid values: the name of any action or `*`.
For more information about these actions, see [Overview of Managing
Access Permissions to Your Amazon Simple Queue Service Resource][1] in
the *Amazon Simple Queue Service Developer Guide*.
Specifying `SendMessage`, `DeleteMessage`, or
`ChangeMessageVisibility` for `ActionName.n` also grants permissions
for the corresponding batch versions of those actions:
`SendMessageBatch`, `DeleteMessageBatch`, and
`ChangeMessageVisibilityBatch`.
[1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-overview-of-managing-access.html
@return [EmptyStructure] | [
"@!group",
"Actions",
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-sqs/lib/aws-sdk-sqs/queue.rb#L121-L125 | train | Add a permission to the queue | [
30522,
13366,
5587,
1035,
6656,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
24240,
1035,
24471,
2140,
1024,
1030,
24471,
2140,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
5587,
1035,
6656,
1006,
7047,
1007,
24501... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.get_node_info_list_with_http_info | def get_node_info_list_with_http_info(continuation_token:nil, node_status_filter:nil, timeout:60, custom_headers:nil)
get_node_info_list_async(continuation_token:continuation_token, node_status_filter:node_status_filter, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def get_node_info_list_with_http_info(continuation_token:nil, node_status_filter:nil, timeout:60, custom_headers:nil)
get_node_info_list_async(continuation_token:continuation_token, node_status_filter:node_status_filter, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"get_node_info_list_with_http_info",
"(",
"continuation_token",
":",
"nil",
",",
"node_status_filter",
":",
"nil",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"get_node_info_list_async",
"(",
"continuation_token",
":continuation_token",
","... | Gets the list of nodes in the Service Fabric cluster.
Gets the list of nodes in the Service Fabric cluster. The response includes
the name, status, id, health, uptime, and other details about the node.
@param continuation_token [String] The continuation token parameter is used
to obtain next set of results. A continuation token with a non empty value is
included in the response of the API when the results from the system do not
fit in a single response. When this value is passed to the next API call, the
API returns next set of results. If there are no further results then the
continuation token does not contain a value. The value of this parameter
should not be URL encoded.
@param node_status_filter [NodeStatusFilter] Allows filtering the nodes based
on the NodeStatus. Only the nodes that are matching the specified filter
value will be returned. The filter value can be one of the following.
Possible values include: 'default', 'all', 'up', 'down', 'enabling',
'disabling', 'disabled', 'unknown', 'removed'
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"list",
"of",
"nodes",
"in",
"the",
"Service",
"Fabric",
"cluster",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L3263-L3265 | train | Gets the node info list. | [
30522,
13366,
2131,
1035,
13045,
1035,
18558,
1035,
2862,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
13633,
1035,
19204,
1024,
9152,
2140,
1010,
13045,
1035,
3570,
1035,
11307,
1024,
9152,
2140,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
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... |
square/connect-ruby-sdk | lib/square_connect/models/v1_page_cell.rb | SquareConnect.V1PageCell.object_type= | def object_type=(object_type)
validator = EnumAttributeValidator.new('String', ["ITEM", "DISCOUNT", "CATEGORY", "PLACEHOLDER"])
unless validator.valid?(object_type)
fail ArgumentError, "invalid value for 'object_type', must be one of #{validator.allowable_values}."
end
@object_type = object_type
end | ruby | def object_type=(object_type)
validator = EnumAttributeValidator.new('String', ["ITEM", "DISCOUNT", "CATEGORY", "PLACEHOLDER"])
unless validator.valid?(object_type)
fail ArgumentError, "invalid value for 'object_type', must be one of #{validator.allowable_values}."
end
@object_type = object_type
end | [
"def",
"object_type",
"=",
"(",
"object_type",
")",
"validator",
"=",
"EnumAttributeValidator",
".",
"new",
"(",
"'String'",
",",
"[",
"\"ITEM\"",
",",
"\"DISCOUNT\"",
",",
"\"CATEGORY\"",
",",
"\"PLACEHOLDER\"",
"]",
")",
"unless",
"validator",
".",
"valid?",
... | Custom attribute writer method checking allowed values (enum).
@param [Object] object_type Object to be assigned | [
"Custom",
"attribute",
"writer",
"method",
"checking",
"allowed",
"values",
"(",
"enum",
")",
"."
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/models/v1_page_cell.rb#L132-L138 | train | Set the object_type of the object. | [
30522,
13366,
4874,
1035,
2828,
1027,
1006,
4874,
1035,
2828,
1007,
9398,
8844,
1027,
4372,
12248,
4779,
3089,
8569,
2618,
10175,
8524,
4263,
1012,
2047,
1006,
1005,
5164,
1005,
1010,
1031,
1000,
8875,
1000,
1010,
1000,
19575,
1000,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/subscription.rb | Azure::ApiManagement::Mgmt::V2018_01_01.Subscription.list_with_http_info | def list_with_http_info(resource_group_name, service_name, filter:nil, top:nil, skip:nil, custom_headers:nil)
list_async(resource_group_name, service_name, filter:filter, top:top, skip:skip, custom_headers:custom_headers).value!
end | ruby | def list_with_http_info(resource_group_name, service_name, filter:nil, top:nil, skip:nil, custom_headers:nil)
list_async(resource_group_name, service_name, filter:filter, top:top, skip:skip, custom_headers:custom_headers).value!
end | [
"def",
"list_with_http_info",
"(",
"resource_group_name",
",",
"service_name",
",",
"filter",
":",
"nil",
",",
"top",
":",
"nil",
",",
"skip",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"list_async",
"(",
"resource_group_name",
",",
"service_name",
",... | Lists all subscriptions of the API Management service instance.
@param resource_group_name [String] The name of the resource group.
@param service_name [String] The name of the API Management service.
@param filter [String] | Field | Supported operators | Supported
functions |
|--------------|------------------------|---------------------------------------------|
| id | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
endswith |
| name | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
endswith |
| stateComment | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
endswith |
| userId | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
endswith |
| productId | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
endswith |
| state | eq |
|
@param top [Integer] Number of records to return.
@param skip [Integer] Number of records to skip.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Lists",
"all",
"subscriptions",
"of",
"the",
"API",
"Management",
"service",
"instance",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/subscription.rb#L83-L85 | train | Gets the list of the available advisor s advisors. | [
30522,
13366,
2862,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
11307,
1024,
9152,
2140,
1010,
2327,
1024,
9152,
2140,
1010,
13558,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jeremytregunna/ruby-trello | lib/trello/label_name.rb | Trello.LabelName.update_fields | def update_fields(fields)
attributes[:yellow] = fields['yellow'] || attributes[:yellow]
attributes[:red] = fields['red'] || attributes[:red]
attributes[:orange] = fields['orange'] || attributes[:orange]
attributes[:green] = fields['green'] || attributes[:green]
attributes[:purple] = fields['purple'] || attributes[:purple]
attributes[:blue] = fields['blue'] || attributes[:blue]
attributes[:sky] = fields['sky'] || attributes[:sky]
attributes[:pink] = fields['pink'] || attributes[:pink]
attributes[:lime] = fields['lime'] || attributes[:lime]
attributes[:black] = fields['black'] || attributes[:black]
self
end | ruby | def update_fields(fields)
attributes[:yellow] = fields['yellow'] || attributes[:yellow]
attributes[:red] = fields['red'] || attributes[:red]
attributes[:orange] = fields['orange'] || attributes[:orange]
attributes[:green] = fields['green'] || attributes[:green]
attributes[:purple] = fields['purple'] || attributes[:purple]
attributes[:blue] = fields['blue'] || attributes[:blue]
attributes[:sky] = fields['sky'] || attributes[:sky]
attributes[:pink] = fields['pink'] || attributes[:pink]
attributes[:lime] = fields['lime'] || attributes[:lime]
attributes[:black] = fields['black'] || attributes[:black]
self
end | [
"def",
"update_fields",
"(",
"fields",
")",
"attributes",
"[",
":yellow",
"]",
"=",
"fields",
"[",
"'yellow'",
"]",
"||",
"attributes",
"[",
":yellow",
"]",
"attributes",
"[",
":red",
"]",
"=",
"fields",
"[",
"'red'",
"]",
"||",
"attributes",
"[",
":red"... | Update the fields of a label.
Supply a hash of stringkeyed data retrieved from the Trello API representing
a label. | [
"Update",
"the",
"fields",
"of",
"a",
"label",
"."
] | ad79c9d8152ad5395b3b61c43170908f1912bfb2 | https://github.com/jeremytregunna/ruby-trello/blob/ad79c9d8152ad5395b3b61c43170908f1912bfb2/lib/trello/label_name.rb#L11-L24 | train | Update the attributes of the object. | [
30522,
13366,
10651,
1035,
4249,
1006,
4249,
1007,
12332,
1031,
1024,
3756,
1033,
1027,
4249,
1031,
1005,
3756,
1005,
1033,
1064,
1064,
12332,
1031,
1024,
3756,
1033,
12332,
1031,
1024,
2417,
1033,
1027,
4249,
1031,
1005,
2417,
1005,
1033,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rmosolgo/graphql-ruby | lib/graphql/schema.rb | GraphQL.Schema.to_definition | def to_definition(only: nil, except: nil, context: {})
GraphQL::Schema::Printer.print_schema(self, only: only, except: except, context: context)
end | ruby | def to_definition(only: nil, except: nil, context: {})
GraphQL::Schema::Printer.print_schema(self, only: only, except: except, context: context)
end | [
"def",
"to_definition",
"(",
"only",
":",
"nil",
",",
"except",
":",
"nil",
",",
"context",
":",
"{",
"}",
")",
"GraphQL",
"::",
"Schema",
"::",
"Printer",
".",
"print_schema",
"(",
"self",
",",
"only",
":",
"only",
",",
"except",
":",
"except",
",",... | Return the GraphQL IDL for the schema
@param context [Hash]
@param only [<#call(member, ctx)>]
@param except [<#call(member, ctx)>]
@return [String] | [
"Return",
"the",
"GraphQL",
"IDL",
"for",
"the",
"schema"
] | d5be13a816f220b9efbabeaa69a3e56fedf311f5 | https://github.com/rmosolgo/graphql-ruby/blob/d5be13a816f220b9efbabeaa69a3e56fedf311f5/lib/graphql/schema.rb#L658-L660 | train | Returns the definition of the schema. | [
30522,
13366,
2000,
1035,
6210,
1006,
2069,
1024,
9152,
2140,
1010,
3272,
1024,
9152,
2140,
1010,
6123,
1024,
1063,
1065,
1007,
10629,
4160,
2140,
1024,
1024,
8040,
28433,
1024,
1024,
15041,
1012,
6140,
1035,
8040,
28433,
1006,
2969,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-core/lib/aws-sdk-core/shared_config.rb | Aws.SharedConfig.fresh | def fresh(options = {})
@profile_name = nil
@credentials_path = nil
@config_path = nil
@parsed_credentials = {}
@parsed_config = nil
@config_enabled = options[:config_enabled] ? true : false
@profile_name = determine_profile(options)
@credentials_path = options[:credentials_path] ||
determine_credentials_path
load_credentials_file if loadable?(@credentials_path)
if @config_enabled
@config_path = options[:config_path] || determine_config_path
load_config_file if loadable?(@config_path)
end
end | ruby | def fresh(options = {})
@profile_name = nil
@credentials_path = nil
@config_path = nil
@parsed_credentials = {}
@parsed_config = nil
@config_enabled = options[:config_enabled] ? true : false
@profile_name = determine_profile(options)
@credentials_path = options[:credentials_path] ||
determine_credentials_path
load_credentials_file if loadable?(@credentials_path)
if @config_enabled
@config_path = options[:config_path] || determine_config_path
load_config_file if loadable?(@config_path)
end
end | [
"def",
"fresh",
"(",
"options",
"=",
"{",
"}",
")",
"@profile_name",
"=",
"nil",
"@credentials_path",
"=",
"nil",
"@config_path",
"=",
"nil",
"@parsed_credentials",
"=",
"{",
"}",
"@parsed_config",
"=",
"nil",
"@config_enabled",
"=",
"options",
"[",
":config_e... | Constructs a new SharedConfig provider object. This will load the shared
credentials file, and optionally the shared configuration file, as ini
files which support profiles.
By default, the shared credential file (the default path for which is
`~/.aws/credentials`) and the shared config file (the default path for
which is `~/.aws/config`) are loaded. However, if you set the
`ENV['AWS_SDK_CONFIG_OPT_OUT']` environment variable, only the shared
credential file will be loaded. You can specify the shared credential
file path with the `ENV['AWS_SHARED_CREDENTIALS_FILE']` environment
variable or with the `:credentials_path` option. Similarly, you can
specify the shared config file path with the `ENV['AWS_CONFIG_FILE']`
environment variable or with the `:config_path` option.
The default profile name is 'default'. You can specify the profile name
with the `ENV['AWS_PROFILE']` environment variable or with the
`:profile_name` option.
@param [Hash] options
@option options [String] :credentials_path Path to the shared credentials
file. If not specified, will check `ENV['AWS_SHARED_CREDENTIALS_FILE']`
before using the default value of "#{Dir.home}/.aws/credentials".
@option options [String] :config_path Path to the shared config file.
If not specified, will check `ENV['AWS_CONFIG_FILE']` before using the
default value of "#{Dir.home}/.aws/config".
@option options [String] :profile_name The credential/config profile name
to use. If not specified, will check `ENV['AWS_PROFILE']` before using
the fixed default value of 'default'.
@option options [Boolean] :config_enabled If true, loads the shared config
file and enables new config values outside of the old shared credential
spec.
@api private | [
"Constructs",
"a",
"new",
"SharedConfig",
"provider",
"object",
".",
"This",
"will",
"load",
"the",
"shared",
"credentials",
"file",
"and",
"optionally",
"the",
"shared",
"configuration",
"file",
"as",
"ini",
"files",
"which",
"support",
"profiles",
"."
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-core/lib/aws-sdk-core/shared_config.rb#L61-L76 | train | Freshly load the credentials and config files | [
30522,
13366,
4840,
1006,
7047,
1027,
1063,
1065,
1007,
1030,
6337,
1035,
2171,
1027,
9152,
2140,
1030,
22496,
1035,
4130,
1027,
9152,
2140,
1030,
9530,
8873,
2290,
1035,
4130,
1027,
9152,
2140,
1030,
11968,
6924,
1035,
22496,
1027,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/sprockets | lib/sprockets/directive_processor.rb | Sprockets.DirectiveProcessor.process_link_directory_directive | def process_link_directory_directive(path = ".", accept = nil)
path = expand_relative_dirname(:link_directory, path)
accept = expand_accept_shorthand(accept)
link_paths(*@environment.stat_directory_with_dependencies(path), accept)
end | ruby | def process_link_directory_directive(path = ".", accept = nil)
path = expand_relative_dirname(:link_directory, path)
accept = expand_accept_shorthand(accept)
link_paths(*@environment.stat_directory_with_dependencies(path), accept)
end | [
"def",
"process_link_directory_directive",
"(",
"path",
"=",
"\".\"",
",",
"accept",
"=",
"nil",
")",
"path",
"=",
"expand_relative_dirname",
"(",
":link_directory",
",",
"path",
")",
"accept",
"=",
"expand_accept_shorthand",
"(",
"accept",
")",
"link_paths",
"(",... | `link_directory` links all the files inside a single
directory. It's similar to `path/*` since it does not follow
nested directories.
//= link_directory "./fonts"
Use caution when linking against JS or CSS assets. Include an explicit
extension or content type in these cases.
//= link_directory "./scripts" .js | [
"link_directory",
"links",
"all",
"the",
"files",
"inside",
"a",
"single",
"directory",
".",
"It",
"s",
"similar",
"to",
"path",
"/",
"*",
"since",
"it",
"does",
"not",
"follow",
"nested",
"directories",
"."
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/directive_processor.rb#L324-L328 | train | Process the link directory directive | [
30522,
13366,
2832,
1035,
4957,
1035,
14176,
1035,
16449,
1006,
4130,
1027,
1000,
1012,
1000,
1010,
5138,
1027,
9152,
2140,
1007,
4130,
1027,
7818,
1035,
5816,
1035,
16101,
18442,
1006,
1024,
4957,
1035,
14176,
1010,
4130,
1007,
5138,
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_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb | Azure::SQL::Mgmt::V2017_03_01_preview.LongTermRetentionBackups.list_by_location_with_http_info | def list_by_location_with_http_info(location_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
list_by_location_async(location_name, only_latest_per_database:only_latest_per_database, database_state:database_state, custom_headers:custom_headers).value!
end | ruby | def list_by_location_with_http_info(location_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
list_by_location_async(location_name, only_latest_per_database:only_latest_per_database, database_state:database_state, custom_headers:custom_headers).value!
end | [
"def",
"list_by_location_with_http_info",
"(",
"location_name",
",",
"only_latest_per_database",
":",
"nil",
",",
"database_state",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"list_by_location_async",
"(",
"location_name",
",",
"only_latest_per_database",
":only_... | Lists the long term retention backups for a given location.
@param location_name [String] The location of the database
@param only_latest_per_database [Boolean] Whether or not to only get the
latest backup for each database.
@param database_state [LongTermRetentionDatabaseState] Whether to query
against just live databases, just deleted databases, or all databases.
Possible values include: 'All', 'Live', 'Deleted'
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Lists",
"the",
"long",
"term",
"retention",
"backups",
"for",
"a",
"given",
"location",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb#L313-L315 | train | Gets the list of documents in a location. | [
30522,
13366,
2862,
1035,
2011,
1035,
3295,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
3295,
1035,
2171,
1010,
2069,
1035,
6745,
1035,
2566,
1035,
7809,
1024,
9152,
2140,
1010,
7809,
1035,
2110,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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.get_with_http_info | def get_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:nil)
get_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:nil)
get_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, api_version, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"resource_provider_namespace",
",",
"parent_resource_path",
",",
"resource_type",
",",
"resource_name",
",",
"api_version",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
... | Returns a resource belonging to a resource group.
@param resource_group_name [String] The name of the resource group. The name
is case insensitive.
@param resource_provider_namespace [String] Resource identity.
@param parent_resource_path [String] Resource identity.
@param resource_type [String] Resource identity.
@param resource_name [String] Resource identity.
@param api_version [String]
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Returns",
"a",
"resource",
"belonging",
"to",
"a",
"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#L593-L595 | train | Gets the specified resource. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7692,
1035,
10802,
1035,
3415,
15327,
1010,
6687,
1035,
7692,
1035,
4130,
1010,
7692,
1035,
2828,
1010,
7692,
1035,
2171,
1010,
17928,
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... |
gjtorikian/html-proofer | lib/html-proofer/url_validator.rb | HTMLProofer.UrlValidator.new_url_query_values? | def new_url_query_values?(uri, paths_with_queries)
queries = uri.query_values.keys.join('-')
domain_path = extract_domain_path(uri)
if paths_with_queries[domain_path].nil?
paths_with_queries[domain_path] = [queries]
true
elsif !paths_with_queries[domain_path].include?(queries)
paths_with_queries[domain_path] << queries
true
else
false
end
end | ruby | def new_url_query_values?(uri, paths_with_queries)
queries = uri.query_values.keys.join('-')
domain_path = extract_domain_path(uri)
if paths_with_queries[domain_path].nil?
paths_with_queries[domain_path] = [queries]
true
elsif !paths_with_queries[domain_path].include?(queries)
paths_with_queries[domain_path] << queries
true
else
false
end
end | [
"def",
"new_url_query_values?",
"(",
"uri",
",",
"paths_with_queries",
")",
"queries",
"=",
"uri",
".",
"query_values",
".",
"keys",
".",
"join",
"(",
"'-'",
")",
"domain_path",
"=",
"extract_domain_path",
"(",
"uri",
")",
"if",
"paths_with_queries",
"[",
"dom... | remember queries we've seen, ignore future ones | [
"remember",
"queries",
"we",
"ve",
"seen",
"ignore",
"future",
"ones"
] | d00955d3b125b9a1649d056bb347ec30e935d847 | https://github.com/gjtorikian/html-proofer/blob/d00955d3b125b9a1649d056bb347ec30e935d847/lib/html-proofer/url_validator.rb#L53-L65 | train | Returns true if the URI has a new query values | [
30522,
13366,
2047,
1035,
24471,
2140,
1035,
23032,
1035,
5300,
1029,
1006,
24471,
2072,
1010,
10425,
1035,
2007,
1035,
10861,
5134,
1007,
10861,
5134,
1027,
24471,
2072,
1012,
23032,
1035,
5300,
1012,
6309,
1012,
3693,
1006,
1005,
1011,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
projectcypress/health-data-standards | lib/hqmf-model/document.rb | HQMF.Document.specific_occurrence_source_data_criteria | def specific_occurrence_source_data_criteria(force_sources=nil)
return [] if @source_data_criteria.nil?
matching = @source_data_criteria.select {|dc| !dc.specific_occurrence.nil?}
if force_sources
existing = matching.map(&:id)
matching.concat @source_data_criteria.select {|dc| !existing.include?(dc.id) && force_sources.include?(dc.id)}
end
matching
end | ruby | def specific_occurrence_source_data_criteria(force_sources=nil)
return [] if @source_data_criteria.nil?
matching = @source_data_criteria.select {|dc| !dc.specific_occurrence.nil?}
if force_sources
existing = matching.map(&:id)
matching.concat @source_data_criteria.select {|dc| !existing.include?(dc.id) && force_sources.include?(dc.id)}
end
matching
end | [
"def",
"specific_occurrence_source_data_criteria",
"(",
"force_sources",
"=",
"nil",
")",
"return",
"[",
"]",
"if",
"@source_data_criteria",
".",
"nil?",
"matching",
"=",
"@source_data_criteria",
".",
"select",
"{",
"|",
"dc",
"|",
"!",
"dc",
".",
"specific_occurr... | Get the source data criteria that are specific occurrences
@return [Array] an array of HQMF::DataCriteria describing the data elements used by the measure that are specific occurrences | [
"Get",
"the",
"source",
"data",
"criteria",
"that",
"are",
"specific",
"occurrences"
] | 252d4f0927c513eacde6b9ea41b76faa1423c34b | https://github.com/projectcypress/health-data-standards/blob/252d4f0927c513eacde6b9ea41b76faa1423c34b/lib/hqmf-model/document.rb#L146-L156 | train | Returns the specific_occurrence_source_data_criteria for this data criteria | [
30522,
13366,
3563,
1035,
14404,
1035,
3120,
1035,
2951,
1035,
9181,
1006,
2486,
1035,
4216,
1027,
9152,
2140,
1007,
2709,
1031,
1033,
2065,
1030,
3120,
1035,
2951,
1035,
9181,
1012,
9152,
2140,
1029,
9844,
1027,
1030,
3120,
1035,
2951,
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... |
roo-rb/roo | lib/roo/open_office.rb | Roo.OpenOffice.font | def font(row, col, sheet = nil)
sheet ||= default_sheet
read_cells(sheet)
row, col = normalize(row, col)
style_name = @style[sheet][[row, col]] || @style_defaults[sheet][col - 1] || 'Default'
@font_style_definitions[style_name]
end | ruby | def font(row, col, sheet = nil)
sheet ||= default_sheet
read_cells(sheet)
row, col = normalize(row, col)
style_name = @style[sheet][[row, col]] || @style_defaults[sheet][col - 1] || 'Default'
@font_style_definitions[style_name]
end | [
"def",
"font",
"(",
"row",
",",
"col",
",",
"sheet",
"=",
"nil",
")",
"sheet",
"||=",
"default_sheet",
"read_cells",
"(",
"sheet",
")",
"row",
",",
"col",
"=",
"normalize",
"(",
"row",
",",
"col",
")",
"style_name",
"=",
"@style",
"[",
"sheet",
"]",
... | Given a cell, return the cell's style | [
"Given",
"a",
"cell",
"return",
"the",
"cell",
"s",
"style"
] | 4ec1104f0c3c2a29711c0c907371cd2be12bcc3c | https://github.com/roo-rb/roo/blob/4ec1104f0c3c2a29711c0c907371cd2be12bcc3c/lib/roo/open_office.rb#L134-L140 | train | Returns the font definition for a given cell | [
30522,
13366,
15489,
1006,
5216,
1010,
8902,
1010,
7123,
1027,
9152,
2140,
1007,
7123,
1064,
1064,
1027,
12398,
1035,
7123,
3191,
1035,
4442,
1006,
7123,
1007,
5216,
1010,
8902,
1027,
3671,
4697,
1006,
5216,
1010,
8902,
1007,
2806,
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_videosearch/lib/1.0/generated/azure_cognitiveservices_videosearch/videos_operations.rb | Azure::CognitiveServices::VideoSearch::V1_0.VideosOperations.trending_with_http_info | def trending_with_http_info(accept_language:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, country_code:nil, market:nil, safe_search:nil, set_lang:nil, text_decorations:nil, text_format:nil, custom_headers:nil)
trending_async(accept_language:accept_language, user_agent:user_agent, client_id:client_id, client_ip:client_ip, location:location, country_code:country_code, market:market, safe_search:safe_search, set_lang:set_lang, text_decorations:text_decorations, text_format:text_format, custom_headers:custom_headers).value!
end | ruby | def trending_with_http_info(accept_language:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, country_code:nil, market:nil, safe_search:nil, set_lang:nil, text_decorations:nil, text_format:nil, custom_headers:nil)
trending_async(accept_language:accept_language, user_agent:user_agent, client_id:client_id, client_ip:client_ip, location:location, country_code:country_code, market:market, safe_search:safe_search, set_lang:set_lang, text_decorations:text_decorations, text_format:text_format, custom_headers:custom_headers).value!
end | [
"def",
"trending_with_http_info",
"(",
"accept_language",
":",
"nil",
",",
"user_agent",
":",
"nil",
",",
"client_id",
":",
"nil",
",",
"client_ip",
":",
"nil",
",",
"location",
":",
"nil",
",",
"country_code",
":",
"nil",
",",
"market",
":",
"nil",
",",
... | The Video Trending Search API lets you search on Bing and get back a list of
videos that are trending based on search requests made by others. The videos
are broken out into different categories. For example, Top Music Videos. For
a list of markets that support trending videos, see [Trending
Videos](https://docs.microsoft.com/azure/cognitive-services/bing-video-search/trending-videos).
@param accept_language [String] A comma-delimited list of one or more
languages to use for user interface strings. The list is in decreasing order
of preference. For additional information, including expected format, see
[RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
header and the
[setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#setlang)
query parameter are mutually exclusive; do not specify both. If you set this
header, you must also specify the
[cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#cc)
query parameter. To determine the market to return results for, Bing uses the
first supported language it finds from the list and combines it with the cc
parameter value. If the list does not include a supported language, Bing
finds the closest language and market that supports the request or it uses an
aggregated or default market for the results. To determine the market that
Bing used, see the BingAPIs-Market header. Use this header and the cc query
parameter only if you specify multiple languages. Otherwise, use the
[mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#mkt)
and
[setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#setlang)
query parameters. A user interface string is a string that's used as a label
in a user interface. There are few user interface strings in the JSON
response objects. Any links to Bing.com properties in the response objects
apply the specified language.
@param user_agent [String] The user agent originating the request. Bing uses
the user agent to provide mobile users with an optimized experience. Although
optional, you are encouraged to always specify this header. The user-agent
should be the same string that any commonly used browser sends. For
information about user agents, see [RFC
2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
/ 7.0 Mobile / 11A465 Safari / 9537.53
@param client_id [String] Bing uses this header to provide users with
consistent behavior across Bing API calls. Bing often flights new features
and improvements, and it uses the client ID as a key for assigning traffic on
different flights. If you do not use the same client ID for a user across
multiple requests, then Bing may assign the user to multiple conflicting
flights. Being assigned to multiple conflicting flights can lead to an
inconsistent user experience. For example, if the second request has a
different flight assignment than the first, the experience may be unexpected.
Also, Bing can use the client ID to tailor web results to that client ID’s
search history, providing a richer experience for the user. Bing also uses
this header to help improve result rankings by analyzing the activity
generated by a client ID. The relevance improvements help with better quality
of results delivered by Bing APIs and in turn enables higher click-through
rates for the API consumer. IMPORTANT: Although optional, you should consider
this header required. Persisting the client ID across multiple requests for
the same end user and device combination enables 1) the API consumer to
receive a consistent user experience, and 2) higher click-through rates via
better quality of results from the Bing APIs. Each user that uses your
application on the device must have a unique, Bing generated client ID. If
you do not include this header in the request, Bing generates an ID and
returns it in the X-MSEdge-ClientID response header. The only time that you
should NOT include this header in a request is the first time the user uses
your app on that device. Use the client ID for each Bing API request that
your app makes for this user on the device. Persist the client ID. To persist
the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
used across all sessions. Do not use a session cookie. For other apps such as
mobile apps, use the device's persistent storage to persist the ID. The next
time the user uses your app on that device, get the client ID that you
persisted. Bing responses may or may not include this header. If the response
includes this header, capture the client ID and use it for all subsequent
Bing requests for the user on that device. If you include the
X-MSEdge-ClientID, you must not include cookies in the request.
@param client_ip [String] The IPv4 or IPv6 address of the client device. The
IP address is used to discover the user's location. Bing uses the location
information to determine safe search behavior. Although optional, you are
encouraged to always specify this header and the X-Search-Location header. Do
not obfuscate the address (for example, by changing the last octet to 0).
Obfuscating the address results in the location not being anywhere near the
device's actual location, which may result in Bing serving erroneous results.
@param location [String] A semicolon-delimited list of key/value pairs that
describe the client's geographical location. Bing uses the location
information to determine safe search behavior and to return relevant local
content. Specify the key/value pair as <key>:<value>. The following are the
keys that you use to specify the user's location. lat (required): The
latitude of the client's location, in degrees. The latitude must be greater
than or equal to -90.0 and less than or equal to +90.0. Negative values
indicate southern latitudes and positive values indicate northern latitudes.
long (required): The longitude of the client's location, in degrees. The
longitude must be greater than or equal to -180.0 and less than or equal to
+180.0. Negative values indicate western longitudes and positive values
indicate eastern longitudes. re (required): The radius, in meters, which
specifies the horizontal accuracy of the coordinates. Pass the value returned
by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
(optional): The UTC UNIX timestamp of when the client was at the location.
(The UNIX timestamp is the number of seconds since January 1, 1970.) head
(optional): The client's relative heading or direction of travel. Specify the
direction of travel as degrees from 0 through 360, counting clockwise
relative to true north. Specify this key only if the sp key is nonzero. sp
(optional): The horizontal velocity (speed), in meters per second, that the
client device is traveling. alt (optional): The altitude of the client
device, in meters. are (optional): The radius, in meters, that specifies the
vertical accuracy of the coordinates. Specify this key only if you specify
the alt key. Although many of the keys are optional, the more information
that you provide, the more accurate the location results are. Although
optional, you are encouraged to always specify the user's geographical
location. Providing the location is especially important if the client's IP
address does not accurately reflect the user's physical location (for
example, if the client uses VPN). For optimal results, you should include
this header and the X-MSEdge-ClientIP header, but at a minimum, you should
include this header.
@param country_code [String] A 2-character country code of the country where
the results come from. This API supports only the United States market. If
you specify this query parameter, it must be set to us. If you set this
parameter, you must also specify the Accept-Language header. Bing uses the
first supported language it finds from the languages list, and combine that
language with the country code that you specify to determine the market to
return results for. If the languages list does not include a supported
language, Bing finds the closest language and market that supports the
request, or it may use an aggregated or default market for the results
instead of a specified one. You should use this query parameter and the
Accept-Language query parameter only if you specify multiple languages;
otherwise, you should use the mkt and setLang query parameters. This
parameter and the mkt query parameter are mutually exclusive—do not specify
both.
@param market [String] The market where the results come from. Typically, mkt
is the country where the user is making the request from. However, it could
be a different country if the user is not located in a country where Bing
delivers results. The market must be in the form <language code>-<country
code>. For example, en-US. The string is case insensitive. For a list of
possible market values, see [Market
Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#market-codes).
NOTE: If known, you are encouraged to always specify the market. Specifying
the market helps Bing route the request and return an appropriate and optimal
response. If you specify a market that is not listed in [Market
Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#market-codes),
Bing uses a best fit market code based on an internal mapping that is subject
to change. This parameter and the
[cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#cc)
query parameter are mutually exclusive—do not specify both.
@param safe_search [SafeSearch] Filter videos for adult content. The
following are the possible filter values. Off: If the request is through the
Video Search API, the response includes adult videos and the thumbnail images
of the videos are clear (non-fuzzy). If the request is through the Web Search
API, the response includes adult videos but the thumbnail images of the
videos are pixelated (fuzzy). Moderate: If the request is through the Video
Search API, the response does not include videos with adult content. If the
request is through the Web Search API, the response may include videos with
adult content but the thumbnail images of the videos are pixelated (fuzzy).
Strict: Does not return videos with adult content. The default is Moderate.
If the request comes from a market that Bing's adult policy requires that
safeSearch is set to Strict, Bing ignores the safeSearch value and uses
Strict. If you use the site: query operator, there is the chance that the
response may contain adult content regardless of what the safeSearch query
parameter is set to. Use site: only if you are aware of the content on the
site and your scenario supports the possibility of adult content. Possible
values include: 'Off', 'Moderate', 'Strict'
@param set_lang [String] The language to use for user interface strings.
Specify the language using the ISO 639-1 2-letter language code. For example,
the language code for English is EN. The default is EN (English). Although
optional, you should always specify the language. Typically, you set setLang
to the same language specified by mkt unless the user wants the user
interface strings displayed in a different language. This parameter and the
[Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#acceptlanguage)
header are mutually exclusive; do not specify both. A user interface string
is a string that's used as a label in a user interface. There are few user
interface strings in the JSON response objects. Also, any links to Bing.com
properties in the response objects apply the specified language.
@param text_decorations [Boolean] A Boolean value that determines whether
display strings contain decoration markers such as hit highlighting
characters. If true, the strings may include markers. The default is false.
To specify whether to use Unicode characters or HTML tags as the markers, see
the
[textFormat](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#textformat)
query parameter. For information about hit highlighting, see [Hit
Highlighting](https://docs.microsoft.com/azure/cognitive-services/bing-news-search/hit-highlighting).
@param text_format [TextFormat] The type of markers to use for text
decorations (see the textDecorations query parameter). Possible values are
Raw—Use Unicode characters to mark content that needs special formatting. The
Unicode characters are in the range E000 through E019. For example, Bing uses
E000 and E001 to mark the beginning and end of query terms for hit
highlighting. HTML—Use HTML tags to mark content that needs special
formatting. For example, use <b> tags to highlight query terms in display
strings. The default is Raw. For display strings that contain escapable HTML
characters such as <, >, and &, if textFormat is set to HTML, Bing escapes
the characters as appropriate (for example, < is escaped to <). Possible
values include: 'Raw', 'Html'
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"The",
"Video",
"Trending",
"Search",
"API",
"lets",
"you",
"search",
"on",
"Bing",
"and",
"get",
"back",
"a",
"list",
"of",
"videos",
"that",
"are",
"trending",
"based",
"on",
"search",
"requests",
"made",
"by",
"others",
".",
"The",
"videos",
"are",
"b... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_videosearch/lib/1.0/generated/azure_cognitiveservices_videosearch/videos_operations.rb#L2000-L2002 | train | Returns the list of documents trending for a given language. | [
30522,
13366,
9874,
2075,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
5138,
1035,
2653,
1024,
9152,
2140,
1010,
5310,
1035,
4005,
1024,
9152,
2140,
1010,
7396,
1035,
8909,
1024,
9152,
2140,
1010,
7396,
1035,
12997,
1024,
9152,
2140,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/network_watchers.rb | Azure::Network::Mgmt::V2018_08_01.NetworkWatchers.verify_ipflow_async | def verify_ipflow_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
# Send request
promise = begin_verify_ipflow_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Network::Mgmt::V2018_08_01::Models::VerificationIPFlowResult.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | ruby | def verify_ipflow_async(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
# Send request
promise = begin_verify_ipflow_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Network::Mgmt::V2018_08_01::Models::VerificationIPFlowResult.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | [
"def",
"verify_ipflow_async",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_verify_ipflow_async",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"... | @param resource_group_name [String] The name of the resource group.
@param network_watcher_name [String] The name of the network watcher.
@param parameters [VerificationIPFlowParameters] Parameters that define the
IP flow to be verified.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"resource_group_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"resource",
"group",
".",
"@param",
"network_watcher_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"network",
"watcher",
".",
"@param",
"parameters",
"[",
"VerificationIPFl... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/network_watchers.rb#L683-L699 | train | Verify IP flow. | [
30522,
13366,
20410,
1035,
12997,
12314,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2897,
1035,
3422,
2121,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/connection_operations.rb | Azure::Automation::Mgmt::V2015_10_31.ConnectionOperations.update | def update(resource_group_name, automation_account_name, connection_name, parameters, custom_headers:nil)
response = update_async(resource_group_name, automation_account_name, connection_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def update(resource_group_name, automation_account_name, connection_name, parameters, custom_headers:nil)
response = update_async(resource_group_name, automation_account_name, connection_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"update",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"connection_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"update_async",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"connection_... | Update a connection.
@param resource_group_name [String] Name of an Azure Resource group.
@param automation_account_name [String] The name of the automation account.
@param connection_name [String] The parameters supplied to the update a
connection operation.
@param parameters [ConnectionUpdateParameters] The parameters supplied to the
update a connection operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Connection] operation results. | [
"Update",
"a",
"connection",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/connection_operations.rb#L362-L365 | train | Updates a connection. | [
30522,
13366,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
19309,
1035,
4070,
1035,
2171,
1010,
4434,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
10651,
1035,
2004,
6038,
2278,
1006,
7692,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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_health_with_http_info | def get_service_health_with_http_info(service_id, events_health_state_filter:0, partitions_health_state_filter:0, exclude_health_statistics:false, timeout:60, custom_headers:nil)
get_service_health_async(service_id, events_health_state_filter:events_health_state_filter, partitions_health_state_filter:partitions_health_state_filter, exclude_health_statistics:exclude_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def get_service_health_with_http_info(service_id, events_health_state_filter:0, partitions_health_state_filter:0, exclude_health_statistics:false, timeout:60, custom_headers:nil)
get_service_health_async(service_id, events_health_state_filter:events_health_state_filter, partitions_health_state_filter:partitions_health_state_filter, exclude_health_statistics:exclude_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"get_service_health_with_http_info",
"(",
"service_id",
",",
"events_health_state_filter",
":",
"0",
",",
"partitions_health_state_filter",
":",
"0",
",",
"exclude_health_statistics",
":",
"false",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
"... | Gets the health of the specified Service Fabric service.
Gets the health information of the specified service.
Use EventsHealthStateFilter to filter the collection of health events
reported on the service based on the health state.
Use PartitionsHealthStateFilter to filter the collection of partitions
returned.
If you specify a service that does not exist in the health store, this
request returns an error.
@param service_id [String] The identity of the service. This is typically the
full name of the service without the 'fabric:' URI scheme.
Starting from version 6.0, hierarchical names are delimited with the "~"
character.
For example, if the service name is "fabric:/myapp/app1/svc1", the service
identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
versions.
@param events_health_state_filter [Integer] Allows filtering the collection
of HealthEvent objects returned based on health state.
The possible values for this parameter include integer value of one of the
following health states.
Only events that match the filter are returned. All events are used to
evaluate the aggregated health state.
If not specified, all entries are returned. The state values are flag based
enumeration, so the value could be a combination of these value obtained
using bitwise 'OR' operator. For example, If the provided value is 6 then all
of the events with HealthState value of OK (2) and Warning (4) are returned.
- Default - Default value. Matches any HealthState. The value is zero.
- None - Filter that doesn't match any HealthState value. Used in order to
return no results on a given collection of states. The value is 1.
- Ok - Filter that matches input with HealthState value Ok. The value is 2.
- Warning - Filter that matches input with HealthState value Warning. The
value is 4.
- Error - Filter that matches input with HealthState value Error. The value
is 8.
- All - Filter that matches input with any HealthState value. The value is
65535.
@param partitions_health_state_filter [Integer] Allows filtering of the
partitions health state objects returned in the result of service health
query based on their health state.
The possible values for this parameter include integer value of one of the
following health states.
Only partitions that match the filter are returned. All partitions are used
to evaluate the aggregated health state.
If not specified, all entries are returned. The state values are flag based
enumeration, so the value could be a combination of these value
obtained using bitwise 'OR' operator. For example, if the provided value is 6
then health state of partitions with HealthState value of OK (2) and Warning
(4) will be returned.
- Default - Default value. Matches any HealthState. The value is zero.
- None - Filter that doesn't match any HealthState value. Used in order to
return no results on a given collection of states. The value is 1.
- Ok - Filter that matches input with HealthState value Ok. The value is 2.
- Warning - Filter that matches input with HealthState value Warning. The
value is 4.
- Error - Filter that matches input with HealthState value Error. The value
is 8.
- All - Filter that matches input with any HealthState value. The value is
65535.
@param exclude_health_statistics [Boolean] Indicates whether the health
statistics should be returned as part of the query result. False by default.
The statistics show the number of children entities in health state Ok,
Warning, and Error.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"health",
"of",
"the",
"specified",
"Service",
"Fabric",
"service",
"."
] | 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#L10953-L10955 | train | Gets the health of the service. | [
30522,
13366,
2131,
1035,
2326,
1035,
2740,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2326,
1035,
8909,
1010,
2824,
1035,
2740,
1035,
2110,
1035,
11307,
1024,
1014,
1010,
13571,
2015,
1035,
2740,
1035,
2110,
1035,
11307,
1024,
1014,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-sns/lib/aws-sdk-sns/resource.rb | Aws::SNS.Resource.platform_applications | def platform_applications(options = {})
batches = Enumerator.new do |y|
resp = @client.list_platform_applications(options)
resp.each_page do |page|
batch = []
page.data.platform_applications.each do |p|
batch << PlatformApplication.new(
arn: p.platform_application_arn,
client: @client
)
end
y.yield(batch)
end
end
PlatformApplication::Collection.new(batches)
end | ruby | def platform_applications(options = {})
batches = Enumerator.new do |y|
resp = @client.list_platform_applications(options)
resp.each_page do |page|
batch = []
page.data.platform_applications.each do |p|
batch << PlatformApplication.new(
arn: p.platform_application_arn,
client: @client
)
end
y.yield(batch)
end
end
PlatformApplication::Collection.new(batches)
end | [
"def",
"platform_applications",
"(",
"options",
"=",
"{",
"}",
")",
"batches",
"=",
"Enumerator",
".",
"new",
"do",
"|",
"y",
"|",
"resp",
"=",
"@client",
".",
"list_platform_applications",
"(",
"options",
")",
"resp",
".",
"each_page",
"do",
"|",
"page",
... | @example Request syntax with placeholder values
sns.platform_applications()
@param [Hash] options ({})
@return [PlatformApplication::Collection] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-sns/lib/aws-sdk-sns/resource.rb#L134-L149 | train | Returns an array of all platform applications | [
30522,
13366,
4132,
1035,
5097,
1006,
7047,
1027,
1063,
1065,
1007,
14108,
2229,
1027,
4372,
17897,
16259,
1012,
2047,
2079,
1064,
1061,
1064,
24501,
2361,
1027,
1030,
7396,
1012,
2862,
1035,
4132,
1035,
5097,
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... |
fastlane/fastlane | credentials_manager/lib/credentials_manager/account_manager.rb | CredentialsManager.AccountManager.invalid_credentials | def invalid_credentials(force: false)
puts("The login credentials for '#{user}' seem to be wrong".red)
if fetch_password_from_env
puts("The password was taken from the environment variable")
puts("Please make sure it is correct")
return false
end
if force || agree("Do you want to re-enter your password? (y/n)", true)
puts("Removing Keychain entry for user '#{user}'...".yellow) if mac?
remove_from_keychain
ask_for_login
return true
end
false
end | ruby | def invalid_credentials(force: false)
puts("The login credentials for '#{user}' seem to be wrong".red)
if fetch_password_from_env
puts("The password was taken from the environment variable")
puts("Please make sure it is correct")
return false
end
if force || agree("Do you want to re-enter your password? (y/n)", true)
puts("Removing Keychain entry for user '#{user}'...".yellow) if mac?
remove_from_keychain
ask_for_login
return true
end
false
end | [
"def",
"invalid_credentials",
"(",
"force",
":",
"false",
")",
"puts",
"(",
"\"The login credentials for '#{user}' seem to be wrong\"",
".",
"red",
")",
"if",
"fetch_password_from_env",
"puts",
"(",
"\"The password was taken from the environment variable\"",
")",
"puts",
"(",... | Call this method to ask the user to re-enter the credentials
@param force: if false, the user is asked before it gets deleted
@return: Did the user decide to remove the old entry and enter a new password? | [
"Call",
"this",
"method",
"to",
"ask",
"the",
"user",
"to",
"re",
"-",
"enter",
"the",
"credentials"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/credentials_manager/lib/credentials_manager/account_manager.rb#L63-L79 | train | Checks if the login credentials are wrong | [
30522,
13366,
19528,
1035,
22496,
1006,
2486,
1024,
6270,
1007,
8509,
1006,
1000,
1996,
8833,
2378,
22496,
2005,
1005,
1001,
1063,
5310,
1065,
1005,
4025,
2000,
2022,
3308,
1000,
1012,
2417,
1007,
2065,
18584,
30524,
1007,
8509,
1006,
1000,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_authorization/lib/2015-07-01/generated/azure_mgmt_authorization/permissions.rb | Azure::Authorization::Mgmt::V2015_07_01.Permissions.list_for_resource_with_http_info | def list_for_resource_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, custom_headers:nil)
list_for_resource_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, custom_headers:custom_headers).value!
end | ruby | def list_for_resource_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, custom_headers:nil)
list_for_resource_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, custom_headers:custom_headers).value!
end | [
"def",
"list_for_resource_with_http_info",
"(",
"resource_group_name",
",",
"resource_provider_namespace",
",",
"parent_resource_path",
",",
"resource_type",
",",
"resource_name",
",",
"custom_headers",
":",
"nil",
")",
"list_for_resource_async",
"(",
"resource_group_name",
"... | Gets all permissions the caller has for a resource.
@param resource_group_name [String] The name of the resource group containing
the resource. The name is case insensitive.
@param resource_provider_namespace [String] The namespace of the resource
provider.
@param parent_resource_path [String] The parent resource identity.
@param resource_type [String] The resource type of the resource.
@param resource_name [String] The name of the resource to get the permissions
for.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"all",
"permissions",
"the",
"caller",
"has",
"for",
"a",
"resource",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_authorization/lib/2015-07-01/generated/azure_mgmt_authorization/permissions.rb#L156-L158 | train | Gets the list of resources under the resource provider. | [
30522,
13366,
2862,
1035,
2005,
1035,
7692,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7692,
1035,
10802,
1035,
3415,
15327,
1010,
6687,
1035,
7692,
1035,
4130,
1010,
7692,
1035,
2828,
1010,
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... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.4.0.36/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_4_0_36.ServiceFabricClientAPIs.disable_service_backup | def disable_service_backup(service_id, disable_backup_description:nil, timeout:60, custom_headers:nil)
response = disable_service_backup_async(service_id, disable_backup_description:disable_backup_description, timeout:timeout, custom_headers:custom_headers).value!
nil
end | ruby | def disable_service_backup(service_id, disable_backup_description:nil, timeout:60, custom_headers:nil)
response = disable_service_backup_async(service_id, disable_backup_description:disable_backup_description, timeout:timeout, custom_headers:custom_headers).value!
nil
end | [
"def",
"disable_service_backup",
"(",
"service_id",
",",
"disable_backup_description",
":",
"nil",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"disable_service_backup_async",
"(",
"service_id",
",",
"disable_backup_description",
... | Disables periodic backup of Service Fabric service which was previously
enabled.
Disables periodic backup of Service Fabric service which was previously
enabled. Backup must be explicitly enabled before it can be disabled.
In case the backup is enabled for the Service Fabric application, which this
service is part of, this service would continue to be periodically backed up
as per the policy mapped at the application level.
@param service_id [String] The identity of the service. This ID is typically
the full name of the service without the 'fabric:' URI scheme.
Starting from version 6.0, hierarchical names are delimited with the "~"
character.
For example, if the service name is "fabric:/myapp/app1/svc1", the service
identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
versions.
@param disable_backup_description [DisableBackupDescription] Specifies the
parameters to disable backup for any backup entity.
@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. | [
"Disables",
"periodic",
"backup",
"of",
"Service",
"Fabric",
"service",
"which",
"was",
"previously",
"enabled",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.4.0.36/generated/azure_service_fabric/service_fabric_client_apis.rb#L24292-L24295 | train | Disables backup of a service. | [
30522,
13366,
4487,
19150,
1035,
2326,
1035,
10200,
1006,
2326,
1035,
8909,
1010,
4487,
19150,
1035,
10200,
1035,
6412,
1024,
9152,
2140,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4487,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/module_tool/metadata.rb | Puppet::ModuleTool.Metadata.validate_data_provider | def validate_data_provider(value)
if value.is_a?(String)
unless value =~ /^[a-zA-Z][a-zA-Z0-9_]*$/
if value =~ /^[a-zA-Z]/
raise ArgumentError, _("field 'data_provider' contains non-alphanumeric characters")
else
raise ArgumentError, _("field 'data_provider' must begin with a letter")
end
end
else
raise ArgumentError, _("field 'data_provider' must be a string")
end
end | ruby | def validate_data_provider(value)
if value.is_a?(String)
unless value =~ /^[a-zA-Z][a-zA-Z0-9_]*$/
if value =~ /^[a-zA-Z]/
raise ArgumentError, _("field 'data_provider' contains non-alphanumeric characters")
else
raise ArgumentError, _("field 'data_provider' must begin with a letter")
end
end
else
raise ArgumentError, _("field 'data_provider' must be a string")
end
end | [
"def",
"validate_data_provider",
"(",
"value",
")",
"if",
"value",
".",
"is_a?",
"(",
"String",
")",
"unless",
"value",
"=~",
"/",
"/",
"if",
"value",
"=~",
"/",
"/",
"raise",
"ArgumentError",
",",
"_",
"(",
"\"field 'data_provider' contains non-alphanumeric cha... | Validates that the given _value_ is a symbolic name that starts with a letter
and then contains only letters, digits, or underscore. Will raise an ArgumentError
if that's not the case.
@param value [Object] The value to be tested | [
"Validates",
"that",
"the",
"given",
"_value_",
"is",
"a",
"symbolic",
"name",
"that",
"starts",
"with",
"a",
"letter",
"and",
"then",
"contains",
"only",
"letters",
"digits",
"or",
"underscore",
".",
"Will",
"raise",
"an",
"ArgumentError",
"if",
"that",
"s"... | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/module_tool/metadata.rb#L201-L213 | train | Validate the data_provider | [
30522,
13366,
9398,
3686,
1035,
2951,
1035,
10802,
1006,
3643,
1007,
2065,
3643,
1012,
2003,
1035,
1037,
1029,
1006,
5164,
1007,
4983,
3643,
1027,
1066,
1013,
1034,
1031,
1037,
1011,
23564,
1011,
1062,
1033,
1031,
1037,
1011,
23564,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activerecord/lib/active_record/transactions.rb | ActiveRecord.Transactions.remember_transaction_record_state | def remember_transaction_record_state
@_start_transaction_state ||= {
id: id,
new_record: @new_record,
destroyed: @destroyed,
attributes: @attributes,
frozen?: frozen?,
level: 0
}
@_start_transaction_state[:level] += 1
remember_new_record_before_last_commit
end | ruby | def remember_transaction_record_state
@_start_transaction_state ||= {
id: id,
new_record: @new_record,
destroyed: @destroyed,
attributes: @attributes,
frozen?: frozen?,
level: 0
}
@_start_transaction_state[:level] += 1
remember_new_record_before_last_commit
end | [
"def",
"remember_transaction_record_state",
"@_start_transaction_state",
"||=",
"{",
"id",
":",
"id",
",",
"new_record",
":",
"@new_record",
",",
"destroyed",
":",
"@destroyed",
",",
"attributes",
":",
"@attributes",
",",
"frozen?",
":",
"frozen?",
",",
"level",
"... | Save the new record state and id of a record so it can be restored later if a transaction fails. | [
"Save",
"the",
"new",
"record",
"state",
"and",
"id",
"of",
"a",
"record",
"so",
"it",
"can",
"be",
"restored",
"later",
"if",
"a",
"transaction",
"fails",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activerecord/lib/active_record/transactions.rb#L385-L396 | train | Remember the record state of the transaction | [
30522,
13366,
3342,
1035,
12598,
1035,
2501,
1035,
2110,
1030,
1035,
2707,
1035,
12598,
1035,
2110,
1064,
1064,
1027,
1063,
8909,
1024,
8909,
1010,
2047,
1035,
2501,
1024,
1030,
2047,
1035,
2501,
1010,
3908,
1024,
1030,
3908,
1010,
12332,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
danger/danger | lib/danger/danger_core/plugins/dangerfile_danger_plugin.rb | Danger.DangerfileDangerPlugin.import_dangerfile | def import_dangerfile(opts)
if opts.kind_of?(String)
warn "Use `import_dangerfile(github: '#{opts}')` instead of `import_dangerfile '#{opts}'`."
import_dangerfile_from_github(opts)
elsif opts.kind_of?(Hash)
if opts.key?(:github) || opts.key?(:gitlab)
import_dangerfile_from_github(opts[:github] || opts[:gitlab], opts[:branch], opts[:path])
elsif opts.key?(:path)
import_dangerfile_from_path(opts[:path])
elsif opts.key?(:gem)
import_dangerfile_from_gem(opts[:gem])
else
raise "`import` requires a Hash with either :github or :gem"
end
else
raise "`import` requires a Hash" unless opts.kind_of?(Hash)
end
end | ruby | def import_dangerfile(opts)
if opts.kind_of?(String)
warn "Use `import_dangerfile(github: '#{opts}')` instead of `import_dangerfile '#{opts}'`."
import_dangerfile_from_github(opts)
elsif opts.kind_of?(Hash)
if opts.key?(:github) || opts.key?(:gitlab)
import_dangerfile_from_github(opts[:github] || opts[:gitlab], opts[:branch], opts[:path])
elsif opts.key?(:path)
import_dangerfile_from_path(opts[:path])
elsif opts.key?(:gem)
import_dangerfile_from_gem(opts[:gem])
else
raise "`import` requires a Hash with either :github or :gem"
end
else
raise "`import` requires a Hash" unless opts.kind_of?(Hash)
end
end | [
"def",
"import_dangerfile",
"(",
"opts",
")",
"if",
"opts",
".",
"kind_of?",
"(",
"String",
")",
"warn",
"\"Use `import_dangerfile(github: '#{opts}')` instead of `import_dangerfile '#{opts}'`.\"",
"import_dangerfile_from_github",
"(",
"opts",
")",
"elsif",
"opts",
".",
"kin... | @!group Danger
Import a Dangerfile.
@param [Hash] opts
@option opts [String] :github GitHub repo
@option opts [String] :gitlab GitLab repo
@option opts [String] :gem Gem name
@option opts [String] :path Path to Dangerfile
@return [void] | [
"@!group",
"Danger",
"Import",
"a",
"Dangerfile",
"."
] | 0d6d09f2d949c287fe75202d947374042b0679f4 | https://github.com/danger/danger/blob/0d6d09f2d949c287fe75202d947374042b0679f4/lib/danger/danger_core/plugins/dangerfile_danger_plugin.rb#L74-L91 | train | Import the dangerfile from a gitlab or gitlab repo | [
30522,
13366,
12324,
1035,
5473,
8873,
2571,
1006,
23569,
2015,
1007,
2065,
23569,
2015,
1012,
2785,
1035,
1997,
1029,
1006,
5164,
1007,
11582,
1000,
2224,
1036,
12324,
1035,
5473,
8873,
2571,
1006,
21025,
2705,
12083,
1024,
1005,
1001,
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... |
GeorgeKaraszi/ActiveRecordExtended | lib/active_record_extended/utilities.rb | ActiveRecordExtended.Utilities.wrap_with_agg_array | def wrap_with_agg_array(arel_or_rel_query, alias_name, casting_option = :agg, distinct = false)
query = group_when_needed(arel_or_rel_query)
query = Arel::Nodes::ArrayAgg.new(to_sql_array(query))
query.distinct = distinct || [:agg_distinct, :array_agg_distinct].include?(casting_option)
nested_alias_escape(query, alias_name)
end | ruby | def wrap_with_agg_array(arel_or_rel_query, alias_name, casting_option = :agg, distinct = false)
query = group_when_needed(arel_or_rel_query)
query = Arel::Nodes::ArrayAgg.new(to_sql_array(query))
query.distinct = distinct || [:agg_distinct, :array_agg_distinct].include?(casting_option)
nested_alias_escape(query, alias_name)
end | [
"def",
"wrap_with_agg_array",
"(",
"arel_or_rel_query",
",",
"alias_name",
",",
"casting_option",
"=",
":agg",
",",
"distinct",
"=",
"false",
")",
"query",
"=",
"group_when_needed",
"(",
"arel_or_rel_query",
")",
"query",
"=",
"Arel",
"::",
"Nodes",
"::",
"Array... | Wraps query into an aggregated array
EX: `(ARRAY_AGG((SELECT * FROM users)) AS "members"`
`(ARRAY_AGG(DISTINCT (SELECT * FROM users)) AS "members"`
`SELECT ARRAY_AGG((id)) AS "ids" FROM users`
`SELECT ARRAY_AGG(DISTINCT (id)) AS "ids" FROM users` | [
"Wraps",
"query",
"into",
"an",
"aggregated",
"array",
"EX",
":",
"(",
"ARRAY_AGG",
"((",
"SELECT",
"*",
"FROM",
"users",
"))",
"AS",
"members",
"(",
"ARRAY_AGG",
"(",
"DISTINCT",
"(",
"SELECT",
"*",
"FROM",
"users",
"))",
"AS",
"members",
"SELECT",
"ARR... | aca74eebb64b9957a2c8765bef6e43c7d5736fd8 | https://github.com/GeorgeKaraszi/ActiveRecordExtended/blob/aca74eebb64b9957a2c8765bef6e43c7d5736fd8/lib/active_record_extended/utilities.rb#L48-L53 | train | Wrap the query with an array aggregation | [
30522,
13366,
10236,
1035,
2007,
1035,
12943,
2290,
1035,
9140,
1006,
2024,
2140,
1035,
2030,
1035,
2128,
2140,
1035,
23032,
1010,
14593,
1035,
2171,
1010,
9179,
1035,
5724,
1027,
1024,
12943,
2290,
1010,
5664,
1027,
6270,
1007,
23032,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
projectcypress/health-data-standards | lib/hqmf-parser/1.0/data_criteria.rb | HQMF1.DataCriteria.const_name | def const_name
components = title.gsub(/\W/,' ').split.collect {|word| word.strip.upcase }
if @derived_from
components << HQMF::Counter.instance.next
end
components.join '_'
end | ruby | def const_name
components = title.gsub(/\W/,' ').split.collect {|word| word.strip.upcase }
if @derived_from
components << HQMF::Counter.instance.next
end
components.join '_'
end | [
"def",
"const_name",
"components",
"=",
"title",
".",
"gsub",
"(",
"/",
"\\W",
"/",
",",
"' '",
")",
".",
"split",
".",
"collect",
"{",
"|",
"word",
"|",
"word",
".",
"strip",
".",
"upcase",
"}",
"if",
"@derived_from",
"components",
"<<",
"HQMF",
"::... | Get a JS friendly constant name for this measure attribute | [
"Get",
"a",
"JS",
"friendly",
"constant",
"name",
"for",
"this",
"measure",
"attribute"
] | 252d4f0927c513eacde6b9ea41b76faa1423c34b | https://github.com/projectcypress/health-data-standards/blob/252d4f0927c513eacde6b9ea41b76faa1423c34b/lib/hqmf-parser/1.0/data_criteria.rb#L74-L80 | train | Returns the name of the current page. | [
30522,
13366,
9530,
3367,
1035,
2171,
6177,
1027,
2516,
1012,
28177,
12083,
1006,
1013,
1032,
1059,
1013,
1010,
1005,
1005,
1007,
1012,
3975,
1012,
8145,
1063,
1064,
2773,
1064,
2773,
1012,
6167,
1012,
2039,
18382,
1065,
2065,
1030,
5173,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/guest.rb | Vagrant.Guest.capability | def capability(*args)
super
rescue Errors::CapabilityNotFound => e
raise Errors::GuestCapabilityNotFound,
cap: e.extra_data[:cap],
guest: name
rescue Errors::CapabilityInvalid => e
raise Errors::GuestCapabilityInvalid,
cap: e.extra_data[:cap],
guest: name
end | ruby | def capability(*args)
super
rescue Errors::CapabilityNotFound => e
raise Errors::GuestCapabilityNotFound,
cap: e.extra_data[:cap],
guest: name
rescue Errors::CapabilityInvalid => e
raise Errors::GuestCapabilityInvalid,
cap: e.extra_data[:cap],
guest: name
end | [
"def",
"capability",
"(",
"*",
"args",
")",
"super",
"rescue",
"Errors",
"::",
"CapabilityNotFound",
"=>",
"e",
"raise",
"Errors",
"::",
"GuestCapabilityNotFound",
",",
"cap",
":",
"e",
".",
"extra_data",
"[",
":cap",
"]",
",",
"guest",
":",
"name",
"rescu... | See {CapabilityHost#capability} | [
"See",
"{",
"CapabilityHost#capability",
"}"
] | c22a145c59790c098f95d50141d9afb48e1ef55f | https://github.com/hashicorp/vagrant/blob/c22a145c59790c098f95d50141d9afb48e1ef55f/lib/vagrant/guest.rb#L42-L52 | train | Returns the capability of the current user. | [
30522,
13366,
10673,
1006,
1008,
12098,
5620,
1007,
3565,
5343,
10697,
1024,
1024,
10673,
17048,
14876,
8630,
1027,
1028,
1041,
5333,
10697,
1024,
1024,
4113,
17695,
8010,
17048,
14876,
8630,
1010,
6178,
1024,
1041,
1012,
4469,
1035,
2951,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
meew0/discordrb | lib/discordrb/data/server.rb | Discordrb.Server.member | def member(id, request = true)
id = id.resolve_id
return @members[id] if member_cached?(id)
return nil unless request
member = @bot.member(self, id)
@members[id] = member unless member.nil?
rescue StandardError
nil
end | ruby | def member(id, request = true)
id = id.resolve_id
return @members[id] if member_cached?(id)
return nil unless request
member = @bot.member(self, id)
@members[id] = member unless member.nil?
rescue StandardError
nil
end | [
"def",
"member",
"(",
"id",
",",
"request",
"=",
"true",
")",
"id",
"=",
"id",
".",
"resolve_id",
"return",
"@members",
"[",
"id",
"]",
"if",
"member_cached?",
"(",
"id",
")",
"return",
"nil",
"unless",
"request",
"member",
"=",
"@bot",
".",
"member",
... | Gets a member on this server based on user ID
@param id [Integer] The user ID to look for
@param request [true, false] Whether the member should be requested from Discord if it's not cached | [
"Gets",
"a",
"member",
"on",
"this",
"server",
"based",
"on",
"user",
"ID"
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/data/server.rb#L122-L131 | train | Get a member of this group. | [
30522,
13366,
2266,
1006,
8909,
1010,
5227,
1027,
2995,
1007,
8909,
1027,
8909,
1012,
10663,
1035,
8909,
2709,
1030,
2372,
1031,
8909,
1033,
2065,
2266,
1035,
17053,
2094,
1029,
1006,
8909,
1007,
2709,
9152,
2140,
4983,
5227,
2266,
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... |
deivid-rodriguez/byebug | lib/byebug/interface.rb | Byebug.Interface.split_commands | def split_commands(cmd_line)
return [""] if cmd_line.empty?
cmd_line.split(/;/).each_with_object([]) do |v, m|
if m.empty? || m.last[-1] != '\\'
m << v.strip
next
end
m.last[-1, 1] = ""
m.last << ";" << v
end
end | ruby | def split_commands(cmd_line)
return [""] if cmd_line.empty?
cmd_line.split(/;/).each_with_object([]) do |v, m|
if m.empty? || m.last[-1] != '\\'
m << v.strip
next
end
m.last[-1, 1] = ""
m.last << ";" << v
end
end | [
"def",
"split_commands",
"(",
"cmd_line",
")",
"return",
"[",
"\"\"",
"]",
"if",
"cmd_line",
".",
"empty?",
"cmd_line",
".",
"split",
"(",
"/",
"/",
")",
".",
"each_with_object",
"(",
"[",
"]",
")",
"do",
"|",
"v",
",",
"m",
"|",
"if",
"m",
".",
... | Splits a command line of the form "cmd1 ; cmd2 ; ... ; cmdN" into an
array of commands: [cmd1, cmd2, ..., cmdN] | [
"Splits",
"a",
"command",
"line",
"of",
"the",
"form",
"cmd1",
";",
"cmd2",
";",
"...",
";",
"cmdN",
"into",
"an",
"array",
"of",
"commands",
":",
"[",
"cmd1",
"cmd2",
"...",
"cmdN",
"]"
] | bf41a63858a648baa7fb621600d6451786d1572a | https://github.com/deivid-rodriguez/byebug/blob/bf41a63858a648baa7fb621600d6451786d1572a/lib/byebug/interface.rb#L128-L140 | train | Split the command line into a list of words | [
30522,
13366,
3975,
1035,
10954,
1006,
4642,
2094,
1035,
2240,
1007,
2709,
1031,
1000,
1000,
1033,
2065,
4642,
2094,
1035,
2240,
1012,
4064,
1029,
4642,
2094,
1035,
2240,
1012,
30524,
2079,
1064,
1058,
1010,
1049,
1064,
2065,
1049,
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... |
seejohnrun/ice_cube | lib/ice_cube/schedule.rb | IceCube.Schedule.conflicts_with? | def conflicts_with?(other_schedule, closing_time = nil)
closing_time = TimeUtil.ensure_time(closing_time)
unless terminating? || other_schedule.terminating? || closing_time
raise ArgumentError, "One or both schedules must be terminating to use #conflicts_with?"
end
# Pick the terminating schedule, and other schedule
# No need to reverse if terminating? or there is a closing time
terminating_schedule = self
unless terminating? || closing_time
terminating_schedule, other_schedule = other_schedule, terminating_schedule
end
# Go through each occurrence of the terminating schedule and determine
# if the other occurs at that time
#
last_time = nil
terminating_schedule.each_occurrence do |time|
if closing_time && time > closing_time
last_time = closing_time
break
end
last_time = time
return true if other_schedule.occurring_at?(time)
end
# Due to durations, we need to walk up to the end time, and verify in the
# other direction
if last_time
last_time += terminating_schedule.duration
other_schedule.each_occurrence do |time|
break if time > last_time
return true if terminating_schedule.occurring_at?(time)
end
end
# No conflict, return false
false
end | ruby | def conflicts_with?(other_schedule, closing_time = nil)
closing_time = TimeUtil.ensure_time(closing_time)
unless terminating? || other_schedule.terminating? || closing_time
raise ArgumentError, "One or both schedules must be terminating to use #conflicts_with?"
end
# Pick the terminating schedule, and other schedule
# No need to reverse if terminating? or there is a closing time
terminating_schedule = self
unless terminating? || closing_time
terminating_schedule, other_schedule = other_schedule, terminating_schedule
end
# Go through each occurrence of the terminating schedule and determine
# if the other occurs at that time
#
last_time = nil
terminating_schedule.each_occurrence do |time|
if closing_time && time > closing_time
last_time = closing_time
break
end
last_time = time
return true if other_schedule.occurring_at?(time)
end
# Due to durations, we need to walk up to the end time, and verify in the
# other direction
if last_time
last_time += terminating_schedule.duration
other_schedule.each_occurrence do |time|
break if time > last_time
return true if terminating_schedule.occurring_at?(time)
end
end
# No conflict, return false
false
end | [
"def",
"conflicts_with?",
"(",
"other_schedule",
",",
"closing_time",
"=",
"nil",
")",
"closing_time",
"=",
"TimeUtil",
".",
"ensure_time",
"(",
"closing_time",
")",
"unless",
"terminating?",
"||",
"other_schedule",
".",
"terminating?",
"||",
"closing_time",
"raise"... | Determine if this schedule conflicts with another schedule
@param [IceCube::Schedule] other_schedule - The schedule to compare to
@param [Time] closing_time - the last time to consider
@return [Boolean] whether or not the schedules conflict at all | [
"Determine",
"if",
"this",
"schedule",
"conflicts",
"with",
"another",
"schedule"
] | fb6c657bdc4f87dfda2bf83f15c5f487b78ccabd | https://github.com/seejohnrun/ice_cube/blob/fb6c657bdc4f87dfda2bf83f15c5f487b78ccabd/lib/ice_cube/schedule.rb#L257-L291 | train | Returns true if this schedule conflicts with another schedule | [
30522,
13366,
9755,
1035,
2007,
1029,
1006,
2060,
1035,
6134,
1010,
5494,
1035,
2051,
1027,
9152,
2140,
1007,
5494,
1035,
2051,
1027,
2051,
21823,
2140,
1012,
5676,
1035,
2051,
1006,
5494,
1035,
2051,
1007,
4983,
23552,
1029,
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... |
googleapis/google-cloud-ruby | google-cloud-bigquery/lib/google-cloud-bigquery.rb | Google.Cloud.bigquery | def bigquery scope: nil, retries: nil, timeout: nil
Google::Cloud.bigquery @project, @keyfile, scope: scope,
retries: (retries || @retries),
timeout: (timeout || @timeout)
end | ruby | def bigquery scope: nil, retries: nil, timeout: nil
Google::Cloud.bigquery @project, @keyfile, scope: scope,
retries: (retries || @retries),
timeout: (timeout || @timeout)
end | [
"def",
"bigquery",
"scope",
":",
"nil",
",",
"retries",
":",
"nil",
",",
"timeout",
":",
"nil",
"Google",
"::",
"Cloud",
".",
"bigquery",
"@project",
",",
"@keyfile",
",",
"scope",
":",
"scope",
",",
"retries",
":",
"(",
"retries",
"||",
"@retries",
")... | Creates a new object for connecting to the BigQuery service.
Each call creates a new connection.
For more information on connecting to Google Cloud see the
{file:AUTHENTICATION.md Authentication Guide}.
@param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
set of resources and operations that the connection can access. See
[Using OAuth 2.0 to Access Google
APIs](https://developers.google.com/identity/protocols/OAuth2).
The default scope is:
* `https://www.googleapis.com/auth/bigquery`
@param [Integer] retries Number of times to retry requests on server
error. The default value is `5`. Optional.
@param [Integer] timeout Default request timeout in seconds. Optional.
@return [Google::Cloud::Bigquery::Project]
@example
require "google/cloud"
gcloud = Google::Cloud.new
bigquery = gcloud.bigquery
dataset = bigquery.dataset "my_dataset"
table = dataset.table "my_table"
table.data.each do |row|
puts row
end
@example The default scope can be overridden with the `scope` option:
require "google/cloud"
gcloud = Google::Cloud.new
platform_scope = "https://www.googleapis.com/auth/cloud-platform"
bigquery = gcloud.bigquery scope: platform_scope | [
"Creates",
"a",
"new",
"object",
"for",
"connecting",
"to",
"the",
"BigQuery",
"service",
".",
"Each",
"call",
"creates",
"a",
"new",
"connection",
"."
] | 846c1a57250ac860ef4de1b54853a480ab2ff702 | https://github.com/googleapis/google-cloud-ruby/blob/846c1a57250ac860ef4de1b54853a480ab2ff702/google-cloud-bigquery/lib/google-cloud-bigquery.rb#L67-L71 | train | Create a new instance of the BigQuery object. | [
30522,
13366,
2502,
4226,
2854,
9531,
1024,
9152,
2140,
1010,
2128,
21011,
1024,
9152,
2140,
1010,
2051,
5833,
1024,
30524,
1030,
2051,
5833,
1007,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/schema.rb | Sunspot.Schema.dynamic_fields | def dynamic_fields
fields = []
variant_combinations.each do |field_variants|
FIELD_TYPES.each do |type|
fields << DynamicField.new(type, field_variants)
end
end
fields
end | ruby | def dynamic_fields
fields = []
variant_combinations.each do |field_variants|
FIELD_TYPES.each do |type|
fields << DynamicField.new(type, field_variants)
end
end
fields
end | [
"def",
"dynamic_fields",
"fields",
"=",
"[",
"]",
"variant_combinations",
".",
"each",
"do",
"|",
"field_variants",
"|",
"FIELD_TYPES",
".",
"each",
"do",
"|",
"type",
"|",
"fields",
"<<",
"DynamicField",
".",
"new",
"(",
"type",
",",
"field_variants",
")",
... | DynamicField instances representing all the available types and variants | [
"DynamicField",
"instances",
"representing",
"all",
"the",
"available",
"types",
"and",
"variants"
] | 31dd76cd7a14a4ef7bd541de97483d8cd72ff685 | https://github.com/sunspot/sunspot/blob/31dd76cd7a14a4ef7bd541de97483d8cd72ff685/sunspot/lib/sunspot/schema.rb#L53-L61 | train | Returns a list of dynamic fields | [
30522,
13366,
8790,
1035,
4249,
4249,
1027,
1031,
1033,
8349,
1035,
14930,
1012,
2169,
2079,
1064,
2492,
1035,
10176,
1064,
2492,
1035,
4127,
1012,
2169,
2079,
1064,
2828,
1064,
4249,
1026,
1026,
8790,
3790,
1012,
2047,
1006,
2828,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/disaster_recovery_configurations.rb | Azure::SQL::Mgmt::V2014_04_01.DisasterRecoveryConfigurations.begin_failover_allow_data_loss | def begin_failover_allow_data_loss(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
response = begin_failover_allow_data_loss_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:custom_headers).value!
nil
end | ruby | def begin_failover_allow_data_loss(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
response = begin_failover_allow_data_loss_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_failover_allow_data_loss",
"(",
"resource_group_name",
",",
"server_name",
",",
"disaster_recovery_configuration_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_failover_allow_data_loss_async",
"(",
"resource_group_name",
",",
"server_name",... | Fails over from the current primary server to this server. This operation
might result in data loss.
@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 disaster_recovery_configuration_name [String] The name of the disaster
recovery configuration to failover forcefully.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Fails",
"over",
"from",
"the",
"current",
"primary",
"server",
"to",
"this",
"server",
".",
"This",
"operation",
"might",
"result",
"in",
"data",
"loss",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/disaster_recovery_configurations.rb#L746-L749 | train | Allow data loss of a server to be lost. | [
30522,
13366,
4088,
1035,
8246,
7840,
1035,
3499,
1035,
2951,
1035,
3279,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
7071,
1035,
7233,
1035,
9563,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/api/v1_items_api.rb | SquareConnect.V1ItemsApi.update_fee | def update_fee(location_id, fee_id, body, opts = {})
data, _status_code, _headers = update_fee_with_http_info(location_id, fee_id, body, opts)
return data
end | ruby | def update_fee(location_id, fee_id, body, opts = {})
data, _status_code, _headers = update_fee_with_http_info(location_id, fee_id, body, opts)
return data
end | [
"def",
"update_fee",
"(",
"location_id",
",",
"fee_id",
",",
"body",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"update_fee_with_http_info",
"(",
"location_id",
",",
"fee_id",
",",
"body",
",",
"opts",
")",
"return"... | UpdateFee
Modifies the details of an existing fee (tax).
@param location_id The ID of the fee's associated location.
@param fee_id The ID of the fee to edit.
@param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
@param [Hash] opts the optional parameters
@return [V1Fee] | [
"UpdateFee",
"Modifies",
"the",
"details",
"of",
"an",
"existing",
"fee",
"(",
"tax",
")",
"."
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/v1_items_api.rb#L2005-L2008 | train | Updates a fee | [
30522,
13366,
10651,
1035,
7408,
1006,
3295,
1035,
8909,
1010,
7408,
1035,
8909,
1010,
2303,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
10651,
1035,
7408,
1035,
2007,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Shopify/liquid | lib/liquid/standardfilters.rb | Liquid.StandardFilters.sort | def sort(input, property = nil)
ary = InputIterator.new(input)
return [] if ary.empty?
if property.nil?
ary.sort do |a, b|
nil_safe_compare(a, b)
end
elsif ary.all? { |el| el.respond_to?(:[]) }
begin
ary.sort { |a, b| nil_safe_compare(a[property], b[property]) }
rescue TypeError
raise_property_error(property)
end
end
end | ruby | def sort(input, property = nil)
ary = InputIterator.new(input)
return [] if ary.empty?
if property.nil?
ary.sort do |a, b|
nil_safe_compare(a, b)
end
elsif ary.all? { |el| el.respond_to?(:[]) }
begin
ary.sort { |a, b| nil_safe_compare(a[property], b[property]) }
rescue TypeError
raise_property_error(property)
end
end
end | [
"def",
"sort",
"(",
"input",
",",
"property",
"=",
"nil",
")",
"ary",
"=",
"InputIterator",
".",
"new",
"(",
"input",
")",
"return",
"[",
"]",
"if",
"ary",
".",
"empty?",
"if",
"property",
".",
"nil?",
"ary",
".",
"sort",
"do",
"|",
"a",
",",
"b"... | Sort elements of the array
provide optional property with which to sort an array of hashes or drops | [
"Sort",
"elements",
"of",
"the",
"array",
"provide",
"optional",
"property",
"with",
"which",
"to",
"sort",
"an",
"array",
"of",
"hashes",
"or",
"drops"
] | b3b63a683f6daaea7e70f1602ee829abdf970ef3 | https://github.com/Shopify/liquid/blob/b3b63a683f6daaea7e70f1602ee829abdf970ef3/lib/liquid/standardfilters.rb#L134-L150 | train | Sort an array of objects by the given property. | [
30522,
13366,
4066,
1006,
7953,
1010,
3200,
1027,
9152,
2140,
1007,
12098,
2100,
1027,
7953,
21646,
8844,
1012,
2047,
1006,
7953,
1007,
2709,
1031,
1033,
2065,
12098,
2100,
1012,
4064,
1029,
2065,
3200,
1012,
9152,
2140,
1029,
12098,
2100,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
randym/axlsx | lib/axlsx/workbook/workbook.rb | Axlsx.Workbook.insert_worksheet | def insert_worksheet(index=0, options={})
worksheet = Worksheet.new(self, options)
@worksheets.delete_at(@worksheets.size - 1)
@worksheets.insert(index, worksheet)
yield worksheet if block_given?
worksheet
end | ruby | def insert_worksheet(index=0, options={})
worksheet = Worksheet.new(self, options)
@worksheets.delete_at(@worksheets.size - 1)
@worksheets.insert(index, worksheet)
yield worksheet if block_given?
worksheet
end | [
"def",
"insert_worksheet",
"(",
"index",
"=",
"0",
",",
"options",
"=",
"{",
"}",
")",
"worksheet",
"=",
"Worksheet",
".",
"new",
"(",
"self",
",",
"options",
")",
"@worksheets",
".",
"delete_at",
"(",
"@worksheets",
".",
"size",
"-",
"1",
")",
"@works... | inserts a worksheet into this workbook at the position specified.
It the index specified is out of range, the worksheet will be added to the end of the
worksheets collection
@return [Worksheet]
@param index The zero based position to insert the newly created worksheet
@param [Hash] options Options to pass into the worksheed during initialization.
@option options [String] name The name of the worksheet
@option options [Hash] page_margins The page margins for the worksheet | [
"inserts",
"a",
"worksheet",
"into",
"this",
"workbook",
"at",
"the",
"position",
"specified",
".",
"It",
"the",
"index",
"specified",
"is",
"out",
"of",
"range",
"the",
"worksheet",
"will",
"be",
"added",
"to",
"the",
"end",
"of",
"the",
"worksheets",
"co... | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/workbook.rb#L263-L269 | train | Insert a worksheet at the given index. | [
30522,
13366,
19274,
1035,
2573,
21030,
2102,
1006,
5950,
1027,
1014,
1010,
7047,
1027,
1063,
1065,
1007,
2573,
21030,
2102,
1027,
2573,
21030,
30524,
1035,
2012,
1006,
1030,
2573,
21030,
3215,
1012,
2946,
1011,
1015,
1007,
1030,
2573,
2103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.set | def set(row, col, value, sheet = nil) #:nodoc:
key = normalize(row, col)
cell_type = cell_type_by_value(value)
sheet_for(sheet).cells[key] = Cell.new(value, cell_type, nil, cell_type, value, nil, nil, nil, Coordinate.new(row, col))
end | ruby | def set(row, col, value, sheet = nil) #:nodoc:
key = normalize(row, col)
cell_type = cell_type_by_value(value)
sheet_for(sheet).cells[key] = Cell.new(value, cell_type, nil, cell_type, value, nil, nil, nil, Coordinate.new(row, col))
end | [
"def",
"set",
"(",
"row",
",",
"col",
",",
"value",
",",
"sheet",
"=",
"nil",
")",
"#:nodoc:",
"key",
"=",
"normalize",
"(",
"row",
",",
"col",
")",
"cell_type",
"=",
"cell_type_by_value",
"(",
"value",
")",
"sheet_for",
"(",
"sheet",
")",
".",
"cell... | set a cell to a certain value
(this will not be saved back to the spreadsheet file!) | [
"set",
"a",
"cell",
"to",
"a",
"certain",
"value",
"(",
"this",
"will",
"not",
"be",
"saved",
"back",
"to",
"the",
"spreadsheet",
"file!",
")"
] | 4ec1104f0c3c2a29711c0c907371cd2be12bcc3c | https://github.com/roo-rb/roo/blob/4ec1104f0c3c2a29711c0c907371cd2be12bcc3c/lib/roo/excelx.rb#L153-L157 | train | Set a cell at a given row and column | [
30522,
13366,
2275,
1006,
5216,
1010,
8902,
1010,
3643,
1010,
7123,
1027,
9152,
2140,
1007,
1001,
1024,
7293,
10085,
1024,
3145,
1027,
3671,
4697,
1006,
5216,
1010,
8902,
1007,
3526,
1035,
2828,
1027,
3526,
1035,
2828,
1035,
2011,
1035,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_contentmoderator/lib/1.0/generated/azure_cognitiveservices_contentmoderator/reviews.rb | Azure::CognitiveServices::ContentModerator::V1_0.Reviews.add_video_transcript_moderation_result_async | def add_video_transcript_moderation_result_async(content_type, team_name, review_id, transcript_moderation_body, custom_headers:nil)
fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
fail ArgumentError, 'content_type is nil' if content_type.nil?
fail ArgumentError, 'team_name is nil' if team_name.nil?
fail ArgumentError, 'review_id is nil' if review_id.nil?
fail ArgumentError, 'transcript_moderation_body is nil' if transcript_moderation_body.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['Content-Type'] = content_type unless content_type.nil?
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
# Serialize Request
request_mapper = {
client_side_validation: true,
required: true,
serialized_name: 'transcriptModerationBody',
type: {
name: 'Sequence',
element: {
client_side_validation: true,
required: false,
serialized_name: 'TranscriptModerationBodyItemElementType',
type: {
name: 'Composite',
class_name: 'TranscriptModerationBodyItem'
}
}
}
}
request_content = @client.serialize(request_mapper, transcript_moderation_body)
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
path_template = 'contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/transcriptmoderationresult'
request_url = @base_url || @client.base_url
request_url = request_url.gsub('{Endpoint}', @client.endpoint)
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'teamName' => team_name,'reviewId' => review_id},
body: request_content,
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:put, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 204
error_model = JSON.load(response_content)
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
result
end
promise.execute
end | ruby | def add_video_transcript_moderation_result_async(content_type, team_name, review_id, transcript_moderation_body, custom_headers:nil)
fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
fail ArgumentError, 'content_type is nil' if content_type.nil?
fail ArgumentError, 'team_name is nil' if team_name.nil?
fail ArgumentError, 'review_id is nil' if review_id.nil?
fail ArgumentError, 'transcript_moderation_body is nil' if transcript_moderation_body.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['Content-Type'] = content_type unless content_type.nil?
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
# Serialize Request
request_mapper = {
client_side_validation: true,
required: true,
serialized_name: 'transcriptModerationBody',
type: {
name: 'Sequence',
element: {
client_side_validation: true,
required: false,
serialized_name: 'TranscriptModerationBodyItemElementType',
type: {
name: 'Composite',
class_name: 'TranscriptModerationBodyItem'
}
}
}
}
request_content = @client.serialize(request_mapper, transcript_moderation_body)
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
path_template = 'contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/transcriptmoderationresult'
request_url = @base_url || @client.base_url
request_url = request_url.gsub('{Endpoint}', @client.endpoint)
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'teamName' => team_name,'reviewId' => review_id},
body: request_content,
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:put, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 204
error_model = JSON.load(response_content)
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
result
end
promise.execute
end | [
"def",
"add_video_transcript_moderation_result_async",
"(",
"content_type",
",",
"team_name",
",",
"review_id",
",",
"transcript_moderation_body",
",",
"custom_headers",
":",
"nil",
")",
"fail",
"ArgumentError",
",",
"'@client.endpoint is nil'",
"if",
"@client",
".",
"end... | This API adds a transcript screen text result file for a video review.
Transcript screen text result file is a result of Screen Text API . In order
to generate transcript screen text result file , a transcript file has to be
screened for profanity using Screen Text API.
@param content_type [String] The content type.
@param team_name [String] Your team name.
@param review_id [String] Id of the review.
@param transcript_moderation_body [Array<TranscriptModerationBodyItem>] Body
for add video transcript moderation result API
@param [Hash{String => String}] A hash of custom headers that will be added
to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response. | [
"This",
"API",
"adds",
"a",
"transcript",
"screen",
"text",
"result",
"file",
"for",
"a",
"video",
"review",
".",
"Transcript",
"screen",
"text",
"result",
"file",
"is",
"a",
"result",
"of",
"Screen",
"Text",
"API",
".",
"In",
"order",
"to",
"generate",
... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_contentmoderator/lib/1.0/generated/azure_cognitiveservices_contentmoderator/reviews.rb#L1184-L1250 | train | Add a transcript moderation result to a video review. | [
30522,
13366,
5587,
1035,
2678,
1035,
24051,
30524,
8400,
2003,
9152,
2140,
1005,
2065,
1030,
7396,
1012,
2203,
8400,
1012,
9152,
2140,
1029,
8246,
6685,
2121,
29165,
1010,
1005,
4180,
1035,
2828,
2003,
9152,
2140,
1005,
2065,
4180,
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/commander.rb | Guard.Commander.run_all | def run_all(scopes = {})
UI.clear(force: true)
UI.action_with_scopes("Run", scopes)
Runner.new.run(:run_all, scopes)
end | ruby | def run_all(scopes = {})
UI.clear(force: true)
UI.action_with_scopes("Run", scopes)
Runner.new.run(:run_all, scopes)
end | [
"def",
"run_all",
"(",
"scopes",
"=",
"{",
"}",
")",
"UI",
".",
"clear",
"(",
"force",
":",
"true",
")",
"UI",
".",
"action_with_scopes",
"(",
"\"Run\"",
",",
"scopes",
")",
"Runner",
".",
"new",
".",
"run",
"(",
":run_all",
",",
"scopes",
")",
"en... | Trigger `run_all` on all Guard plugins currently enabled.
@param [Hash] scopes hash with a Guard plugin or a group scope | [
"Trigger",
"run_all",
"on",
"all",
"Guard",
"plugins",
"currently",
"enabled",
"."
] | e2508cd83badf0d537dbaba35d307adc35d92e4f | https://github.com/guard/guard/blob/e2508cd83badf0d537dbaba35d307adc35d92e4f/lib/guard/commander.rb#L80-L84 | train | Run all the tasks | [
30522,
13366,
2448,
1035,
2035,
1006,
9531,
2015,
1027,
1063,
1065,
1007,
21318,
1012,
3154,
1006,
2486,
1024,
2995,
1007,
21318,
1012,
2895,
1035,
2007,
1035,
9531,
2015,
1006,
1000,
2448,
1000,
1010,
9531,
2015,
1007,
5479,
1012,
2047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_multi_role_pool_instance_metrics_next | def list_multi_role_pool_instance_metrics_next(next_page_link, custom_headers:nil)
response = list_multi_role_pool_instance_metrics_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_multi_role_pool_instance_metrics_next(next_page_link, custom_headers:nil)
response = list_multi_role_pool_instance_metrics_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_multi_role_pool_instance_metrics_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_multi_role_pool_instance_metrics_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"respo... | Get metrics for a specific instance of a multi-role pool of an App Service
Environment.
Get metrics for a specific instance of a multi-role pool of an App Service
Environment.
@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 [ResourceMetricCollection] operation results. | [
"Get",
"metrics",
"for",
"a",
"specific",
"instance",
"of",
"a",
"multi",
"-",
"role",
"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#L5616-L5619 | train | Gets metrics for a multi - role pool instance. | [
30522,
13366,
2862,
1035,
4800,
1035,
2535,
1035,
4770,
1035,
6013,
1035,
12046,
2015,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
4800,
1035,
2535,
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... |
activeadmin/activeadmin | lib/active_admin/router.rb | ActiveAdmin.Router.define_resources_routes | def define_resources_routes
resources = namespaces.flat_map { |n| n.resources.values }
resources.each do |config|
define_resource_routes(config)
end
end | ruby | def define_resources_routes
resources = namespaces.flat_map { |n| n.resources.values }
resources.each do |config|
define_resource_routes(config)
end
end | [
"def",
"define_resources_routes",
"resources",
"=",
"namespaces",
".",
"flat_map",
"{",
"|",
"n",
"|",
"n",
".",
"resources",
".",
"values",
"}",
"resources",
".",
"each",
"do",
"|",
"config",
"|",
"define_resource_routes",
"(",
"config",
")",
"end",
"end"
] | Defines the routes for each resource | [
"Defines",
"the",
"routes",
"for",
"each",
"resource"
] | 0759c8dcf97865748c9344459162ac3c7e65a6cd | https://github.com/activeadmin/activeadmin/blob/0759c8dcf97865748c9344459162ac3c7e65a6cd/lib/active_admin/router.rb#L30-L35 | train | define resources routes | [
30522,
13366,
9375,
1035,
4219,
1035,
5847,
4219,
1027,
3415,
15327,
2015,
1012,
4257,
1035,
4949,
1063,
1064,
1050,
1064,
1050,
1012,
4219,
1012,
5300,
1065,
4219,
1012,
2169,
2079,
1064,
9530,
8873,
2290,
1064,
9375,
1035,
7692,
1035,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rmosolgo/graphql-ruby | lib/graphql/subscriptions.rb | GraphQL.Subscriptions.normalize_arguments | def normalize_arguments(event_name, arg_owner, args)
case arg_owner
when GraphQL::Field, GraphQL::InputObjectType
normalized_args = {}
missing_arg_names = []
args.each do |k, v|
arg_name = k.to_s
arg_defn = arg_owner.arguments[arg_name]
if arg_defn
normalized_arg_name = arg_name
else
normalized_arg_name = normalize_name(arg_name)
arg_defn = arg_owner.arguments[normalized_arg_name]
end
if arg_defn
normalized_args[normalized_arg_name] = normalize_arguments(event_name, arg_defn.type, v)
else
# Couldn't find a matching argument definition
missing_arg_names << arg_name
end
end
if missing_arg_names.any?
arg_owner_name = if arg_owner.is_a?(GraphQL::Field)
"Subscription.#{arg_owner.name}"
else
arg_owner.to_s
end
raise InvalidTriggerError, "Can't trigger Subscription.#{event_name}, received undefined arguments: #{missing_arg_names.join(", ")}. (Should match arguments of #{arg_owner_name}.)"
end
normalized_args
when GraphQL::ListType
args.map { |a| normalize_arguments(event_name, arg_owner.of_type, a) }
when GraphQL::NonNullType
normalize_arguments(event_name, arg_owner.of_type, args)
else
args
end
end | ruby | def normalize_arguments(event_name, arg_owner, args)
case arg_owner
when GraphQL::Field, GraphQL::InputObjectType
normalized_args = {}
missing_arg_names = []
args.each do |k, v|
arg_name = k.to_s
arg_defn = arg_owner.arguments[arg_name]
if arg_defn
normalized_arg_name = arg_name
else
normalized_arg_name = normalize_name(arg_name)
arg_defn = arg_owner.arguments[normalized_arg_name]
end
if arg_defn
normalized_args[normalized_arg_name] = normalize_arguments(event_name, arg_defn.type, v)
else
# Couldn't find a matching argument definition
missing_arg_names << arg_name
end
end
if missing_arg_names.any?
arg_owner_name = if arg_owner.is_a?(GraphQL::Field)
"Subscription.#{arg_owner.name}"
else
arg_owner.to_s
end
raise InvalidTriggerError, "Can't trigger Subscription.#{event_name}, received undefined arguments: #{missing_arg_names.join(", ")}. (Should match arguments of #{arg_owner_name}.)"
end
normalized_args
when GraphQL::ListType
args.map { |a| normalize_arguments(event_name, arg_owner.of_type, a) }
when GraphQL::NonNullType
normalize_arguments(event_name, arg_owner.of_type, args)
else
args
end
end | [
"def",
"normalize_arguments",
"(",
"event_name",
",",
"arg_owner",
",",
"args",
")",
"case",
"arg_owner",
"when",
"GraphQL",
"::",
"Field",
",",
"GraphQL",
"::",
"InputObjectType",
"normalized_args",
"=",
"{",
"}",
"missing_arg_names",
"=",
"[",
"]",
"args",
"... | Recursively normalize `args` as belonging to `arg_owner`:
- convert symbols to strings,
- if needed, camelize the string (using {#normalize_name})
@param arg_owner [GraphQL::Field, GraphQL::BaseType]
@param args [Hash, Array, Any] some GraphQL input value to coerce as `arg_owner`
@return [Any] normalized arguments value | [
"Recursively",
"normalize",
"args",
"as",
"belonging",
"to",
"arg_owner",
":",
"-",
"convert",
"symbols",
"to",
"strings",
"-",
"if",
"needed",
"camelize",
"the",
"string",
"(",
"using",
"{",
"#normalize_name",
"}",
")"
] | d5be13a816f220b9efbabeaa69a3e56fedf311f5 | https://github.com/rmosolgo/graphql-ruby/blob/d5be13a816f220b9efbabeaa69a3e56fedf311f5/lib/graphql/subscriptions.rb#L189-L229 | train | Normalize arguments of a subscription | [
30522,
13366,
3671,
4697,
1035,
9918,
1006,
2724,
1035,
2171,
1010,
12098,
2290,
1035,
3954,
1010,
12098,
5620,
1007,
2553,
12098,
2290,
1035,
3954,
2043,
10629,
4160,
2140,
1024,
1024,
2492,
1010,
10629,
4160,
2140,
1024,
1024,
7953,
16429... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
samvera/hyrax | lib/hyrax/redis_event_store.rb | Hyrax.RedisEventStore.push | def push(value)
RedisEventStore.instance.lpush(@key, value)
rescue Redis::CommandError, Redis::CannotConnectError
RedisEventStore.logger.error("unable to push event: #{@key}")
nil
end | ruby | def push(value)
RedisEventStore.instance.lpush(@key, value)
rescue Redis::CommandError, Redis::CannotConnectError
RedisEventStore.logger.error("unable to push event: #{@key}")
nil
end | [
"def",
"push",
"(",
"value",
")",
"RedisEventStore",
".",
"instance",
".",
"lpush",
"(",
"@key",
",",
"value",
")",
"rescue",
"Redis",
"::",
"CommandError",
",",
"Redis",
"::",
"CannotConnectError",
"RedisEventStore",
".",
"logger",
".",
"error",
"(",
"\"una... | Adds a value to the end of a list identified by key | [
"Adds",
"a",
"value",
"to",
"the",
"end",
"of",
"a",
"list",
"identified",
"by",
"key"
] | e2b4f56e829a53b1f11296324736e9d5b8c9ee5f | https://github.com/samvera/hyrax/blob/e2b4f56e829a53b1f11296324736e9d5b8c9ee5f/lib/hyrax/redis_event_store.rb#L51-L56 | train | Pushes the given value to the list of events. | [
30522,
13366,
5245,
1006,
3643,
1007,
2417,
5562,
15338,
23809,
2063,
1012,
6013,
1012,
6948,
20668,
1006,
1030,
3145,
1010,
3643,
1007,
5343,
2417,
2483,
1024,
1024,
3474,
29165,
1010,
2417,
2483,
1024,
1024,
3685,
8663,
2638,
21162,
29165... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.get_partition_backup_configuration_info_with_http_info | def get_partition_backup_configuration_info_with_http_info(partition_id, timeout:60, custom_headers:nil)
get_partition_backup_configuration_info_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def get_partition_backup_configuration_info_with_http_info(partition_id, timeout:60, custom_headers:nil)
get_partition_backup_configuration_info_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"get_partition_backup_configuration_info_with_http_info",
"(",
"partition_id",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"get_partition_backup_configuration_info_async",
"(",
"partition_id",
",",
"timeout",
":",
"timeout",
",",
"custom_header... | Gets the partition backup configuration information
Gets the Service Fabric Backup configuration information for the specified
partition.
@param partition_id The identity of the partition.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param 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",
"partition",
"backup",
"configuration",
"information"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L24984-L24986 | train | Gets backup configuration information for the specified partition. | [
30522,
13366,
2131,
1035,
13571,
1035,
10200,
1035,
9563,
1035,
18558,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
13571,
1035,
8909,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
13571,
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_container_registry/lib/2018-02-01-preview/generated/azure_mgmt_container_registry/builds.rb | Azure::ContainerRegistry::Mgmt::V2018_02_01_preview.Builds.get_log_link | def get_log_link(resource_group_name, registry_name, build_id, custom_headers:nil)
response = get_log_link_async(resource_group_name, registry_name, build_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_log_link(resource_group_name, registry_name, build_id, custom_headers:nil)
response = get_log_link_async(resource_group_name, registry_name, build_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_log_link",
"(",
"resource_group_name",
",",
"registry_name",
",",
"build_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_log_link_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"build_id",
",",
"custom_headers",
":custom_... | Gets a link to download the build logs.
@param resource_group_name [String] The name of the resource group to which
the container registry belongs.
@param registry_name [String] The name of the container registry.
@param build_id [String] The build ID.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [BuildGetLogResult] operation results. | [
"Gets",
"a",
"link",
"to",
"download",
"the",
"build",
"logs",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_registry/lib/2018-02-01-preview/generated/azure_mgmt_container_registry/builds.rb#L301-L304 | train | Gets the log link to the specified build. | [
30522,
13366,
2131,
1035,
8833,
1035,
4957,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
3857,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
8833,
1035,
4957,
1035,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
CocoaPods/Xcodeproj | lib/xcodeproj/project.rb | Xcodeproj.Project.new_target | def new_target(type, name, platform, deployment_target = nil, product_group = nil, language = nil)
product_group ||= products_group
ProjectHelper.new_target(self, type, name, platform, deployment_target, product_group, language)
end | ruby | def new_target(type, name, platform, deployment_target = nil, product_group = nil, language = nil)
product_group ||= products_group
ProjectHelper.new_target(self, type, name, platform, deployment_target, product_group, language)
end | [
"def",
"new_target",
"(",
"type",
",",
"name",
",",
"platform",
",",
"deployment_target",
"=",
"nil",
",",
"product_group",
"=",
"nil",
",",
"language",
"=",
"nil",
")",
"product_group",
"||=",
"products_group",
"ProjectHelper",
".",
"new_target",
"(",
"self",... | Creates a new target and adds it to the project.
The target is configured for the given platform and its file reference it
is added to the {products_group}.
The target is pre-populated with common build settings, and the
appropriate Framework according to the platform is added to to its
Frameworks phase.
@param [Symbol] type
the type of target. Can be `:application`, `:framework`,
`:dynamic_library` or `:static_library`.
@param [String] name
the name of the target product.
@param [Symbol] platform
the platform of the target. Can be `:ios` or `:osx`.
@param [String] deployment_target
the deployment target for the platform.
@param [PBXGroup] product_group
the product group, where to add to a file reference of the
created target.
@param [Symbol] language
the primary language of the target, can be `:objc` or `:swift`.
@return [PBXNativeTarget] the target. | [
"Creates",
"a",
"new",
"target",
"and",
"adds",
"it",
"to",
"the",
"project",
"."
] | 3be1684437a6f8e69c7836ad4c85a2b78663272f | https://github.com/CocoaPods/Xcodeproj/blob/3be1684437a6f8e69c7836ad4c85a2b78663272f/lib/xcodeproj/project.rb#L714-L717 | train | Creates a new target | [
30522,
13366,
2047,
1035,
4539,
1006,
2828,
1010,
2171,
1010,
4132,
1010,
10813,
1035,
4539,
1027,
9152,
2140,
1010,
4031,
1035,
2177,
1027,
9152,
2140,
1010,
2653,
1027,
9152,
2140,
1007,
4031,
1035,
2177,
1064,
1064,
1027,
3688,
1035,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jnunemaker/flipper | lib/flipper/feature.rb | Flipper.Feature.disable | def disable(thing = false)
instrument(:disable) do |payload|
adapter.add self
gate = gate_for(thing)
wrapped_thing = gate.wrap(thing)
payload[:gate_name] = gate.name
payload[:thing] = wrapped_thing
adapter.disable self, gate, wrapped_thing
end
end | ruby | def disable(thing = false)
instrument(:disable) do |payload|
adapter.add self
gate = gate_for(thing)
wrapped_thing = gate.wrap(thing)
payload[:gate_name] = gate.name
payload[:thing] = wrapped_thing
adapter.disable self, gate, wrapped_thing
end
end | [
"def",
"disable",
"(",
"thing",
"=",
"false",
")",
"instrument",
"(",
":disable",
")",
"do",
"|",
"payload",
"|",
"adapter",
".",
"add",
"self",
"gate",
"=",
"gate_for",
"(",
"thing",
")",
"wrapped_thing",
"=",
"gate",
".",
"wrap",
"(",
"thing",
")",
... | Public: Disable this feature for something.
Returns the result of Adapter#disable. | [
"Public",
":",
"Disable",
"this",
"feature",
"for",
"something",
"."
] | df0352b663ad3ed45d68710f10a8170249ff9d78 | https://github.com/jnunemaker/flipper/blob/df0352b663ad3ed45d68710f10a8170249ff9d78/lib/flipper/feature.rb#L59-L70 | train | Disable the given thing | [
30522,
13366,
4487,
19150,
1006,
2518,
1027,
6270,
1007,
6602,
1006,
1024,
4487,
19150,
1007,
2079,
1064,
18093,
1064,
15581,
2121,
1012,
5587,
2969,
4796,
1027,
4796,
1035,
2005,
1006,
2518,
1007,
5058,
1035,
2518,
1027,
4796,
1012,
10236,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
capistrano/capistrano | lib/capistrano/dsl.rb | Capistrano.DSL.execute | def execute(*)
file, line, = caller.first.split(":")
colors = SSHKit::Color.new($stderr)
$stderr.puts colors.colorize("Warning: `execute' should be wrapped in an `on' scope in #{file}:#{line}.", :red)
$stderr.puts
$stderr.puts " task :example do"
$stderr.puts colors.colorize(" on roles(:app) do", :yellow)
$stderr.puts " execute 'whoami'"
$stderr.puts colors.colorize(" end", :yellow)
$stderr.puts " end"
$stderr.puts
raise NoMethodError, "undefined method `execute' for main:Object"
end | ruby | def execute(*)
file, line, = caller.first.split(":")
colors = SSHKit::Color.new($stderr)
$stderr.puts colors.colorize("Warning: `execute' should be wrapped in an `on' scope in #{file}:#{line}.", :red)
$stderr.puts
$stderr.puts " task :example do"
$stderr.puts colors.colorize(" on roles(:app) do", :yellow)
$stderr.puts " execute 'whoami'"
$stderr.puts colors.colorize(" end", :yellow)
$stderr.puts " end"
$stderr.puts
raise NoMethodError, "undefined method `execute' for main:Object"
end | [
"def",
"execute",
"(",
"*",
")",
"file",
",",
"line",
",",
"=",
"caller",
".",
"first",
".",
"split",
"(",
"\":\"",
")",
"colors",
"=",
"SSHKit",
"::",
"Color",
".",
"new",
"(",
"$stderr",
")",
"$stderr",
".",
"puts",
"colors",
".",
"colorize",
"("... | Catch common beginner mistake and give a helpful error message on stderr | [
"Catch",
"common",
"beginner",
"mistake",
"and",
"give",
"a",
"helpful",
"error",
"message",
"on",
"stderr"
] | 7a14ddb47d64187c8a7ee14c7d78e874f30f08ef | https://github.com/capistrano/capistrano/blob/7a14ddb47d64187c8a7ee14c7d78e874f30f08ef/lib/capistrano/dsl.rb#L80-L92 | train | Execute the given command. | [
30522,
13366,
15389,
1006,
1008,
1007,
5371,
1010,
2240,
1010,
1027,
20587,
1012,
2034,
1012,
3975,
1006,
1000,
1024,
1000,
1007,
6087,
1027,
7020,
2232,
23615,
1024,
1024,
3609,
1012,
2047,
1006,
1002,
2358,
4063,
2099,
1007,
1002,
2358,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mhenrixon/sidekiq-unique-jobs | lib/sidekiq_unique_jobs/digests.rb | SidekiqUniqueJobs.Digests.delete_by_pattern | def delete_by_pattern(pattern, count: DEFAULT_COUNT)
result, elapsed = timed do
digests = all(pattern: pattern, count: count)
batch_delete(digests)
digests.size
end
log_info("#{__method__}(#{pattern}, count: #{count}) completed in #{elapsed}ms")
result
end | ruby | def delete_by_pattern(pattern, count: DEFAULT_COUNT)
result, elapsed = timed do
digests = all(pattern: pattern, count: count)
batch_delete(digests)
digests.size
end
log_info("#{__method__}(#{pattern}, count: #{count}) completed in #{elapsed}ms")
result
end | [
"def",
"delete_by_pattern",
"(",
"pattern",
",",
"count",
":",
"DEFAULT_COUNT",
")",
"result",
",",
"elapsed",
"=",
"timed",
"do",
"digests",
"=",
"all",
"(",
"pattern",
":",
"pattern",
",",
"count",
":",
"count",
")",
"batch_delete",
"(",
"digests",
")",
... | Deletes unique digests by pattern
@param [String] pattern a key pattern to match with
@param [Integer] count the maximum number
@return [Array<String>] with unique digests | [
"Deletes",
"unique",
"digests",
"by",
"pattern"
] | 2944b97c720528f53962ccfd17d43ac939a77f46 | https://github.com/mhenrixon/sidekiq-unique-jobs/blob/2944b97c720528f53962ccfd17d43ac939a77f46/lib/sidekiq_unique_jobs/digests.rb#L71-L81 | train | Delete all digests matching a pattern | [
30522,
13366,
3972,
12870,
1035,
2011,
1035,
5418,
1006,
5418,
1010,
4175,
1024,
12398,
1035,
4175,
1007,
2765,
1010,
3449,
9331,
6924,
1027,
22313,
2079,
17886,
2015,
1027,
2035,
1006,
5418,
1024,
5418,
1010,
30524,
1035,
1035,
1065,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/partners.rb | Azure::Logic::Mgmt::V2016_06_01.Partners.delete | def delete(resource_group_name, integration_account_name, partner_name, custom_headers:nil)
response = delete_async(resource_group_name, integration_account_name, partner_name, custom_headers:custom_headers).value!
nil
end | ruby | def delete(resource_group_name, integration_account_name, partner_name, custom_headers:nil)
response = delete_async(resource_group_name, integration_account_name, partner_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"delete",
"(",
"resource_group_name",
",",
"integration_account_name",
",",
"partner_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_async",
"(",
"resource_group_name",
",",
"integration_account_name",
",",
"partner_name",
",",
"custom_hea... | Deletes an integration account partner.
@param resource_group_name [String] The resource group name.
@param integration_account_name [String] The integration account name.
@param partner_name [String] The integration account partner name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Deletes",
"an",
"integration",
"account",
"partner",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/partners.rb#L348-L351 | train | Deletes an integration account partner. | [
30522,
13366,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8346,
1035,
4070,
1035,
2171,
1010,
4256,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
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... |
ClosureTree/closure_tree | lib/closure_tree/model.rb | ClosureTree.Model.ancestry_path | def ancestry_path(to_s_column = _ct.name_column)
self_and_ancestors.map { |n| n.send to_s_column.to_sym }.reverse
end | ruby | def ancestry_path(to_s_column = _ct.name_column)
self_and_ancestors.map { |n| n.send to_s_column.to_sym }.reverse
end | [
"def",
"ancestry_path",
"(",
"to_s_column",
"=",
"_ct",
".",
"name_column",
")",
"self_and_ancestors",
".",
"map",
"{",
"|",
"n",
"|",
"n",
".",
"send",
"to_s_column",
".",
"to_sym",
"}",
".",
"reverse",
"end"
] | Returns an array, root first, of self_and_ancestors' values of the +to_s_column+, which defaults
to the +name_column+.
(so child.ancestry_path == +%w{grandparent parent child}+ | [
"Returns",
"an",
"array",
"root",
"first",
"of",
"self_and_ancestors",
"values",
"of",
"the",
"+",
"to_s_column",
"+",
"which",
"defaults",
"to",
"the",
"+",
"name_column",
"+",
".",
"(",
"so",
"child",
".",
"ancestry_path",
"==",
"+",
"%w",
"{",
"grandpar... | 9babda807861a1b76745cfb986b001db01017ef9 | https://github.com/ClosureTree/closure_tree/blob/9babda807861a1b76745cfb986b001db01017ef9/lib/closure_tree/model.rb#L105-L107 | train | Returns ancestry path for this object. | [
30522,
13366,
11377,
1035,
4130,
1006,
2000,
1035,
1055,
1035,
5930,
1027,
1035,
14931,
1012,
2171,
1035,
5930,
1007,
2969,
1035,
1998,
1035,
10748,
1012,
4949,
1063,
1064,
1050,
1064,
1050,
1012,
4604,
2000,
1035,
1055,
1035,
5930,
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... |
ruby/racc | lib/racc/grammar.rb | Racc.Grammar.nullable_symbols | def nullable_symbols
raise 'Grammar not yet closed' unless @closed
@nullable_symbols ||= Sym.set_closure(
@symbols.select { |nt| nt.heads.any?(&:reduce?) }).freeze
end | ruby | def nullable_symbols
raise 'Grammar not yet closed' unless @closed
@nullable_symbols ||= Sym.set_closure(
@symbols.select { |nt| nt.heads.any?(&:reduce?) }).freeze
end | [
"def",
"nullable_symbols",
"raise",
"'Grammar not yet closed'",
"unless",
"@closed",
"@nullable_symbols",
"||=",
"Sym",
".",
"set_closure",
"(",
"@symbols",
".",
"select",
"{",
"|",
"nt",
"|",
"nt",
".",
"heads",
".",
"any?",
"(",
":reduce?",
")",
"}",
")",
... | Can an empty sequence of tokens reduce to this nonterminal?
(Can it be produced out of "nothing"?) | [
"Can",
"an",
"empty",
"sequence",
"of",
"tokens",
"reduce",
"to",
"this",
"nonterminal?",
"(",
"Can",
"it",
"be",
"produced",
"out",
"of",
"nothing",
"?",
")"
] | d3244edfa11dd6e86e43f570c6444d41c7e3552a | https://github.com/ruby/racc/blob/d3244edfa11dd6e86e43f570c6444d41c7e3552a/lib/racc/grammar.rb#L234-L238 | train | Returns the nullable symbols for this grammar. | [
30522,
13366,
19701,
3085,
1035,
9255,
5333,
1005,
8035,
2025,
2664,
30524,
1064,
23961,
1012,
4641,
1012,
2151,
1029,
1006,
1004,
1024,
5547,
1029,
1007,
1065,
1007,
1012,
13184,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
meew0/discordrb | lib/discordrb/commands/command_bot.rb | Discordrb::Commands.CommandBot.create_message | def create_message(data)
message = Discordrb::Message.new(data, self)
return message if message.from_bot? && !@should_parse_self
return message if message.webhook? && !@attributes[:webhook_commands]
unless message.author
Discordrb::LOGGER.warn("Received a message (#{message.inspect}) with nil author! Ignoring, please report this if you can")
return
end
event = CommandEvent.new(message, self)
chain = trigger?(message)
return message unless chain
# Don't allow spaces between the prefix and the command
if chain.start_with?(' ') && !@attributes[:spaces_allowed]
debug('Chain starts with a space')
return message
end
if chain.strip.empty?
debug('Chain is empty')
return message
end
execute_chain(chain, event)
# Return the message so it doesn't get parsed again during the rest of the dispatch handling
message
end | ruby | def create_message(data)
message = Discordrb::Message.new(data, self)
return message if message.from_bot? && !@should_parse_self
return message if message.webhook? && !@attributes[:webhook_commands]
unless message.author
Discordrb::LOGGER.warn("Received a message (#{message.inspect}) with nil author! Ignoring, please report this if you can")
return
end
event = CommandEvent.new(message, self)
chain = trigger?(message)
return message unless chain
# Don't allow spaces between the prefix and the command
if chain.start_with?(' ') && !@attributes[:spaces_allowed]
debug('Chain starts with a space')
return message
end
if chain.strip.empty?
debug('Chain is empty')
return message
end
execute_chain(chain, event)
# Return the message so it doesn't get parsed again during the rest of the dispatch handling
message
end | [
"def",
"create_message",
"(",
"data",
")",
"message",
"=",
"Discordrb",
"::",
"Message",
".",
"new",
"(",
"data",
",",
"self",
")",
"return",
"message",
"if",
"message",
".",
"from_bot?",
"&&",
"!",
"@should_parse_self",
"return",
"message",
"if",
"message",... | Internal handler for MESSAGE_CREATE that is overwritten to allow for command handling | [
"Internal",
"handler",
"for",
"MESSAGE_CREATE",
"that",
"is",
"overwritten",
"to",
"allow",
"for",
"command",
"handling"
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/commands/command_bot.rb#L393-L423 | train | Create a message from the given data | [
30522,
13366,
3443,
1035,
4471,
1006,
2951,
1007,
4471,
1027,
12532,
4103,
15185,
1024,
1024,
4471,
1012,
2047,
1006,
2951,
1010,
2969,
1007,
2709,
4471,
2065,
4471,
1012,
2013,
1035,
28516,
1029,
1004,
1004,
999,
1030,
2323,
1035,
11968,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/after_hooks.rb | Watir.AfterHooks.add | def add(after_hook = nil, &block)
if block_given?
@after_hooks << block
elsif after_hook.respond_to? :call
@after_hooks << after_hook
else
raise ArgumentError, 'expected block or object responding to #call'
end
end | ruby | def add(after_hook = nil, &block)
if block_given?
@after_hooks << block
elsif after_hook.respond_to? :call
@after_hooks << after_hook
else
raise ArgumentError, 'expected block or object responding to #call'
end
end | [
"def",
"add",
"(",
"after_hook",
"=",
"nil",
",",
"&",
"block",
")",
"if",
"block_given?",
"@after_hooks",
"<<",
"block",
"elsif",
"after_hook",
".",
"respond_to?",
":call",
"@after_hooks",
"<<",
"after_hook",
"else",
"raise",
"ArgumentError",
",",
"'expected bl... | Adds new after hook.
@example
browser.after_hooks.add do |browser|
browser.text.include?("Server Error") and puts "Application exception or 500 error!"
end
browser.goto "watir.com/404"
"Application exception or 500 error!"
@param [#call] after_hook Object responding to call
@yield after_hook block
@yieldparam [Watir::Browser] | [
"Adds",
"new",
"after",
"hook",
"."
] | 2d8db09811c6221ae401b85b2f61f5fa66e463a3 | https://github.com/watir/watir/blob/2d8db09811c6221ae401b85b2f61f5fa66e463a3/lib/watir/after_hooks.rb#L35-L43 | train | Add a hook to the after_hooks list | [
30522,
13366,
5587,
1006,
2044,
1035,
8103,
1027,
9152,
2140,
1010,
1004,
3796,
1007,
2065,
3796,
1035,
2445,
1029,
1030,
2044,
1035,
18008,
1026,
1026,
3796,
3449,
5332,
2546,
2044,
1035,
8103,
1012,
6869,
1035,
2000,
1029,
1024,
2655,
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... |
kpumuk/meta-tags | lib/meta_tags/meta_tags_collection.rb | MetaTags.MetaTagsCollection.extract_noindex | def extract_noindex
noindex_name, noindex_value = extract_noindex_attribute(:noindex)
index_name, index_value = extract_noindex_attribute(:index)
nofollow_name, nofollow_value = extract_noindex_attribute(:nofollow)
follow_name, follow_value = extract_noindex_attribute(:follow)
noindex_attributes = if noindex_name == follow_name && (noindex_value || follow_value)
# noindex has higher priority than index and follow has higher priority than nofollow
[
[noindex_name, noindex_value || index_value],
[follow_name, follow_value || nofollow_value],
]
else
[
[index_name, index_value],
[follow_name, follow_value],
[noindex_name, noindex_value],
[nofollow_name, nofollow_value],
]
end
append_noarchive_attribute group_attributes_by_key noindex_attributes
end | ruby | def extract_noindex
noindex_name, noindex_value = extract_noindex_attribute(:noindex)
index_name, index_value = extract_noindex_attribute(:index)
nofollow_name, nofollow_value = extract_noindex_attribute(:nofollow)
follow_name, follow_value = extract_noindex_attribute(:follow)
noindex_attributes = if noindex_name == follow_name && (noindex_value || follow_value)
# noindex has higher priority than index and follow has higher priority than nofollow
[
[noindex_name, noindex_value || index_value],
[follow_name, follow_value || nofollow_value],
]
else
[
[index_name, index_value],
[follow_name, follow_value],
[noindex_name, noindex_value],
[nofollow_name, nofollow_value],
]
end
append_noarchive_attribute group_attributes_by_key noindex_attributes
end | [
"def",
"extract_noindex",
"noindex_name",
",",
"noindex_value",
"=",
"extract_noindex_attribute",
"(",
":noindex",
")",
"index_name",
",",
"index_value",
"=",
"extract_noindex_attribute",
"(",
":index",
")",
"nofollow_name",
",",
"nofollow_value",
"=",
"extract_noindex_at... | Extracts noindex settings as a Hash mapping noindex tag name to value.
@return [Hash<String,String>] noindex attributes. | [
"Extracts",
"noindex",
"settings",
"as",
"a",
"Hash",
"mapping",
"noindex",
"tag",
"name",
"to",
"value",
"."
] | 03585f95edf96cd17024c5c155ce46ec8bc47232 | https://github.com/kpumuk/meta-tags/blob/03585f95edf96cd17024c5c155ce46ec8bc47232/lib/meta_tags/meta_tags_collection.rb#L145-L167 | train | Extract noindex attributes from the archive | [
30522,
13366,
14817,
1035,
2053,
22254,
10288,
2053,
22254,
10288,
1035,
2171,
1010,
2053,
22254,
10288,
1035,
3643,
1027,
30524,
14817,
1035,
2053,
22254,
10288,
1035,
17961,
1006,
1024,
2053,
14876,
7174,
2860,
1007,
3582,
1035,
2171,
1010,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mongodb/mongo-ruby-driver | lib/mongo/cluster.rb | Mongo.Cluster.remove | def remove(host)
address = Address.new(host)
removed_servers = @servers.select { |s| s.address == address }
@update_lock.synchronize { @servers = @servers - removed_servers }
removed_servers.each do |server|
if server.connected?
server.disconnect!
publish_sdam_event(
Monitoring::SERVER_CLOSED,
Monitoring::Event::ServerClosed.new(address, topology)
)
end
end
removed_servers.any?
end | ruby | def remove(host)
address = Address.new(host)
removed_servers = @servers.select { |s| s.address == address }
@update_lock.synchronize { @servers = @servers - removed_servers }
removed_servers.each do |server|
if server.connected?
server.disconnect!
publish_sdam_event(
Monitoring::SERVER_CLOSED,
Monitoring::Event::ServerClosed.new(address, topology)
)
end
end
removed_servers.any?
end | [
"def",
"remove",
"(",
"host",
")",
"address",
"=",
"Address",
".",
"new",
"(",
"host",
")",
"removed_servers",
"=",
"@servers",
".",
"select",
"{",
"|",
"s",
"|",
"s",
".",
"address",
"==",
"address",
"}",
"@update_lock",
".",
"synchronize",
"{",
"@ser... | Remove the server from the cluster for the provided address, if it
exists.
@example Remove the server from the cluster.
server.remove('127.0.0.1:27017')
@param [ String ] host The host/port or socket address.
@return [ true|false ] Whether any servers were removed.
@since 2.0.0, return value added in 2.7.0 | [
"Remove",
"the",
"server",
"from",
"the",
"cluster",
"for",
"the",
"provided",
"address",
"if",
"it",
"exists",
"."
] | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/cluster.rb#L610-L624 | train | Remove a server from the list of servers | [
30522,
13366,
6366,
1006,
3677,
1007,
4769,
1027,
4769,
1012,
2047,
1006,
3677,
1007,
3718,
1035,
14903,
1027,
1030,
14903,
1012,
7276,
1063,
1064,
1055,
1064,
1055,
1012,
4769,
1027,
1027,
4769,
1065,
1030,
10651,
1035,
5843,
1012,
26351,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
huginn/huginn | app/models/agents/website_agent.rb | Agents.WebsiteAgent.store_payload! | def store_payload!(old_events, result)
case interpolated['mode'].presence
when 'on_change'
result_json = result.to_json
if found = old_events.find { |event| event.payload.to_json == result_json }
found.update!(expires_at: new_event_expiration_date)
false
else
true
end
when 'all', 'merge', ''
true
else
raise "Illegal options[mode]: #{interpolated['mode']}"
end
end | ruby | def store_payload!(old_events, result)
case interpolated['mode'].presence
when 'on_change'
result_json = result.to_json
if found = old_events.find { |event| event.payload.to_json == result_json }
found.update!(expires_at: new_event_expiration_date)
false
else
true
end
when 'all', 'merge', ''
true
else
raise "Illegal options[mode]: #{interpolated['mode']}"
end
end | [
"def",
"store_payload!",
"(",
"old_events",
",",
"result",
")",
"case",
"interpolated",
"[",
"'mode'",
"]",
".",
"presence",
"when",
"'on_change'",
"result_json",
"=",
"result",
".",
"to_json",
"if",
"found",
"=",
"old_events",
".",
"find",
"{",
"|",
"event"... | This method returns true if the result should be stored as a new event.
If mode is set to 'on_change', this method may return false and update an existing
event to expire further in the future. | [
"This",
"method",
"returns",
"true",
"if",
"the",
"result",
"should",
"be",
"stored",
"as",
"a",
"new",
"event",
".",
"If",
"mode",
"is",
"set",
"to",
"on_change",
"this",
"method",
"may",
"return",
"false",
"and",
"update",
"an",
"existing",
"event",
"t... | 01e18fef7b6bd827a5d48a89391e460b5fb1bee3 | https://github.com/huginn/huginn/blob/01e18fef7b6bd827a5d48a89391e460b5fb1bee3/app/models/agents/website_agent.rb#L507-L522 | train | Store the payload of the event in the cache | [
30522,
13366,
3573,
1035,
18093,
999,
1006,
2214,
1035,
2824,
1010,
2765,
1007,
2553,
6970,
18155,
4383,
1031,
1005,
5549,
1005,
1033,
1012,
3739,
2043,
1005,
2006,
1035,
2689,
1005,
2765,
1035,
1046,
3385,
1027,
2765,
1012,
2000,
1035,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.get_application_type_info_list | def get_application_type_info_list(application_type_definition_kind_filter:0, exclude_application_parameters:false, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
response = get_application_type_info_list_async(application_type_definition_kind_filter:application_type_definition_kind_filter, exclude_application_parameters:exclude_application_parameters, continuation_token:continuation_token, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_application_type_info_list(application_type_definition_kind_filter:0, exclude_application_parameters:false, continuation_token:nil, max_results:0, timeout:60, custom_headers:nil)
response = get_application_type_info_list_async(application_type_definition_kind_filter:application_type_definition_kind_filter, exclude_application_parameters:exclude_application_parameters, continuation_token:continuation_token, max_results:max_results, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_application_type_info_list",
"(",
"application_type_definition_kind_filter",
":",
"0",
",",
"exclude_application_parameters",
":",
"false",
",",
"continuation_token",
":",
"nil",
",",
"max_results",
":",
"0",
",",
"timeout",
":",
"60",
",",
"custom_headers",... | Gets the list of application types in the Service Fabric cluster.
Returns the information about the application types that are provisioned or
in the process of being provisioned in the Service Fabric cluster. Each
version of an application type is returned as one application type. The
response includes the name, version, status and other details about the
application type. This is a paged query, meaning that if not all of the
application types fit in a page, one page of results is returned as well as a
continuation token which can be used to get the next page. For example, if
there are 10 application types but a page only fits the first 3 application
types, or if max results is set to 3, then 3 is returned. To access the rest
of the results, retrieve subsequent pages by using the returned continuation
token in the next query. An empty continuation token is returned if there are
no subsequent pages.
@param application_type_definition_kind_filter [Integer] Used to filter on
ApplicationTypeDefinitionKind which is the mechanism used to define a Service
Fabric application type.
- Default - Default value, which performs the same function as selecting
"All". The value is 0.
- All - Filter that matches input with any ApplicationTypeDefinitionKind
value. The value is 65535.
- ServiceFabricApplicationPackage - Filter that matches input with
ApplicationTypeDefinitionKind value ServiceFabricApplicationPackage. The
value is 1.
- Compose - Filter that matches input with ApplicationTypeDefinitionKind
value Compose. The value is 2.
@param exclude_application_parameters [Boolean] The flag that specifies
whether application parameters will be excluded from the result.
@param continuation_token [String] The continuation token parameter is used
to obtain next set of results. A continuation token with a non empty value is
included in the response of the API when the results from the system do not
fit in a single response. When this value is passed to the next API call, the
API returns next set of results. If there are no further results then the
continuation token does not contain a value. The value of this parameter
should not be URL encoded.
@param max_results [Integer] The maximum number of results to be returned as
part of the paged queries. This parameter defines the upper bound on the
number of results returned. The results returned can be less than the
specified maximum results if they do not fit in the message as per the max
message size restrictions defined in the configuration. If this parameter is
zero or not specified, the paged queries includes as many results as possible
that fit in the return message.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [PagedApplicationTypeInfoList] operation results. | [
"Gets",
"the",
"list",
"of",
"application",
"types",
"in",
"the",
"Service",
"Fabric",
"cluster",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L4680-L4683 | train | Gets the list of all the applications of the type. | [
30522,
13366,
2131,
1035,
4646,
1035,
2828,
1035,
18558,
1035,
2862,
1006,
4646,
1035,
2828,
1035,
6210,
1035,
2785,
1035,
11307,
1024,
1014,
1010,
23329,
1035,
4646,
1035,
11709,
1024,
6270,
1010,
13633,
1035,
19204,
1024,
9152,
2140,
1010... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
zipmark/rspec_api_documentation | lib/rspec_api_documentation/dsl.rb | RspecApiDocumentation.DSL.resource | def resource(*args, &block)
options = args.last.is_a?(Hash) ? args.pop : {}
options[:api_doc_dsl] = :resource
options[:resource_name] = args.first.to_s
options[:document] = :all unless options.key?(:document)
args.push(options)
describe(*args, &block)
end | ruby | def resource(*args, &block)
options = args.last.is_a?(Hash) ? args.pop : {}
options[:api_doc_dsl] = :resource
options[:resource_name] = args.first.to_s
options[:document] = :all unless options.key?(:document)
args.push(options)
describe(*args, &block)
end | [
"def",
"resource",
"(",
"*",
"args",
",",
"&",
"block",
")",
"options",
"=",
"args",
".",
"last",
".",
"is_a?",
"(",
"Hash",
")",
"?",
"args",
".",
"pop",
":",
"{",
"}",
"options",
"[",
":api_doc_dsl",
"]",
"=",
":resource",
"options",
"[",
":resou... | Custom describe block that sets metadata to enable the rest of RAD
resource "Orders", :meta => :data do
# ...
end
Params:
+args+:: Glob of RSpec's `describe` arguments
+block+:: Block to pass into describe | [
"Custom",
"describe",
"block",
"that",
"sets",
"metadata",
"to",
"enable",
"the",
"rest",
"of",
"RAD"
] | 54fbfda3ec8ede5b3d871700ff69aabe89eafb2f | https://github.com/zipmark/rspec_api_documentation/blob/54fbfda3ec8ede5b3d871700ff69aabe89eafb2f/lib/rspec_api_documentation/dsl.rb#L20-L27 | train | Returns the resource object for the given resource name. | [
30522,
13366,
7692,
1006,
1008,
12098,
5620,
1010,
1004,
3796,
1007,
7047,
1027,
12098,
5620,
1012,
2197,
1012,
2003,
1035,
1037,
1029,
1006,
23325,
1007,
1029,
12098,
5620,
1012,
3769,
1024,
1063,
1065,
7047,
1031,
1024,
17928,
1035,
9986,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_kusto/lib/2017-09-07-privatepreview/generated/azure_mgmt_kusto/databases.rb | Azure::Kusto::Mgmt::V2018_09_07_privatepreview.Databases.add_principals_with_http_info | def add_principals_with_http_info(resource_group_name, cluster_name, database_name, database_principals_to_add, custom_headers:nil)
add_principals_async(resource_group_name, cluster_name, database_name, database_principals_to_add, custom_headers:custom_headers).value!
end | ruby | def add_principals_with_http_info(resource_group_name, cluster_name, database_name, database_principals_to_add, custom_headers:nil)
add_principals_async(resource_group_name, cluster_name, database_name, database_principals_to_add, custom_headers:custom_headers).value!
end | [
"def",
"add_principals_with_http_info",
"(",
"resource_group_name",
",",
"cluster_name",
",",
"database_name",
",",
"database_principals_to_add",
",",
"custom_headers",
":",
"nil",
")",
"add_principals_async",
"(",
"resource_group_name",
",",
"cluster_name",
",",
"database_... | Add Database principals permissions.
@param resource_group_name [String] The name of the resource group containing
the Kusto cluster.
@param cluster_name [String] The name of the Kusto cluster.
@param database_name [String] The name of the database in the Kusto cluster.
@param database_principals_to_add [DatabasePrincipalListRequest] List of
database principals to add.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Add",
"Database",
"principals",
"permissions",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_kusto/lib/2017-09-07-privatepreview/generated/azure_mgmt_kusto/databases.rb#L603-L605 | train | Adds a collection of principals to the database. | [
30522,
13366,
5587,
1035,
27928,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
9324,
1035,
2171,
1010,
7809,
1035,
2171,
1010,
7809,
1035,
27928,
1035,
2000,
1035,
5587,
1010,
7661,
1035,
20346,
2015,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/replication_links.rb | Azure::SQL::Mgmt::V2014_04_01.ReplicationLinks.failover_allow_data_loss | def failover_allow_data_loss(resource_group_name, server_name, database_name, link_id, custom_headers:nil)
response = failover_allow_data_loss_async(resource_group_name, server_name, database_name, link_id, custom_headers:custom_headers).value!
nil
end | ruby | def failover_allow_data_loss(resource_group_name, server_name, database_name, link_id, custom_headers:nil)
response = failover_allow_data_loss_async(resource_group_name, server_name, database_name, link_id, custom_headers:custom_headers).value!
nil
end | [
"def",
"failover_allow_data_loss",
"(",
"resource_group_name",
",",
"server_name",
",",
"database_name",
",",
"link_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"failover_allow_data_loss_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"data... | Sets which replica database is primary by failing over from the current
primary replica database. This operation might result in data loss.
@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 that has the
replication link to be failed over.
@param link_id [String] The ID of the replication link to be failed over.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Sets",
"which",
"replica",
"database",
"is",
"primary",
"by",
"failing",
"over",
"from",
"the",
"current",
"primary",
"replica",
"database",
".",
"This",
"operation",
"might",
"result",
"in",
"data",
"loss",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/replication_links.rb#L294-L297 | train | Check whether the data loss of the specified database link is allowed to be lost. | [
30522,
13366,
8246,
7840,
1035,
3499,
1035,
2951,
1035,
3279,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
7809,
1035,
2171,
1010,
4957,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
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_policy_insights/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/remediations.rb | Azure::PolicyInsights::Mgmt::V2018_07_01_preview.Remediations.list_deployments_at_subscription_as_lazy | def list_deployments_at_subscription_as_lazy(remediation_name, query_options:nil, custom_headers:nil)
response = list_deployments_at_subscription_async(remediation_name, query_options:query_options, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_deployments_at_subscription_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_deployments_at_subscription_as_lazy(remediation_name, query_options:nil, custom_headers:nil)
response = list_deployments_at_subscription_async(remediation_name, query_options:query_options, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_deployments_at_subscription_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_deployments_at_subscription_as_lazy",
"(",
"remediation_name",
",",
"query_options",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_deployments_at_subscription_async",
"(",
"remediation_name",
",",
"query_options",
":query_options",
... | Gets all deployments for a remediation at subscription scope.
@param remediation_name [String] The name of the remediation.
@param query_options [QueryOptions] Additional parameters for the operation
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [RemediationDeploymentsListResult] which provide lazy access to pages
of the response. | [
"Gets",
"all",
"deployments",
"for",
"a",
"remediation",
"at",
"subscription",
"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#L3107-L3116 | train | Gets the list of deployments for a remediation at subscription scope. | [
30522,
13366,
2862,
1035,
10813,
2015,
1035,
2012,
1035,
15002,
1035,
2004,
1035,
13971,
1006,
2128,
16969,
3508,
1035,
2171,
1010,
23032,
1035,
7047,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_recovery_services_site_recovery/lib/2018-01-10/generated/azure_mgmt_recovery_services_site_recovery/replication_protection_containers.rb | Azure::RecoveryServicesSiteRecovery::Mgmt::V2018_01_10.ReplicationProtectionContainers.begin_delete | def begin_delete(fabric_name, protection_container_name, custom_headers:nil)
response = begin_delete_async(fabric_name, protection_container_name, custom_headers:custom_headers).value!
nil
end | ruby | def begin_delete(fabric_name, protection_container_name, custom_headers:nil)
response = begin_delete_async(fabric_name, protection_container_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_delete",
"(",
"fabric_name",
",",
"protection_container_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_delete_async",
"(",
"fabric_name",
",",
"protection_container_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!"... | Removes a protection container.
Operation to remove a protection container.
@param fabric_name [String] Unique fabric ARM name.
@param protection_container_name [String] Unique protection container ARM
name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Removes",
"a",
"protection",
"container",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_recovery_services_site_recovery/lib/2018-01-10/generated/azure_mgmt_recovery_services_site_recovery/replication_protection_containers.rb#L747-L750 | train | Deletes a protection container. | [
30522,
13366,
4088,
1035,
3972,
12870,
1006,
8313,
1035,
2171,
1010,
3860,
1035,
11661,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
3972,
12870,
1035,
2004,
6038,
2278,
1006,
8313,
1035,
2171,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.add_prebuilt_with_http_info | def add_prebuilt_with_http_info(app_id, version_id, prebuilt_extractor_names, custom_headers:nil)
add_prebuilt_async(app_id, version_id, prebuilt_extractor_names, custom_headers:custom_headers).value!
end | ruby | def add_prebuilt_with_http_info(app_id, version_id, prebuilt_extractor_names, custom_headers:nil)
add_prebuilt_async(app_id, version_id, prebuilt_extractor_names, custom_headers:custom_headers).value!
end | [
"def",
"add_prebuilt_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"prebuilt_extractor_names",
",",
"custom_headers",
":",
"nil",
")",
"add_prebuilt_async",
"(",
"app_id",
",",
"version_id",
",",
"prebuilt_extractor_names",
",",
"custom_headers",
":custom_header... | Adds a list of prebuilt entities to a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param prebuilt_extractor_names [Array<String>] An array of prebuilt entity
extractor names.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Adds",
"a",
"list",
"of",
"prebuilt",
"entities",
"to",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L1225-L1227 | train | Adds a prebuilt specification to the application version. | [
30522,
13366,
5587,
1035,
3653,
8569,
4014,
2102,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
3653,
8569,
4014,
2102,
1035,
14817,
2953,
1035,
3415,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
puppetlabs/puppet | lib/puppet/network/authconfig.rb | Puppet.Network::DefaultAuthProvider.insert_default_acl | def insert_default_acl
self.class.default_acl.each do |acl|
unless rights[acl[:acl]]
Puppet.info _("Inserting default '%{acl}' (auth %{auth}) ACL") % { acl: acl[:acl], auth: acl[:authenticated] }
mk_acl(acl)
end
end
# queue an empty (ie deny all) right for every other path
# actually this is not strictly necessary as the rights system
# denies not explicitly allowed paths
unless rights["/"]
rights.newright("/").restrict_authenticated(:any)
end
end | ruby | def insert_default_acl
self.class.default_acl.each do |acl|
unless rights[acl[:acl]]
Puppet.info _("Inserting default '%{acl}' (auth %{auth}) ACL") % { acl: acl[:acl], auth: acl[:authenticated] }
mk_acl(acl)
end
end
# queue an empty (ie deny all) right for every other path
# actually this is not strictly necessary as the rights system
# denies not explicitly allowed paths
unless rights["/"]
rights.newright("/").restrict_authenticated(:any)
end
end | [
"def",
"insert_default_acl",
"self",
".",
"class",
".",
"default_acl",
".",
"each",
"do",
"|",
"acl",
"|",
"unless",
"rights",
"[",
"acl",
"[",
":acl",
"]",
"]",
"Puppet",
".",
"info",
"_",
"(",
"\"Inserting default '%{acl}' (auth %{auth}) ACL\"",
")",
"%",
... | force regular ACLs to be present | [
"force",
"regular",
"ACLs",
"to",
"be",
"present"
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/network/authconfig.rb#L38-L51 | train | insert default ACLs into the current object | [
30522,
13366,
19274,
1035,
12398,
1035,
9353,
2140,
2969,
1012,
2465,
1012,
12398,
1035,
9353,
2140,
1012,
2169,
2079,
1064,
9353,
2140,
1064,
4983,
2916,
1031,
9353,
2140,
1031,
1024,
9353,
2140,
1033,
1033,
13997,
1012,
18558,
1035,
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... |
alexreisner/geocoder | lib/geocoder/sql.rb | Geocoder.Sql.approx_distance | def approx_distance(latitude, longitude, lat_attr, lon_attr, options = {})
units = options[:units] || Geocoder.config.units
dx = Geocoder::Calculations.longitude_degree_distance(30, units)
dy = Geocoder::Calculations.latitude_degree_distance(units)
# sin of 45 degrees = average x or y component of vector
factor = Math.sin(Math::PI / 4)
"(#{dy} * ABS(#{lat_attr} - #{latitude.to_f}) * #{factor}) + " +
"(#{dx} * ABS(#{lon_attr} - #{longitude.to_f}) * #{factor})"
end | ruby | def approx_distance(latitude, longitude, lat_attr, lon_attr, options = {})
units = options[:units] || Geocoder.config.units
dx = Geocoder::Calculations.longitude_degree_distance(30, units)
dy = Geocoder::Calculations.latitude_degree_distance(units)
# sin of 45 degrees = average x or y component of vector
factor = Math.sin(Math::PI / 4)
"(#{dy} * ABS(#{lat_attr} - #{latitude.to_f}) * #{factor}) + " +
"(#{dx} * ABS(#{lon_attr} - #{longitude.to_f}) * #{factor})"
end | [
"def",
"approx_distance",
"(",
"latitude",
",",
"longitude",
",",
"lat_attr",
",",
"lon_attr",
",",
"options",
"=",
"{",
"}",
")",
"units",
"=",
"options",
"[",
":units",
"]",
"||",
"Geocoder",
".",
"config",
".",
"units",
"dx",
"=",
"Geocoder",
"::",
... | Distance calculation for use with a database without trigonometric
functions, like SQLite. Approach is to find objects within a square
rather than a circle, so results are very approximate (will include
objects outside the given radius).
Distance and bearing calculations are *extremely inaccurate*. To be
clear: this only exists to provide interface consistency. Results
are not intended for use in production! | [
"Distance",
"calculation",
"for",
"use",
"with",
"a",
"database",
"without",
"trigonometric",
"functions",
"like",
"SQLite",
".",
"Approach",
"is",
"to",
"find",
"objects",
"within",
"a",
"square",
"rather",
"than",
"a",
"circle",
"so",
"results",
"are",
"very... | e087dc2759264ee6f307b926bb2de4ec2406859e | https://github.com/alexreisner/geocoder/blob/e087dc2759264ee6f307b926bb2de4ec2406859e/lib/geocoder/sql.rb#L34-L44 | train | Returns the approximate distance between two points | [
30522,
13366,
22480,
1035,
3292,
1006,
15250,
1010,
20413,
1010,
2474,
2102,
1035,
2012,
16344,
1010,
8840,
2078,
1035,
2012,
16344,
1010,
7047,
1027,
1063,
1065,
1007,
3197,
1027,
7047,
1031,
1024,
3197,
1033,
1064,
1064,
20248,
16044,
209... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.report_node_health_with_http_info | def report_node_health_with_http_info(node_name, health_information, immediate:false, timeout:60, custom_headers:nil)
report_node_health_async(node_name, health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def report_node_health_with_http_info(node_name, health_information, immediate:false, timeout:60, custom_headers:nil)
report_node_health_async(node_name, health_information, immediate:immediate, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"report_node_health_with_http_info",
"(",
"node_name",
",",
"health_information",
",",
"immediate",
":",
"false",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"report_node_health_async",
"(",
"node_name",
",",
"health_information",
",",
... | Sends a health report on the Service Fabric node.
Reports health state of the specified Service Fabric node. The report must
contain the information about the source of the health report and property on
which it is reported.
The report is sent to a Service Fabric gateway node, which forwards to the
health store.
The report may be accepted by the gateway, but rejected by the health store
after extra validation.
For example, the health store may reject the report because of an invalid
parameter, like a stale sequence number.
To see whether the report was applied in the health store, run GetNodeHealth
and check that the report appears in the HealthEvents section.
@param node_name [String] The name of the node.
@param health_information [HealthInformation] Describes the health
information for the health report. This information needs to be present in
all of the health reports sent to the health manager.
@param immediate [Boolean] A flag which indicates whether the report should
be sent immediately.
A health report is sent to a Service Fabric gateway Application, which
forwards to the health store.
If Immediate is set to true, the report is sent immediately from HTTP Gateway
to the health store, regardless of the fabric client settings that the HTTP
Gateway Application is using.
This is useful for critical reports that should be sent as soon as possible.
Depending on timing and other conditions, sending the report may still fail,
for example if the HTTP Gateway is closed or the message doesn't reach the
Gateway.
If Immediate is set to false, the report is sent based on the health client
settings from the HTTP Gateway. Therefore, it will be batched according to
the HealthReportSendInterval configuration.
This is the recommended setting because it allows the health client to
optimize health reporting messages to health store as well as health report
processing.
By default, reports are not sent immediately.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Sends",
"a",
"health",
"report",
"on",
"the",
"Service",
"Fabric",
"node",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L3938-L3940 | train | Report node health. | [
30522,
13366,
3189,
1035,
13045,
1035,
2740,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
13045,
1035,
2171,
1010,
2740,
1035,
2592,
1010,
6234,
1024,
6270,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rubocop-hq/rubocop | lib/rubocop/processed_source.rb | RuboCop.ProcessedSource.parser_class | def parser_class(ruby_version)
case ruby_version
when 2.2
require 'parser/ruby22'
Parser::Ruby22
when 2.3
require 'parser/ruby23'
Parser::Ruby23
when 2.4
require 'parser/ruby24'
Parser::Ruby24
when 2.5
require 'parser/ruby25'
Parser::Ruby25
when 2.6
require 'parser/ruby26'
Parser::Ruby26
else
raise ArgumentError, "Unknown Ruby version: #{ruby_version.inspect}"
end
end | ruby | def parser_class(ruby_version)
case ruby_version
when 2.2
require 'parser/ruby22'
Parser::Ruby22
when 2.3
require 'parser/ruby23'
Parser::Ruby23
when 2.4
require 'parser/ruby24'
Parser::Ruby24
when 2.5
require 'parser/ruby25'
Parser::Ruby25
when 2.6
require 'parser/ruby26'
Parser::Ruby26
else
raise ArgumentError, "Unknown Ruby version: #{ruby_version.inspect}"
end
end | [
"def",
"parser_class",
"(",
"ruby_version",
")",
"case",
"ruby_version",
"when",
"2.2",
"require",
"'parser/ruby22'",
"Parser",
"::",
"Ruby22",
"when",
"2.3",
"require",
"'parser/ruby23'",
"Parser",
"::",
"Ruby23",
"when",
"2.4",
"require",
"'parser/ruby24'",
"Parse... | rubocop:disable Metrics/MethodLength | [
"rubocop",
":",
"disable",
"Metrics",
"/",
"MethodLength"
] | 2a4f4f0fdac4e1bb25891fc312af2ea60c6aa2f0 | https://github.com/rubocop-hq/rubocop/blob/2a4f4f0fdac4e1bb25891fc312af2ea60c6aa2f0/lib/rubocop/processed_source.rb#L171-L191 | train | Returns the parser class for the given Ruby version. | [
30522,
13366,
11968,
8043,
1035,
2465,
1006,
10090,
1035,
2544,
1007,
2553,
10090,
1035,
2544,
2043,
1016,
1012,
1016,
5478,
1005,
11968,
8043,
1013,
10090,
19317,
1005,
11968,
8043,
1024,
1024,
10090,
19317,
2043,
1016,
1012,
1017,
5478,
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... |
chef/ohai | lib/ohai/system.rb | Ohai.System.freeze_strings! | def freeze_strings!
# Recursive visitor pattern helper.
visitor = lambda do |val|
case val
when Hash
val.each_value { |v| visitor.call(v) }
when Array
val.each { |v| visitor.call(v) }
when String
val.freeze
end
end
visitor.call(@data)
end | ruby | def freeze_strings!
# Recursive visitor pattern helper.
visitor = lambda do |val|
case val
when Hash
val.each_value { |v| visitor.call(v) }
when Array
val.each { |v| visitor.call(v) }
when String
val.freeze
end
end
visitor.call(@data)
end | [
"def",
"freeze_strings!",
"# Recursive visitor pattern helper.",
"visitor",
"=",
"lambda",
"do",
"|",
"val",
"|",
"case",
"val",
"when",
"Hash",
"val",
".",
"each_value",
"{",
"|",
"v",
"|",
"visitor",
".",
"call",
"(",
"v",
")",
"}",
"when",
"Array",
"val... | Freeze all string values in @data. This makes them immutable and saves
a bit of RAM.
@api private
@return [void] | [
"Freeze",
"all",
"string",
"values",
"in",
"@data",
".",
"This",
"makes",
"them",
"immutable",
"and",
"saves",
"a",
"bit",
"of",
"RAM",
"."
] | 8d66449940f04237586b2f928231c6b26e2cc19a | https://github.com/chef/ohai/blob/8d66449940f04237586b2f928231c6b26e2cc19a/lib/ohai/system.rb#L206-L219 | train | Freeze all strings in the array | [
30522,
13366,
13184,
1035,
7817,
999,
1001,
28667,
9236,
3512,
10367,
5418,
2393,
2121,
1012,
10367,
1027,
23375,
2079,
1064,
11748,
1064,
2553,
11748,
2043,
23325,
11748,
1012,
2169,
1035,
3643,
1063,
1064,
1058,
1064,
10367,
1012,
2655,
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... |
sinatra/sinatra | sinatra-contrib/lib/sinatra/config_file.rb | Sinatra.ConfigFile.config_for_env | def config_for_env(hash)
return from_environment_key(hash) if environment_keys?(hash)
hash.each_with_object(IndifferentHash[]) do |(k, v), acc|
if environment_keys?(v)
acc.merge!(k => v[environment.to_s]) if v.key?(environment.to_s)
else
acc.merge!(k => v)
end
end
end | ruby | def config_for_env(hash)
return from_environment_key(hash) if environment_keys?(hash)
hash.each_with_object(IndifferentHash[]) do |(k, v), acc|
if environment_keys?(v)
acc.merge!(k => v[environment.to_s]) if v.key?(environment.to_s)
else
acc.merge!(k => v)
end
end
end | [
"def",
"config_for_env",
"(",
"hash",
")",
"return",
"from_environment_key",
"(",
"hash",
")",
"if",
"environment_keys?",
"(",
"hash",
")",
"hash",
".",
"each_with_object",
"(",
"IndifferentHash",
"[",
"]",
")",
"do",
"|",
"(",
"k",
",",
"v",
")",
",",
"... | Given a +hash+ containing application configuration it returns
settings applicable to the current environment. Note: It gives
precedence to environment settings defined at the root-level. | [
"Given",
"a",
"+",
"hash",
"+",
"containing",
"application",
"configuration",
"it",
"returns",
"settings",
"applicable",
"to",
"the",
"current",
"environment",
".",
"Note",
":",
"It",
"gives",
"precedence",
"to",
"environment",
"settings",
"defined",
"at",
"the"... | 1aa64f9858edc3f93cc8d46e26f724c1ae103b1c | https://github.com/sinatra/sinatra/blob/1aa64f9858edc3f93cc8d46e26f724c1ae103b1c/sinatra-contrib/lib/sinatra/config_file.rb#L146-L156 | train | Returns the config for the given environment | [
30522,
13366,
9530,
8873,
2290,
1035,
2005,
1035,
4372,
2615,
1006,
23325,
1007,
2709,
2013,
1035,
4044,
1035,
3145,
1006,
23325,
1007,
2065,
4044,
1035,
6309,
1029,
1006,
23325,
1007,
23325,
1012,
2169,
1035,
2007,
1035,
4874,
1006,
24436,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/public_ipprefixes.rb | Azure::Network::Mgmt::V2018_07_01.PublicIPPrefixes.begin_delete | def begin_delete(resource_group_name, public_ip_prefix_name, custom_headers:nil)
response = begin_delete_async(resource_group_name, public_ip_prefix_name, custom_headers:custom_headers).value!
nil
end | ruby | def begin_delete(resource_group_name, public_ip_prefix_name, custom_headers:nil)
response = begin_delete_async(resource_group_name, public_ip_prefix_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_delete",
"(",
"resource_group_name",
",",
"public_ip_prefix_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_delete_async",
"(",
"resource_group_name",
",",
"public_ip_prefix_name",
",",
"custom_headers",
":custom_headers",
")",
".",
... | Deletes the specified public IP prefix.
@param resource_group_name [String] The name of the resource group.
@param public_ip_prefix_name [String] The name of the PublicIpPrefix.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Deletes",
"the",
"specified",
"public",
"IP",
"prefix",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/public_ipprefixes.rb#L430-L433 | train | Deletes an existing public IP prefix. | [
30522,
13366,
4088,
1035,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2270,
1035,
12997,
1035,
17576,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
3972,
12870,
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... |
mongodb/mongoid | lib/mongoid/interceptable.rb | Mongoid.Interceptable.run_targeted_callbacks | def run_targeted_callbacks(place, kind)
name = "_run__#{place}__#{kind}__callbacks"
unless respond_to?(name)
chain = ActiveSupport::Callbacks::CallbackChain.new(name, {})
send("_#{kind}_callbacks").each do |callback|
chain.append(callback) if callback.kind == place
end
self.class.send :define_method, name do
env = ActiveSupport::Callbacks::Filters::Environment.new(self, false, nil)
sequence = chain.compile
sequence.invoke_before(env)
env.value = !env.halted
sequence.invoke_after(env)
env.value
end
self.class.send :protected, name
end
send(name)
end | ruby | def run_targeted_callbacks(place, kind)
name = "_run__#{place}__#{kind}__callbacks"
unless respond_to?(name)
chain = ActiveSupport::Callbacks::CallbackChain.new(name, {})
send("_#{kind}_callbacks").each do |callback|
chain.append(callback) if callback.kind == place
end
self.class.send :define_method, name do
env = ActiveSupport::Callbacks::Filters::Environment.new(self, false, nil)
sequence = chain.compile
sequence.invoke_before(env)
env.value = !env.halted
sequence.invoke_after(env)
env.value
end
self.class.send :protected, name
end
send(name)
end | [
"def",
"run_targeted_callbacks",
"(",
"place",
",",
"kind",
")",
"name",
"=",
"\"_run__#{place}__#{kind}__callbacks\"",
"unless",
"respond_to?",
"(",
"name",
")",
"chain",
"=",
"ActiveSupport",
"::",
"Callbacks",
"::",
"CallbackChain",
".",
"new",
"(",
"name",
","... | Run only the callbacks for the target location (before, after, around)
and kind (save, update, create).
@example Run the targeted callbacks.
model.run_targeted_callbacks(:before, :save)
@param [ Symbol ] place The time to run, :before, :after, :around.
@param [ Symbol ] kind The type of callback, :save, :create, :update.
@return [ Object ] The result of the chain execution.
@since 3.0.0 | [
"Run",
"only",
"the",
"callbacks",
"for",
"the",
"target",
"location",
"(",
"before",
"after",
"around",
")",
"and",
"kind",
"(",
"save",
"update",
"create",
")",
"."
] | 56976e32610f4c2450882b0bfe14da099f0703f4 | https://github.com/mongodb/mongoid/blob/56976e32610f4c2450882b0bfe14da099f0703f4/lib/mongoid/interceptable.rb#L250-L268 | train | Runs the callbacks defined in the class. | [
30522,
13366,
2448,
1035,
9416,
1035,
2655,
12221,
1006,
2173,
1010,
2785,
1007,
2171,
1027,
1000,
1035,
2448,
1035,
1035,
1001,
1063,
2173,
1065,
1035,
1035,
1001,
1063,
2785,
1065,
1035,
1035,
2655,
12221,
1000,
4983,
6869,
1035,
2000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-ec2/lib/aws-sdk-ec2/vpc.rb | Aws::EC2.Vpc.request_vpc_peering_connection | def request_vpc_peering_connection(options = {})
options = options.merge(vpc_id: @id)
resp = @client.create_vpc_peering_connection(options)
VpcPeeringConnection.new(
id: resp.data.vpc_peering_connection.vpc_peering_connection_id,
data: resp.data.vpc_peering_connection,
client: @client
)
end | ruby | def request_vpc_peering_connection(options = {})
options = options.merge(vpc_id: @id)
resp = @client.create_vpc_peering_connection(options)
VpcPeeringConnection.new(
id: resp.data.vpc_peering_connection.vpc_peering_connection_id,
data: resp.data.vpc_peering_connection,
client: @client
)
end | [
"def",
"request_vpc_peering_connection",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"vpc_id",
":",
"@id",
")",
"resp",
"=",
"@client",
".",
"create_vpc_peering_connection",
"(",
"options",
")",
"VpcPeeringConnection",
".",
... | @example Request syntax with placeholder values
vpcpeeringconnection = vpc.request_vpc_peering_connection({
dry_run: false,
peer_owner_id: "String",
peer_vpc_id: "String",
peer_region: "String",
})
@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 [String] :peer_owner_id
The AWS account ID of the owner of the accepter VPC.
Default: Your AWS account ID
@option options [String] :peer_vpc_id
The ID of the VPC with which you are creating the VPC peering
connection. You must specify this parameter in the request.
@option options [String] :peer_region
The region code for the accepter VPC, if the accepter VPC is located
in a region other than the region in which you make the request.
Default: The region in which you make the request.
@return [VpcPeeringConnection] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/vpc.rb#L680-L688 | train | Request a vpc peering connection | [
30522,
13366,
5227,
1035,
21210,
2278,
1035,
16740,
1035,
4434,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
21210,
2278,
1035,
8909,
1024,
1030,
8909,
1007,
24501,
2361,
1027,
1030,
7396,
30524,
7047,
1007,
2121... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_iot_hub/lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb | Azure::IotHub::Mgmt::V2017_01_19.IotHubResource.list_jobs | def list_jobs(resource_group_name, resource_name, custom_headers:nil)
first_page = list_jobs_as_lazy(resource_group_name, resource_name, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_jobs(resource_group_name, resource_name, custom_headers:nil)
first_page = list_jobs_as_lazy(resource_group_name, resource_name, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_jobs",
"(",
"resource_group_name",
",",
"resource_name",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_jobs_as_lazy",
"(",
"resource_group_name",
",",
"resource_name",
",",
"custom_headers",
":custom_headers",
")",
"first_page",
".",
"g... | 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 resource_group_name [String] The name of the resource group that
contains the IoT hub.
@param resource_name [String] The name of the IoT hub.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<JobResponse>] 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#L1079-L1082 | train | Gets all the jobs in a resource group. | [
30522,
13366,
2862,
1035,
5841,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7692,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2862,
1035,
5841,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
grpc/grpc | src/ruby/lib/grpc/generic/active_call.rb | GRPC.ActiveCall.bidi_streamer | def bidi_streamer(requests, metadata: {}, &blk)
raise_error_if_already_executed
# Metadata might have already been sent if this is an operation view
begin
send_initial_metadata(metadata)
rescue GRPC::Core::CallError => e
batch_result = @call.run_batch(RECV_STATUS_ON_CLIENT => nil)
set_input_stream_done
set_output_stream_done
attach_status_results_and_complete_call(batch_result)
raise e
rescue => e
set_input_stream_done
set_output_stream_done
raise e
end
bd = BidiCall.new(@call,
@marshal,
@unmarshal,
metadata_received: @metadata_received)
bd.run_on_client(requests,
proc { set_input_stream_done },
proc { set_output_stream_done },
&blk)
end | ruby | def bidi_streamer(requests, metadata: {}, &blk)
raise_error_if_already_executed
# Metadata might have already been sent if this is an operation view
begin
send_initial_metadata(metadata)
rescue GRPC::Core::CallError => e
batch_result = @call.run_batch(RECV_STATUS_ON_CLIENT => nil)
set_input_stream_done
set_output_stream_done
attach_status_results_and_complete_call(batch_result)
raise e
rescue => e
set_input_stream_done
set_output_stream_done
raise e
end
bd = BidiCall.new(@call,
@marshal,
@unmarshal,
metadata_received: @metadata_received)
bd.run_on_client(requests,
proc { set_input_stream_done },
proc { set_output_stream_done },
&blk)
end | [
"def",
"bidi_streamer",
"(",
"requests",
",",
"metadata",
":",
"{",
"}",
",",
"&",
"blk",
")",
"raise_error_if_already_executed",
"# Metadata might have already been sent if this is an operation view",
"begin",
"send_initial_metadata",
"(",
"metadata",
")",
"rescue",
"GRPC"... | bidi_streamer sends a stream of requests to the GRPC server, and yields
a stream of responses.
This method takes an Enumerable of requests, and returns and enumerable
of responses.
== requests ==
requests provides an 'iterable' of Requests. I.e. it follows Ruby's
#each enumeration protocol. In the simplest case, requests will be an
array of marshallable objects; in typical case it will be an
Enumerable that allows dynamic construction of the marshallable
objects.
== responses ==
This is an enumerator of responses. I.e, its #next method blocks
waiting for the next response. Also, if at any point the block needs
to consume all the remaining responses, this can be done using #each or
#collect. Calling #each or #collect should only be done if
the_call#writes_done has been called, otherwise the block will loop
forever.
@param requests [Object] an Enumerable of requests to send
@param metadata [Hash] metadata to be sent to the server. If a value is
a list, multiple metadata for its key are sent
@return [Enumerator, nil] a response Enumerator | [
"bidi_streamer",
"sends",
"a",
"stream",
"of",
"requests",
"to",
"the",
"GRPC",
"server",
"and",
"yields",
"a",
"stream",
"of",
"responses",
"."
] | f3937f0e55227a4ef3a23f895d3b204a947610f8 | https://github.com/grpc/grpc/blob/f3937f0e55227a4ef3a23f895d3b204a947610f8/src/ruby/lib/grpc/generic/active_call.rb#L494-L520 | train | Creates a new BidiStreamer. | [
30522,
13366,
7226,
2072,
1035,
5460,
2121,
1006,
11186,
1010,
27425,
1024,
1063,
1065,
1010,
1004,
1038,
13687,
1007,
5333,
1035,
7561,
1035,
2065,
1035,
2525,
1035,
6472,
1001,
27425,
2453,
2031,
2525,
2042,
2741,
2065,
2023,
2003,
2019,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.