repo stringclasses 235 values | path stringlengths 11 168 | func_name stringlengths 12 143 | original_string stringlengths 83 6.91k | language stringclasses 1 value | code stringlengths 83 6.91k | code_tokens listlengths 15 1.01k | docstring stringlengths 5 25.7k | docstring_tokens listlengths 1 427 | sha stringclasses 235 values | url stringlengths 99 268 | partition stringclasses 1 value | summary stringlengths 7 202 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
backup/backup | integration/support/example_helpers.rb | BackupSpec.ExampleHelpers.create_config | def create_config(text = nil, config_file = nil)
config_file ||= Backup::Config.config_file
config_path = File.dirname(config_file)
unless text.to_s.empty?
indent = text.lines.first.match(/^ */)[0].length
text = text.lines.map { |l| l[indent..-1] }.join
end
config = <<-EOS.gsub(/^ /, "")
# encoding: utf-8
Backup::Utilities.configure do
# silence the log output produced by the auto-detection
tar_dist :gnu
end
Backup::Logger.configure do
console.quiet = true
logfile.enabled = false
end
Backup::Storage::Local.defaults do |local|
local.path = "#{LOCAL_STORAGE_PATH}"
end
#{text}
#{CONFIG_TEMPLATE}
EOS
# Create models path, since models are always relative to the config file.
FileUtils.mkdir_p File.join(config_path, "models")
File.open(config_file, "w") { |f| f.write config }
end | ruby | def create_config(text = nil, config_file = nil)
config_file ||= Backup::Config.config_file
config_path = File.dirname(config_file)
unless text.to_s.empty?
indent = text.lines.first.match(/^ */)[0].length
text = text.lines.map { |l| l[indent..-1] }.join
end
config = <<-EOS.gsub(/^ /, "")
# encoding: utf-8
Backup::Utilities.configure do
# silence the log output produced by the auto-detection
tar_dist :gnu
end
Backup::Logger.configure do
console.quiet = true
logfile.enabled = false
end
Backup::Storage::Local.defaults do |local|
local.path = "#{LOCAL_STORAGE_PATH}"
end
#{text}
#{CONFIG_TEMPLATE}
EOS
# Create models path, since models are always relative to the config file.
FileUtils.mkdir_p File.join(config_path, "models")
File.open(config_file, "w") { |f| f.write config }
end | [
"def",
"create_config",
"(",
"text",
"=",
"nil",
",",
"config_file",
"=",
"nil",
")",
"config_file",
"||=",
"Backup",
"::",
"Config",
".",
"config_file",
"config_path",
"=",
"File",
".",
"dirname",
"(",
"config_file",
")",
"unless",
"text",
".",
"to_s",
".... | Creates the config.rb file.
By default, this will be created as ~/Backup/config.rb,
since Backup::Config is reset before each example.
If paths will be changed when calling backup_perform(),
like --config-file or --root-path, then the full path to
the config file must be given here in +config_file+.
The config file created here will disable console log output
and file logging, but this may be overridden in +text+.
Note that the first line in +text+ will set the indent for the text being
given and that indent will be removed from all lines in +text+
If you don"t intend to change the default config.rb contents or path,
you can omit this method from your example. Calling create_model()
will call this method if the +config_file+ does not exist. | [
"Creates",
"the",
"config",
".",
"rb",
"file",
"."
] | 64370f925e859f858766b674717a3dbee0de7a26 | https://github.com/backup/backup/blob/64370f925e859f858766b674717a3dbee0de7a26/integration/support/example_helpers.rb#L27-L60 | train | Create a config file with the given text. | [
30522,
13366,
3443,
1035,
9530,
8873,
2290,
1006,
3793,
1027,
9152,
2140,
1010,
9530,
8873,
2290,
1035,
5371,
1027,
9152,
2140,
1007,
9530,
8873,
2290,
1035,
5371,
1064,
1064,
1027,
10200,
1024,
1024,
9530,
8873,
2290,
1012,
9530,
8873,
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... |
mongodb/mongoid | lib/mongoid/association.rb | Mongoid.Association.reload_relations | def reload_relations
relations.each_pair do |name, meta|
if instance_variable_defined?("@_#{name}")
if _parent.nil? || instance_variable_get("@_#{name}") != _parent
remove_instance_variable("@_#{name}")
end
end
end
end | ruby | def reload_relations
relations.each_pair do |name, meta|
if instance_variable_defined?("@_#{name}")
if _parent.nil? || instance_variable_get("@_#{name}") != _parent
remove_instance_variable("@_#{name}")
end
end
end
end | [
"def",
"reload_relations",
"relations",
".",
"each_pair",
"do",
"|",
"name",
",",
"meta",
"|",
"if",
"instance_variable_defined?",
"(",
"\"@_#{name}\"",
")",
"if",
"_parent",
".",
"nil?",
"||",
"instance_variable_get",
"(",
"\"@_#{name}\"",
")",
"!=",
"_parent",
... | Convenience method for iterating through the loaded associations and
reloading them.
@example Reload the associations.
document.reload_relations
@return [ Hash ] The association metadata.
@since 2.1.6 | [
"Convenience",
"method",
"for",
"iterating",
"through",
"the",
"loaded",
"associations",
"and",
"reloading",
"them",
"."
] | 56976e32610f4c2450882b0bfe14da099f0703f4 | https://github.com/mongodb/mongoid/blob/56976e32610f4c2450882b0bfe14da099f0703f4/lib/mongoid/association.rb#L141-L149 | train | Reload the relation objects | [
30522,
13366,
2128,
11066,
1035,
4262,
4262,
1012,
2169,
1035,
3940,
2079,
1064,
2171,
1010,
18804,
1064,
2065,
6013,
1035,
8023,
1035,
4225,
1029,
1006,
1000,
1030,
1035,
1001,
1063,
2171,
1065,
1000,
1007,
2065,
1035,
6687,
1012,
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... |
middleman/middleman | middleman-cli/lib/middleman-cli/build.rb | Middleman::Cli.Build.clean_directories! | def clean_directories!
all_build_files = File.join(@app.config[:build_dir], '**', '*')
empty_directories = Dir[all_build_files].select do |d|
File.directory?(d)
end
empty_directories.each do |d|
remove_file d, force: true if Pathname(d).children.empty?
end
end | ruby | def clean_directories!
all_build_files = File.join(@app.config[:build_dir], '**', '*')
empty_directories = Dir[all_build_files].select do |d|
File.directory?(d)
end
empty_directories.each do |d|
remove_file d, force: true if Pathname(d).children.empty?
end
end | [
"def",
"clean_directories!",
"all_build_files",
"=",
"File",
".",
"join",
"(",
"@app",
".",
"config",
"[",
":build_dir",
"]",
",",
"'**'",
",",
"'*'",
")",
"empty_directories",
"=",
"Dir",
"[",
"all_build_files",
"]",
".",
"select",
"do",
"|",
"d",
"|",
... | Find empty directories in the build folder and remove them.
@return [Boolean] | [
"Find",
"empty",
"directories",
"in",
"the",
"build",
"folder",
"and",
"remove",
"them",
"."
] | a0dd9f78094813162895511e8516e0c5507cee50 | https://github.com/middleman/middleman/blob/a0dd9f78094813162895511e8516e0c5507cee50/middleman-cli/lib/middleman-cli/build.rb#L163-L173 | train | clean all directories that are not in the build directory | [
30522,
13366,
4550,
1035,
2472,
3111,
999,
2035,
1035,
3857,
1035,
6764,
1027,
5371,
1012,
3693,
1006,
1030,
10439,
1012,
9530,
8873,
2290,
1031,
1024,
3857,
1035,
16101,
1033,
1010,
1005,
1008,
1008,
1005,
1010,
1005,
1008,
1005,
1007,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.suspend | def suspend(resource_group_name, name, custom_headers:nil)
first_page = suspend_as_lazy(resource_group_name, name, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def suspend(resource_group_name, name, custom_headers:nil)
first_page = suspend_as_lazy(resource_group_name, name, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"suspend",
"(",
"resource_group_name",
",",
"name",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"suspend_as_lazy",
"(",
"resource_group_name",
",",
"name",
",",
"custom_headers",
":custom_headers",
")",
"first_page",
".",
"get_all_items",
"end"... | Suspend an App Service Environment.
Suspend an App Service Environment.
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param name [String] Name of the App Service Environment.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<Site>] operation results. | [
"Suspend",
"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#L2881-L2884 | train | Suspend a virtual machine. | [
30522,
13366,
28324,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
28324,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
7661,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
tongueroo/jets | lib/jets/resource/config/config_rule.rb | Jets::Resource::Config.ConfigRule.definition_properties | def definition_properties
{
config_rule_name: config_rule_name,
source: {
owner: "CUSTOM_LAMBDA",
source_identifier: "!GetAtt {namespace}LambdaFunction.Arn",
source_details: [
{
event_source: "aws.config",
message_type: "ConfigurationItemChangeNotification"
},
{
event_source: "aws.config",
message_type: "OversizedConfigurationItemChangeNotification"
}
]
},
}.deep_merge(@props)
end | ruby | def definition_properties
{
config_rule_name: config_rule_name,
source: {
owner: "CUSTOM_LAMBDA",
source_identifier: "!GetAtt {namespace}LambdaFunction.Arn",
source_details: [
{
event_source: "aws.config",
message_type: "ConfigurationItemChangeNotification"
},
{
event_source: "aws.config",
message_type: "OversizedConfigurationItemChangeNotification"
}
]
},
}.deep_merge(@props)
end | [
"def",
"definition_properties",
"{",
"config_rule_name",
":",
"config_rule_name",
",",
"source",
":",
"{",
"owner",
":",
"\"CUSTOM_LAMBDA\"",
",",
"source_identifier",
":",
"\"!GetAtt {namespace}LambdaFunction.Arn\"",
",",
"source_details",
":",
"[",
"{",
"event_source",
... | Do not name this method properties, that is a computed method of `Jets::Resource::Base` | [
"Do",
"not",
"name",
"this",
"method",
"properties",
"that",
"is",
"a",
"computed",
"method",
"of",
"Jets",
"::",
"Resource",
"::",
"Base"
] | 46943a519224067e58aa3e2d5656e3ca083150f9 | https://github.com/tongueroo/jets/blob/46943a519224067e58aa3e2d5656e3ca083150f9/lib/jets/resource/config/config_rule.rb#L27-L45 | train | Returns a hash of properties to be used in the definition. | [
30522,
13366,
6210,
1035,
5144,
1063,
9530,
8873,
2290,
1035,
3627,
1035,
2171,
1024,
9530,
8873,
2290,
1035,
3627,
1035,
2171,
1010,
3120,
1024,
1063,
3954,
1024,
1000,
7661,
1035,
23375,
1000,
1010,
3120,
1035,
8909,
4765,
18095,
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... |
rmagick/rmagick | lib/rmagick_internal.rb | Magick.Draw.text_align | def text_align(alignment)
Kernel.raise ArgumentError, "Unknown alignment constant: #{alignment}" unless ALIGN_TYPE_NAMES.key?(alignment.to_i)
primitive "text-align #{ALIGN_TYPE_NAMES[alignment.to_i]}"
end | ruby | def text_align(alignment)
Kernel.raise ArgumentError, "Unknown alignment constant: #{alignment}" unless ALIGN_TYPE_NAMES.key?(alignment.to_i)
primitive "text-align #{ALIGN_TYPE_NAMES[alignment.to_i]}"
end | [
"def",
"text_align",
"(",
"alignment",
")",
"Kernel",
".",
"raise",
"ArgumentError",
",",
"\"Unknown alignment constant: #{alignment}\"",
"unless",
"ALIGN_TYPE_NAMES",
".",
"key?",
"(",
"alignment",
".",
"to_i",
")",
"primitive",
"\"text-align #{ALIGN_TYPE_NAMES[alignment.t... | Specify text alignment relative to a given point | [
"Specify",
"text",
"alignment",
"relative",
"to",
"a",
"given",
"point"
] | ef6688ed9d76bf123c2ea1a483eff8635051adb7 | https://github.com/rmagick/rmagick/blob/ef6688ed9d76bf123c2ea1a483eff8635051adb7/lib/rmagick_internal.rb#L612-L615 | train | Returns the text alignment for the given text. | [
30522,
13366,
3793,
1035,
25705,
1006,
12139,
1007,
16293,
1012,
5333,
6685,
2121,
29165,
1010,
1000,
4242,
12139,
5377,
1024,
1001,
1063,
12139,
1065,
1000,
4983,
25705,
1035,
2828,
1035,
3415,
1012,
3145,
1029,
1006,
12139,
1012,
2000,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
awesome-print/awesome_print | lib/awesome_print/ext/action_view.rb | AwesomePrint.ActionView.ap_debug | def ap_debug(object, options = {})
object.ai(
options.merge(html: true)
).sub(
/^<pre([\s>])/,
'<pre class="debug_dump"\\1'
)
end | ruby | def ap_debug(object, options = {})
object.ai(
options.merge(html: true)
).sub(
/^<pre([\s>])/,
'<pre class="debug_dump"\\1'
)
end | [
"def",
"ap_debug",
"(",
"object",
",",
"options",
"=",
"{",
"}",
")",
"object",
".",
"ai",
"(",
"options",
".",
"merge",
"(",
"html",
":",
"true",
")",
")",
".",
"sub",
"(",
"/",
"\\s",
"/",
",",
"'<pre class=\"debug_dump\"\\\\1'",
")",
"end"
] | Use HTML colors and add default "debug_dump" class to the resulting HTML. | [
"Use",
"HTML",
"colors",
"and",
"add",
"default",
"debug_dump",
"class",
"to",
"the",
"resulting",
"HTML",
"."
] | 4564fd74721562cbef2443f7d97109bf9192343d | https://github.com/awesome-print/awesome_print/blob/4564fd74721562cbef2443f7d97109bf9192343d/lib/awesome_print/ext/action_view.rb#L9-L16 | train | Return a string with the debug_dump class. | [
30522,
13366,
9706,
1035,
2139,
8569,
2290,
1006,
4874,
1010,
7047,
1027,
1063,
1065,
1007,
4874,
1012,
9932,
1006,
7047,
1012,
13590,
1006,
16129,
1024,
2995,
1007,
1007,
1012,
4942,
1006,
1013,
1034,
1026,
3653,
1006,
1031,
1032,
1055,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/product_policy.rb | Azure::ApiManagement::Mgmt::V2018_01_01.ProductPolicy.list_by_product | def list_by_product(resource_group_name, service_name, product_id, custom_headers:nil)
response = list_by_product_async(resource_group_name, service_name, product_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_product(resource_group_name, service_name, product_id, custom_headers:nil)
response = list_by_product_async(resource_group_name, service_name, product_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_product",
"(",
"resource_group_name",
",",
"service_name",
",",
"product_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_product_async",
"(",
"resource_group_name",
",",
"service_name",
",",
"product_id",
",",
"custom_headers",
"... | Get the policy configuration at the Product level.
@param resource_group_name [String] The name of the resource group.
@param service_name [String] The name of the API Management service.
@param product_id [String] Product identifier. Must be unique in the current
API Management service instance.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [PolicyCollection] operation results. | [
"Get",
"the",
"policy",
"configuration",
"at",
"the",
"Product",
"level",
"."
] | 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/product_policy.rb#L36-L39 | train | Gets the list of all the product s terms. | [
30522,
13366,
2862,
1035,
2011,
1035,
4031,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
4031,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
4031,
1035,
2004,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
haml/haml | lib/haml/buffer.rb | Haml.Buffer.fix_textareas! | def fix_textareas!(input)
return input unless input.include?('<textarea'.freeze)
pattern = /<(textarea)([^>]*)>(\n|
)(.*?)<\/textarea>/im
input.gsub!(pattern) do |s|
match = pattern.match(s)
content = match[4]
if match[3] == '
'
content.sub!(/\A /, ' ')
else
content.sub!(/\A[ ]*/, '')
end
"<#{match[1]}#{match[2]}>\n#{content}</#{match[1]}>"
end
input
end | ruby | def fix_textareas!(input)
return input unless input.include?('<textarea'.freeze)
pattern = /<(textarea)([^>]*)>(\n|
)(.*?)<\/textarea>/im
input.gsub!(pattern) do |s|
match = pattern.match(s)
content = match[4]
if match[3] == '
'
content.sub!(/\A /, ' ')
else
content.sub!(/\A[ ]*/, '')
end
"<#{match[1]}#{match[2]}>\n#{content}</#{match[1]}>"
end
input
end | [
"def",
"fix_textareas!",
"(",
"input",
")",
"return",
"input",
"unless",
"input",
".",
"include?",
"(",
"'<textarea'",
".",
"freeze",
")",
"pattern",
"=",
"/",
"\\n",
"\\/",
"/im",
"input",
".",
"gsub!",
"(",
"pattern",
")",
"do",
"|",
"s",
"|",
"match... | Works like #{find_and_preserve}, but allows the first newline after a
preserved opening tag to remain unencoded, and then outdents the content.
This change was motivated primarily by the change in Rails 3.2.3 to emit
a newline after textarea helpers.
@param input [String] The text to process
@since Haml 4.0.1
@private | [
"Works",
"like",
"#",
"{",
"find_and_preserve",
"}",
"but",
"allows",
"the",
"first",
"newline",
"after",
"a",
"preserved",
"opening",
"tag",
"to",
"remain",
"unencoded",
"and",
"then",
"outdents",
"the",
"content",
".",
"This",
"change",
"was",
"motivated",
... | 9aa0fbe4a91b999978927be569d2ad0cd39076f1 | https://github.com/haml/haml/blob/9aa0fbe4a91b999978927be569d2ad0cd39076f1/lib/haml/buffer.rb#L163-L178 | train | Fixes textareas in the input string | [
30522,
13366,
8081,
1035,
3793,
12069,
3022,
999,
1006,
7953,
1007,
2709,
7953,
4983,
7953,
1012,
2421,
1029,
1006,
1005,
1026,
3793,
12069,
2050,
1005,
1012,
13184,
1007,
5418,
1027,
1013,
1026,
1006,
3793,
12069,
2050,
1007,
1006,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/models/v1_update_modifier_list_request.rb | SquareConnect.V1UpdateModifierListRequest.selection_type= | def selection_type=(selection_type)
validator = EnumAttributeValidator.new('String', ["SINGLE", "MULTIPLE"])
unless validator.valid?(selection_type)
fail ArgumentError, "invalid value for 'selection_type', must be one of #{validator.allowable_values}."
end
@selection_type = selection_type
end | ruby | def selection_type=(selection_type)
validator = EnumAttributeValidator.new('String', ["SINGLE", "MULTIPLE"])
unless validator.valid?(selection_type)
fail ArgumentError, "invalid value for 'selection_type', must be one of #{validator.allowable_values}."
end
@selection_type = selection_type
end | [
"def",
"selection_type",
"=",
"(",
"selection_type",
")",
"validator",
"=",
"EnumAttributeValidator",
".",
"new",
"(",
"'String'",
",",
"[",
"\"SINGLE\"",
",",
"\"MULTIPLE\"",
"]",
")",
"unless",
"validator",
".",
"valid?",
"(",
"selection_type",
")",
"fail",
... | Custom attribute writer method checking allowed values (enum).
@param [Object] selection_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_update_modifier_list_request.rb#L94-L100 | train | Set the selection type of the record. | [
30522,
13366,
4989,
1035,
2828,
1027,
1006,
4989,
1035,
2828,
1007,
9398,
8844,
1027,
4372,
12248,
4779,
3089,
8569,
2618,
10175,
8524,
4263,
1012,
2047,
1006,
1005,
5164,
1005,
1010,
1031,
1000,
2309,
1000,
1010,
1000,
3674,
1000,
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... |
primer/octicons | lib/octicons_jekyll/lib/jekyll-octicons.rb | Jekyll.Octicons.string_to_hash | def string_to_hash(markup)
options = {}
if match = markup.match(Syntax)
markup.scan(TagAttributes) do |key, value|
options[key.to_sym] = value.gsub(/\A"|"\z/, "")
end
end
options
end | ruby | def string_to_hash(markup)
options = {}
if match = markup.match(Syntax)
markup.scan(TagAttributes) do |key, value|
options[key.to_sym] = value.gsub(/\A"|"\z/, "")
end
end
options
end | [
"def",
"string_to_hash",
"(",
"markup",
")",
"options",
"=",
"{",
"}",
"if",
"match",
"=",
"markup",
".",
"match",
"(",
"Syntax",
")",
"markup",
".",
"scan",
"(",
"TagAttributes",
")",
"do",
"|",
"key",
",",
"value",
"|",
"options",
"[",
"key",
".",
... | Create a ruby hash from a string passed by the jekyll tag | [
"Create",
"a",
"ruby",
"hash",
"from",
"a",
"string",
"passed",
"by",
"the",
"jekyll",
"tag"
] | 6fe5475945d5633818b49ce55619ec039789b1c8 | https://github.com/primer/octicons/blob/6fe5475945d5633818b49ce55619ec039789b1c8/lib/octicons_jekyll/lib/jekyll-octicons.rb#L58-L68 | train | Convert a string to a hash | [
30522,
13366,
5164,
1035,
2000,
1035,
23325,
1006,
2928,
6279,
1007,
7047,
1027,
1063,
1065,
2065,
2674,
1027,
2928,
6279,
1012,
2674,
1006,
20231,
1007,
2928,
6279,
1012,
13594,
1006,
6415,
19321,
3089,
8569,
4570,
1007,
2079,
1064,
3145,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
samvera/hyrax | app/models/hyrax/operation.rb | Hyrax.Operation.rollup_messages | def rollup_messages
[].tap do |messages|
messages << message if message.present?
children&.pluck(:message)&.uniq&.each do |child_message|
messages << child_message if child_message.present?
end
end
end | ruby | def rollup_messages
[].tap do |messages|
messages << message if message.present?
children&.pluck(:message)&.uniq&.each do |child_message|
messages << child_message if child_message.present?
end
end
end | [
"def",
"rollup_messages",
"[",
"]",
".",
"tap",
"do",
"|",
"messages",
"|",
"messages",
"<<",
"message",
"if",
"message",
".",
"present?",
"children",
"&.",
"pluck",
"(",
":message",
")",
"&.",
"uniq",
"&.",
"each",
"do",
"|",
"child_message",
"|",
"mess... | Roll up messages for an operation and all of its children | [
"Roll",
"up",
"messages",
"for",
"an",
"operation",
"and",
"all",
"of",
"its",
"children"
] | e2b4f56e829a53b1f11296324736e9d5b8c9ee5f | https://github.com/samvera/hyrax/blob/e2b4f56e829a53b1f11296324736e9d5b8c9ee5f/app/models/hyrax/operation.rb#L45-L52 | train | rollup messages into a single array of objects | [
30522,
13366,
4897,
6279,
1035,
7696,
1031,
1033,
1012,
11112,
2079,
1064,
7696,
1064,
7696,
1026,
1026,
4471,
2065,
4471,
1012,
2556,
1029,
2336,
1004,
1012,
20228,
12722,
1006,
1024,
4471,
1007,
1004,
1012,
4895,
18515,
1004,
1012,
2169,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
haml/haml | lib/haml/helpers.rb | Haml.Helpers.list_of | def list_of(enum, opts={}, &block)
opts_attributes = opts.map { |k, v| " #{k}='#{v}'" }.join
enum.map do |i|
result = capture_haml(i, &block)
if result.count("\n") > 1
result.gsub!("\n", "\n ")
result = "\n #{result.strip}\n"
else
result.strip!
end
%Q!<li#{opts_attributes}>#{result}</li>!
end.join("\n")
end | ruby | def list_of(enum, opts={}, &block)
opts_attributes = opts.map { |k, v| " #{k}='#{v}'" }.join
enum.map do |i|
result = capture_haml(i, &block)
if result.count("\n") > 1
result.gsub!("\n", "\n ")
result = "\n #{result.strip}\n"
else
result.strip!
end
%Q!<li#{opts_attributes}>#{result}</li>!
end.join("\n")
end | [
"def",
"list_of",
"(",
"enum",
",",
"opts",
"=",
"{",
"}",
",",
"&",
"block",
")",
"opts_attributes",
"=",
"opts",
".",
"map",
"{",
"|",
"k",
",",
"v",
"|",
"\" #{k}='#{v}'\"",
"}",
".",
"join",
"enum",
".",
"map",
"do",
"|",
"i",
"|",
"result",
... | Takes an `Enumerable` object and a block
and iterates over the enum,
yielding each element to a Haml block
and putting the result into `<li>` elements.
This creates a list of the results of the block.
For example:
= list_of([['hello'], ['yall']]) do |i|
= i[0]
Produces:
<li>hello</li>
<li>yall</li>
And:
= list_of({:title => 'All the stuff', :description => 'A book about all the stuff.'}) do |key, val|
%h3= key.humanize
%p= val
Produces:
<li>
<h3>Title</h3>
<p>All the stuff</p>
</li>
<li>
<h3>Description</h3>
<p>A book about all the stuff.</p>
</li>
While:
= list_of(["Home", "About", "Contact", "FAQ"], {class: "nav", role: "nav"}) do |item|
%a{ href="#" }= item
Produces:
<li class='nav' role='nav'>
<a href='#'>Home</a>
</li>
<li class='nav' role='nav'>
<a href='#'>About</a>
</li>
<li class='nav' role='nav'>
<a href='#'>Contact</a>
</li>
<li class='nav' role='nav'>
<a href='#'>FAQ</a>
</li>
`[[class", "nav"], [role", "nav"]]` could have been used instead of `{class: "nav", role: "nav"}` (or any enumerable collection where each pair of items responds to #to_s)
@param enum [Enumerable] The list of objects to iterate over
@param [Enumerable<#to_s,#to_s>] opts Each key/value pair will become an attribute pair for each list item element.
@yield [item] A block which contains Haml code that goes within list items
@yieldparam item An element of `enum` | [
"Takes",
"an",
"Enumerable",
"object",
"and",
"a",
"block",
"and",
"iterates",
"over",
"the",
"enum",
"yielding",
"each",
"element",
"to",
"a",
"Haml",
"block",
"and",
"putting",
"the",
"result",
"into",
"<li",
">",
"elements",
".",
"This",
"creates",
"a",... | 9aa0fbe4a91b999978927be569d2ad0cd39076f1 | https://github.com/haml/haml/blob/9aa0fbe4a91b999978927be569d2ad0cd39076f1/lib/haml/helpers.rb#L199-L213 | train | Returns a list of elements in the given array. | [
30522,
13366,
2862,
1035,
1997,
1006,
4372,
2819,
1010,
23569,
2015,
1027,
1063,
1065,
1010,
1004,
3796,
1007,
23569,
2015,
1035,
12332,
1027,
23569,
2015,
1012,
4949,
1063,
1064,
1047,
1010,
1058,
1064,
1000,
1001,
1063,
1047,
1065,
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... |
github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/octo_fetcher.rb | GitHubChangelogGenerator.OctoFetcher.fetch_github_token | def fetch_github_token
env_var = @options[:token].presence || ENV["CHANGELOG_GITHUB_TOKEN"]
Helper.log.warn NO_TOKEN_PROVIDED unless env_var
env_var
end | ruby | def fetch_github_token
env_var = @options[:token].presence || ENV["CHANGELOG_GITHUB_TOKEN"]
Helper.log.warn NO_TOKEN_PROVIDED unless env_var
env_var
end | [
"def",
"fetch_github_token",
"env_var",
"=",
"@options",
"[",
":token",
"]",
".",
"presence",
"||",
"ENV",
"[",
"\"CHANGELOG_GITHUB_TOKEN\"",
"]",
"Helper",
".",
"log",
".",
"warn",
"NO_TOKEN_PROVIDED",
"unless",
"env_var",
"env_var",
"end"
] | Returns GitHub token. First try to use variable, provided by --token option,
otherwise try to fetch it from CHANGELOG_GITHUB_TOKEN env variable.
@return [String] | [
"Returns",
"GitHub",
"token",
".",
"First",
"try",
"to",
"use",
"variable",
"provided",
"by",
"--",
"token",
"option",
"otherwise",
"try",
"to",
"fetch",
"it",
"from",
"CHANGELOG_GITHUB_TOKEN",
"env",
"variable",
"."
] | f18c64b5cc0d7473b059275b88385ac11ca8b564 | https://github.com/github-changelog-generator/github-changelog-generator/blob/f18c64b5cc0d7473b059275b88385ac11ca8b564/lib/github_changelog_generator/octo_fetcher.rb#L459-L465 | train | Fetch the github token | [
30522,
13366,
18584,
1035,
21025,
2705,
12083,
1035,
19204,
4372,
2615,
1035,
13075,
1027,
1030,
7047,
1031,
1024,
19204,
1033,
1012,
3739,
1064,
1064,
4372,
2615,
1031,
1000,
2689,
21197,
1035,
21025,
2705,
12083,
1035,
19204,
1000,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_media_services/lib/2018-07-01/generated/azure_mgmt_media_services/streaming_endpoints.rb | Azure::MediaServices::Mgmt::V2018_07_01.StreamingEndpoints.begin_stop_with_http_info | def begin_stop_with_http_info(resource_group_name, account_name, streaming_endpoint_name, custom_headers:nil)
begin_stop_async(resource_group_name, account_name, streaming_endpoint_name, custom_headers:custom_headers).value!
end | ruby | def begin_stop_with_http_info(resource_group_name, account_name, streaming_endpoint_name, custom_headers:nil)
begin_stop_async(resource_group_name, account_name, streaming_endpoint_name, custom_headers:custom_headers).value!
end | [
"def",
"begin_stop_with_http_info",
"(",
"resource_group_name",
",",
"account_name",
",",
"streaming_endpoint_name",
",",
"custom_headers",
":",
"nil",
")",
"begin_stop_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"streaming_endpoint_name",
",",
"custom_hea... | Stop StreamingEndpoint
Stops an existing StreamingEndpoint.
@param resource_group_name [String] The name of the resource group within the
Azure subscription.
@param account_name [String] The Media Services account name.
@param streaming_endpoint_name [String] The name of the StreamingEndpoint.
@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. | [
"Stop",
"StreamingEndpoint"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_media_services/lib/2018-07-01/generated/azure_mgmt_media_services/streaming_endpoints.rb#L1017-L1019 | train | Stops the streaming endpoint. | [
30522,
13366,
4088,
1035,
2644,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
11058,
1035,
2203,
8400,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_customer_insights/lib/2017-01-01/generated/azure_mgmt_customer_insights/authorization_policies.rb | Azure::CustomerInsights::Mgmt::V2017_01_01.AuthorizationPolicies.regenerate_primary_key | def regenerate_primary_key(resource_group_name, hub_name, authorization_policy_name, custom_headers:nil)
response = regenerate_primary_key_async(resource_group_name, hub_name, authorization_policy_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def regenerate_primary_key(resource_group_name, hub_name, authorization_policy_name, custom_headers:nil)
response = regenerate_primary_key_async(resource_group_name, hub_name, authorization_policy_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"regenerate_primary_key",
"(",
"resource_group_name",
",",
"hub_name",
",",
"authorization_policy_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"regenerate_primary_key_async",
"(",
"resource_group_name",
",",
"hub_name",
",",
"authorization_policy_n... | Regenerates the primary policy key of the specified authorization policy.
@param resource_group_name [String] The name of the resource group.
@param hub_name [String] The name of the hub.
@param authorization_policy_name [String] The name of the policy.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [AuthorizationPolicy] operation results. | [
"Regenerates",
"the",
"primary",
"policy",
"key",
"of",
"the",
"specified",
"authorization",
"policy",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_customer_insights/lib/2017-01-01/generated/azure_mgmt_customer_insights/authorization_policies.rb#L349-L352 | train | Regenerate the primary key of the authorization policy. | [
30522,
13366,
19723,
24454,
3686,
1035,
3078,
1035,
3145,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
9594,
1035,
2171,
1010,
20104,
1035,
3343,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
19723,
24454,
3686... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_mixedreality/lib/2019-02-28-preview/generated/azure_mgmt_mixedreality/spatial_anchors_accounts.rb | Azure::MixedReality::Mgmt::V2019_02_28_preview.SpatialAnchorsAccounts.create_with_http_info | def create_with_http_info(resource_group_name, spatial_anchors_account_name, spatial_anchors_account, custom_headers:nil)
create_async(resource_group_name, spatial_anchors_account_name, spatial_anchors_account, custom_headers:custom_headers).value!
end | ruby | def create_with_http_info(resource_group_name, spatial_anchors_account_name, spatial_anchors_account, custom_headers:nil)
create_async(resource_group_name, spatial_anchors_account_name, spatial_anchors_account, custom_headers:custom_headers).value!
end | [
"def",
"create_with_http_info",
"(",
"resource_group_name",
",",
"spatial_anchors_account_name",
",",
"spatial_anchors_account",
",",
"custom_headers",
":",
"nil",
")",
"create_async",
"(",
"resource_group_name",
",",
"spatial_anchors_account_name",
",",
"spatial_anchors_accoun... | Creating or Updating a Spatial Anchors Account.
@param resource_group_name [String] Name of an Azure resource group.
@param spatial_anchors_account_name [String] Name of an Mixed Reality Spatial
Anchors Account.
@param spatial_anchors_account [SpatialAnchorsAccount] Spatial Anchors
Account parameter.
@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. | [
"Creating",
"or",
"Updating",
"a",
"Spatial",
"Anchors",
"Account",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_mixedreality/lib/2019-02-28-preview/generated/azure_mgmt_mixedreality/spatial_anchors_accounts.rb#L536-L538 | train | Creates a new spatial anchors account. | [
30522,
13366,
3443,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
13589,
1035,
24674,
1035,
4070,
30524,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
13589,
1035,
24674,
1035,
4070,
1035,
2171,
1010,
13589,
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... |
alexreisner/geocoder | lib/geocoder/calculations.rb | Geocoder.Calculations.coordinates_present? | def coordinates_present?(*args)
args.each do |a|
# note that Float::NAN != Float::NAN
# still, this could probably be improved:
return false if (!a.is_a?(Numeric) or a.to_s == "NaN")
end
true
end | ruby | def coordinates_present?(*args)
args.each do |a|
# note that Float::NAN != Float::NAN
# still, this could probably be improved:
return false if (!a.is_a?(Numeric) or a.to_s == "NaN")
end
true
end | [
"def",
"coordinates_present?",
"(",
"*",
"args",
")",
"args",
".",
"each",
"do",
"|",
"a",
"|",
"# note that Float::NAN != Float::NAN",
"# still, this could probably be improved:",
"return",
"false",
"if",
"(",
"!",
"a",
".",
"is_a?",
"(",
"Numeric",
")",
"or",
... | Returns true if all given arguments are valid latitude/longitude values. | [
"Returns",
"true",
"if",
"all",
"given",
"arguments",
"are",
"valid",
"latitude",
"/",
"longitude",
"values",
"."
] | e087dc2759264ee6f307b926bb2de4ec2406859e | https://github.com/alexreisner/geocoder/blob/e087dc2759264ee6f307b926bb2de4ec2406859e/lib/geocoder/calculations.rb#L44-L51 | train | Returns true if the coordinates present in the given array | [
30522,
13366,
12093,
1035,
2556,
1029,
1006,
1008,
12098,
5620,
1007,
12098,
5620,
1012,
2169,
2079,
1064,
1037,
1064,
1001,
3602,
2008,
14257,
1024,
1024,
16660,
999,
1027,
14257,
1024,
1024,
16660,
1001,
2145,
1010,
2023,
2071,
2763,
2022... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
thoughtbot/factory_bot | lib/factory_bot/definition_proxy.rb | FactoryBot.DefinitionProxy.sequence | def sequence(name, *args, &block)
sequence = Sequence.new(name, *args, &block)
FactoryBot::Internal.register_inline_sequence(sequence)
add_attribute(name) { increment_sequence(sequence) }
end | ruby | def sequence(name, *args, &block)
sequence = Sequence.new(name, *args, &block)
FactoryBot::Internal.register_inline_sequence(sequence)
add_attribute(name) { increment_sequence(sequence) }
end | [
"def",
"sequence",
"(",
"name",
",",
"*",
"args",
",",
"&",
"block",
")",
"sequence",
"=",
"Sequence",
".",
"new",
"(",
"name",
",",
"args",
",",
"block",
")",
"FactoryBot",
"::",
"Internal",
".",
"register_inline_sequence",
"(",
"sequence",
")",
"add_at... | Adds an attribute that will have unique values generated by a sequence with
a specified format.
The result of:
factory :user do
sequence(:email) { |n| "person#{n}@example.com" }
end
Is equal to:
sequence(:email) { |n| "person#{n}@example.com" }
factory :user do
email { FactoryBot.generate(:email) }
end
Except that no globally available sequence will be defined. | [
"Adds",
"an",
"attribute",
"that",
"will",
"have",
"unique",
"values",
"generated",
"by",
"a",
"sequence",
"with",
"a",
"specified",
"format",
"."
] | 99ac02400fd56bd1872fc3ed84f81ea5e8f27737 | https://github.com/thoughtbot/factory_bot/blob/99ac02400fd56bd1872fc3ed84f81ea5e8f27737/lib/factory_bot/definition_proxy.rb#L122-L126 | train | Add a sequence to the document. | [
30522,
13366,
5537,
1006,
2171,
1010,
1008,
12098,
5620,
1010,
1004,
3796,
1007,
5537,
1027,
5537,
1012,
2047,
1006,
2171,
1010,
1008,
12098,
5620,
1010,
1004,
3796,
1007,
4713,
18384,
1024,
1024,
4722,
1012,
4236,
1035,
23881,
1035,
5537,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/gateway.rb | Discordrb.Gateway.send_resume | def send_resume(token, session_id, seq)
data = {
token: token,
session_id: session_id,
seq: seq
}
send_packet(Opcodes::RESUME, data)
end | ruby | def send_resume(token, session_id, seq)
data = {
token: token,
session_id: session_id,
seq: seq
}
send_packet(Opcodes::RESUME, data)
end | [
"def",
"send_resume",
"(",
"token",
",",
"session_id",
",",
"seq",
")",
"data",
"=",
"{",
"token",
":",
"token",
",",
"session_id",
":",
"session_id",
",",
"seq",
":",
"seq",
"}",
"send_packet",
"(",
"Opcodes",
"::",
"RESUME",
",",
"data",
")",
"end"
] | Sends a resume packet (op 6). This replays all events from a previous point specified by its packet sequence. This
will not work if the packet to resume from has already been acknowledged using a heartbeat, or if the session ID
belongs to a now invalid session.
If this packet is sent at the beginning of a connection, it will act similarly to an {#identify} in that it
creates a session on the current connection. Unlike identify however, this packet can also be sent in an existing
session and will just replay some of the events.
@param token [String] The token that was used to identify the session to resume.
@param session_id [String] The session ID of the session to resume.
@param seq [Integer] The packet sequence of the packet after which the events should be replayed. | [
"Sends",
"a",
"resume",
"packet",
"(",
"op",
"6",
")",
".",
"This",
"replays",
"all",
"events",
"from",
"a",
"previous",
"point",
"specified",
"by",
"its",
"packet",
"sequence",
".",
"This",
"will",
"not",
"work",
"if",
"the",
"packet",
"to",
"resume",
... | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/gateway.rb#L374-L382 | train | Send a resume packet to the server | [
30522,
13366,
4604,
1035,
13746,
1006,
19204,
1010,
5219,
1035,
8909,
1010,
7367,
4160,
1007,
2951,
1027,
1063,
19204,
1024,
19204,
1010,
5219,
1035,
8909,
1024,
5219,
1035,
8909,
1010,
7367,
4160,
1024,
7367,
4160,
1065,
4604,
1035,
14771,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/workflows.rb | Azure::Logic::Mgmt::V2016_06_01.Workflows.validate_workflow | def validate_workflow(resource_group_name, workflow_name, validate, custom_headers:nil)
response = validate_workflow_async(resource_group_name, workflow_name, validate, custom_headers:custom_headers).value!
nil
end | ruby | def validate_workflow(resource_group_name, workflow_name, validate, custom_headers:nil)
response = validate_workflow_async(resource_group_name, workflow_name, validate, custom_headers:custom_headers).value!
nil
end | [
"def",
"validate_workflow",
"(",
"resource_group_name",
",",
"workflow_name",
",",
"validate",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"validate_workflow_async",
"(",
"resource_group_name",
",",
"workflow_name",
",",
"validate",
",",
"custom_headers",
... | Validates the workflow.
@param resource_group_name [String] The resource group name.
@param workflow_name [String] The workflow name.
@param validate [Workflow] The workflow.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Validates",
"the",
"workflow",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/workflows.rb#L1243-L1246 | train | Validates the workflow. | [
30522,
13366,
9398,
3686,
1035,
2147,
12314,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2147,
12314,
1035,
2171,
1010,
9398,
3686,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
9398,
3686,
1035,
2147,
12314,
1035,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/network_interface_tap_configurations.rb | Azure::Network::Mgmt::V2019_02_01.NetworkInterfaceTapConfigurations.begin_create_or_update | def begin_create_or_update(resource_group_name, network_interface_name, tap_configuration_name, tap_configuration_parameters, custom_headers:nil)
response = begin_create_or_update_async(resource_group_name, network_interface_name, tap_configuration_name, tap_configuration_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_create_or_update(resource_group_name, network_interface_name, tap_configuration_name, tap_configuration_parameters, custom_headers:nil)
response = begin_create_or_update_async(resource_group_name, network_interface_name, tap_configuration_name, tap_configuration_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_create_or_update",
"(",
"resource_group_name",
",",
"network_interface_name",
",",
"tap_configuration_name",
",",
"tap_configuration_parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_create_or_update_async",
"(",
"resource_group_name",
... | Creates or updates a Tap configuration in the specified NetworkInterface.
@param resource_group_name [String] The name of the resource group.
@param network_interface_name [String] The name of the network interface.
@param tap_configuration_name [String] The name of the tap configuration.
@param tap_configuration_parameters [NetworkInterfaceTapConfiguration]
Parameters supplied to the create or update tap configuration operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [NetworkInterfaceTapConfiguration] operation results. | [
"Creates",
"or",
"updates",
"a",
"Tap",
"configuration",
"in",
"the",
"specified",
"NetworkInterface",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/network_interface_tap_configurations.rb#L398-L401 | train | Creates or updates a network interface tap configuration. | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2897,
1035,
8278,
1035,
2171,
1010,
11112,
1035,
9563,
1035,
2171,
1010,
11112,
1035,
9563,
1035,
11709,
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_network/lib/2018-07-01/generated/azure_mgmt_network/security_rules.rb | Azure::Network::Mgmt::V2018_07_01.SecurityRules.create_or_update | def create_or_update(resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers:nil)
response = create_or_update_async(resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_or_update(resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers:nil)
response = create_or_update_async(resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_or_update",
"(",
"resource_group_name",
",",
"network_security_group_name",
",",
"security_rule_name",
",",
"security_rule_parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_or_update_async",
"(",
"resource_group_name",
",",
"networ... | Creates or updates a security rule in the specified network security group.
@param resource_group_name [String] The name of the resource group.
@param network_security_group_name [String] The name of the network security
group.
@param security_rule_name [String] The name of the security rule.
@param security_rule_parameters [SecurityRule] Parameters supplied to the
create or update network security rule operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [SecurityRule] operation results. | [
"Creates",
"or",
"updates",
"a",
"security",
"rule",
"in",
"the",
"specified",
"network",
"security",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/security_rules.rb#L179-L182 | train | Creates or updates a network security rule. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2897,
1035,
3036,
1035,
2177,
1035,
2171,
1010,
3036,
1035,
3627,
1035,
2171,
1010,
3036,
1035,
3627,
1035,
11709,
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/databases.rb | Azure::SQL::Mgmt::V2014_04_01.Databases.list_metric_definitions_with_http_info | def list_metric_definitions_with_http_info(resource_group_name, server_name, database_name, custom_headers:nil)
list_metric_definitions_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
end | ruby | def list_metric_definitions_with_http_info(resource_group_name, server_name, database_name, custom_headers:nil)
list_metric_definitions_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
end | [
"def",
"list_metric_definitions_with_http_info",
"(",
"resource_group_name",
",",
"server_name",
",",
"database_name",
",",
"custom_headers",
":",
"nil",
")",
"list_metric_definitions_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"database_name",
",",
"custom... | Returns database metric definitions.
@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.
@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",
"database",
"metric",
"definitions",
"."
] | 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#L1259-L1261 | train | Gets the metric definitions for the specified database. | [
30522,
13366,
2862,
1035,
12046,
1035,
15182,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
7809,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2862,
1035,
12046,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/validations/hour_of_day.rb | IceCube.Validations::HourOfDay.hour_of_day | def hour_of_day(*hours)
hours.flatten.each do |hour|
unless hour.is_a?(Integer)
raise ArgumentError, "expecting Integer value for hour, got #{hour.inspect}"
end
verify_alignment(hour, :hour, :hour_of_day) { |error| raise error }
validations_for(:hour_of_day) << Validation.new(hour)
end
clobber_base_validations(:hour)
self
end | ruby | def hour_of_day(*hours)
hours.flatten.each do |hour|
unless hour.is_a?(Integer)
raise ArgumentError, "expecting Integer value for hour, got #{hour.inspect}"
end
verify_alignment(hour, :hour, :hour_of_day) { |error| raise error }
validations_for(:hour_of_day) << Validation.new(hour)
end
clobber_base_validations(:hour)
self
end | [
"def",
"hour_of_day",
"(",
"*",
"hours",
")",
"hours",
".",
"flatten",
".",
"each",
"do",
"|",
"hour",
"|",
"unless",
"hour",
".",
"is_a?",
"(",
"Integer",
")",
"raise",
"ArgumentError",
",",
"\"expecting Integer value for hour, got #{hour.inspect}\"",
"end",
"v... | Add hour of day validations | [
"Add",
"hour",
"of",
"day",
"validations"
] | fb6c657bdc4f87dfda2bf83f15c5f487b78ccabd | https://github.com/seejohnrun/ice_cube/blob/fb6c657bdc4f87dfda2bf83f15c5f487b78ccabd/lib/ice_cube/validations/hour_of_day.rb#L6-L18 | train | Check the validity of the hours of the day | [
30522,
13366,
3178,
1035,
1997,
1035,
2154,
1006,
1008,
2847,
1007,
2847,
1012,
4257,
6528,
1012,
2169,
2079,
1064,
3178,
1064,
4983,
3178,
1012,
2003,
1035,
1037,
1029,
1006,
16109,
1007,
5333,
6685,
2121,
29165,
1010,
1000,
8074,
16109,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fazibear/colorize | lib/colorize/class_methods.rb | Colorize.ClassMethods.color_methods | def color_methods
colors.each do |key|
next if key == :default
define_method key do
colorize(:color => key)
end
define_method "on_#{key}" do
colorize(:background => key)
end
end
end | ruby | def color_methods
colors.each do |key|
next if key == :default
define_method key do
colorize(:color => key)
end
define_method "on_#{key}" do
colorize(:background => key)
end
end
end | [
"def",
"color_methods",
"colors",
".",
"each",
"do",
"|",
"key",
"|",
"next",
"if",
"key",
"==",
":default",
"define_method",
"key",
"do",
"colorize",
"(",
":color",
"=>",
"key",
")",
"end",
"define_method",
"\"on_#{key}\"",
"do",
"colorize",
"(",
":backgrou... | Generate color and on_color methods | [
"Generate",
"color",
"and",
"on_color",
"methods"
] | 526654c6d7dfc5483b70184d06b994eba8359514 | https://github.com/fazibear/colorize/blob/526654c6d7dfc5483b70184d06b994eba8359514/lib/colorize/class_methods.rb#L93-L105 | train | Define color methods | [
30522,
13366,
3609,
1035,
4725,
6087,
1012,
2169,
2079,
1064,
3145,
1064,
2279,
2065,
3145,
1027,
1027,
1024,
12398,
9375,
1035,
4118,
3145,
2079,
3609,
4697,
1006,
1024,
3609,
1027,
1028,
3145,
1007,
2203,
9375,
1035,
4118,
1000,
2006,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_media_services/lib/2018-07-01/generated/azure_mgmt_media_services/jobs.rb | Azure::MediaServices::Mgmt::V2018_07_01.Jobs.create_with_http_info | def create_with_http_info(resource_group_name, account_name, transform_name, job_name, parameters, custom_headers:nil)
create_async(resource_group_name, account_name, transform_name, job_name, parameters, custom_headers:custom_headers).value!
end | ruby | def create_with_http_info(resource_group_name, account_name, transform_name, job_name, parameters, custom_headers:nil)
create_async(resource_group_name, account_name, transform_name, job_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"create_with_http_info",
"(",
"resource_group_name",
",",
"account_name",
",",
"transform_name",
",",
"job_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"create_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"transform_name",
... | Create Job
Creates a Job.
@param resource_group_name [String] The name of the resource group within the
Azure subscription.
@param account_name [String] The Media Services account name.
@param transform_name [String] The Transform name.
@param job_name [String] The Job name.
@param parameters [Job] The request parameters
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Create",
"Job"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_media_services/lib/2018-07-01/generated/azure_mgmt_media_services/jobs.rb#L284-L286 | train | Creates a new chunk of a chunk of the image. | [
30522,
13366,
3443,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
10938,
1035,
2171,
1010,
3105,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3443,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/thrift | lib/rb/lib/thrift/struct.rb | Thrift.Struct.differences | def differences(other)
diffs = []
unless other.is_a?(self.class)
diffs << "Different class!"
else
each_field do |fid, field_info|
name = field_info[:name]
diffs << "#{name} differs!" unless self.instance_variable_get("@#{name}") == other.instance_variable_get("@#{name}")
end
end
diffs
end | ruby | def differences(other)
diffs = []
unless other.is_a?(self.class)
diffs << "Different class!"
else
each_field do |fid, field_info|
name = field_info[:name]
diffs << "#{name} differs!" unless self.instance_variable_get("@#{name}") == other.instance_variable_get("@#{name}")
end
end
diffs
end | [
"def",
"differences",
"(",
"other",
")",
"diffs",
"=",
"[",
"]",
"unless",
"other",
".",
"is_a?",
"(",
"self",
".",
"class",
")",
"diffs",
"<<",
"\"Different class!\"",
"else",
"each_field",
"do",
"|",
"fid",
",",
"field_info",
"|",
"name",
"=",
"field_i... | This implementation of hash() is inspired by Apache's Java HashCodeBuilder class. | [
"This",
"implementation",
"of",
"hash",
"()",
"is",
"inspired",
"by",
"Apache",
"s",
"Java",
"HashCodeBuilder",
"class",
"."
] | 27d8387c49a49fcf193893f834e9766ae0b051c1 | https://github.com/apache/thrift/blob/27d8387c49a49fcf193893f834e9766ae0b051c1/lib/rb/lib/thrift/struct.rb#L140-L151 | train | Returns an array of the differences between this object and the other object. | [
30522,
13366,
5966,
1006,
2060,
1007,
4487,
21807,
1027,
1031,
1033,
4983,
2060,
1012,
2003,
1035,
1037,
1029,
1006,
2969,
1012,
2465,
1007,
4487,
21807,
1026,
1026,
1000,
2367,
2465,
999,
1000,
2842,
2169,
1035,
2492,
2079,
1064,
10882,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.get_job_details | def get_job_details(team_name, job_id, custom_headers:nil)
response = get_job_details_async(team_name, job_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_job_details(team_name, job_id, custom_headers:nil)
response = get_job_details_async(team_name, job_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_job_details",
"(",
"team_name",
",",
"job_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_job_details_async",
"(",
"team_name",
",",
"job_id",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"... | Get the Job Details for a Job Id.
@param team_name [String] Your Team Name.
@param job_id [String] Id of the job.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Job] operation results. | [
"Get",
"the",
"Job",
"Details",
"for",
"a",
"Job",
"Id",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_contentmoderator/lib/1.0/generated/azure_cognitiveservices_contentmoderator/reviews.rb#L135-L138 | train | Gets the details of a job. | [
30522,
13366,
2131,
1035,
3105,
1035,
4751,
1006,
2136,
1035,
2171,
1010,
3105,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
30524,
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,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.get_regex_entity_role_with_http_info | def get_regex_entity_role_with_http_info(app_id, version_id, entity_id, role_id, custom_headers:nil)
get_regex_entity_role_async(app_id, version_id, entity_id, role_id, custom_headers:custom_headers).value!
end | ruby | def get_regex_entity_role_with_http_info(app_id, version_id, entity_id, role_id, custom_headers:nil)
get_regex_entity_role_async(app_id, version_id, entity_id, role_id, custom_headers:custom_headers).value!
end | [
"def",
"get_regex_entity_role_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"role_id",
",",
"custom_headers",
":",
"nil",
")",
"get_regex_entity_role_async",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"role_id",
",",
"custom... | Get one role for a given regular expression entity in a version of the
application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param entity_id entity ID.
@param role_id entity role ID.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Get",
"one",
"role",
"for",
"a",
"given",
"regular",
"expression",
"entity",
"in",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L9733-L9735 | train | Gets the regex entity role. | [
30522,
13366,
2131,
1035,
19723,
10288,
1035,
9178,
1035,
2535,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
9178,
1035,
8909,
1010,
2535,
1035,
8909,
30524,
1035,
2004,
6038,
2278,
1006,
10439... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/break_type.rb | SquareConnect.BreakType.id= | def id=(id)
if !id.nil? && id.to_s.length > 255
fail ArgumentError, "invalid value for 'id', the character length must be smaller than or equal to 255."
end
@id = id
end | ruby | def id=(id)
if !id.nil? && id.to_s.length > 255
fail ArgumentError, "invalid value for 'id', the character length must be smaller than or equal to 255."
end
@id = id
end | [
"def",
"id",
"=",
"(",
"id",
")",
"if",
"!",
"id",
".",
"nil?",
"&&",
"id",
".",
"to_s",
".",
"length",
">",
"255",
"fail",
"ArgumentError",
",",
"\"invalid value for 'id', the character length must be smaller than or equal to 255.\"",
"end",
"@id",
"=",
"id",
"... | Custom attribute writer method with validation
@param [Object] id Value to be assigned | [
"Custom",
"attribute",
"writer",
"method",
"with",
"validation"
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/models/break_type.rb#L165-L172 | train | Set the ID of the object. | [
30522,
13366,
8909,
1027,
1006,
8909,
1007,
2065,
999,
8909,
1012,
9152,
2140,
30524,
2000,
20637,
1012,
1000,
2203,
1030,
8909,
1027,
8909,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_sas_definition | def get_sas_definition(vault_base_url, storage_account_name, sas_definition_name, custom_headers:nil)
response = get_sas_definition_async(vault_base_url, storage_account_name, sas_definition_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_sas_definition(vault_base_url, storage_account_name, sas_definition_name, custom_headers:nil)
response = get_sas_definition_async(vault_base_url, storage_account_name, sas_definition_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_sas_definition",
"(",
"vault_base_url",
",",
"storage_account_name",
",",
"sas_definition_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_sas_definition_async",
"(",
"vault_base_url",
",",
"storage_account_name",
",",
"sas_definition_name",
... | Gets information about a SAS definition for the specified storage account.
This operation requires the storage/getsas permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param storage_account_name [String] The name of the storage account.
@param sas_definition_name [String] The name of the SAS definition.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [SasDefinitionBundle] operation results. | [
"Gets",
"information",
"about",
"a",
"SAS",
"definition",
"for",
"the",
"specified",
"storage",
"account",
".",
"This",
"operation",
"requires",
"the",
"storage",
"/",
"getsas",
"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#L7883-L7886 | train | Gets the sas definition. | [
30522,
13366,
2131,
1035,
21871,
1035,
6210,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
5527,
1035,
4070,
1035,
2171,
1010,
21871,
1035,
6210,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | 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_property_info | def get_property_info(name_id, property_name, timeout:60, custom_headers:nil)
response = get_property_info_async(name_id, property_name, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_property_info(name_id, property_name, timeout:60, custom_headers:nil)
response = get_property_info_async(name_id, property_name, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_property_info",
"(",
"name_id",
",",
"property_name",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_property_info_async",
"(",
"name_id",
",",
"property_name",
",",
"timeout",
":",
"timeout",
",",
"custom_he... | Gets the specified Service Fabric property.
Gets the specified Service Fabric property under a given name. This will
always return both value and metadata.
@param name_id [String] The Service Fabric name, without the 'fabric:' URI
scheme.
@param property_name [String] Specifies the name of the property to get.
@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 [PropertyInfo] operation results. | [
"Gets",
"the",
"specified",
"Service",
"Fabric",
"property",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L26842-L26845 | train | Gets the properties of a given resource group. | [
30522,
13366,
2131,
1035,
3200,
1035,
18558,
1006,
2171,
1035,
8909,
1010,
3200,
1035,
2171,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
3200,
1035,
18558,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-dynamodb/lib/aws-sdk-dynamodb/table.rb | Aws::DynamoDB.Table.update_item | def update_item(options = {})
options = options.merge(table_name: @name)
resp = @client.update_item(options)
resp.data
end | ruby | def update_item(options = {})
options = options.merge(table_name: @name)
resp = @client.update_item(options)
resp.data
end | [
"def",
"update_item",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"table_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"update_item",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
table.update_item({
key: { # required
"AttributeName" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
},
attribute_updates: {
"AttributeName" => {
value: "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
action: "ADD", # accepts ADD, PUT, DELETE
},
},
expected: {
"AttributeName" => {
value: "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
exists: false,
comparison_operator: "EQ", # accepts EQ, NE, IN, LE, LT, GE, GT, BETWEEN, NOT_NULL, NULL, CONTAINS, NOT_CONTAINS, BEGINS_WITH
attribute_value_list: ["value"], # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
},
},
conditional_operator: "AND", # accepts AND, OR
return_values: "NONE", # accepts NONE, ALL_OLD, UPDATED_OLD, ALL_NEW, UPDATED_NEW
return_consumed_capacity: "INDEXES", # accepts INDEXES, TOTAL, NONE
return_item_collection_metrics: "SIZE", # accepts SIZE, NONE
update_expression: "UpdateExpression",
condition_expression: "ConditionExpression",
expression_attribute_names: {
"ExpressionAttributeNameVariable" => "AttributeName",
},
expression_attribute_values: {
"ExpressionAttributeValueVariable" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
},
})
@param [Hash] options ({})
@option options [required, Hash<String,Types::AttributeValue>] :key
The primary key of the item to be updated. Each element consists of an
attribute name and a value for that attribute.
For the primary key, you must provide all of the attributes. For
example, with a simple primary key, you only need to provide a value
for the partition key. For a composite primary key, you must provide
values for both the partition key and the sort key.
@option options [Hash<String,Types::AttributeValueUpdate>] :attribute_updates
This is a legacy parameter. Use `UpdateExpression` instead. For more
information, see [AttributeUpdates][1] in the *Amazon DynamoDB
Developer Guide*.
[1]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributeUpdates.html
@option options [Hash<String,Types::ExpectedAttributeValue>] :expected
This is a legacy parameter. Use `ConditionExpression` instead. For
more information, see [Expected][1] in the *Amazon DynamoDB Developer
Guide*.
[1]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.Expected.html
@option options [String] :conditional_operator
This is a legacy parameter. Use `ConditionExpression` instead. For
more information, see [ConditionalOperator][1] in the *Amazon DynamoDB
Developer Guide*.
[1]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.ConditionalOperator.html
@option options [String] :return_values
Use `ReturnValues` if you want to get the item attributes as they
appear before or after they are updated. For `UpdateItem`, the valid
values are:
* `NONE` - If `ReturnValues` is not specified, or if its value is
`NONE`, then nothing is returned. (This setting is the default for
`ReturnValues`.)
* `ALL_OLD` - Returns all of the attributes of the item, as they
appeared before the UpdateItem operation.
* `UPDATED_OLD` - Returns only the updated attributes, as they
appeared before the UpdateItem operation.
* `ALL_NEW` - Returns all of the attributes of the item, as they
appear after the UpdateItem operation.
* `UPDATED_NEW` - Returns only the updated attributes, as they appear
after the UpdateItem operation.
There is no additional cost associated with requesting a return value
aside from the small network and processing overhead of receiving a
larger response. No read capacity units are consumed.
The values returned are strongly consistent.
@option options [String] :return_consumed_capacity
Determines the level of detail about provisioned throughput
consumption that is returned in the response:
* `INDEXES` - The response includes the aggregate `ConsumedCapacity`
for the operation, together with `ConsumedCapacity` for each table
and secondary index that was accessed.
Note that some operations, such as `GetItem` and `BatchGetItem`, do
not access any indexes at all. In these cases, specifying `INDEXES`
will only return `ConsumedCapacity` information for table(s).
* `TOTAL` - The response includes only the aggregate
`ConsumedCapacity` for the operation.
* `NONE` - No `ConsumedCapacity` details are included in the response.
@option options [String] :return_item_collection_metrics
Determines whether item collection metrics are returned. If set to
`SIZE`, the response includes statistics about item collections, if
any, that were modified during the operation are returned in the
response. If set to `NONE` (the default), no statistics are returned.
@option options [String] :update_expression
An expression that defines one or more attributes to be updated, the
action to be performed on them, and new value(s) for them.
The following action values are available for `UpdateExpression`.
* `SET` - Adds one or more attributes and values to an item. If any of
these attribute already exist, they are replaced by the new values.
You can also use `SET` to add or subtract from an attribute that is
of type Number. For example: `SET myNum = myNum + :val`
`SET` supports the following functions:
* `if_not_exists (path, operand)` - if the item does not contain an
attribute at the specified path, then `if_not_exists` evaluates to
operand; otherwise, it evaluates to path. You can use this
function to avoid overwriting an attribute that may already be
present in the item.
* `list_append (operand, operand)` - evaluates to a list with a new
element added to it. You can append the new element to the start
or the end of the list by reversing the order of the operands.
These function names are case-sensitive.
* `REMOVE` - Removes one or more attributes from an item.
* `ADD` - Adds the specified value to the item, if the attribute does
not already exist. If the attribute does exist, then the behavior of
`ADD` depends on the data type of the attribute:
* If the existing attribute is a number, and if `Value` is also a
number, then `Value` is mathematically added to the existing
attribute. If `Value` is a negative number, then it is subtracted
from the existing attribute.
<note markdown="1"> If you use `ADD` to increment or decrement a number value for an
item that doesn't exist before the update, DynamoDB uses `0` as
the initial value.
Similarly, if you use `ADD` for an existing item to increment or
decrement an attribute value that doesn't exist before the
update, DynamoDB uses `0` as the initial value. For example,
suppose that the item you want to update doesn't have an
attribute named *itemcount*, but you decide to `ADD` the number
`3` to this attribute anyway. DynamoDB will create the *itemcount*
attribute, set its initial value to `0`, and finally add `3` to
it. The result will be a new *itemcount* attribute in the item,
with a value of `3`.
</note>
* If the existing data type is a set and if `Value` is also a set,
then `Value` is added to the existing set. For example, if the
attribute value is the set `[1,2]`, and the `ADD` action specified
`[3]`, then the final attribute value is `[1,2,3]`. An error
occurs if an `ADD` action is specified for a set attribute and the
attribute type specified does not match the existing set type.
Both sets must have the same primitive data type. For example, if
the existing data type is a set of strings, the `Value` must also
be a set of strings.
The `ADD` action only supports Number and set data types. In
addition, `ADD` can only be used on top-level attributes, not nested
attributes.
* `DELETE` - Deletes an element from a set.
If a set of values is specified, then those values are subtracted
from the old set. For example, if the attribute value was the set
`[a,b,c]` and the `DELETE` action specifies `[a,c]`, then the final
attribute value is `[b]`. Specifying an empty set is an error.
The `DELETE` action only supports set data types. In addition,
`DELETE` can only be used on top-level attributes, not nested
attributes.
You can have many actions in a single expression, such as the
following: `SET a=:value1, b=:value2 DELETE :value3, :value4, :value5`
For more information on update expressions, see [Modifying Items and
Attributes][1] in the *Amazon DynamoDB Developer Guide*.
[1]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.Modifying.html
@option options [String] :condition_expression
A condition that must be satisfied in order for a conditional update
to succeed.
An expression can contain any of the following:
* Functions: `attribute_exists | attribute_not_exists | attribute_type
| contains | begins_with | size`
These function names are case-sensitive.
* Comparison operators: `= | <> | < | > | <= | >= | BETWEEN | IN `
* Logical operators: `AND | OR | NOT`
For more information on condition expressions, see [Specifying
Conditions][1] in the *Amazon DynamoDB Developer Guide*.
[1]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html
@option options [Hash<String,String>] :expression_attribute_names
One or more substitution tokens for attribute names in an expression.
The following are some use cases for using
`ExpressionAttributeNames`\:
* To access an attribute whose name conflicts with a DynamoDB reserved
word.
* To create a placeholder for repeating occurrences of an attribute
name in an expression.
* To prevent special characters in an attribute name from being
misinterpreted in an expression.
Use the **#** character in an expression to dereference an attribute
name. For example, consider the following attribute name:
* `Percentile`
^
The name of this attribute conflicts with a reserved word, so it
cannot be used directly in an expression. (For the complete list of
reserved words, see [Reserved Words][1] in the *Amazon DynamoDB
Developer Guide*). To work around this, you could specify the
following for `ExpressionAttributeNames`\:
* `\{"#P":"Percentile"\}`
^
You could then use this substitution in an expression, as in this
example:
* `#P = :val`
^
<note markdown="1"> Tokens that begin with the **\:** character are *expression attribute
values*, which are placeholders for the actual value at runtime.
</note>
For more information on expression attribute names, see [Accessing
Item Attributes][2] in the *Amazon DynamoDB Developer Guide*.
[1]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html
[2]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html
@option options [Hash<String,Types::AttributeValue>] :expression_attribute_values
One or more values that can be substituted in an expression.
Use the **\:** (colon) character in an expression to dereference an
attribute value. For example, suppose that you wanted to check whether
the value of the *ProductStatus* attribute was one of the following:
`Available | Backordered | Discontinued`
You would first need to specify `ExpressionAttributeValues` as
follows:
`\{ ":avail":\{"S":"Available"\}, ":back":\{"S":"Backordered"\},
":disc":\{"S":"Discontinued"\} \}`
You could then use these values in an expression, such as this:
`ProductStatus IN (:avail, :back, :disc)`
For more information on expression attribute values, see [Specifying
Conditions][1] in the *Amazon DynamoDB Developer Guide*.
[1]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html
@return [Types::UpdateItemOutput] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-dynamodb/lib/aws-sdk-dynamodb/table.rb#L2088-L2092 | train | Update an item in the table | [
30522,
13366,
10651,
1035,
8875,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
2795,
1035,
2171,
1024,
1030,
2171,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
10651,
1035,
8875,
1006,
7047,
1007,
24501,
2361,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_policy_insights/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_states.rb | Azure::PolicyInsights::Mgmt::V2018_04_04.PolicyStates.list_query_results_for_policy_set_definition | def list_query_results_for_policy_set_definition(policy_states_resource, subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
response = list_query_results_for_policy_set_definition_async(policy_states_resource, subscription_id, policy_set_definition_name, query_options:query_options, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_query_results_for_policy_set_definition(policy_states_resource, subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
response = list_query_results_for_policy_set_definition_async(policy_states_resource, subscription_id, policy_set_definition_name, query_options:query_options, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_query_results_for_policy_set_definition",
"(",
"policy_states_resource",
",",
"subscription_id",
",",
"policy_set_definition_name",
",",
"query_options",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_query_results_for_policy_set_definit... | Queries policy states for the subscription level policy set definition.
@param policy_states_resource [PolicyStatesResource] The virtual resource
under PolicyStates resource type. In a given time range, 'latest' represents
the latest policy state(s), whereas 'default' represents all policy state(s).
Possible values include: 'default', 'latest'
@param subscription_id [String] Microsoft Azure subscription ID.
@param policy_set_definition_name [String] Policy set definition name.
@param query_options [QueryOptions] Additional parameters for the operation
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [PolicyStatesQueryResults] operation results. | [
"Queries",
"policy",
"states",
"for",
"the",
"subscription",
"level",
"policy",
"set",
"definition",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_policy_insights/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_states.rb#L1003-L1006 | train | Gets the policy states for the policy set definition. | [
30522,
13366,
2862,
1035,
23032,
1035,
3463,
1035,
2005,
1035,
3343,
1035,
2275,
1035,
6210,
1006,
3343,
1035,
2163,
1035,
7692,
1010,
15002,
1035,
8909,
1010,
3343,
1035,
2275,
1035,
6210,
1035,
2171,
1010,
23032,
1035,
7047,
1024,
9152,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-core/lib/aws-sdk-core/shared_config.rb | Aws.SharedConfig.assume_role_credentials_from_config | def assume_role_credentials_from_config(opts = {})
p = opts.delete(:profile) || @profile_name
chain_config = opts.delete(:chain_config)
credentials = assume_role_from_profile(@parsed_credentials, p, opts, chain_config)
if @parsed_config
credentials ||= assume_role_from_profile(@parsed_config, p, opts, chain_config)
end
credentials
end | ruby | def assume_role_credentials_from_config(opts = {})
p = opts.delete(:profile) || @profile_name
chain_config = opts.delete(:chain_config)
credentials = assume_role_from_profile(@parsed_credentials, p, opts, chain_config)
if @parsed_config
credentials ||= assume_role_from_profile(@parsed_config, p, opts, chain_config)
end
credentials
end | [
"def",
"assume_role_credentials_from_config",
"(",
"opts",
"=",
"{",
"}",
")",
"p",
"=",
"opts",
".",
"delete",
"(",
":profile",
")",
"||",
"@profile_name",
"chain_config",
"=",
"opts",
".",
"delete",
"(",
":chain_config",
")",
"credentials",
"=",
"assume_role... | Attempts to assume a role from shared config or shared credentials file.
Will always attempt first to assume a role from the shared credentials
file, if present. | [
"Attempts",
"to",
"assume",
"a",
"role",
"from",
"shared",
"config",
"or",
"shared",
"credentials",
"file",
".",
"Will",
"always",
"attempt",
"first",
"to",
"assume",
"a",
"role",
"from",
"the",
"shared",
"credentials",
"file",
"if",
"present",
"."
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-core/lib/aws-sdk-core/shared_config.rb#L114-L122 | train | Assume the credentials from the parsed_credentials and parsed_config | [
30522,
13366,
7868,
1035,
2535,
1035,
22496,
1035,
2013,
1035,
9530,
8873,
2290,
1006,
23569,
2015,
1027,
1063,
1065,
1007,
1052,
1027,
23569,
2015,
1012,
3972,
12870,
1006,
1024,
6337,
1007,
1064,
1064,
1030,
6337,
1035,
2171,
4677,
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... |
puppetlabs/puppet | lib/puppet/environments.rb | Puppet::Environments.Cached.add_entry | def add_entry(name, cache_entry)
Puppet.debug {"Caching environment '#{name}' #{cache_entry.label}"}
@cache[name] = cache_entry
expires = cache_entry.expires
@expirations.add(expires)
if @next_expiration > expires
@next_expiration = expires
end
end | ruby | def add_entry(name, cache_entry)
Puppet.debug {"Caching environment '#{name}' #{cache_entry.label}"}
@cache[name] = cache_entry
expires = cache_entry.expires
@expirations.add(expires)
if @next_expiration > expires
@next_expiration = expires
end
end | [
"def",
"add_entry",
"(",
"name",
",",
"cache_entry",
")",
"Puppet",
".",
"debug",
"{",
"\"Caching environment '#{name}' #{cache_entry.label}\"",
"}",
"@cache",
"[",
"name",
"]",
"=",
"cache_entry",
"expires",
"=",
"cache_entry",
".",
"expires",
"@expirations",
".",
... | Adds a cache entry to the cache | [
"Adds",
"a",
"cache",
"entry",
"to",
"the",
"cache"
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/environments.rb#L365-L373 | train | Add an entry to the cache | [
30522,
13366,
5587,
1035,
4443,
1006,
2171,
1010,
17053,
1035,
4443,
1007,
30524,
8450,
4044,
1005,
1001,
1063,
2171,
1065,
1005,
1001,
1063,
17053,
1035,
4443,
1012,
3830,
1065,
1000,
1065,
1030,
17053,
1031,
2171,
1033,
1027,
17053,
1035,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_storage/lib/2018-07-01/generated/azure_mgmt_storage/blob_containers.rb | Azure::Storage::Mgmt::V2018_07_01.BlobContainers.set_legal_hold_with_http_info | def set_legal_hold_with_http_info(resource_group_name, account_name, container_name, legal_hold, custom_headers:nil)
set_legal_hold_async(resource_group_name, account_name, container_name, legal_hold, custom_headers:custom_headers).value!
end | ruby | def set_legal_hold_with_http_info(resource_group_name, account_name, container_name, legal_hold, custom_headers:nil)
set_legal_hold_async(resource_group_name, account_name, container_name, legal_hold, custom_headers:custom_headers).value!
end | [
"def",
"set_legal_hold_with_http_info",
"(",
"resource_group_name",
",",
"account_name",
",",
"container_name",
",",
"legal_hold",
",",
"custom_headers",
":",
"nil",
")",
"set_legal_hold_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"container_name",
",",
... | Sets legal hold tags. Setting the same tag results in an idempotent
operation. SetLegalHold follows an append pattern and does not clear out the
existing tags that are not specified in the request.
@param resource_group_name [String] The name of the resource group within the
user's subscription. The name is case insensitive.
@param account_name [String] The name of the storage account within the
specified resource group. Storage account names must be between 3 and 24
characters in length and use numbers and lower-case letters only.
@param container_name [String] The name of the blob container within the
specified storage account. Blob container names must be between 3 and 63
characters in length and use numbers, lower-case letters and dash (-) only.
Every dash (-) character must be immediately preceded and followed by a
letter or number.
@param legal_hold [LegalHold] The LegalHold property that will be set to a
blob container.
@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. | [
"Sets",
"legal",
"hold",
"tags",
".",
"Setting",
"the",
"same",
"tag",
"results",
"in",
"an",
"idempotent",
"operation",
".",
"SetLegalHold",
"follows",
"an",
"append",
"pattern",
"and",
"does",
"not",
"clear",
"out",
"the",
"existing",
"tags",
"that",
"are"... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_storage/lib/2018-07-01/generated/azure_mgmt_storage/blob_containers.rb#L720-L722 | train | Sets the legal hold of a container. | [
30522,
13366,
2275,
1035,
3423,
1035,
2907,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
11661,
1035,
2171,
1010,
3423,
1035,
2907,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mojombo/chronic | lib/chronic/parser.rb | Chronic.Parser.guess | def guess(span, mode = :middle)
return span if not mode
return span.begin + span.width / 2 if span.width > 1 and (mode == true or mode == :middle)
return span.end if mode == :end
span.begin
end | ruby | def guess(span, mode = :middle)
return span if not mode
return span.begin + span.width / 2 if span.width > 1 and (mode == true or mode == :middle)
return span.end if mode == :end
span.begin
end | [
"def",
"guess",
"(",
"span",
",",
"mode",
"=",
":middle",
")",
"return",
"span",
"if",
"not",
"mode",
"return",
"span",
".",
"begin",
"+",
"span",
".",
"width",
"/",
"2",
"if",
"span",
".",
"width",
">",
"1",
"and",
"(",
"mode",
"==",
"true",
"or... | Guess a specific time within the given span.
span - The Chronic::Span object to calcuate a guess from.
Returns a new Time object. | [
"Guess",
"a",
"specific",
"time",
"within",
"the",
"given",
"span",
"."
] | 2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c | https://github.com/mojombo/chronic/blob/2b1eae7ec440d767c09e0b1a7f0e9bcf30ce1d6c/lib/chronic/parser.rb#L152-L157 | train | Returns a new span with the best guess | [
30522,
30524,
1024,
2690,
1007,
2709,
8487,
1012,
2203,
2065,
5549,
1027,
1027,
1024,
2203,
8487,
1012,
4088,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb | Azure::CognitiveServices::ComputerVision::V2_0.ComputerVisionClient.analyze_image_in_stream_with_http_info | def analyze_image_in_stream_with_http_info(image, visual_features:nil, details:nil, language:nil, custom_headers:nil)
analyze_image_in_stream_async(image, visual_features:visual_features, details:details, language:language, custom_headers:custom_headers).value!
end | ruby | def analyze_image_in_stream_with_http_info(image, visual_features:nil, details:nil, language:nil, custom_headers:nil)
analyze_image_in_stream_async(image, visual_features:visual_features, details:details, language:language, custom_headers:custom_headers).value!
end | [
"def",
"analyze_image_in_stream_with_http_info",
"(",
"image",
",",
"visual_features",
":",
"nil",
",",
"details",
":",
"nil",
",",
"language",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"analyze_image_in_stream_async",
"(",
"image",
",",
"visual_features",... | This operation extracts a rich set of visual features based on the image
content.
Two input methods are supported -- (1) Uploading an image or (2) specifying
an image URL. Within your request, there is an optional parameter to allow
you to choose which features to return. By default, image categories are
returned in the response.
A successful response will be returned in JSON. If the request failed, the
response will contain an error code and a message to help understand what
went wrong.
@param image An image stream.
@param visual_features [Array<VisualFeatureTypes>] A string indicating what
visual feature types to return. Multiple values should be comma-separated.
Valid visual feature types include: Categories - categorizes image content
according to a taxonomy defined in documentation. Tags - tags the image with
a detailed list of words related to the image content. Description -
describes the image content with a complete English sentence. Faces - detects
if faces are present. If present, generate coordinates, gender and age.
ImageType - detects if image is clipart or a line drawing. Color - determines
the accent color, dominant color, and whether an image is black&white. Adult
- detects if the image is pornographic in nature (depicts nudity or a sex
act). Sexually suggestive content is also detected. Objects - detects
various objects within an image, including the approximate location. The
Objects argument is only available in English. Brands - detects various
brands within an image, including the approximate location. The Brands
argument is only available in English.
@param details [Array<Details>] A string indicating which domain-specific
details to return. Multiple values should be comma-separated. Valid visual
feature types include: Celebrities - identifies celebrities if detected in
the image, Landmarks - identifies notable landmarks in the image.
@param language [Enum] The desired language for output generation. If this
parameter is not specified, the default value is "en".Supported
languages:en - English, Default. es - Spanish, ja - Japanese, pt -
Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es',
'ja', 'pt', 'zh'
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"This",
"operation",
"extracts",
"a",
"rich",
"set",
"of",
"visual",
"features",
"based",
"on",
"the",
"image",
"content",
".",
"Two",
"input",
"methods",
"are",
"supported",
"--",
"(",
"1",
")",
"Uploading",
"an",
"image",
"or",
"(",
"2",
")",
"specifyi... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb#L1867-L1869 | train | Analyze an image in a binary stream. | [
30522,
13366,
17908,
1035,
3746,
1035,
1999,
1035,
5460,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
3746,
1010,
5107,
1035,
2838,
1024,
9152,
2140,
1010,
4751,
1024,
9152,
2140,
1010,
2653,
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... |
puppetlabs/puppet | lib/puppet/util/windows/registry.rb | Puppet::Util::Windows.Registry.read | def read(key, name_ptr, *rtype)
result = nil
query_value_ex(key, name_ptr) do |type, data_ptr, byte_length|
unless rtype.empty? or rtype.include?(type)
raise TypeError, _("Type mismatch (expect %{rtype} but %{type} present)") % { rtype: rtype.inspect, type: type }
end
string_length = 0
# buffer is raw bytes, *not* chars - less a NULL terminator
string_length = (byte_length / FFI.type_size(:wchar)) - 1 if byte_length > 0
begin
case type
when Win32::Registry::REG_SZ, Win32::Registry::REG_EXPAND_SZ
result = [ type, data_ptr.read_wide_string(string_length) ]
when Win32::Registry::REG_MULTI_SZ
result = [ type, data_ptr.read_wide_string(string_length).split(/\0/) ]
when Win32::Registry::REG_BINARY
result = [ type, data_ptr.read_bytes(byte_length) ]
when Win32::Registry::REG_DWORD
result = [ type, data_ptr.read_dword ]
when Win32::Registry::REG_DWORD_BIG_ENDIAN
result = [ type, data_ptr.order(:big).read_dword ]
when Win32::Registry::REG_QWORD
result = [ type, data_ptr.read_qword ]
else
raise TypeError, _("Type %{type} is not supported.") % { type: type }
end
rescue IndexError => ex
raise if (ex.message !~ /^Memory access .* is out of bounds$/i)
parent_key_name = key.parent ? "#{key.parent.keyname}\\" : ""
Puppet.warning _("A value in the registry key %{parent_key_name}%{key} is corrupt or invalid") % { parent_key_name: parent_key_name, key: key.keyname }
end
end
result
end | ruby | def read(key, name_ptr, *rtype)
result = nil
query_value_ex(key, name_ptr) do |type, data_ptr, byte_length|
unless rtype.empty? or rtype.include?(type)
raise TypeError, _("Type mismatch (expect %{rtype} but %{type} present)") % { rtype: rtype.inspect, type: type }
end
string_length = 0
# buffer is raw bytes, *not* chars - less a NULL terminator
string_length = (byte_length / FFI.type_size(:wchar)) - 1 if byte_length > 0
begin
case type
when Win32::Registry::REG_SZ, Win32::Registry::REG_EXPAND_SZ
result = [ type, data_ptr.read_wide_string(string_length) ]
when Win32::Registry::REG_MULTI_SZ
result = [ type, data_ptr.read_wide_string(string_length).split(/\0/) ]
when Win32::Registry::REG_BINARY
result = [ type, data_ptr.read_bytes(byte_length) ]
when Win32::Registry::REG_DWORD
result = [ type, data_ptr.read_dword ]
when Win32::Registry::REG_DWORD_BIG_ENDIAN
result = [ type, data_ptr.order(:big).read_dword ]
when Win32::Registry::REG_QWORD
result = [ type, data_ptr.read_qword ]
else
raise TypeError, _("Type %{type} is not supported.") % { type: type }
end
rescue IndexError => ex
raise if (ex.message !~ /^Memory access .* is out of bounds$/i)
parent_key_name = key.parent ? "#{key.parent.keyname}\\" : ""
Puppet.warning _("A value in the registry key %{parent_key_name}%{key} is corrupt or invalid") % { parent_key_name: parent_key_name, key: key.keyname }
end
end
result
end | [
"def",
"read",
"(",
"key",
",",
"name_ptr",
",",
"*",
"rtype",
")",
"result",
"=",
"nil",
"query_value_ex",
"(",
"key",
",",
"name_ptr",
")",
"do",
"|",
"type",
",",
"data_ptr",
",",
"byte_length",
"|",
"unless",
"rtype",
".",
"empty?",
"or",
"rtype",
... | Read a registry value named name and return array of
[ type, data ].
When name is nil, the `default' value is read.
type is value type. (see Win32::Registry::Constants module)
data is value data, its class is:
:REG_SZ, REG_EXPAND_SZ
String
:REG_MULTI_SZ
Array of String
:REG_DWORD, REG_DWORD_BIG_ENDIAN, REG_QWORD
Integer
:REG_BINARY
String (contains binary data)
When rtype is specified, the value type must be included by
rtype array, or TypeError is raised. | [
"Read",
"a",
"registry",
"value",
"named",
"name",
"and",
"return",
"array",
"of",
"[",
"type",
"data",
"]",
".",
"When",
"name",
"is",
"nil",
"the",
"default",
"value",
"is",
"read",
".",
"type",
"is",
"value",
"type",
".",
"(",
"see",
"Win32",
"::"... | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/util/windows/registry.rb#L220-L257 | train | Read a value from the registry. | [
30522,
13366,
3191,
1006,
3145,
1010,
2171,
1035,
13866,
2099,
1010,
1008,
19387,
18863,
1007,
2765,
1027,
9152,
2140,
23032,
1035,
3643,
1035,
4654,
1006,
3145,
1010,
2171,
1035,
13866,
2099,
1007,
2079,
1064,
2828,
1010,
2951,
1035,
13866... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sensu/sensu | lib/sensu/daemon.rb | Sensu.Daemon.validate_settings! | def validate_settings!(settings)
if settings.errors.empty?
puts "configuration is valid"
exit
else
puts "configuration is invalid"
puts Sensu::JSON.dump({:errors => @settings.errors}, :pretty => true)
exit 2
end
end | ruby | def validate_settings!(settings)
if settings.errors.empty?
puts "configuration is valid"
exit
else
puts "configuration is invalid"
puts Sensu::JSON.dump({:errors => @settings.errors}, :pretty => true)
exit 2
end
end | [
"def",
"validate_settings!",
"(",
"settings",
")",
"if",
"settings",
".",
"errors",
".",
"empty?",
"puts",
"\"configuration is valid\"",
"exit",
"else",
"puts",
"\"configuration is invalid\"",
"puts",
"Sensu",
"::",
"JSON",
".",
"dump",
"(",
"{",
":errors",
"=>",
... | Determine if the Sensu settings are valid, if there are load or
validation errors, and immediately exit the process with the
appropriate exit status code. This method is used to determine
if the latest configuration changes are valid prior to
restarting the Sensu service, triggered by a CLI argument, e.g.
`--validate_config`.
@param settings [Object] | [
"Determine",
"if",
"the",
"Sensu",
"settings",
"are",
"valid",
"if",
"there",
"are",
"load",
"or",
"validation",
"errors",
"and",
"immediately",
"exit",
"the",
"process",
"with",
"the",
"appropriate",
"exit",
"status",
"code",
".",
"This",
"method",
"is",
"u... | 51319e4b58c8d9986f101ad71ff729aa3e51e951 | https://github.com/sensu/sensu/blob/51319e4b58c8d9986f101ad71ff729aa3e51e951/lib/sensu/daemon.rb#L126-L135 | train | Validate the configuration | [
30522,
13366,
9398,
3686,
1035,
10906,
999,
1006,
10906,
1007,
2065,
10906,
1012,
10697,
1012,
4064,
1029,
8509,
1000,
9563,
2003,
9398,
1000,
6164,
2842,
8509,
1000,
9563,
2003,
19528,
1000,
8509,
12411,
6342,
1024,
1024,
1046,
3385,
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... |
Dynamoid/dynamoid | lib/dynamoid/document.rb | Dynamoid.Document.reload | def reload
options = { consistent_read: true }
if self.class.range_key
options[:range_key] = range_value
end
self.attributes = self.class.find(hash_key, options).attributes
@associations.values.each(&:reset)
self
end | ruby | def reload
options = { consistent_read: true }
if self.class.range_key
options[:range_key] = range_value
end
self.attributes = self.class.find(hash_key, options).attributes
@associations.values.each(&:reset)
self
end | [
"def",
"reload",
"options",
"=",
"{",
"consistent_read",
":",
"true",
"}",
"if",
"self",
".",
"class",
".",
"range_key",
"options",
"[",
":range_key",
"]",
"=",
"range_value",
"end",
"self",
".",
"attributes",
"=",
"self",
".",
"class",
".",
"find",
"(",... | An object is equal to another object if their ids are equal.
@since 0.2.0
Reload an object from the database -- if you suspect the object has changed in the datastore and you need those
changes to be reflected immediately, you would call this method. This is a consistent read.
@return [Dynamoid::Document] the document this method was called on
@since 0.2.0 | [
"An",
"object",
"is",
"equal",
"to",
"another",
"object",
"if",
"their",
"ids",
"are",
"equal",
"."
] | 9e3d006b039e45877b003564ded65509b10b6354 | https://github.com/Dynamoid/dynamoid/blob/9e3d006b039e45877b003564ded65509b10b6354/lib/dynamoid/document.rb#L374-L384 | train | Reloads the object from the database. | [
30522,
13366,
2128,
11066,
7047,
1027,
1063,
8335,
1035,
3191,
1024,
2995,
1065,
2065,
2969,
1012,
2465,
1012,
2846,
1035,
3145,
7047,
1031,
1024,
2846,
1035,
3145,
1033,
1027,
2846,
1035,
3643,
2203,
2969,
1012,
12332,
1027,
2969,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/service_endpoint_policy_definitions.rb | Azure::Network::Mgmt::V2018_08_01.ServiceEndpointPolicyDefinitions.create_or_update | def create_or_update(resource_group_name, service_endpoint_policy_name, service_endpoint_policy_definition_name, service_endpoint_policy_definitions, custom_headers:nil)
response = create_or_update_async(resource_group_name, service_endpoint_policy_name, service_endpoint_policy_definition_name, service_endpoint_policy_definitions, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_or_update(resource_group_name, service_endpoint_policy_name, service_endpoint_policy_definition_name, service_endpoint_policy_definitions, custom_headers:nil)
response = create_or_update_async(resource_group_name, service_endpoint_policy_name, service_endpoint_policy_definition_name, service_endpoint_policy_definitions, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_or_update",
"(",
"resource_group_name",
",",
"service_endpoint_policy_name",
",",
"service_endpoint_policy_definition_name",
",",
"service_endpoint_policy_definitions",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_or_update_async",
"(",
"resou... | Creates or updates a service endpoint policy definition in the specified
service endpoint policy.
@param resource_group_name [String] The name of the resource group.
@param service_endpoint_policy_name [String] The name of the service endpoint
policy.
@param service_endpoint_policy_definition_name [String] The name of the
service endpoint policy definition name.
@param service_endpoint_policy_definitions [ServiceEndpointPolicyDefinition]
Parameters supplied to the create or update service endpoint policy
operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ServiceEndpointPolicyDefinition] operation results. | [
"Creates",
"or",
"updates",
"a",
"service",
"endpoint",
"policy",
"definition",
"in",
"the",
"specified",
"service",
"endpoint",
"policy",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/service_endpoint_policy_definitions.rb#L190-L193 | train | Creates or updates a service endpoint policy. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2203,
8400,
1035,
3343,
1035,
2171,
1010,
2326,
1035,
2203,
8400,
1035,
3343,
1035,
6210,
1035,
2171,
1010,
2326,
1035,
2203,
8400,
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... |
mikker/passwordless | lib/passwordless/controller_helpers.rb | Passwordless.ControllerHelpers.sign_out | def sign_out(authenticatable_class)
key = cookie_name(authenticatable_class)
cookies.encrypted.permanent[key] = {value: nil}
cookies.delete(key)
true
end | ruby | def sign_out(authenticatable_class)
key = cookie_name(authenticatable_class)
cookies.encrypted.permanent[key] = {value: nil}
cookies.delete(key)
true
end | [
"def",
"sign_out",
"(",
"authenticatable_class",
")",
"key",
"=",
"cookie_name",
"(",
"authenticatable_class",
")",
"cookies",
".",
"encrypted",
".",
"permanent",
"[",
"key",
"]",
"=",
"{",
"value",
":",
"nil",
"}",
"cookies",
".",
"delete",
"(",
"key",
")... | Signs out user by deleting their encrypted cookie.
@param (see #authenticate_by_cookie)
@return [boolean] Always true | [
"Signs",
"out",
"user",
"by",
"deleting",
"their",
"encrypted",
"cookie",
"."
] | 80d3e00c78114aed01f336514a236dfc17d0a91a | https://github.com/mikker/passwordless/blob/80d3e00c78114aed01f336514a236dfc17d0a91a/lib/passwordless/controller_helpers.rb#L48-L53 | train | sign out the user s session | [
30522,
13366,
3696,
1035,
2041,
1006,
14469,
27892,
1035,
2465,
1007,
3145,
1027,
17387,
1035,
2171,
1006,
14469,
27892,
1035,
2465,
1007,
16324,
1012,
4372,
26775,
22571,
3064,
1012,
4568,
1031,
3145,
1033,
1027,
1063,
3643,
1024,
9152,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
meew0/discordrb | lib/discordrb/data/role.rb | Discordrb.Role.update_data | def update_data(new_data)
@name = new_data[:name] || new_data['name'] || @name
@hoist = new_data['hoist'] unless new_data['hoist'].nil?
@hoist = new_data[:hoist] unless new_data[:hoist].nil?
@colour = new_data[:colour] || (new_data['color'] ? ColourRGB.new(new_data['color']) : @colour)
end | ruby | def update_data(new_data)
@name = new_data[:name] || new_data['name'] || @name
@hoist = new_data['hoist'] unless new_data['hoist'].nil?
@hoist = new_data[:hoist] unless new_data[:hoist].nil?
@colour = new_data[:colour] || (new_data['color'] ? ColourRGB.new(new_data['color']) : @colour)
end | [
"def",
"update_data",
"(",
"new_data",
")",
"@name",
"=",
"new_data",
"[",
":name",
"]",
"||",
"new_data",
"[",
"'name'",
"]",
"||",
"@name",
"@hoist",
"=",
"new_data",
"[",
"'hoist'",
"]",
"unless",
"new_data",
"[",
"'hoist'",
"]",
".",
"nil?",
"@hoist"... | Updates the data cache from a hash containing data
@note For internal use only
@!visibility private | [
"Updates",
"the",
"data",
"cache",
"from",
"a",
"hash",
"containing",
"data"
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/data/role.rb#L100-L105 | train | Update the data from the given hash | [
30522,
13366,
10651,
1035,
2951,
1006,
2047,
1035,
2951,
1007,
1030,
2171,
1027,
2047,
1035,
2951,
1031,
1024,
2171,
1033,
1064,
1064,
2047,
1035,
2951,
1031,
1005,
2171,
1005,
1033,
1064,
1064,
1030,
2171,
1030,
7570,
2923,
1027,
2047,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-iam/lib/aws-sdk-iam/group.rb | Aws::IAM.Group.policies | def policies(options = {})
batches = Enumerator.new do |y|
options = options.merge(group_name: @name)
resp = @client.list_group_policies(options)
resp.each_page do |page|
batch = []
page.data.policy_names.each do |p|
batch << GroupPolicy.new(
group_name: @name,
name: p,
client: @client
)
end
y.yield(batch)
end
end
GroupPolicy::Collection.new(batches)
end | ruby | def policies(options = {})
batches = Enumerator.new do |y|
options = options.merge(group_name: @name)
resp = @client.list_group_policies(options)
resp.each_page do |page|
batch = []
page.data.policy_names.each do |p|
batch << GroupPolicy.new(
group_name: @name,
name: p,
client: @client
)
end
y.yield(batch)
end
end
GroupPolicy::Collection.new(batches)
end | [
"def",
"policies",
"(",
"options",
"=",
"{",
"}",
")",
"batches",
"=",
"Enumerator",
".",
"new",
"do",
"|",
"y",
"|",
"options",
"=",
"options",
".",
"merge",
"(",
"group_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"list_group_policies",
"("... | @example Request syntax with placeholder values
group.policies()
@param [Hash] options ({})
@return [GroupPolicy::Collection] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-iam/lib/aws-sdk-iam/group.rb#L487-L504 | train | Returns a list of all policies in the group | [
30522,
13366,
6043,
1006,
7047,
1027,
1063,
1065,
1007,
14108,
2229,
1027,
4372,
17897,
16259,
1012,
2047,
2079,
1064,
1061,
1064,
7047,
1027,
7047,
1012,
13590,
1006,
2177,
1035,
2171,
1024,
1030,
2171,
1007,
24501,
2361,
1027,
1030,
7396,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
httprb/http | lib/http/request.rb | HTTP.Request.stream | def stream(socket)
include_proxy_headers if using_proxy? && !@uri.https?
Request::Writer.new(socket, body, headers, headline).stream
end | ruby | def stream(socket)
include_proxy_headers if using_proxy? && !@uri.https?
Request::Writer.new(socket, body, headers, headline).stream
end | [
"def",
"stream",
"(",
"socket",
")",
"include_proxy_headers",
"if",
"using_proxy?",
"&&",
"!",
"@uri",
".",
"https?",
"Request",
"::",
"Writer",
".",
"new",
"(",
"socket",
",",
"body",
",",
"headers",
",",
"headline",
")",
".",
"stream",
"end"
] | Stream the request to a socket | [
"Stream",
"the",
"request",
"to",
"a",
"socket"
] | f37a10ea4fab3ee411907ea2e4251ddf0ca33a93 | https://github.com/httprb/http/blob/f37a10ea4fab3ee411907ea2e4251ddf0ca33a93/lib/http/request.rb#L116-L119 | train | Stream the response to a socket. | [
30522,
13366,
5460,
1006,
22278,
1007,
2421,
1035,
24540,
1035,
20346,
2015,
2065,
2478,
1035,
24540,
1029,
1004,
1004,
999,
1030,
24471,
2072,
1012,
16770,
1029,
5227,
1024,
1024,
3213,
1012,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
tongueroo/jets | lib/jets/resource/child_stack/app_class.rb | Jets::Resource::ChildStack.AppClass.app_logical_id | def app_logical_id
regexp = Regexp.new(".*#{Jets.config.project_namespace}-app-")
controller_name = @path.sub(regexp, '').sub('.yml', '')
controller_name.underscore.camelize
end | ruby | def app_logical_id
regexp = Regexp.new(".*#{Jets.config.project_namespace}-app-")
controller_name = @path.sub(regexp, '').sub('.yml', '')
controller_name.underscore.camelize
end | [
"def",
"app_logical_id",
"regexp",
"=",
"Regexp",
".",
"new",
"(",
"\".*#{Jets.config.project_namespace}-app-\"",
")",
"controller_name",
"=",
"@path",
".",
"sub",
"(",
"regexp",
",",
"''",
")",
".",
"sub",
"(",
"'.yml'",
",",
"''",
")",
"controller_name",
"."... | map the path to a camelized logical_id. Example:
/tmp/jets/demo/templates/demo-dev-2-posts_controller.yml to
PostsController | [
"map",
"the",
"path",
"to",
"a",
"camelized",
"logical_id",
".",
"Example",
":",
"/",
"tmp",
"/",
"jets",
"/",
"demo",
"/",
"templates",
"/",
"demo",
"-",
"dev",
"-",
"2",
"-",
"posts_controller",
".",
"yml",
"to",
"PostsController"
] | 46943a519224067e58aa3e2d5656e3ca083150f9 | https://github.com/tongueroo/jets/blob/46943a519224067e58aa3e2d5656e3ca083150f9/lib/jets/resource/child_stack/app_class.rb#L93-L97 | train | Returns the logical ID of the controller. | [
30522,
13366,
10439,
1035,
11177,
1035,
8909,
19723,
10288,
2361,
1027,
19723,
10288,
2361,
1012,
2047,
1006,
1000,
1012,
1008,
1001,
1063,
9924,
1012,
9530,
8873,
2290,
1012,
2622,
1035,
3415,
15327,
1065,
1011,
10439,
1011,
1000,
1007,
11... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2017-12-01/generated/azure_mgmt_compute/virtual_machine_scale_set_vms.rb | Azure::Compute::Mgmt::V2017_12_01.VirtualMachineScaleSetVMs.begin_delete_with_http_info | def begin_delete_with_http_info(resource_group_name, vm_scale_set_name, instance_id, custom_headers:nil)
begin_delete_async(resource_group_name, vm_scale_set_name, instance_id, custom_headers:custom_headers).value!
end | ruby | def begin_delete_with_http_info(resource_group_name, vm_scale_set_name, instance_id, custom_headers:nil)
begin_delete_async(resource_group_name, vm_scale_set_name, instance_id, custom_headers:custom_headers).value!
end | [
"def",
"begin_delete_with_http_info",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"instance_id",
",",
"custom_headers",
":",
"nil",
")",
"begin_delete_async",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"instance_id",
",",
"custom_headers",
"... | Deletes a virtual machine from a VM scale set.
@param resource_group_name [String] The name of the resource group.
@param vm_scale_set_name [String] The name of the VM scale set.
@param instance_id [String] The instance ID of the virtual machine.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Deletes",
"a",
"virtual",
"machine",
"from",
"a",
"VM",
"scale",
"set",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2017-12-01/generated/azure_mgmt_compute/virtual_machine_scale_set_vms.rb#L1223-L1225 | train | Deletes a virtual machine from a VM scale set. | [
30522,
13366,
4088,
1035,
3972,
12870,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
4094,
1035,
2275,
1035,
2171,
1010,
6013,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2018-04-01/generated/azure_mgmt_compute/virtual_machine_images.rb | Azure::Compute::Mgmt::V2018_04_01.VirtualMachineImages.get_with_http_info | def get_with_http_info(location, publisher_name, offer, skus, version, custom_headers:nil)
get_async(location, publisher_name, offer, skus, version, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(location, publisher_name, offer, skus, version, custom_headers:nil)
get_async(location, publisher_name, offer, skus, version, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"location",
",",
"publisher_name",
",",
"offer",
",",
"skus",
",",
"version",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"location",
",",
"publisher_name",
",",
"offer",
",",
"skus",
",",
"version",
",",
"cust... | Gets a virtual machine image.
@param location [String] The name of a supported Azure region.
@param publisher_name [String] A valid image publisher.
@param offer [String] A valid image publisher offer.
@param skus [String] A valid image SKU.
@param version [String] A valid image SKU version.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"a",
"virtual",
"machine",
"image",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2018-04-01/generated/azure_mgmt_compute/virtual_machine_images.rb#L55-L57 | train | Gets the specified chunk of the image. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
3295,
1010,
6674,
1035,
2171,
1010,
3749,
1010,
15315,
2271,
1010,
2544,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
2004,
6038,
2278,
1006,
3295,
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... |
sensu/sensu | lib/sensu/daemon.rb | Sensu.Daemon.setup_spawn | def setup_spawn
@logger.info("configuring sensu spawn", :settings => @settings[:sensu][:spawn])
threadpool_size = @settings[:sensu][:spawn][:limit] + 10
@logger.debug("setting eventmachine threadpool size", :size => threadpool_size)
EM::threadpool_size = threadpool_size
Spawn.setup(@settings[:sensu][:spawn])
end | ruby | def setup_spawn
@logger.info("configuring sensu spawn", :settings => @settings[:sensu][:spawn])
threadpool_size = @settings[:sensu][:spawn][:limit] + 10
@logger.debug("setting eventmachine threadpool size", :size => threadpool_size)
EM::threadpool_size = threadpool_size
Spawn.setup(@settings[:sensu][:spawn])
end | [
"def",
"setup_spawn",
"@logger",
".",
"info",
"(",
"\"configuring sensu spawn\"",
",",
":settings",
"=>",
"@settings",
"[",
":sensu",
"]",
"[",
":spawn",
"]",
")",
"threadpool_size",
"=",
"@settings",
"[",
":sensu",
"]",
"[",
":spawn",
"]",
"[",
":limit",
"]... | Set up Sensu spawn, creating a worker to create, control, and
limit spawned child processes. This method adjusts the
EventMachine thread pool size to accommodate the concurrent
process spawn limit and other Sensu process operations.
https://github.com/sensu/sensu-spawn | [
"Set",
"up",
"Sensu",
"spawn",
"creating",
"a",
"worker",
"to",
"create",
"control",
"and",
"limit",
"spawned",
"child",
"processes",
".",
"This",
"method",
"adjusts",
"the",
"EventMachine",
"thread",
"pool",
"size",
"to",
"accommodate",
"the",
"concurrent",
"... | 51319e4b58c8d9986f101ad71ff729aa3e51e951 | https://github.com/sensu/sensu/blob/51319e4b58c8d9986f101ad71ff729aa3e51e951/lib/sensu/daemon.rb#L203-L209 | train | setup the sensu spawn | [
30522,
13366,
16437,
1035,
25645,
1030,
8833,
4590,
1012,
18558,
1006,
1000,
9530,
8873,
27390,
2075,
12411,
6342,
25645,
1000,
1010,
1024,
10906,
1027,
1028,
1030,
10906,
1031,
1024,
12411,
6342,
1033,
1031,
1024,
25645,
1033,
1007,
11689,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.dead_letter_source_queues | def dead_letter_source_queues(options = {})
batches = Enumerator.new do |y|
batch = []
options = options.merge(queue_url: @url)
resp = @client.list_dead_letter_source_queues(options)
resp.data.queue_urls.each do |q|
batch << Queue.new(
url: q,
client: @client
)
end
y.yield(batch)
end
Queue::Collection.new(batches)
end | ruby | def dead_letter_source_queues(options = {})
batches = Enumerator.new do |y|
batch = []
options = options.merge(queue_url: @url)
resp = @client.list_dead_letter_source_queues(options)
resp.data.queue_urls.each do |q|
batch << Queue.new(
url: q,
client: @client
)
end
y.yield(batch)
end
Queue::Collection.new(batches)
end | [
"def",
"dead_letter_source_queues",
"(",
"options",
"=",
"{",
"}",
")",
"batches",
"=",
"Enumerator",
".",
"new",
"do",
"|",
"y",
"|",
"batch",
"=",
"[",
"]",
"options",
"=",
"options",
".",
"merge",
"(",
"queue_url",
":",
"@url",
")",
"resp",
"=",
"... | @!group Associations
@example Request syntax with placeholder values
queue.dead_letter_source_queues()
@param [Hash] options ({})
@return [Queue::Collection] | [
"@!group",
"Associations",
"@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#L695-L709 | train | Returns a collection of dead letter source queues | [
30522,
13366,
2757,
1035,
3661,
1035,
3120,
1035,
24240,
2015,
1006,
7047,
1027,
1063,
1065,
1007,
14108,
2229,
1027,
4372,
17897,
16259,
1012,
2047,
2079,
1064,
1061,
1064,
14108,
1027,
1031,
1033,
7047,
1027,
7047,
1012,
13590,
1006,
2424... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/channel.rb | Discordrb.Channel.remove_group_users | def remove_group_users(user_ids)
raise 'Attempted to remove a user from a non-group channel!' unless group?
user_ids = [user_ids] unless user_ids.is_a? Array
user_ids.each do |user_id|
API::Channel.remove_group_user(@bot.token, @id, user_id.resolve_id)
end
self
end | ruby | def remove_group_users(user_ids)
raise 'Attempted to remove a user from a non-group channel!' unless group?
user_ids = [user_ids] unless user_ids.is_a? Array
user_ids.each do |user_id|
API::Channel.remove_group_user(@bot.token, @id, user_id.resolve_id)
end
self
end | [
"def",
"remove_group_users",
"(",
"user_ids",
")",
"raise",
"'Attempted to remove a user from a non-group channel!'",
"unless",
"group?",
"user_ids",
"=",
"[",
"user_ids",
"]",
"unless",
"user_ids",
".",
"is_a?",
"Array",
"user_ids",
".",
"each",
"do",
"|",
"user_id",... | Removes a user from a group channel.
@param user_ids [Array<#resolve_id>, #resolve_id] User ID or array of user IDs to remove from the group channel.
@return [Channel] the group channel. | [
"Removes",
"a",
"user",
"from",
"a",
"group",
"channel",
"."
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/data/channel.rb#L679-L687 | train | Remove a group user from this channel | [
30522,
13366,
6366,
1035,
2177,
1035,
5198,
1006,
5310,
1035,
8909,
2015,
1007,
5333,
1005,
4692,
2000,
6366,
1037,
5310,
2013,
1037,
2512,
1011,
2177,
3149,
999,
1005,
4983,
2177,
1029,
5310,
1035,
8909,
2015,
30524,
2015,
1033,
4983,
53... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/config.rb | Xcodeproj.Config.merge_attributes! | def merge_attributes!(attributes)
@attributes.merge!(attributes) do |_, v1, v2|
v1 = v1.strip
v2 = v2.strip
v1_split = v1.shellsplit
v2_split = v2.shellsplit
if (v2_split - v1_split).empty? || v1_split.first(v2_split.size) == v2_split
v1
elsif v2_split.first(v1_split.size) == v1_split
v2
else
"#{v1} #{v2}"
end
end
end | ruby | def merge_attributes!(attributes)
@attributes.merge!(attributes) do |_, v1, v2|
v1 = v1.strip
v2 = v2.strip
v1_split = v1.shellsplit
v2_split = v2.shellsplit
if (v2_split - v1_split).empty? || v1_split.first(v2_split.size) == v2_split
v1
elsif v2_split.first(v1_split.size) == v1_split
v2
else
"#{v1} #{v2}"
end
end
end | [
"def",
"merge_attributes!",
"(",
"attributes",
")",
"@attributes",
".",
"merge!",
"(",
"attributes",
")",
"do",
"|",
"_",
",",
"v1",
",",
"v2",
"|",
"v1",
"=",
"v1",
".",
"strip",
"v2",
"=",
"v2",
".",
"strip",
"v1_split",
"=",
"v1",
".",
"shellsplit... | Merges the given attributes hash while ensuring values are not duplicated.
@param [Hash] attributes
The attributes hash to merge into @attributes.
@return [void] | [
"Merges",
"the",
"given",
"attributes",
"hash",
"while",
"ensuring",
"values",
"are",
"not",
"duplicated",
"."
] | 3be1684437a6f8e69c7836ad4c85a2b78663272f | https://github.com/CocoaPods/Xcodeproj/blob/3be1684437a6f8e69c7836ad4c85a2b78663272f/lib/xcodeproj/config.rb#L296-L310 | train | Merge the attributes with the current attributes. | [
30522,
13366,
13590,
1035,
12332,
999,
1006,
12332,
1007,
1030,
12332,
1012,
13590,
999,
1006,
12332,
1007,
2079,
1064,
1035,
1010,
1058,
2487,
1010,
1058,
2475,
1064,
1058,
2487,
1027,
1058,
2487,
1012,
6167,
1058,
2475,
1027,
1058,
2475,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_recovery_services_backup/lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/protection_policies.rb | Azure::RecoveryServicesBackup::Mgmt::V2016_06_01.ProtectionPolicies.create_or_update | def create_or_update(vault_name, resource_group_name, policy_name, resource_protection_policy, custom_headers:nil)
response = create_or_update_async(vault_name, resource_group_name, policy_name, resource_protection_policy, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_or_update(vault_name, resource_group_name, policy_name, resource_protection_policy, custom_headers:nil)
response = create_or_update_async(vault_name, resource_group_name, policy_name, resource_protection_policy, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_or_update",
"(",
"vault_name",
",",
"resource_group_name",
",",
"policy_name",
",",
"resource_protection_policy",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_or_update_async",
"(",
"vault_name",
",",
"resource_group_name",
",",
"polic... | Creates or modifies a backup policy. This is an asynchronous operation. Use
the GetPolicyOperationResult API to Get the operation status.
@param vault_name [String] The name of the Recovery Services vault.
@param resource_group_name [String] The name of the resource group associated
with the Recovery Services vault.
@param policy_name [String] The backup policy to be created.
@param resource_protection_policy [ProtectionPolicyResource] The resource
backup policy.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ProtectionPolicyResource] operation results. | [
"Creates",
"or",
"modifies",
"a",
"backup",
"policy",
".",
"This",
"is",
"an",
"asynchronous",
"operation",
".",
"Use",
"the",
"GetPolicyOperationResult",
"API",
"to",
"Get",
"the",
"operation",
"status",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_recovery_services_backup/lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/protection_policies.rb#L151-L154 | train | Creates or updates a protection policy in the specified vault. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1006,
11632,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3343,
1035,
2171,
1010,
7692,
1035,
3860,
1035,
3343,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3443,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
boazsegev/combine_pdf | lib/combine_pdf/decrypt.rb | CombinePDF.PDFDecrypt.decrypt | def decrypt
raise_encrypted_error @encryption_dictionary unless @encryption_dictionary[:Filter] == :Standard
@key = set_general_key
case actual_object(@encryption_dictionary[:V])
when 1, 2
# raise_encrypted_error
_perform_decrypt_proc_ @objects, method(:decrypt_RC4)
when 4
# make sure CF is a Hash (as required by the PDF standard for this type of encryption).
raise_encrypted_error unless actual_object(@encryption_dictionary[:CF]).is_a?(Hash)
# support trivial case for now
# - same filter for streams (Stmf) and strings(Strf)
# - AND :CFM == :V2 (use algorithm 1)
raise_encrypted_error unless (@encryption_dictionary[:StmF] == @encryption_dictionary[:StrF])
cfilter = actual_object(@encryption_dictionary[:CF])[@encryption_dictionary[:StrF]]
raise_encrypted_error unless cfilter
raise_encrypted_error unless (cfilter[:AuthEvent] == :DocOpen)
if (cfilter[:CFM] == :V2)
_perform_decrypt_proc_ @objects, method(:decrypt_RC4)
elsif (cfilter[:CFM] == :AESV2)
_perform_decrypt_proc_ @objects, method(:decrypt_AES)
else
raise_encrypted_error
end
end
# rebuild stream lengths?
@objects
rescue => e
puts e
puts e.message
puts e.backtrace.join("\n")
raise_encrypted_error
end | ruby | def decrypt
raise_encrypted_error @encryption_dictionary unless @encryption_dictionary[:Filter] == :Standard
@key = set_general_key
case actual_object(@encryption_dictionary[:V])
when 1, 2
# raise_encrypted_error
_perform_decrypt_proc_ @objects, method(:decrypt_RC4)
when 4
# make sure CF is a Hash (as required by the PDF standard for this type of encryption).
raise_encrypted_error unless actual_object(@encryption_dictionary[:CF]).is_a?(Hash)
# support trivial case for now
# - same filter for streams (Stmf) and strings(Strf)
# - AND :CFM == :V2 (use algorithm 1)
raise_encrypted_error unless (@encryption_dictionary[:StmF] == @encryption_dictionary[:StrF])
cfilter = actual_object(@encryption_dictionary[:CF])[@encryption_dictionary[:StrF]]
raise_encrypted_error unless cfilter
raise_encrypted_error unless (cfilter[:AuthEvent] == :DocOpen)
if (cfilter[:CFM] == :V2)
_perform_decrypt_proc_ @objects, method(:decrypt_RC4)
elsif (cfilter[:CFM] == :AESV2)
_perform_decrypt_proc_ @objects, method(:decrypt_AES)
else
raise_encrypted_error
end
end
# rebuild stream lengths?
@objects
rescue => e
puts e
puts e.message
puts e.backtrace.join("\n")
raise_encrypted_error
end | [
"def",
"decrypt",
"raise_encrypted_error",
"@encryption_dictionary",
"unless",
"@encryption_dictionary",
"[",
":Filter",
"]",
"==",
":Standard",
"@key",
"=",
"set_general_key",
"case",
"actual_object",
"(",
"@encryption_dictionary",
"[",
":V",
"]",
")",
"when",
"1",
"... | include CombinePDF::Renderer
@!visibility private
make a new Decrypt object. requires:
objects:: an array containing the encrypted objects.
root_dictionary:: the root PDF dictionary, containing the Encrypt dictionary.
call this to start the decryption. | [
"include",
"CombinePDF",
"::",
"Renderer"
] | 09054051019c069f551f3e60be789577c0f93900 | https://github.com/boazsegev/combine_pdf/blob/09054051019c069f551f3e60be789577c0f93900/lib/combine_pdf/decrypt.rb#L39-L73 | train | decrypt the object using the given encryption dictionary | [
30522,
13366,
11703,
2854,
13876,
5333,
1035,
4372,
26775,
22571,
3064,
1035,
7561,
1030,
21999,
1035,
9206,
4983,
1030,
21999,
1035,
9206,
1031,
1024,
11307,
1033,
1027,
1027,
1024,
3115,
1030,
3145,
1027,
2275,
1035,
2236,
1035,
3145,
255... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
anycable/anycable | lib/anycable/cli.rb | AnyCable.CLI.run_custom_server_command! | def run_custom_server_command!
pid = nil
stopped = false
command_thread = Thread.new do
pid = Process.spawn(server_command)
logger.info "Started command: #{server_command} (pid: #{pid})"
Process.wait pid
pid = nil
raise Interrupt, "Server command exit unexpectedly" unless stopped
end
command_thread.abort_on_exception = true
at_stop do
stopped = true
next if pid.nil?
Process.kill("SIGTERM", pid)
logger.info "Wait till process #{pid} stop..."
tick = 0
loop do
tick += 0.2
break if tick > WAIT_PROCESS
if pid.nil?
logger.info "Process #{pid} stopped."
break
end
end
end
end | ruby | def run_custom_server_command!
pid = nil
stopped = false
command_thread = Thread.new do
pid = Process.spawn(server_command)
logger.info "Started command: #{server_command} (pid: #{pid})"
Process.wait pid
pid = nil
raise Interrupt, "Server command exit unexpectedly" unless stopped
end
command_thread.abort_on_exception = true
at_stop do
stopped = true
next if pid.nil?
Process.kill("SIGTERM", pid)
logger.info "Wait till process #{pid} stop..."
tick = 0
loop do
tick += 0.2
break if tick > WAIT_PROCESS
if pid.nil?
logger.info "Process #{pid} stopped."
break
end
end
end
end | [
"def",
"run_custom_server_command!",
"pid",
"=",
"nil",
"stopped",
"=",
"false",
"command_thread",
"=",
"Thread",
".",
"new",
"do",
"pid",
"=",
"Process",
".",
"spawn",
"(",
"server_command",
")",
"logger",
".",
"info",
"\"Started command: #{server_command} (pid: #{... | rubocop: disable Metrics/MethodLength, Metrics/AbcSize | [
"rubocop",
":",
"disable",
"Metrics",
"/",
"MethodLength",
"Metrics",
"/",
"AbcSize"
] | d7515e8e034d42e86ebeb09786a92aad2a11b25f | https://github.com/anycable/anycable/blob/d7515e8e034d42e86ebeb09786a92aad2a11b25f/lib/anycable/cli.rb#L180-L214 | train | Run the custom server command | [
30522,
13366,
2448,
1035,
7661,
1035,
8241,
1035,
3094,
999,
14255,
2094,
1027,
9152,
2140,
3030,
1027,
6270,
3094,
1035,
11689,
1027,
11689,
1012,
2047,
2079,
14255,
2094,
1027,
2832,
1012,
25645,
1006,
8241,
1035,
3094,
1007,
8833,
4590,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.children_to_string | def children_to_string(children)
children.map do |child|
if child.text?
child.content
else
if child.name == 's'
compressed_spaces = child.attributes['c'].to_s.to_i
# no explicit number means a count of 1:
compressed_spaces == 0 ? ' ' : ' ' * compressed_spaces
else
child.content
end
end
end.join
end | ruby | def children_to_string(children)
children.map do |child|
if child.text?
child.content
else
if child.name == 's'
compressed_spaces = child.attributes['c'].to_s.to_i
# no explicit number means a count of 1:
compressed_spaces == 0 ? ' ' : ' ' * compressed_spaces
else
child.content
end
end
end.join
end | [
"def",
"children_to_string",
"(",
"children",
")",
"children",
".",
"map",
"do",
"|",
"child",
"|",
"if",
"child",
".",
"text?",
"child",
".",
"content",
"else",
"if",
"child",
".",
"name",
"==",
"'s'",
"compressed_spaces",
"=",
"child",
".",
"attributes",... | helper method to convert compressed spaces and other elements within
an text into a string
FIXME: add a test for compressed_spaces == 0. It's not currently tested. | [
"helper",
"method",
"to",
"convert",
"compressed",
"spaces",
"and",
"other",
"elements",
"within",
"an",
"text",
"into",
"a",
"string",
"FIXME",
":",
"add",
"a",
"test",
"for",
"compressed_spaces",
"==",
"0",
".",
"It",
"s",
"not",
"currently",
"tested",
"... | 4ec1104f0c3c2a29711c0c907371cd2be12bcc3c | https://github.com/roo-rb/roo/blob/4ec1104f0c3c2a29711c0c907371cd2be12bcc3c/lib/roo/open_office.rb#L608-L622 | train | Returns a string representation of the children | [
30522,
13366,
2336,
1035,
2000,
1035,
5164,
1006,
2336,
1007,
2336,
1012,
4949,
2079,
1064,
2775,
1064,
2065,
2775,
1012,
3793,
1029,
2775,
1012,
4180,
2842,
2065,
2775,
1012,
2171,
1027,
1027,
1005,
1055,
1005,
16620,
1035,
7258,
1027,
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... |
tongueroo/ufo | lib/ufo/setting.rb | Ufo.Setting.data | def data
if @check_ufo_project && !File.exist?(project_settings_path)
Ufo.check_ufo_project!
end
# project based settings files
project = load_file(project_settings_path)
user_file = "#{ENV['HOME']}/.ufo/settings.yml"
user = File.exist?(user_file) ? YAML.load_file(user_file) : {}
default_file = File.expand_path("../default/settings.yml", __FILE__)
default = load_file(default_file)
all_envs = default.deep_merge(user.deep_merge(project))
all_envs = merge_base(all_envs)
data = all_envs[ufo_env] || all_envs["base"] || {}
data.deep_symbolize_keys
end | ruby | def data
if @check_ufo_project && !File.exist?(project_settings_path)
Ufo.check_ufo_project!
end
# project based settings files
project = load_file(project_settings_path)
user_file = "#{ENV['HOME']}/.ufo/settings.yml"
user = File.exist?(user_file) ? YAML.load_file(user_file) : {}
default_file = File.expand_path("../default/settings.yml", __FILE__)
default = load_file(default_file)
all_envs = default.deep_merge(user.deep_merge(project))
all_envs = merge_base(all_envs)
data = all_envs[ufo_env] || all_envs["base"] || {}
data.deep_symbolize_keys
end | [
"def",
"data",
"if",
"@check_ufo_project",
"&&",
"!",
"File",
".",
"exist?",
"(",
"project_settings_path",
")",
"Ufo",
".",
"check_ufo_project!",
"end",
"# project based settings files",
"project",
"=",
"load_file",
"(",
"project_settings_path",
")",
"user_file",
"=",... | data contains the settings.yml config. The order or precedence for settings
is the project ufo/settings.yml and then the ~/.ufo/settings.yml. | [
"data",
"contains",
"the",
"settings",
".",
"yml",
"config",
".",
"The",
"order",
"or",
"precedence",
"for",
"settings",
"is",
"the",
"project",
"ufo",
"/",
"settings",
".",
"yml",
"and",
"then",
"the",
"~",
"/",
".",
"ufo",
"/",
"settings",
".",
"yml"... | 16ac3dad28edcab2693c0e7d89a1971aca65b8f9 | https://github.com/tongueroo/ufo/blob/16ac3dad28edcab2693c0e7d89a1971aca65b8f9/lib/ufo/setting.rb#L14-L32 | train | Get the data for the current environment | [
30522,
13366,
2951,
2065,
1030,
4638,
1035,
24321,
1035,
2622,
1004,
1004,
999,
5371,
1012,
4839,
1029,
1006,
2622,
1035,
10906,
1035,
4130,
1007,
24321,
1012,
4638,
1035,
24321,
1035,
2622,
999,
2203,
1001,
2622,
2241,
10906,
6764,
2622,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
plaid/plaid-ruby | lib/plaid/products/auth.rb | Plaid.Auth.get | def get(access_token, account_ids: nil, options: nil)
post_with_auth 'auth/get',
AuthResponse,
build_payload(access_token,
account_ids: account_ids,
options: options)
end | ruby | def get(access_token, account_ids: nil, options: nil)
post_with_auth 'auth/get',
AuthResponse,
build_payload(access_token,
account_ids: account_ids,
options: options)
end | [
"def",
"get",
"(",
"access_token",
",",
"account_ids",
":",
"nil",
",",
"options",
":",
"nil",
")",
"post_with_auth",
"'auth/get'",
",",
"AuthResponse",
",",
"build_payload",
"(",
"access_token",
",",
"account_ids",
":",
"account_ids",
",",
"options",
":",
"op... | Public: Get information about account and routing numbers for checking
and savings accounts.
Does a POST /auth/get call which returns high level account information
along with account and routing numbers for checking and savings
accounts.
access_token - access_token who's item to fetch Auth for.
account_ids - Specific account ids to fetch numbers for (optional).
options - Additional options to merge into API request.
Returns AuthResponse. | [
"Public",
":",
"Get",
"information",
"about",
"account",
"and",
"routing",
"numbers",
"for",
"checking",
"and",
"savings",
"accounts",
"."
] | ce3da1c5559c739de88c5f59e54eef875f296673 | https://github.com/plaid/plaid-ruby/blob/ce3da1c5559c739de88c5f59e54eef875f296673/lib/plaid/products/auth.rb#L16-L22 | train | Get the data from the API | [
30522,
13366,
2131,
1006,
3229,
1035,
19204,
1010,
4070,
1035,
8909,
2015,
1024,
9152,
2140,
1010,
7047,
1024,
9152,
2140,
1007,
2695,
1035,
2007,
1035,
8740,
2705,
1005,
8740,
2705,
1013,
2131,
1005,
1010,
8740,
2705,
6072,
26029,
3366,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/environments.rb | Azure::Labservices::Mgmt::V2018_10_15.Environments.reset_password_async | def reset_password_async(resource_group_name, lab_account_name, lab_name, environment_setting_name, environment_name, reset_password_payload, custom_headers:nil)
# Send request
promise = begin_reset_password_async(resource_group_name, lab_account_name, lab_name, environment_setting_name, environment_name, reset_password_payload, 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 reset_password_async(resource_group_name, lab_account_name, lab_name, environment_setting_name, environment_name, reset_password_payload, custom_headers:nil)
# Send request
promise = begin_reset_password_async(resource_group_name, lab_account_name, lab_name, environment_setting_name, environment_name, reset_password_payload, 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",
"reset_password_async",
"(",
"resource_group_name",
",",
"lab_account_name",
",",
"lab_name",
",",
"environment_setting_name",
",",
"environment_name",
",",
"reset_password_payload",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_r... | @param resource_group_name [String] The name of the resource group.
@param lab_account_name [String] The name of the lab Account.
@param lab_name [String] The name of the lab.
@param environment_setting_name [String] The name of the environment Setting.
@param environment_name [String] The name of the environment.
@param reset_password_payload [ResetPasswordPayload] Represents the payload
for resetting passwords.
@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",
"lab_account_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"lab",
"Account",
".",
"@param",
"lab_name",
"[",
"String",
"]",
"The",
... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/environments.rb#L665-L679 | train | Resets the password of an environment. | [
30522,
13366,
25141,
1035,
20786,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
6845,
1035,
4070,
1035,
2171,
1010,
6845,
1035,
2171,
1010,
4044,
1035,
4292,
1035,
2171,
1010,
4044,
1035,
2171,
1010,
25141,
1035,
20786,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.create_composite_entity_role_with_http_info | def create_composite_entity_role_with_http_info(app_id, version_id, c_entity_id, entity_role_create_object, custom_headers:nil)
create_composite_entity_role_async(app_id, version_id, c_entity_id, entity_role_create_object, custom_headers:custom_headers).value!
end | ruby | def create_composite_entity_role_with_http_info(app_id, version_id, c_entity_id, entity_role_create_object, custom_headers:nil)
create_composite_entity_role_async(app_id, version_id, c_entity_id, entity_role_create_object, custom_headers:custom_headers).value!
end | [
"def",
"create_composite_entity_role_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"c_entity_id",
",",
"entity_role_create_object",
",",
"custom_headers",
":",
"nil",
")",
"create_composite_entity_role_async",
"(",
"app_id",
",",
"version_id",
",",
"c_entity_id",
... | Create a role for a composite entity in a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param c_entity_id The composite entity extractor ID.
@param entity_role_create_object [EntityRoleCreateObject] An entity role
object containing the name of role.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Create",
"a",
"role",
"for",
"a",
"composite",
"entity",
"in",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L7169-L7171 | train | Creates a composite entity role for a given entity. | [
30522,
13366,
3443,
1035,
12490,
1035,
9178,
1035,
2535,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
1039,
1035,
9178,
1035,
8909,
1010,
9178,
1035,
2535,
1035,
3443,
1035,
4874,
1010,
7661,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
comfy/comfortable-mexican-sofa | lib/comfortable_mexican_sofa/extensions/acts_as_tree.rb | ComfortableMexicanSofa::ActsAsTree.InstanceMethods.ancestors | def ancestors
node = self
nodes = []
nodes << node = node.parent while node.parent
nodes
end | ruby | def ancestors
node = self
nodes = []
nodes << node = node.parent while node.parent
nodes
end | [
"def",
"ancestors",
"node",
"=",
"self",
"nodes",
"=",
"[",
"]",
"nodes",
"<<",
"node",
"=",
"node",
".",
"parent",
"while",
"node",
".",
"parent",
"nodes",
"end"
] | Returns list of ancestors, starting from parent until root.
subchild1.ancestors # => [child1, root] | [
"Returns",
"list",
"of",
"ancestors",
"starting",
"from",
"parent",
"until",
"root",
"."
] | 38a31428f6e2c07d5bda64f0371eebfb29a3abc4 | https://github.com/comfy/comfortable-mexican-sofa/blob/38a31428f6e2c07d5bda64f0371eebfb29a3abc4/lib/comfortable_mexican_sofa/extensions/acts_as_tree.rb#L65-L70 | train | Returns an array of all ancestors of the given node. | [
30522,
13366,
10748,
13045,
1027,
2969,
14164,
1027,
1031,
1033,
14164,
1026,
1026,
13045,
1027,
13045,
1012,
6687,
2096,
13045,
1012,
6687,
14164,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
CanCanCommunity/cancancan | lib/cancan/ability.rb | CanCan.Ability.permissions | def permissions
permissions_list = {
can: Hash.new { |actions, k1| actions[k1] = Hash.new { |subjects, k2| subjects[k2] = [] } },
cannot: Hash.new { |actions, k1| actions[k1] = Hash.new { |subjects, k2| subjects[k2] = [] } }
}
rules.each { |rule| extract_rule_in_permissions(permissions_list, rule) }
permissions_list
end | ruby | def permissions
permissions_list = {
can: Hash.new { |actions, k1| actions[k1] = Hash.new { |subjects, k2| subjects[k2] = [] } },
cannot: Hash.new { |actions, k1| actions[k1] = Hash.new { |subjects, k2| subjects[k2] = [] } }
}
rules.each { |rule| extract_rule_in_permissions(permissions_list, rule) }
permissions_list
end | [
"def",
"permissions",
"permissions_list",
"=",
"{",
"can",
":",
"Hash",
".",
"new",
"{",
"|",
"actions",
",",
"k1",
"|",
"actions",
"[",
"k1",
"]",
"=",
"Hash",
".",
"new",
"{",
"|",
"subjects",
",",
"k2",
"|",
"subjects",
"[",
"k2",
"]",
"=",
"[... | Return a hash of permissions for the user in the format of:
{
can: can_hash,
cannot: cannot_hash
}
Where can_hash and cannot_hash are formatted thusly:
{
action: { subject: [attributes] }
} | [
"Return",
"a",
"hash",
"of",
"permissions",
"for",
"the",
"user",
"in",
"the",
"format",
"of",
":",
"{",
"can",
":",
"can_hash",
"cannot",
":",
"cannot_hash",
"}"
] | b2e5660c6b9b683fc45b8f425b90c4d06e2f24bf | https://github.com/CanCanCommunity/cancancan/blob/b2e5660c6b9b683fc45b8f425b90c4d06e2f24bf/lib/cancan/ability.rb#L266-L273 | train | Returns the permissions list for the current user | [
30522,
13366,
6656,
2015,
6656,
2015,
1035,
2862,
1027,
1063,
2064,
1024,
23325,
1012,
2047,
1063,
1064,
4506,
1010,
1047,
2487,
1064,
4506,
1031,
1047,
2487,
1033,
1027,
23325,
1012,
2047,
1063,
1064,
5739,
1010,
1047,
2475,
1064,
5739,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/box_collection.rb | Vagrant.BoxCollection.find | def find(name, providers, version)
providers = Array(providers)
# Build up the requirements we have
requirements = version.to_s.split(",").map do |v|
Gem::Requirement.new(v.strip)
end
with_collection_lock do
box_directory = @directory.join(dir_name(name))
if !box_directory.directory?
@logger.info("Box not found: #{name} (#{providers.join(", ")})")
return nil
end
# Keep a mapping of Gem::Version mangled versions => directories.
# ie. 0.1.0.pre.alpha.2 => 0.1.0-alpha.2
# This is so we can sort version numbers properly here, but still
# refer to the real directory names in path checks below and pass an
# unmangled version string to Box.new
version_dir_map = {}
versions = box_directory.children(true).map do |versiondir|
next if !versiondir.directory?
next if versiondir.basename.to_s.start_with?(".")
version = Gem::Version.new(versiondir.basename.to_s)
version_dir_map[version.to_s] = versiondir.basename.to_s
version
end.compact
# Traverse through versions with the latest version first
versions.sort.reverse.each do |v|
if !requirements.all? { |r| r.satisfied_by?(v) }
# Unsatisfied version requirements
next
end
versiondir = box_directory.join(version_dir_map[v.to_s])
providers.each do |provider|
provider_dir = versiondir.join(provider.to_s)
next if !provider_dir.directory?
@logger.info("Box found: #{name} (#{provider})")
metadata_url = nil
metadata_url_file = box_directory.join("metadata_url")
metadata_url = metadata_url_file.read if metadata_url_file.file?
if metadata_url && @hook
hook_env = @hook.call(
:authenticate_box_url, box_urls: [metadata_url])
metadata_url = hook_env[:box_urls].first
end
return Box.new(
name, provider, version_dir_map[v.to_s], provider_dir,
metadata_url: metadata_url,
)
end
end
end
nil
end | ruby | def find(name, providers, version)
providers = Array(providers)
# Build up the requirements we have
requirements = version.to_s.split(",").map do |v|
Gem::Requirement.new(v.strip)
end
with_collection_lock do
box_directory = @directory.join(dir_name(name))
if !box_directory.directory?
@logger.info("Box not found: #{name} (#{providers.join(", ")})")
return nil
end
# Keep a mapping of Gem::Version mangled versions => directories.
# ie. 0.1.0.pre.alpha.2 => 0.1.0-alpha.2
# This is so we can sort version numbers properly here, but still
# refer to the real directory names in path checks below and pass an
# unmangled version string to Box.new
version_dir_map = {}
versions = box_directory.children(true).map do |versiondir|
next if !versiondir.directory?
next if versiondir.basename.to_s.start_with?(".")
version = Gem::Version.new(versiondir.basename.to_s)
version_dir_map[version.to_s] = versiondir.basename.to_s
version
end.compact
# Traverse through versions with the latest version first
versions.sort.reverse.each do |v|
if !requirements.all? { |r| r.satisfied_by?(v) }
# Unsatisfied version requirements
next
end
versiondir = box_directory.join(version_dir_map[v.to_s])
providers.each do |provider|
provider_dir = versiondir.join(provider.to_s)
next if !provider_dir.directory?
@logger.info("Box found: #{name} (#{provider})")
metadata_url = nil
metadata_url_file = box_directory.join("metadata_url")
metadata_url = metadata_url_file.read if metadata_url_file.file?
if metadata_url && @hook
hook_env = @hook.call(
:authenticate_box_url, box_urls: [metadata_url])
metadata_url = hook_env[:box_urls].first
end
return Box.new(
name, provider, version_dir_map[v.to_s], provider_dir,
metadata_url: metadata_url,
)
end
end
end
nil
end | [
"def",
"find",
"(",
"name",
",",
"providers",
",",
"version",
")",
"providers",
"=",
"Array",
"(",
"providers",
")",
"# Build up the requirements we have",
"requirements",
"=",
"version",
".",
"to_s",
".",
"split",
"(",
"\",\"",
")",
".",
"map",
"do",
"|",
... | Find a box in the collection with the given name and provider.
@param [String] name Name of the box (logical name).
@param [Array] providers Providers that the box implements.
@param [String] version Version constraints to adhere to. Example:
"~> 1.0" or "= 1.0, ~> 1.1"
@return [Box] The box found, or `nil` if not found. | [
"Find",
"a",
"box",
"in",
"the",
"collection",
"with",
"the",
"given",
"name",
"and",
"provider",
"."
] | c22a145c59790c098f95d50141d9afb48e1ef55f | https://github.com/hashicorp/vagrant/blob/c22a145c59790c098f95d50141d9afb48e1ef55f/lib/vagrant/box_collection.rb#L272-L335 | train | Find a box by its name and its dependencies. | [
30522,
13366,
2424,
1006,
2171,
1010,
11670,
1010,
2544,
1007,
11670,
1027,
9140,
1006,
11670,
1007,
1001,
3857,
2039,
1996,
5918,
2057,
2031,
5918,
1027,
2544,
1012,
2000,
1035,
1055,
1012,
3975,
1006,
1000,
1010,
1000,
1007,
1012,
4949,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
boazsegev/combine_pdf | lib/combine_pdf/page_methods.rb | CombinePDF.Page_Methods.insert_content | def insert_content(object, location = -1)
object = { is_reference_only: true, referenced_object: { indirect_reference_id: 0, raw_stream_content: object } } if object.is_a?(String)
raise TypeError, 'expected a String or Hash object.' unless object.is_a?(Hash)
prep_content_array
self[:Contents].insert location, object
self[:Contents].flatten!
self
end | ruby | def insert_content(object, location = -1)
object = { is_reference_only: true, referenced_object: { indirect_reference_id: 0, raw_stream_content: object } } if object.is_a?(String)
raise TypeError, 'expected a String or Hash object.' unless object.is_a?(Hash)
prep_content_array
self[:Contents].insert location, object
self[:Contents].flatten!
self
end | [
"def",
"insert_content",
"(",
"object",
",",
"location",
"=",
"-",
"1",
")",
"object",
"=",
"{",
"is_reference_only",
":",
"true",
",",
"referenced_object",
":",
"{",
"indirect_reference_id",
":",
"0",
",",
"raw_stream_content",
":",
"object",
"}",
"}",
"if"... | adds a string or an object to the content stream, at the location indicated
accepts:
object:: can be a string or a hash object
location:: can be any numeral related to the possition in the :Contents array. defaults to -1 == insert at the end. | [
"adds",
"a",
"string",
"or",
"an",
"object",
"to",
"the",
"content",
"stream",
"at",
"the",
"location",
"indicated"
] | 09054051019c069f551f3e60be789577c0f93900 | https://github.com/boazsegev/combine_pdf/blob/09054051019c069f551f3e60be789577c0f93900/lib/combine_pdf/page_methods.rb#L692-L699 | train | Insert a content into the stream. | [
30522,
13366,
19274,
1035,
4180,
1006,
4874,
1010,
3295,
1027,
1011,
1015,
1007,
4874,
1027,
1063,
2003,
1035,
4431,
1035,
2069,
1024,
2995,
1010,
14964,
1035,
4874,
1024,
1063,
14958,
1035,
4431,
1035,
8909,
1024,
1014,
1010,
6315,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.get_service_name_info | def get_service_name_info(partition_id, timeout:60, custom_headers:nil)
response = get_service_name_info_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_service_name_info(partition_id, timeout:60, custom_headers:nil)
response = get_service_name_info_async(partition_id, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_service_name_info",
"(",
"partition_id",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_service_name_info_async",
"(",
"partition_id",
",",
"timeout",
":",
"timeout",
",",
"custom_headers",
":custom_headers",
")"... | Gets the name of the Service Fabric service for a partition.
Gets name of the service for the specified partition. A 404 error is returned
if the partition ID does not exist in the cluster.
@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 [ServiceNameInfo] operation results. | [
"Gets",
"the",
"name",
"of",
"the",
"Service",
"Fabric",
"service",
"for",
"a",
"partition",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L12092-L12095 | train | Gets the service name info for the specified partition. | [
30522,
13366,
2131,
1035,
2326,
1035,
2171,
1035,
18558,
1006,
13571,
1035,
8909,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
2326,
1035,
2171,
1035,
18558,
1035,
2004,
6038,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_customvisiontraining/lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb | Azure::CognitiveServices::Customvisiontraining::V3_0.CustomvisiontrainingClient.train_project | def train_project(project_id, training_type:nil, reserved_budget_in_hours:0, force_train:false, notification_email_address:nil, custom_headers:nil)
response = train_project_async(project_id, training_type:training_type, reserved_budget_in_hours:reserved_budget_in_hours, force_train:force_train, notification_email_address:notification_email_address, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def train_project(project_id, training_type:nil, reserved_budget_in_hours:0, force_train:false, notification_email_address:nil, custom_headers:nil)
response = train_project_async(project_id, training_type:training_type, reserved_budget_in_hours:reserved_budget_in_hours, force_train:force_train, notification_email_address:notification_email_address, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"train_project",
"(",
"project_id",
",",
"training_type",
":",
"nil",
",",
"reserved_budget_in_hours",
":",
"0",
",",
"force_train",
":",
"false",
",",
"notification_email_address",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"tra... | Queues project for training.
@param project_id The project id.
@param training_type [Enum] The type of training to use to train the project
(default: Regular). Possible values include: 'Regular', 'Advanced'
@param reserved_budget_in_hours [Integer] The number of hours reserved as
budget for training (if applicable).
@param force_train [Boolean] Whether to force train even if dataset and
configuration does not change (default: false).
@param notification_email_address [String] The email address to send
notification to when training finishes (default: null).
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Iteration] operation results. | [
"Queues",
"project",
"for",
"training",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_customvisiontraining/lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb#L3307-L3310 | train | Train a project. | [
30522,
13366,
3345,
1035,
2622,
1006,
2622,
1035,
8909,
1010,
2731,
1035,
2828,
1024,
9152,
2140,
1010,
9235,
1035,
5166,
1035,
1999,
1035,
2847,
1024,
1014,
1010,
2486,
1035,
3345,
1024,
6270,
1010,
26828,
1035,
10373,
1035,
4769,
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_storagesync/lib/2018-07-01/generated/azure_mgmt_storagesync/cloud_endpoints.rb | Azure::StorageSync::Mgmt::V2018_07_01.CloudEndpoints.begin_delete_with_http_info | def begin_delete_with_http_info(resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, custom_headers:nil)
begin_delete_async(resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, custom_headers:custom_headers).value!
end | ruby | def begin_delete_with_http_info(resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, custom_headers:nil)
begin_delete_async(resource_group_name, storage_sync_service_name, sync_group_name, cloud_endpoint_name, custom_headers:custom_headers).value!
end | [
"def",
"begin_delete_with_http_info",
"(",
"resource_group_name",
",",
"storage_sync_service_name",
",",
"sync_group_name",
",",
"cloud_endpoint_name",
",",
"custom_headers",
":",
"nil",
")",
"begin_delete_async",
"(",
"resource_group_name",
",",
"storage_sync_service_name",
... | Delete a given CloudEndpoint.
@param resource_group_name [String] The name of the resource group. The name
is case insensitive.
@param storage_sync_service_name [String] Name of Storage Sync Service
resource.
@param sync_group_name [String] Name of Sync Group resource.
@param cloud_endpoint_name [String] Name of Cloud Endpoint object.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Delete",
"a",
"given",
"CloudEndpoint",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_storagesync/lib/2018-07-01/generated/azure_mgmt_storagesync/cloud_endpoints.rb#L795-L797 | train | Deletes the specified cloud endpoint from the specified sync group. | [
30522,
30524,
2177,
1035,
2171,
1010,
6112,
1035,
2203,
8400,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
1035,
3972,
12870,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
5527,
1035,
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... |
github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/generator/generator_tags.rb | GitHubChangelogGenerator.Generator.get_time_of_tag | def get_time_of_tag(tag_name)
raise ChangelogGeneratorError, "tag_name is nil" if tag_name.nil?
name_of_tag = tag_name.fetch("name")
time_for_tag_name = @tag_times_hash[name_of_tag]
return time_for_tag_name if time_for_tag_name
@fetcher.fetch_date_of_tag(tag_name).tap do |time_string|
@tag_times_hash[name_of_tag] = time_string
end
end | ruby | def get_time_of_tag(tag_name)
raise ChangelogGeneratorError, "tag_name is nil" if tag_name.nil?
name_of_tag = tag_name.fetch("name")
time_for_tag_name = @tag_times_hash[name_of_tag]
return time_for_tag_name if time_for_tag_name
@fetcher.fetch_date_of_tag(tag_name).tap do |time_string|
@tag_times_hash[name_of_tag] = time_string
end
end | [
"def",
"get_time_of_tag",
"(",
"tag_name",
")",
"raise",
"ChangelogGeneratorError",
",",
"\"tag_name is nil\"",
"if",
"tag_name",
".",
"nil?",
"name_of_tag",
"=",
"tag_name",
".",
"fetch",
"(",
"\"name\"",
")",
"time_for_tag_name",
"=",
"@tag_times_hash",
"[",
"name... | Returns date for given GitHub Tag hash
Memoize the date by tag name.
@param [Hash] tag_name
@return [Time] time of specified tag | [
"Returns",
"date",
"for",
"given",
"GitHub",
"Tag",
"hash"
] | f18c64b5cc0d7473b059275b88385ac11ca8b564 | https://github.com/github-changelog-generator/github-changelog-generator/blob/f18c64b5cc0d7473b059275b88385ac11ca8b564/lib/github_changelog_generator/generator/generator_tags.rb#L68-L78 | train | Get the time of a given tag | [
30522,
13366,
2131,
1035,
2051,
1035,
1997,
1035,
6415,
1006,
6415,
1035,
2171,
1007,
5333,
2689,
21197,
6914,
6906,
19277,
18933,
2099,
1010,
1000,
6415,
1035,
2171,
2003,
9152,
2140,
1000,
2065,
6415,
1035,
2171,
1012,
9152,
2140,
1029,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
daddyz/phonelib | lib/phonelib/phone_analyzer_helper.rb | Phonelib.PhoneAnalyzerHelper.changed_dp_phone | def changed_dp_phone(country, phone)
data = Phonelib.phone_data[country]
return if data.nil? || data[Core::DOUBLE_COUNTRY_PREFIX_FLAG].nil?
country_code = Phonelib.phone_data[country][Core::COUNTRY_CODE]
if phone.start_with? country_code * 2
phone.gsub(cr("^#{country_code}"), '')
else
"#{country_code}#{phone}"
end
end | ruby | def changed_dp_phone(country, phone)
data = Phonelib.phone_data[country]
return if data.nil? || data[Core::DOUBLE_COUNTRY_PREFIX_FLAG].nil?
country_code = Phonelib.phone_data[country][Core::COUNTRY_CODE]
if phone.start_with? country_code * 2
phone.gsub(cr("^#{country_code}"), '')
else
"#{country_code}#{phone}"
end
end | [
"def",
"changed_dp_phone",
"(",
"country",
",",
"phone",
")",
"data",
"=",
"Phonelib",
".",
"phone_data",
"[",
"country",
"]",
"return",
"if",
"data",
".",
"nil?",
"||",
"data",
"[",
"Core",
"::",
"DOUBLE_COUNTRY_PREFIX_FLAG",
"]",
".",
"nil?",
"country_code... | changes phone to with/without double country prefix | [
"changes",
"phone",
"to",
"with",
"/",
"without",
"double",
"country",
"prefix"
] | aa0023eab7c896b71275bf342bc7f49735cbdbbf | https://github.com/daddyz/phonelib/blob/aa0023eab7c896b71275bf342bc7f49735cbdbbf/lib/phonelib/phone_analyzer_helper.rb#L55-L65 | train | Returns the new phone for the given country. | [
30522,
13366,
2904,
1035,
1040,
2361,
1035,
3042,
1006,
2406,
1010,
3042,
1007,
2951,
1027,
3042,
29521,
1012,
3042,
1035,
2951,
1031,
2406,
1033,
2709,
2065,
2951,
1012,
9152,
2140,
1029,
1064,
1064,
2951,
1031,
4563,
1024,
1024,
3313,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mikel/mail | lib/mail/attachments_list.rb | Mail.AttachmentsList.[] | def [](index_value)
if index_value.is_a?(Integer)
self.fetch(index_value)
else
self.select { |a| a.filename == index_value }.first
end
end | ruby | def [](index_value)
if index_value.is_a?(Integer)
self.fetch(index_value)
else
self.select { |a| a.filename == index_value }.first
end
end | [
"def",
"[]",
"(",
"index_value",
")",
"if",
"index_value",
".",
"is_a?",
"(",
"Integer",
")",
"self",
".",
"fetch",
"(",
"index_value",
")",
"else",
"self",
".",
"select",
"{",
"|",
"a",
"|",
"a",
".",
"filename",
"==",
"index_value",
"}",
".",
"firs... | Returns the attachment by filename or at index.
mail.attachments['test.png'] = File.read('test.png')
mail.attachments['test.jpg'] = File.read('test.jpg')
mail.attachments['test.png'].filename #=> 'test.png'
mail.attachments[1].filename #=> 'test.jpg' | [
"Returns",
"the",
"attachment",
"by",
"filename",
"or",
"at",
"index",
"."
] | fb53fb369eb2bf0494ac70675970c90cdcc3f495 | https://github.com/mikel/mail/blob/fb53fb369eb2bf0494ac70675970c90cdcc3f495/lib/mail/attachments_list.rb#L32-L38 | train | Get the index of the file in the current page | [
30522,
13366,
1031,
1033,
1006,
5950,
1035,
3643,
1007,
2065,
5950,
1035,
3643,
1012,
2003,
1035,
1037,
1029,
1006,
16109,
1007,
2969,
1012,
18584,
1006,
5950,
1035,
3643,
1007,
2842,
2969,
1012,
7276,
1063,
1064,
1037,
1064,
1037,
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... |
hashicorp/vault-ruby | lib/vault/api/auth_token.rb | Vault.AuthToken.accessors | def accessors(options = {})
headers = extract_headers!(options)
json = client.list("/v1/auth/token/accessors", options, headers)
return Secret.decode(json)
end | ruby | def accessors(options = {})
headers = extract_headers!(options)
json = client.list("/v1/auth/token/accessors", options, headers)
return Secret.decode(json)
end | [
"def",
"accessors",
"(",
"options",
"=",
"{",
"}",
")",
"headers",
"=",
"extract_headers!",
"(",
"options",
")",
"json",
"=",
"client",
".",
"list",
"(",
"\"/v1/auth/token/accessors\"",
",",
"options",
",",
"headers",
")",
"return",
"Secret",
".",
"decode",
... | Lists all token accessors.
@example Listing token accessors
result = Vault.auth_token.accessors #=> #<Vault::Secret>
result.data[:keys] #=> ["476ea048-ded5-4d07-eeea-938c6b4e43ec", "bb00c093-b7d3-b0e9-69cc-c4d85081165b"]
@return [Array<Secret>] | [
"Lists",
"all",
"token",
"accessors",
"."
] | 02f0532a802ba1a2a0d8703a4585dab76eb9d864 | https://github.com/hashicorp/vault-ruby/blob/02f0532a802ba1a2a0d8703a4585dab76eb9d864/lib/vault/api/auth_token.rb#L25-L29 | train | Get the list of all accessors | [
30522,
13366,
3229,
5668,
1006,
7047,
1027,
1063,
1065,
1007,
20346,
2015,
1027,
14817,
1035,
20346,
2015,
999,
1006,
7047,
1007,
1046,
3385,
1027,
7396,
1012,
2862,
1006,
1000,
1013,
1058,
2487,
1013,
8740,
2705,
1013,
19204,
1013,
3229,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | def get_storage_accounts(vault_base_url, maxresults:nil, custom_headers:nil)
first_page = get_storage_accounts_as_lazy(vault_base_url, maxresults:maxresults, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def get_storage_accounts(vault_base_url, maxresults:nil, custom_headers:nil)
first_page = get_storage_accounts_as_lazy(vault_base_url, maxresults:maxresults, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"get_storage_accounts",
"(",
"vault_base_url",
",",
"maxresults",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"get_storage_accounts_as_lazy",
"(",
"vault_base_url",
",",
"maxresults",
":",
"maxresults",
",",
"custom_headers",
":custom... | 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 [Array<StorageAccountItem>] 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#L6970-L6973 | train | Gets all the Azure Storage accounts. | [
30522,
13366,
2131,
1035,
5527,
1035,
6115,
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,
1035,
3931,
1027,
2131,
1035,
5527,
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... |
fastlane/fastlane | spaceship/lib/spaceship/tunes/tunes_client.rb | Spaceship.TunesClient.supported_territories | def supported_territories
data = supported_countries
data.map { |country| Spaceship::Tunes::Territory.factory(country) }
end | ruby | def supported_territories
data = supported_countries
data.map { |country| Spaceship::Tunes::Territory.factory(country) }
end | [
"def",
"supported_territories",
"data",
"=",
"supported_countries",
"data",
".",
"map",
"{",
"|",
"country",
"|",
"Spaceship",
"::",
"Tunes",
"::",
"Territory",
".",
"factory",
"(",
"country",
")",
"}",
"end"
] | Returns an array of all supported territories
@note Although this information is publicly available, the current spaceship implementation requires you to have a logged in client to access it
@return [Array] the Territory objects (Spaceship::Tunes::Territory) | [
"Returns",
"an",
"array",
"of",
"all",
"supported",
"territories"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/spaceship/lib/spaceship/tunes/tunes_client.rb#L744-L747 | train | Returns the number of territories supported by the current language | [
30522,
13366,
3569,
1035,
6500,
2951,
1027,
3569,
1035,
3032,
2951,
1012,
4949,
1063,
1064,
2406,
1064,
25516,
1024,
1024,
13281,
1024,
1024,
3700,
1012,
4713,
1006,
2406,
1007,
1065,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jekyll/jekyll | lib/jekyll/filters.rb | Jekyll.Filters.sort_input | def sort_input(input, property, order)
input.map { |item| [item_property(item, property), item] }
.sort! do |a_info, b_info|
a_property = a_info.first
b_property = b_info.first
if !a_property.nil? && b_property.nil?
- order
elsif a_property.nil? && !b_property.nil?
+ order
else
a_property <=> b_property || a_property.to_s <=> b_property.to_s
end
end
.map!(&:last)
end | ruby | def sort_input(input, property, order)
input.map { |item| [item_property(item, property), item] }
.sort! do |a_info, b_info|
a_property = a_info.first
b_property = b_info.first
if !a_property.nil? && b_property.nil?
- order
elsif a_property.nil? && !b_property.nil?
+ order
else
a_property <=> b_property || a_property.to_s <=> b_property.to_s
end
end
.map!(&:last)
end | [
"def",
"sort_input",
"(",
"input",
",",
"property",
",",
"order",
")",
"input",
".",
"map",
"{",
"|",
"item",
"|",
"[",
"item_property",
"(",
"item",
",",
"property",
")",
",",
"item",
"]",
"}",
".",
"sort!",
"do",
"|",
"a_info",
",",
"b_info",
"|"... | Sort the input Enumerable by the given property.
If the property doesn't exist, return the sort order respective of
which item doesn't have the property.
We also utilize the Schwartzian transform to make this more efficient. | [
"Sort",
"the",
"input",
"Enumerable",
"by",
"the",
"given",
"property",
".",
"If",
"the",
"property",
"doesn",
"t",
"exist",
"return",
"the",
"sort",
"order",
"respective",
"of",
"which",
"item",
"doesn",
"t",
"have",
"the",
"property",
".",
"We",
"also",
... | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/filters.rb#L311-L326 | train | Sort the input array by the given property and order | [
30522,
13366,
4066,
1035,
7953,
1006,
7953,
1010,
3200,
1010,
2344,
1007,
7953,
1012,
4949,
1063,
1064,
8875,
1064,
1031,
8875,
1035,
3200,
1006,
8875,
1010,
3200,
1007,
1010,
8875,
1033,
1065,
1012,
4066,
999,
2079,
1064,
1037,
1035,
185... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb | Azure::KeyVault::V2016_10_01.KeyVaultClient.update_certificate_issuer_with_http_info | def update_certificate_issuer_with_http_info(vault_base_url, issuer_name, provider:nil, credentials:nil, organization_details:nil, attributes:nil, custom_headers:nil)
update_certificate_issuer_async(vault_base_url, issuer_name, provider:provider, credentials:credentials, organization_details:organization_details, attributes:attributes, custom_headers:custom_headers).value!
end | ruby | def update_certificate_issuer_with_http_info(vault_base_url, issuer_name, provider:nil, credentials:nil, organization_details:nil, attributes:nil, custom_headers:nil)
update_certificate_issuer_async(vault_base_url, issuer_name, provider:provider, credentials:credentials, organization_details:organization_details, attributes:attributes, custom_headers:custom_headers).value!
end | [
"def",
"update_certificate_issuer_with_http_info",
"(",
"vault_base_url",
",",
"issuer_name",
",",
"provider",
":",
"nil",
",",
"credentials",
":",
"nil",
",",
"organization_details",
":",
"nil",
",",
"attributes",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")... | Updates the specified certificate issuer.
The UpdateCertificateIssuer operation performs an update on the specified
certificate issuer entity. This operation requires the
certificates/setissuers permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param issuer_name [String] The name of the issuer.
@param provider [String] The issuer provider.
@param credentials [IssuerCredentials] The credentials to be used for the
issuer.
@param organization_details [OrganizationDetails] Details of the organization
as provided to the issuer.
@param attributes [IssuerAttributes] Attributes of the issuer object.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Updates",
"the",
"specified",
"certificate",
"issuer",
"."
] | 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#L4834-L4836 | train | Updates the certificate issuer. | [
30522,
13366,
10651,
1035,
8196,
1035,
3277,
2099,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
3277,
2099,
1035,
2171,
1010,
10802,
1024,
9152,
2140,
1010,
22496,
1024,
9152,
2140,
1010,
3029,
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... |
lostisland/faraday | lib/faraday/connection.rb | Faraday.Connection.build_request | def build_request(method)
Request.create(method) do |req|
req.params = params.dup
req.headers = headers.dup
req.options = options
yield(req) if block_given?
end
end | ruby | def build_request(method)
Request.create(method) do |req|
req.params = params.dup
req.headers = headers.dup
req.options = options
yield(req) if block_given?
end
end | [
"def",
"build_request",
"(",
"method",
")",
"Request",
".",
"create",
"(",
"method",
")",
"do",
"|",
"req",
"|",
"req",
".",
"params",
"=",
"params",
".",
"dup",
"req",
".",
"headers",
"=",
"headers",
".",
"dup",
"req",
".",
"options",
"=",
"options"... | Creates and configures the request object.
@param method [Symbol]
@yield [Faraday::Request] if block given
@return [Faraday::Request] | [
"Creates",
"and",
"configures",
"the",
"request",
"object",
"."
] | 3abe9d1eea4bdf61cdf7b76ff9f1ae7e09482e70 | https://github.com/lostisland/faraday/blob/3abe9d1eea4bdf61cdf7b76ff9f1ae7e09482e70/lib/faraday/connection.rb#L513-L520 | train | Build a request object | [
30522,
13366,
3857,
1035,
5227,
1006,
4118,
1007,
5227,
1012,
3443,
1006,
4118,
1007,
2079,
1064,
2128,
4160,
1064,
2128,
4160,
1012,
11498,
5244,
1027,
11498,
5244,
1012,
4241,
2361,
2128,
4160,
1012,
20346,
2015,
1027,
20346,
2015,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/gallery_images.rb | Azure::Labservices::Mgmt::V2018_10_15.GalleryImages.update | def update(resource_group_name, lab_account_name, gallery_image_name, gallery_image, custom_headers:nil)
response = update_async(resource_group_name, lab_account_name, gallery_image_name, gallery_image, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def update(resource_group_name, lab_account_name, gallery_image_name, gallery_image, custom_headers:nil)
response = update_async(resource_group_name, lab_account_name, gallery_image_name, gallery_image, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"update",
"(",
"resource_group_name",
",",
"lab_account_name",
",",
"gallery_image_name",
",",
"gallery_image",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"update_async",
"(",
"resource_group_name",
",",
"lab_account_name",
",",
"gallery_image_name"... | Modify properties of gallery images.
@param resource_group_name [String] The name of the resource group.
@param lab_account_name [String] The name of the lab Account.
@param gallery_image_name [String] The name of the gallery Image.
@param gallery_image [GalleryImageFragment] Represents an image from the
Azure Marketplace
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [GalleryImage] operation results. | [
"Modify",
"properties",
"of",
"gallery",
"images",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/gallery_images.rb#L457-L460 | train | Update a single gallery image. | [
30522,
13366,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
6845,
1035,
4070,
1035,
2171,
1010,
3916,
1035,
3746,
1035,
2171,
1010,
3916,
1035,
3746,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
10651,
1035,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
decidim/decidim | decidim-core/lib/decidim/stats_registry.rb | Decidim.StatsRegistry.only | def only(names)
filtered_stats = @stats.select do |stat|
names.include? stat[:name]
end
StatsRegistry.new(filtered_stats)
end | ruby | def only(names)
filtered_stats = @stats.select do |stat|
names.include? stat[:name]
end
StatsRegistry.new(filtered_stats)
end | [
"def",
"only",
"(",
"names",
")",
"filtered_stats",
"=",
"@stats",
".",
"select",
"do",
"|",
"stat",
"|",
"names",
".",
"include?",
"stat",
"[",
":name",
"]",
"end",
"StatsRegistry",
".",
"new",
"(",
"filtered_stats",
")",
"end"
] | Public: Creates a new registry with only the stats included into the provided ones
names - An Array of stats names to include
Returns a new StatsRegistry with the selected stats | [
"Public",
":",
"Creates",
"a",
"new",
"registry",
"with",
"only",
"the",
"stats",
"included",
"into",
"the",
"provided",
"ones"
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/lib/decidim/stats_registry.rb#L104-L109 | train | Returns a new StatsRegistry with only the specified names. | [
30522,
13366,
2069,
1006,
3415,
1007,
21839,
1035,
26319,
1027,
1030,
26319,
1012,
7276,
2079,
1064,
28093,
1064,
3415,
1012,
2421,
1029,
28093,
1031,
1024,
2171,
1033,
2203,
26319,
2890,
24063,
2854,
1012,
2047,
1006,
21839,
1035,
26319,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.add_custom_prebuilt_intent_with_http_info | def add_custom_prebuilt_intent_with_http_info(app_id, version_id, prebuilt_domain_model_create_object, custom_headers:nil)
add_custom_prebuilt_intent_async(app_id, version_id, prebuilt_domain_model_create_object, custom_headers:custom_headers).value!
end | ruby | def add_custom_prebuilt_intent_with_http_info(app_id, version_id, prebuilt_domain_model_create_object, custom_headers:nil)
add_custom_prebuilt_intent_async(app_id, version_id, prebuilt_domain_model_create_object, custom_headers:custom_headers).value!
end | [
"def",
"add_custom_prebuilt_intent_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"prebuilt_domain_model_create_object",
",",
"custom_headers",
":",
"nil",
")",
"add_custom_prebuilt_intent_async",
"(",
"app_id",
",",
"version_id",
",",
"prebuilt_domain_model_create_obj... | Adds a customizable prebuilt intent model to a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param prebuilt_domain_model_create_object [PrebuiltDomainModelCreateObject]
A model object containing the name of the customizable prebuilt intent and
the name of the domain to which this model belongs.
@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",
"customizable",
"prebuilt",
"intent",
"model",
"to",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L4353-L4355 | train | Adds a prebuilt intent to an App Service Environment. | [
30522,
13366,
5587,
1035,
7661,
1035,
3653,
8569,
4014,
2102,
1035,
7848,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
3653,
8569,
4014,
2102,
1035,
5884,
1035,
2944,
1035,
3443,
1035,
4874,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
randym/axlsx | lib/axlsx/workbook/worksheet/conditional_formatting.rb | Axlsx.ConditionalFormatting.to_xml_string | def to_xml_string(str = '')
str << ('<conditionalFormatting sqref="' << sqref << '">')
str << rules.collect{ |rule| rule.to_xml_string }.join(' ')
str << '</conditionalFormatting>'
end | ruby | def to_xml_string(str = '')
str << ('<conditionalFormatting sqref="' << sqref << '">')
str << rules.collect{ |rule| rule.to_xml_string }.join(' ')
str << '</conditionalFormatting>'
end | [
"def",
"to_xml_string",
"(",
"str",
"=",
"''",
")",
"str",
"<<",
"(",
"'<conditionalFormatting sqref=\"'",
"<<",
"sqref",
"<<",
"'\">'",
")",
"str",
"<<",
"rules",
".",
"collect",
"{",
"|",
"rule",
"|",
"rule",
".",
"to_xml_string",
"}",
".",
"join",
"("... | Serializes the conditional formatting element
@example Conditional Formatting XML looks like:
<conditionalFormatting sqref="E3:E9">
<cfRule type="cellIs" dxfId="0" priority="1" operator="greaterThan">
<formula>0.5</formula>
</cfRule>
</conditionalFormatting>
@param [String] str
@return [String] | [
"Serializes",
"the",
"conditional",
"formatting",
"element"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/worksheet/conditional_formatting.rb#L76-L80 | train | Returns the XML string for this conditionalFormatting. | [
30522,
13366,
2000,
1035,
20950,
1035,
5164,
1006,
2358,
2099,
1027,
1005,
1005,
1007,
2358,
2099,
1026,
1026,
1006,
1005,
1026,
18462,
14192,
19321,
2075,
5490,
2890,
2546,
1027,
1000,
1005,
1026,
1026,
5490,
2890,
2546,
1026,
1026,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_datalake_analytics/lib/2015-10-01-preview/generated/azure_mgmt_datalake_analytics/account.rb | Azure::DataLakeAnalytics::Mgmt::V2015_10_01_preview.Account.create_async | def create_async(resource_group_name, name, parameters, custom_headers:nil)
# Send request
promise = begin_create_async(resource_group_name, name, parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::DataLakeAnalytics::Mgmt::V2015_10_01_preview::Models::DataLakeAnalyticsAccount.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_async(resource_group_name, name, parameters, custom_headers:nil)
# Send request
promise = begin_create_async(resource_group_name, name, parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::DataLakeAnalytics::Mgmt::V2015_10_01_preview::Models::DataLakeAnalyticsAccount.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_async",
"(",
"resource_group_name",
",",
"name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_create_async",
"(",
"resource_group_name",
",",
"name",
",",
"parameters",
",",
"custom_headers",
":cu... | @param resource_group_name [String] The name of the Azure resource group that
contains the Data Lake Analytics account.the account will be associated with.
@param name [String] The name of the Data Lake Analytics account to create.
@param parameters [DataLakeAnalyticsAccount] Parameters supplied to the
create Data Lake Analytics account 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",
"Azure",
"resource",
"group",
"that",
"contains",
"the",
"Data",
"Lake",
"Analytics",
"account",
".",
"the",
"account",
"will",
"be",
"associated",
"with",
".",
"@param",
"name",
... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_datalake_analytics/lib/2015-10-01-preview/generated/azure_mgmt_datalake_analytics/account.rb#L1942-L1958 | train | Creates a Data Lake Analytics account. | [
30522,
13366,
3443,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
30524,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | 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_application_backup_with_http_info | def disable_application_backup_with_http_info(application_id, timeout:60, disable_backup_description:nil, custom_headers:nil)
disable_application_backup_async(application_id, timeout:timeout, disable_backup_description:disable_backup_description, custom_headers:custom_headers).value!
end | ruby | def disable_application_backup_with_http_info(application_id, timeout:60, disable_backup_description:nil, custom_headers:nil)
disable_application_backup_async(application_id, timeout:timeout, disable_backup_description:disable_backup_description, custom_headers:custom_headers).value!
end | [
"def",
"disable_application_backup_with_http_info",
"(",
"application_id",
",",
"timeout",
":",
"60",
",",
"disable_backup_description",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"disable_application_backup_async",
"(",
"application_id",
",",
"timeout",
":",
"... | Disables periodic backup of Service Fabric application.
Disables periodic backup of Service Fabric application which was previously
enabled.
@param application_id [String] The identity of the application. This is
typically the full name of the application without the 'fabric:' URI scheme.
Starting from version 6.0, hierarchical names are delimited with the "~"
character.
For example, if the application name is "fabric:/myapp/app1", the application
identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param disable_backup_description [DisableBackupDescription] Specifies the
parameters to disable backup for any backup entity.
@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. | [
"Disables",
"periodic",
"backup",
"of",
"Service",
"Fabric",
"application",
"."
] | 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#L23422-L23424 | train | Disables backup of the application. | [
30522,
13366,
4487,
19150,
1035,
4646,
1035,
10200,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
4646,
1035,
8909,
1010,
2051,
5833,
1024,
3438,
1010,
4487,
19150,
1035,
10200,
1035,
6412,
1024,
9152,
2140,
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... |
chef/ohai | lib/ohai/loader.rb | Ohai.Loader.plugin_files_by_dir | def plugin_files_by_dir(plugin_dir = Ohai.config[:plugin_path])
Array(plugin_dir).map do |path|
if Dir.exist?(path)
Ohai::Log.trace("Searching for Ohai plugins in #{path}")
escaped = ChefConfig::PathHelper.escape_glob_dir(path)
Dir[File.join(escaped, "**", "*.rb")]
else
Ohai::Log.debug("The plugin path #{path} does not exist. Skipping...")
[]
end
end.flatten
end | ruby | def plugin_files_by_dir(plugin_dir = Ohai.config[:plugin_path])
Array(plugin_dir).map do |path|
if Dir.exist?(path)
Ohai::Log.trace("Searching for Ohai plugins in #{path}")
escaped = ChefConfig::PathHelper.escape_glob_dir(path)
Dir[File.join(escaped, "**", "*.rb")]
else
Ohai::Log.debug("The plugin path #{path} does not exist. Skipping...")
[]
end
end.flatten
end | [
"def",
"plugin_files_by_dir",
"(",
"plugin_dir",
"=",
"Ohai",
".",
"config",
"[",
":plugin_path",
"]",
")",
"Array",
"(",
"plugin_dir",
")",
".",
"map",
"do",
"|",
"path",
"|",
"if",
"Dir",
".",
"exist?",
"(",
"path",
")",
"Ohai",
"::",
"Log",
".",
"... | Searches all plugin paths and returns an Array of file paths to plugins
@param dir [Array, String] directory/directories to load plugins from
@return [Array<String>] | [
"Searches",
"all",
"plugin",
"paths",
"and",
"returns",
"an",
"Array",
"of",
"file",
"paths",
"to",
"plugins"
] | 8d66449940f04237586b2f928231c6b26e2cc19a | https://github.com/chef/ohai/blob/8d66449940f04237586b2f928231c6b26e2cc19a/lib/ohai/loader.rb#L43-L55 | train | Returns an array of all the plugin files in the given directory. | [
30522,
13366,
13354,
2378,
1035,
6764,
1035,
2011,
1035,
16101,
1006,
13354,
2378,
1035,
16101,
1027,
2821,
4886,
1012,
9530,
8873,
2290,
1031,
1024,
13354,
2378,
1035,
4130,
1033,
1007,
9140,
1006,
13354,
2378,
1035,
16101,
1007,
1012,
494... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SamSaffron/message_bus | lib/message_bus/http_client.rb | MessageBus.HTTPClient.subscribe | def subscribe(channel, last_message_id: nil, &callback)
raise InvalidChannel unless channel.to_s.start_with?("/")
raise MissingBlock unless block_given?
last_message_id = -1 if last_message_id && !last_message_id.is_a?(Integer)
@channels[channel] ||= Channel.new
channel = @channels[channel]
channel.last_message_id = last_message_id if last_message_id
channel.callbacks.push(callback)
start if stopped?
end | ruby | def subscribe(channel, last_message_id: nil, &callback)
raise InvalidChannel unless channel.to_s.start_with?("/")
raise MissingBlock unless block_given?
last_message_id = -1 if last_message_id && !last_message_id.is_a?(Integer)
@channels[channel] ||= Channel.new
channel = @channels[channel]
channel.last_message_id = last_message_id if last_message_id
channel.callbacks.push(callback)
start if stopped?
end | [
"def",
"subscribe",
"(",
"channel",
",",
"last_message_id",
":",
"nil",
",",
"&",
"callback",
")",
"raise",
"InvalidChannel",
"unless",
"channel",
".",
"to_s",
".",
"start_with?",
"(",
"\"/\"",
")",
"raise",
"MissingBlock",
"unless",
"block_given?",
"last_messag... | Subscribes to a channel which executes the given callback when a message
is published to the channel
@example Subscribing to a channel for message
client = MessageBus::HTTPClient.new('http://some.test.com')
client.subscribe("/test") do |payload, _message_id, _global_id|
puts payload
end
A last_message_id may be provided.
* -1 will subscribe to all new messages
* -2 will recieve last message + all new messages
* -3 will recieve last 2 message + all new messages
@example Subscribing to a channel with `last_message_id`
client.subscribe("/test", last_message_id: -2) do |payload|
puts payload
end
@param channel [String] channel to listen for messages on
@param last_message_id [Integer] last message id to start polling on.
@yield [data, message_id, global_id]
callback to be executed whenever a message is received
@yieldparam data [Hash] data payload of the message received on the channel
@yieldparam message_id [Integer] id of the message in the channel
@yieldparam global_id [Integer] id of the message in the global backlog
@yieldreturn [void]
@return [Integer] the current status of the client | [
"Subscribes",
"to",
"a",
"channel",
"which",
"executes",
"the",
"given",
"callback",
"when",
"a",
"message",
"is",
"published",
"to",
"the",
"channel"
] | 90fba639eb5d332ca8e87fd35f1d603a5743076d | https://github.com/SamSaffron/message_bus/blob/90fba639eb5d332ca8e87fd35f1d603a5743076d/lib/message_bus/http_client.rb#L168-L179 | train | Subscribe to a channel | [
30522,
13366,
4942,
29234,
1006,
3149,
1010,
2197,
1035,
4471,
1035,
8909,
1024,
9152,
2140,
1010,
1004,
2655,
5963,
1007,
5333,
19528,
26058,
4983,
3149,
1012,
2000,
1035,
1055,
1012,
2707,
1035,
2007,
1029,
1006,
1000,
1013,
1000,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ankane/searchkick | lib/searchkick/index.rb | Searchkick.Index.klass_document_type | def klass_document_type(klass, ignore_type = false)
@klass_document_type[[klass, ignore_type]] ||= begin
if !ignore_type && klass.searchkick_klass.searchkick_options[:_type]
type = klass.searchkick_klass.searchkick_options[:_type]
type = type.call if type.respond_to?(:call)
type
else
klass.model_name.to_s.underscore
end
end
end | ruby | def klass_document_type(klass, ignore_type = false)
@klass_document_type[[klass, ignore_type]] ||= begin
if !ignore_type && klass.searchkick_klass.searchkick_options[:_type]
type = klass.searchkick_klass.searchkick_options[:_type]
type = type.call if type.respond_to?(:call)
type
else
klass.model_name.to_s.underscore
end
end
end | [
"def",
"klass_document_type",
"(",
"klass",
",",
"ignore_type",
"=",
"false",
")",
"@klass_document_type",
"[",
"[",
"klass",
",",
"ignore_type",
"]",
"]",
"||=",
"begin",
"if",
"!",
"ignore_type",
"&&",
"klass",
".",
"searchkick_klass",
".",
"searchkick_options... | other | [
"other"
] | 33ee919b56a5204d9e5c519f87e1681216be7699 | https://github.com/ankane/searchkick/blob/33ee919b56a5204d9e5c519f87e1681216be7699/lib/searchkick/index.rb#L221-L231 | train | Returns the document type for a given class. | [
30522,
13366,
1047,
27102,
1035,
6254,
1035,
2828,
1006,
1047,
27102,
1010,
8568,
1035,
2828,
1027,
6270,
1007,
1030,
1047,
27102,
1035,
6254,
1035,
30524,
1047,
27102,
1012,
3945,
29493,
2243,
1035,
1047,
27102,
1012,
3945,
29493,
2243,
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... |
aws/aws-sdk-ruby | build_tools/changelog.rb | BuildTools.Changelog.version_unreleased_changes | def version_unreleased_changes(options)
version = options.fetch(:version)
date = options.fetch(:date, Time.now.strftime('%Y-%m-%d'))
lines = read.lines.to_a
lines[0] = "#{version} (#{date})\n"
write(lines.join)
add_unreleased_changes_section
end | ruby | def version_unreleased_changes(options)
version = options.fetch(:version)
date = options.fetch(:date, Time.now.strftime('%Y-%m-%d'))
lines = read.lines.to_a
lines[0] = "#{version} (#{date})\n"
write(lines.join)
add_unreleased_changes_section
end | [
"def",
"version_unreleased_changes",
"(",
"options",
")",
"version",
"=",
"options",
".",
"fetch",
"(",
":version",
")",
"date",
"=",
"options",
".",
"fetch",
"(",
":date",
",",
"Time",
".",
"now",
".",
"strftime",
"(",
"'%Y-%m-%d'",
")",
")",
"lines",
"... | @option options [required, String] :version The version number to apply
to the unreleased changes section at the top of the CHANGELOG.
Should be formatted like "1.0.0".
@option options [optional, String<YYYY-MM-DD>] :date Defaults to the
current date. | [
"@option",
"options",
"[",
"required",
"String",
"]",
":",
"version",
"The",
"version",
"number",
"to",
"apply",
"to",
"the",
"unreleased",
"changes",
"section",
"at",
"the",
"top",
"of",
"the",
"CHANGELOG",
".",
"Should",
"be",
"formatted",
"like",
"1",
"... | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/build_tools/changelog.rb#L29-L36 | train | Add unreleased changes to the current version | [
30522,
13366,
2544,
1035,
13270,
1035,
3431,
1006,
7047,
1007,
2544,
1027,
7047,
1012,
18584,
1006,
1024,
2544,
1007,
3058,
1027,
7047,
1012,
18584,
1006,
1024,
3058,
1010,
2051,
1012,
2085,
1012,
2358,
12881,
7292,
1006,
1005,
1003,
1061,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
piotrmurach/github | lib/github_api/parameter_filter.rb | Github.ParameterFilter.filter! | def filter!(keys, params, options={:recursive => true}) # :nodoc:
case params
when Hash, ParamsHash
params.keys.each do |k, v|
unless (keys.include?(k) or Github::Validations::VALID_API_KEYS.include?(k))
params.delete(k)
else
filter!(keys, params[k]) if options[:recursive]
end
end
when Array
params.map! do |el|
filter!(keys, el) if options[:recursive]
end
else
params
end
return params
end | ruby | def filter!(keys, params, options={:recursive => true}) # :nodoc:
case params
when Hash, ParamsHash
params.keys.each do |k, v|
unless (keys.include?(k) or Github::Validations::VALID_API_KEYS.include?(k))
params.delete(k)
else
filter!(keys, params[k]) if options[:recursive]
end
end
when Array
params.map! do |el|
filter!(keys, el) if options[:recursive]
end
else
params
end
return params
end | [
"def",
"filter!",
"(",
"keys",
",",
"params",
",",
"options",
"=",
"{",
":recursive",
"=>",
"true",
"}",
")",
"# :nodoc:",
"case",
"params",
"when",
"Hash",
",",
"ParamsHash",
"params",
".",
"keys",
".",
"each",
"do",
"|",
"k",
",",
"v",
"|",
"unless... | Removes any keys from nested hashes that don't match predefiend keys | [
"Removes",
"any",
"keys",
"from",
"nested",
"hashes",
"that",
"don",
"t",
"match",
"predefiend",
"keys"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/parameter_filter.rb#L14-L32 | train | Filter params by keys | [
30522,
13366,
11307,
999,
1006,
6309,
1010,
11498,
5244,
1010,
7047,
1027,
1063,
1024,
28667,
9236,
3512,
1027,
1028,
2995,
1065,
1007,
1001,
1024,
7293,
10085,
1024,
2553,
11498,
5244,
2043,
23325,
1010,
11498,
5244,
14949,
2232,
11498,
52... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_restart_progress_with_http_info | def get_partition_restart_progress_with_http_info(service_id, partition_id, operation_id, timeout:60, custom_headers:nil)
get_partition_restart_progress_async(service_id, partition_id, operation_id, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def get_partition_restart_progress_with_http_info(service_id, partition_id, operation_id, timeout:60, custom_headers:nil)
get_partition_restart_progress_async(service_id, partition_id, operation_id, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"get_partition_restart_progress_with_http_info",
"(",
"service_id",
",",
"partition_id",
",",
"operation_id",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"get_partition_restart_progress_async",
"(",
"service_id",
",",
"partition_id",
",",
"... | Gets the progress of a PartitionRestart operation started using
StartPartitionRestart.
Gets the progress of a PartitionRestart started with StartPartitionRestart
using the provided OperationId.
@param service_id [String] The identity of the service. This is typically the
full name of the service without the 'fabric:' URI scheme.
Starting from version 6.0, hierarchical names are delimited with the "~"
character.
For example, if the service name is "fabric:/myapp/app1/svc1", the service
identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
versions.
@param partition_id The identity of the partition.
@param operation_id A GUID that identifies a call of this API. This is
passed into the corresponding GetProgress API
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"progress",
"of",
"a",
"PartitionRestart",
"operation",
"started",
"using",
"StartPartitionRestart",
"."
] | 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#L21498-L21500 | train | Gets the restart progress of the specified partition. | [
30522,
13366,
2131,
1035,
13571,
1035,
23818,
1035,
5082,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2326,
1035,
8909,
1010,
13571,
1035,
8909,
1010,
3169,
1035,
8909,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/managers.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.Managers.regenerate_activation_key | def regenerate_activation_key(resource_group_name, manager_name, custom_headers:nil)
response = regenerate_activation_key_async(resource_group_name, manager_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def regenerate_activation_key(resource_group_name, manager_name, custom_headers:nil)
response = regenerate_activation_key_async(resource_group_name, manager_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"regenerate_activation_key",
"(",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"regenerate_activation_key_async",
"(",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":custom_headers",
")",
... | Re-generates and returns the activation key of the manager.
@param resource_group_name [String] The resource group name
@param manager_name [String] The manager name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Key] operation results. | [
"Re",
"-",
"generates",
"and",
"returns",
"the",
"activation",
"key",
"of",
"the",
"manager",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/managers.rb#L1666-L1669 | train | Regenerate activation key for a managed database. | [
30522,
13366,
19723,
24454,
3686,
1035,
13791,
1035,
3145,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
19723,
24454,
3686,
1035,
13791,
1035,
3145,
1035,
200... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/managed_server_security_alert_policies.rb | Azure::SQL::Mgmt::V2017_03_01_preview.ManagedServerSecurityAlertPolicies.list_by_instance_as_lazy | def list_by_instance_as_lazy(resource_group_name, managed_instance_name, custom_headers:nil)
response = list_by_instance_async(resource_group_name, managed_instance_name, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_instance_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_by_instance_as_lazy(resource_group_name, managed_instance_name, custom_headers:nil)
response = list_by_instance_async(resource_group_name, managed_instance_name, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_instance_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_by_instance_as_lazy",
"(",
"resource_group_name",
",",
"managed_instance_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_instance_async",
"(",
"resource_group_name",
",",
"managed_instance_name",
",",
"custom_headers",
":custom_headers",
... | Get the managed server's threat detection policies.
@param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param managed_instance_name [String] The name of the managed instance.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ManagedServerSecurityAlertPolicyListResult] which provide lazy
access to pages of the response. | [
"Get",
"the",
"managed",
"server",
"s",
"threat",
"detection",
"policies",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/managed_server_security_alert_policies.rb#L488-L497 | train | Gets the list of managed instance s terms. | [
30522,
13366,
2862,
1035,
2011,
1035,
6013,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3266,
1035,
6013,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
6013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-admin | lib/jekyll-admin/apiable.rb | JekyllAdmin.APIable.to_api | def to_api(include_content: false)
output = hash_for_api
output = output.merge(url_fields)
# Include content, if requested, otherwise remove it
if include_content
output = output.merge(content_fields)
else
CONTENT_FIELDS.each { |field| output.delete(field) }
end
# Documents have duplicate output and content fields, Pages do not
# Since it's an API, use `content` in both for consistency
output.delete("output")
# By default, calling to_liquid on a collection will return a docs
# array with each rendered document, which we don't want.
if is_a?(Jekyll::Collection)
output.delete("docs")
output["entries_url"] = entries_url
end
if is_a?(Jekyll::Document)
output["relative_path"] = relative_path.sub("_drafts/", "") if draft?
output["name"] = basename
end
if is_a?(Jekyll::StaticFile)
output["from_theme"] = from_theme_gem?
end
output
end | ruby | def to_api(include_content: false)
output = hash_for_api
output = output.merge(url_fields)
# Include content, if requested, otherwise remove it
if include_content
output = output.merge(content_fields)
else
CONTENT_FIELDS.each { |field| output.delete(field) }
end
# Documents have duplicate output and content fields, Pages do not
# Since it's an API, use `content` in both for consistency
output.delete("output")
# By default, calling to_liquid on a collection will return a docs
# array with each rendered document, which we don't want.
if is_a?(Jekyll::Collection)
output.delete("docs")
output["entries_url"] = entries_url
end
if is_a?(Jekyll::Document)
output["relative_path"] = relative_path.sub("_drafts/", "") if draft?
output["name"] = basename
end
if is_a?(Jekyll::StaticFile)
output["from_theme"] = from_theme_gem?
end
output
end | [
"def",
"to_api",
"(",
"include_content",
":",
"false",
")",
"output",
"=",
"hash_for_api",
"output",
"=",
"output",
".",
"merge",
"(",
"url_fields",
")",
"# Include content, if requested, otherwise remove it",
"if",
"include_content",
"output",
"=",
"output",
".",
"... | Returns a hash suitable for use as an API response.
For Documents and Pages:
1. Adds the file's raw content to the `raw_content` field
2. Adds the file's raw YAML front matter to the `front_matter` field
For Static Files it addes the Base64 `encoded_content` field
Options:
include_content - if true, includes the content in the respond, false by default
to support mapping on indexes where we only want metadata
Returns a hash (which can then be to_json'd) | [
"Returns",
"a",
"hash",
"suitable",
"for",
"use",
"as",
"an",
"API",
"response",
"."
] | bc053b3b93faba679e8666091c42c47970e3bb5e | https://github.com/jekyll/jekyll-admin/blob/bc053b3b93faba679e8666091c42c47970e3bb5e/lib/jekyll-admin/apiable.rb#L24-L56 | train | Returns a hash of the API response | [
30522,
13366,
2000,
1035,
17928,
1006,
2421,
1035,
4180,
1024,
6270,
1007,
6434,
1027,
23325,
1035,
2005,
1035,
17928,
6434,
1027,
6434,
1012,
13590,
1006,
24471,
2140,
1035,
4249,
1007,
1001,
2421,
4180,
1010,
2065,
7303,
1010,
4728,
6366,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hanami/hanami | lib/hanami/hanamirc.rb | Hanami.Hanamirc.default_options | def default_options
@default_options ||= Utils::Hash.symbolize({
PROJECT_NAME => project_name,
TEST_KEY => DEFAULT_TEST_SUITE,
TEMPLATE_KEY => DEFAULT_TEMPLATE
}).freeze
end | ruby | def default_options
@default_options ||= Utils::Hash.symbolize({
PROJECT_NAME => project_name,
TEST_KEY => DEFAULT_TEST_SUITE,
TEMPLATE_KEY => DEFAULT_TEMPLATE
}).freeze
end | [
"def",
"default_options",
"@default_options",
"||=",
"Utils",
"::",
"Hash",
".",
"symbolize",
"(",
"{",
"PROJECT_NAME",
"=>",
"project_name",
",",
"TEST_KEY",
"=>",
"DEFAULT_TEST_SUITE",
",",
"TEMPLATE_KEY",
"=>",
"DEFAULT_TEMPLATE",
"}",
")",
".",
"freeze",
"end"... | Default values for writing the hanamirc file
@since 0.5.1
@api private
@see Hanami::Hanamirc#options | [
"Default",
"values",
"for",
"writing",
"the",
"hanamirc",
"file"
] | 8c6e5147e92ef869b25379448572da3698eacfdc | https://github.com/hanami/hanami/blob/8c6e5147e92ef869b25379448572da3698eacfdc/lib/hanami/hanamirc.rb#L95-L101 | train | Returns the default options for the current project | [
30522,
13366,
12398,
1035,
7047,
1030,
12398,
1035,
7047,
1064,
1064,
1027,
21183,
12146,
1024,
1024,
23325,
1012,
6454,
4697,
1006,
1063,
2622,
1035,
2171,
1027,
1028,
2622,
1035,
2171,
1010,
3231,
1035,
3145,
1027,
1028,
12398,
1035,
3231... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_management/lib/2017-08-31-preview/generated/azure_mgmt_resources_management/management_groups.rb | Azure::ResourcesManagement::Mgmt::V2017_08_31_preview.ManagementGroups.list | def list(skiptoken:nil, custom_headers:nil)
first_page = list_as_lazy(skiptoken:skiptoken, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list(skiptoken:nil, custom_headers:nil)
first_page = list_as_lazy(skiptoken:skiptoken, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list",
"(",
"skiptoken",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_as_lazy",
"(",
"skiptoken",
":",
"skiptoken",
",",
"custom_headers",
":custom_headers",
")",
"first_page",
".",
"get_all_items",
"end"
] | List management groups for the authenticated user.
@param skiptoken [String] Page continuation token is only used if a previous
operation returned a partial result.
If a previous response contains a nextLink element, the value of the nextLink
element will include a token parameter that specifies a starting point to use
for subsequent calls.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<ManagementGroupInfo>] operation results. | [
"List",
"management",
"groups",
"for",
"the",
"authenticated",
"user",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_resources_management/lib/2017-08-31-preview/generated/azure_mgmt_resources_management/management_groups.rb#L43-L46 | train | Gets all the available terms of a product. | [
30522,
13366,
2862,
1006,
13558,
18715,
2368,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2862,
1035,
2004,
1035,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_management/lib/2017-08-31-preview/generated/azure_mgmt_resources_management/management_groups.rb | Azure::ResourcesManagement::Mgmt::V2017_08_31_preview.ManagementGroups.get_with_http_info | def get_with_http_info(expand:nil, recurse:nil, custom_headers:nil)
get_async(expand:expand, recurse:recurse, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(expand:nil, recurse:nil, custom_headers:nil)
get_async(expand:expand, recurse:recurse, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"expand",
":",
"nil",
",",
"recurse",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"expand",
":",
"expand",
",",
"recurse",
":",
"recurse",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!... | Get the details of the management group.
@param expand [Enum] The $expand=children query string parameter allows
clients to request inclusion of children in the response payload. Possible
values include: 'children'
@param recurse [Boolean] The $recurse=true query string parameter allows
clients to request inclusion of entire hierarchy in the response payload.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Get",
"the",
"details",
"of",
"the",
"management",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_resources_management/lib/2017-08-31-preview/generated/azure_mgmt_resources_management/management_groups.rb#L164-L166 | train | Gets the index of the index specification. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7818,
1024,
9152,
2140,
1010,
28667,
28393,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
2004,
6038,
2278,
1006,
7818,
1024,
7818,
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-ec2/lib/aws-sdk-ec2/route.rb | Aws::EC2.Route.delete | def delete(options = {})
options = options.merge(
route_table_id: @route_table_id,
destination_cidr_block: @destination_cidr_block
)
resp = @client.delete_route(options)
resp.data
end | ruby | def delete(options = {})
options = options.merge(
route_table_id: @route_table_id,
destination_cidr_block: @destination_cidr_block
)
resp = @client.delete_route(options)
resp.data
end | [
"def",
"delete",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"route_table_id",
":",
"@route_table_id",
",",
"destination_cidr_block",
":",
"@destination_cidr_block",
")",
"resp",
"=",
"@client",
".",
"delete_route",
"(",
"... | @!group Actions
@example Request syntax with placeholder values
route.delete({
destination_ipv_6_cidr_block: "String",
dry_run: false,
})
@param [Hash] options ({})
@option options [String] :destination_ipv_6_cidr_block
The IPv6 CIDR range for the route. The value you specify must match
the CIDR for the route exactly.
@option options [Boolean] :dry_run
Checks whether you have the required permissions for the action,
without actually making the request, and provides an error response.
If you have the required permissions, the error response is
`DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
@return [EmptyStructure] | [
"@!group",
"Actions",
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/route.rb#L267-L274 | train | Delete a route | [
30522,
13366,
3972,
12870,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
2799,
1035,
2795,
1035,
8909,
1024,
1030,
2799,
1035,
2795,
1035,
8909,
1010,
7688,
1035,
28744,
2099,
1035,
3796,
1024,
1030,
7688,
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... |
Dynamoid/dynamoid | lib/dynamoid/fields.rb | Dynamoid.Fields.write_attribute | def write_attribute(name, value)
name = name.to_sym
if association = @associations[name]
association.reset
end
@attributes_before_type_cast[name] = value
value_casted = TypeCasting.cast_field(value, self.class.attributes[name])
attributes[name] = value_casted
end | ruby | def write_attribute(name, value)
name = name.to_sym
if association = @associations[name]
association.reset
end
@attributes_before_type_cast[name] = value
value_casted = TypeCasting.cast_field(value, self.class.attributes[name])
attributes[name] = value_casted
end | [
"def",
"write_attribute",
"(",
"name",
",",
"value",
")",
"name",
"=",
"name",
".",
"to_sym",
"if",
"association",
"=",
"@associations",
"[",
"name",
"]",
"association",
".",
"reset",
"end",
"@attributes_before_type_cast",
"[",
"name",
"]",
"=",
"value",
"va... | Write an attribute on the object. Also marks the previous value as dirty.
@param [Symbol] name the name of the field
@param [Object] value the value to assign to that field
@since 0.2.0 | [
"Write",
"an",
"attribute",
"on",
"the",
"object",
".",
"Also",
"marks",
"the",
"previous",
"value",
"as",
"dirty",
"."
] | 9e3d006b039e45877b003564ded65509b10b6354 | https://github.com/Dynamoid/dynamoid/blob/9e3d006b039e45877b003564ded65509b10b6354/lib/dynamoid/fields.rb#L117-L128 | train | Write an attribute to the object. | [
30522,
13366,
4339,
1035,
17961,
1006,
2171,
1010,
3643,
1007,
2171,
1027,
2171,
1012,
2000,
1035,
25353,
2213,
2065,
2523,
1027,
1030,
8924,
1031,
2171,
1033,
2523,
1012,
25141,
2203,
1030,
12332,
1035,
2077,
1035,
2828,
1035,
3459,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb | Aws::EC2.Resource.instances | def instances(options = {})
batches = Enumerator.new do |y|
resp = @client.describe_instances(options)
resp.each_page do |page|
batch = []
page.data.reservations.each do |r|
r.instances.each do |i|
batch << Instance.new(
id: i.instance_id,
data: i,
client: @client
)
end
end
y.yield(batch)
end
end
Instance::Collection.new(batches)
end | ruby | def instances(options = {})
batches = Enumerator.new do |y|
resp = @client.describe_instances(options)
resp.each_page do |page|
batch = []
page.data.reservations.each do |r|
r.instances.each do |i|
batch << Instance.new(
id: i.instance_id,
data: i,
client: @client
)
end
end
y.yield(batch)
end
end
Instance::Collection.new(batches)
end | [
"def",
"instances",
"(",
"options",
"=",
"{",
"}",
")",
"batches",
"=",
"Enumerator",
".",
"new",
"do",
"|",
"y",
"|",
"resp",
"=",
"@client",
".",
"describe_instances",
"(",
"options",
")",
"resp",
".",
"each_page",
"do",
"|",
"page",
"|",
"batch",
... | @example Request syntax with placeholder values
instances = ec2.instances({
filters: [
{
name: "String",
values: ["String"],
},
],
instance_ids: ["String"],
dry_run: false,
})
@param [Hash] options ({})
@option options [Array<Types::Filter>] :filters
The filters.
* `affinity` - The affinity setting for an instance running on a
Dedicated Host (`default` \| `host`).
* `architecture` - The instance architecture (`i386` \| `x86_64`).
* `availability-zone` - The Availability Zone of the instance.
* `block-device-mapping.attach-time` - The attach time for an EBS
volume mapped to the instance, for example,
`2010-09-15T17:15:20.000Z`.
* `block-device-mapping.delete-on-termination` - A Boolean that
indicates whether the EBS volume is deleted on instance termination.
* `block-device-mapping.device-name` - The device name specified in
the block device mapping (for example, `/dev/sdh` or `xvdh`).
* `block-device-mapping.status` - The status for the EBS volume
(`attaching` \| `attached` \| `detaching` \| `detached`).
* `block-device-mapping.volume-id` - The volume ID of the EBS volume.
* `client-token` - The idempotency token you provided when you
launched the instance.
* `dns-name` - The public DNS name of the instance.
* `group-id` - The ID of the security group for the instance.
EC2-Classic only.
* `group-name` - The name of the security group for the instance.
EC2-Classic only.
* `hibernation-options.configured` - A Boolean that indicates whether
the instance is enabled for hibernation. A value of `true` means
that the instance is enabled for hibernation.
* `host-id` - The ID of the Dedicated Host on which the instance is
running, if applicable.
* `hypervisor` - The hypervisor type of the instance (`ovm` \| `xen`).
* `iam-instance-profile.arn` - The instance profile associated with
the instance. Specified as an ARN.
* `image-id` - The ID of the image used to launch the instance.
* `instance-id` - The ID of the instance.
* `instance-lifecycle` - Indicates whether this is a Spot Instance or
a Scheduled Instance (`spot` \| `scheduled`).
* `instance-state-code` - The state of the instance, as a 16-bit
unsigned integer. The high byte is used for internal purposes and
should be ignored. The low byte is set based on the state
represented. The valid values are: 0 (pending), 16 (running), 32
(shutting-down), 48 (terminated), 64 (stopping), and 80 (stopped).
* `instance-state-name` - The state of the instance (`pending` \|
`running` \| `shutting-down` \| `terminated` \| `stopping` \|
`stopped`).
* `instance-type` - The type of instance (for example, `t2.micro`).
* `instance.group-id` - The ID of the security group for the instance.
* `instance.group-name` - The name of the security group for the
instance.
* `ip-address` - The public IPv4 address of the instance.
* `kernel-id` - The kernel ID.
* `key-name` - The name of the key pair used when the instance was
launched.
* `launch-index` - When launching multiple instances, this is the
index for the instance in the launch group (for example, 0, 1, 2,
and so on).
* `launch-time` - The time when the instance was launched.
* `monitoring-state` - Indicates whether detailed monitoring is
enabled (`disabled` \| `enabled`).
* `network-interface.addresses.private-ip-address` - The private IPv4
address associated with the network interface.
* `network-interface.addresses.primary` - Specifies whether the IPv4
address of the network interface is the primary private IPv4
address.
* `network-interface.addresses.association.public-ip` - The ID of the
association of an Elastic IP address (IPv4) with a network
interface.
* `network-interface.addresses.association.ip-owner-id` - The owner ID
of the private IPv4 address associated with the network interface.
* `network-interface.association.public-ip` - The address of the
Elastic IP address (IPv4) bound to the network interface.
* `network-interface.association.ip-owner-id` - The owner of the
Elastic IP address (IPv4) associated with the network interface.
* `network-interface.association.allocation-id` - The allocation ID
returned when you allocated the Elastic IP address (IPv4) for your
network interface.
* `network-interface.association.association-id` - The association ID
returned when the network interface was associated with an IPv4
address.
* `network-interface.attachment.attachment-id` - The ID of the
interface attachment.
* `network-interface.attachment.instance-id` - The ID of the instance
to which the network interface is attached.
* `network-interface.attachment.instance-owner-id` - The owner ID of
the instance to which the network interface is attached.
* `network-interface.attachment.device-index` - The device index to
which the network interface is attached.
* `network-interface.attachment.status` - The status of the attachment
(`attaching` \| `attached` \| `detaching` \| `detached`).
* `network-interface.attachment.attach-time` - The time that the
network interface was attached to an instance.
* `network-interface.attachment.delete-on-termination` - Specifies
whether the attachment is deleted when an instance is terminated.
* `network-interface.availability-zone` - The Availability Zone for
the network interface.
* `network-interface.description` - The description of the network
interface.
* `network-interface.group-id` - The ID of a security group associated
with the network interface.
* `network-interface.group-name` - The name of a security group
associated with the network interface.
* `network-interface.ipv6-addresses.ipv6-address` - The IPv6 address
associated with the network interface.
* `network-interface.mac-address` - The MAC address of the network
interface.
* `network-interface.network-interface-id` - The ID of the network
interface.
* `network-interface.owner-id` - The ID of the owner of the network
interface.
* `network-interface.private-dns-name` - The private DNS name of the
network interface.
* `network-interface.requester-id` - The requester ID for the network
interface.
* `network-interface.requester-managed` - Indicates whether the
network interface is being managed by AWS.
* `network-interface.status` - The status of the network interface
(`available`) \| `in-use`).
* `network-interface.source-dest-check` - Whether the network
interface performs source/destination checking. A value of `true`
means that checking is enabled, and `false` means that checking is
disabled. The value must be `false` for the network interface to
perform network address translation (NAT) in your VPC.
* `network-interface.subnet-id` - The ID of the subnet for the network
interface.
* `network-interface.vpc-id` - The ID of the VPC for the network
interface.
* `owner-id` - The AWS account ID of the instance owner.
* `placement-group-name` - The name of the placement group for the
instance.
* `placement-partition-number` - The partition in which the instance
is located.
* `platform` - The platform. To list only Windows instances, use
`windows`.
* `private-dns-name` - The private IPv4 DNS name of the instance.
* `private-ip-address` - The private IPv4 address of the instance.
* `product-code` - The product code associated with the AMI used to
launch the instance.
* `product-code.type` - The type of product code (`devpay` \|
`marketplace`).
* `ramdisk-id` - The RAM disk ID.
* `reason` - The reason for the current state of the instance (for
example, shows "User Initiated \[date\]" when you stop or
terminate the instance). Similar to the state-reason-code filter.
* `requester-id` - The ID of the entity that launched the instance on
your behalf (for example, AWS Management Console, Auto Scaling, and
so on).
* `reservation-id` - The ID of the instance's reservation. A
reservation ID is created any time you launch an instance. A
reservation ID has a one-to-one relationship with an instance launch
request, but can be associated with more than one instance if you
launch multiple instances using the same launch request. For
example, if you launch one instance, you get one reservation ID. If
you launch ten instances using the same launch request, you also get
one reservation ID.
* `root-device-name` - The device name of the root device volume (for
example, `/dev/sda1`).
* `root-device-type` - The type of the root device volume (`ebs` \|
`instance-store`).
* `source-dest-check` - Indicates whether the instance performs
source/destination checking. A value of `true` means that checking
is enabled, and `false` means that checking is disabled. The value
must be `false` for the instance to perform network address
translation (NAT) in your VPC.
* `spot-instance-request-id` - The ID of the Spot Instance request.
* `state-reason-code` - The reason code for the state change.
* `state-reason-message` - A message that describes the state change.
* `subnet-id` - The ID of the subnet for the instance.
* `tag`\:<key> - The key/value combination of a tag assigned to
the resource. Use the tag key in the filter name and the tag value
as the filter value. For example, to find all resources that have a
tag with the key `Owner` and the value `TeamA`, specify `tag:Owner`
for the filter name and `TeamA` for the filter value.
* `tag-key` - The key of a tag assigned to the resource. Use this
filter to find all resources that have a tag with a specific key,
regardless of the tag value.
* `tenancy` - The tenancy of an instance (`dedicated` \| `default` \|
`host`).
* `virtualization-type` - The virtualization type of the instance
(`paravirtual` \| `hvm`).
* `vpc-id` - The ID of the VPC that the instance is running in.
@option options [Array<String>] :instance_ids
The instance IDs.
Default: Describes all your instances.
@option options [Boolean] :dry_run
Checks whether you have the required permissions for the action,
without actually making the request, and provides an error response.
If you have the required permissions, the error response is
`DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
@return [Instance::Collection] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb#L1786-L1804 | train | Returns an array of Instance objects | [
30522,
13366,
12107,
1006,
7047,
1027,
1063,
1065,
1007,
14108,
2229,
1027,
4372,
17897,
16259,
1012,
2047,
2079,
1064,
1061,
1064,
24501,
2361,
1027,
1030,
7396,
1012,
6235,
1035,
12107,
1006,
7047,
1007,
24501,
2361,
1012,
2169,
1035,
393... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.