repo stringclasses 237 values | path stringlengths 11 168 | func_name stringlengths 10 147 | original_string stringlengths 79 124k | language stringclasses 1 value | code stringlengths 79 124k | code_tokens listlengths 16 45.3k | docstring stringlengths 4 23.5k | docstring_tokens listlengths 1 452 | sha stringclasses 237 values | url stringlengths 95 268 | partition stringclasses 1 value | summary stringlengths 8 229 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
haml/haml | lib/haml/attribute_compiler.rb | Haml.AttributeCompiler.compile | def compile(attributes, object_ref, dynamic_attributes)
if object_ref != :nil || !AttributeParser.available?
return [:dynamic, AttributeCompiler.runtime_build(attributes, object_ref, dynamic_attributes)]
end
parsed_hashes = [dynamic_attributes.new, dynamic_attributes.old].compact.map do |attribute_hash|
unless (hash = AttributeParser.parse(attribute_hash))
return [:dynamic, AttributeCompiler.runtime_build(attributes, object_ref, dynamic_attributes)]
end
hash
end
attribute_values = build_attribute_values(attributes, parsed_hashes)
AttributeBuilder.verify_attribute_names!(attribute_values.map(&:key))
[:multi, *group_values_for_sort(attribute_values).map { |value_group|
compile_attribute_values(value_group)
}]
end | ruby | def compile(attributes, object_ref, dynamic_attributes)
if object_ref != :nil || !AttributeParser.available?
return [:dynamic, AttributeCompiler.runtime_build(attributes, object_ref, dynamic_attributes)]
end
parsed_hashes = [dynamic_attributes.new, dynamic_attributes.old].compact.map do |attribute_hash|
unless (hash = AttributeParser.parse(attribute_hash))
return [:dynamic, AttributeCompiler.runtime_build(attributes, object_ref, dynamic_attributes)]
end
hash
end
attribute_values = build_attribute_values(attributes, parsed_hashes)
AttributeBuilder.verify_attribute_names!(attribute_values.map(&:key))
[:multi, *group_values_for_sort(attribute_values).map { |value_group|
compile_attribute_values(value_group)
}]
end | [
"def",
"compile",
"(",
"attributes",
",",
"object_ref",
",",
"dynamic_attributes",
")",
"if",
"object_ref",
"!=",
":nil",
"||",
"!",
"AttributeParser",
".",
"available?",
"return",
"[",
":dynamic",
",",
"AttributeCompiler",
".",
"runtime_build",
"(",
"attributes",... | @param options [Haml::Options]
Returns Temple expression to render attributes.
@param attributes [Hash]
@param object_ref [String,:nil]
@param dynamic_attributes [DynamicAttributes]
@return [Array] Temple expression | [
"@param",
"options",
"[",
"Haml",
"::",
"Options",
"]",
"Returns",
"Temple",
"expression",
"to",
"render",
"attributes",
"."
] | 9aa0fbe4a91b999978927be569d2ad0cd39076f1 | https://github.com/haml/haml/blob/9aa0fbe4a91b999978927be569d2ad0cd39076f1/lib/haml/attribute_compiler.rb#L45-L62 | train | Compile the attributes | [
30522,
13366,
4012,
22090,
1006,
12332,
1010,
4874,
1035,
25416,
1010,
8790,
1035,
12332,
1007,
2065,
4874,
1035,
25416,
999,
1027,
1024,
9152,
2140,
1064,
1064,
999,
17961,
19362,
8043,
1012,
2800,
1029,
2709,
1031,
1024,
8790,
1010,
17961... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
github/linguist | samples/Ruby/sinatra.rb | Sinatra.Helpers.content_type | def content_type(type = nil, params={})
return response['Content-Type'] unless type
default = params.delete :default
mime_type = mime_type(type) || default
fail "Unknown media type: %p" % type if mime_type.nil?
mime_type = mime_type.dup
unless params.include? :charset or settings.add_charset.all? { |p| not p === mime_type }
params[:charset] = params.delete('charset') || settings.default_encoding
end
params.delete :charset if mime_type.include? 'charset'
unless params.empty?
mime_type << (mime_type.include?(';') ? ', ' : ';')
mime_type << params.map { |kv| kv.join('=') }.join(', ')
end
response['Content-Type'] = mime_type
end | ruby | def content_type(type = nil, params={})
return response['Content-Type'] unless type
default = params.delete :default
mime_type = mime_type(type) || default
fail "Unknown media type: %p" % type if mime_type.nil?
mime_type = mime_type.dup
unless params.include? :charset or settings.add_charset.all? { |p| not p === mime_type }
params[:charset] = params.delete('charset') || settings.default_encoding
end
params.delete :charset if mime_type.include? 'charset'
unless params.empty?
mime_type << (mime_type.include?(';') ? ', ' : ';')
mime_type << params.map { |kv| kv.join('=') }.join(', ')
end
response['Content-Type'] = mime_type
end | [
"def",
"content_type",
"(",
"type",
"=",
"nil",
",",
"params",
"=",
"{",
"}",
")",
"return",
"response",
"[",
"'Content-Type'",
"]",
"unless",
"type",
"default",
"=",
"params",
".",
"delete",
":default",
"mime_type",
"=",
"mime_type",
"(",
"type",
")",
"... | Set the Content-Type of the response body given a media type or file
extension. | [
"Set",
"the",
"Content",
"-",
"Type",
"of",
"the",
"response",
"body",
"given",
"a",
"media",
"type",
"or",
"file",
"extension",
"."
] | 9116c90fcbb82ac03b4b33c58cfbde1fcf745e99 | https://github.com/github/linguist/blob/9116c90fcbb82ac03b4b33c58cfbde1fcf745e99/samples/Ruby/sinatra.rb#L236-L251 | train | Returns the content - type header. | [
30522,
13366,
4180,
1035,
2828,
1006,
2828,
1027,
9152,
2140,
1010,
11498,
5244,
1027,
1063,
1065,
1007,
2709,
3433,
1031,
1005,
4180,
1011,
2828,
1005,
1033,
4983,
2828,
12398,
1027,
11498,
5244,
1012,
3972,
12870,
1024,
12398,
2771,
4168,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
intridea/hashie | lib/hashie/mash.rb | Hashie.Mash.deep_update | def deep_update(other_hash, &blk)
other_hash.each_pair do |k, v|
key = convert_key(k)
if v.is_a?(::Hash) && key?(key) && regular_reader(key).is_a?(Mash)
custom_reader(key).deep_update(v, &blk)
else
value = convert_value(v, true)
value = convert_value(yield(key, self[k], value), true) if blk && key?(k)
custom_writer(key, value, false)
end
end
self
end | ruby | def deep_update(other_hash, &blk)
other_hash.each_pair do |k, v|
key = convert_key(k)
if v.is_a?(::Hash) && key?(key) && regular_reader(key).is_a?(Mash)
custom_reader(key).deep_update(v, &blk)
else
value = convert_value(v, true)
value = convert_value(yield(key, self[k], value), true) if blk && key?(k)
custom_writer(key, value, false)
end
end
self
end | [
"def",
"deep_update",
"(",
"other_hash",
",",
"&",
"blk",
")",
"other_hash",
".",
"each_pair",
"do",
"|",
"k",
",",
"v",
"|",
"key",
"=",
"convert_key",
"(",
"k",
")",
"if",
"v",
".",
"is_a?",
"(",
"::",
"Hash",
")",
"&&",
"key?",
"(",
"key",
")"... | Recursively merges this mash with the passed
in hash, merging each hash in the hierarchy. | [
"Recursively",
"merges",
"this",
"mash",
"with",
"the",
"passed",
"in",
"hash",
"merging",
"each",
"hash",
"in",
"the",
"hierarchy",
"."
] | da9fd39a0e551e09c1441cb7453c969a4afbfd7f | https://github.com/intridea/hashie/blob/da9fd39a0e551e09c1441cb7453c969a4afbfd7f/lib/hashie/mash.rb#L218-L230 | train | Deep update the hash with the values from the other hash. | [
30522,
13366,
2784,
1035,
10651,
1006,
2060,
1035,
23325,
1010,
1004,
1038,
13687,
1007,
2060,
1035,
23325,
1012,
2169,
1035,
3940,
2079,
1064,
1047,
1010,
1058,
1064,
3145,
1027,
10463,
1035,
3145,
1006,
1047,
1007,
2065,
1058,
1012,
2003,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/internet_gateway.rb | Aws::EC2.InternetGateway.attach_to_vpc | def attach_to_vpc(options = {})
options = options.merge(internet_gateway_id: @id)
resp = @client.attach_internet_gateway(options)
resp.data
end | ruby | def attach_to_vpc(options = {})
options = options.merge(internet_gateway_id: @id)
resp = @client.attach_internet_gateway(options)
resp.data
end | [
"def",
"attach_to_vpc",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"internet_gateway_id",
":",
"@id",
")",
"resp",
"=",
"@client",
".",
"attach_internet_gateway",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @!group Actions
@example Request syntax with placeholder values
internet_gateway.attach_to_vpc({
dry_run: false,
vpc_id: "String", # required
})
@param [Hash] options ({})
@option options [Boolean] :dry_run
Checks whether you have the required permissions for the action,
without actually making the request, and provides an error response.
If you have the required permissions, the error response is
`DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
@option options [required, String] :vpc_id
The ID of the VPC.
@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/internet_gateway.rb#L199-L203 | train | Attach to a VPC | [
30522,
13366,
22476,
1035,
2000,
1035,
21210,
2278,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
4274,
1035,
11909,
1035,
8909,
1024,
1030,
8909,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
22476,
1035,
4274,
1035... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
grpc/grpc | src/ruby/lib/grpc/generic/rpc_desc.rb | GRPC.RpcDesc.unmarshal_proc | def unmarshal_proc(target)
fail ArgumentError unless [:input, :output].include?(target)
unmarshal_class = send(target)
unmarshal_class = unmarshal_class.type if unmarshal_class.is_a? Stream
proc { |o| unmarshal_class.send(unmarshal_method, o) }
end | ruby | def unmarshal_proc(target)
fail ArgumentError unless [:input, :output].include?(target)
unmarshal_class = send(target)
unmarshal_class = unmarshal_class.type if unmarshal_class.is_a? Stream
proc { |o| unmarshal_class.send(unmarshal_method, o) }
end | [
"def",
"unmarshal_proc",
"(",
"target",
")",
"fail",
"ArgumentError",
"unless",
"[",
":input",
",",
":output",
"]",
".",
"include?",
"(",
"target",
")",
"unmarshal_class",
"=",
"send",
"(",
"target",
")",
"unmarshal_class",
"=",
"unmarshal_class",
".",
"type",... | @param [:input, :output] target determines whether to produce the an
unmarshal Proc for the rpc input parameter or
its output parameter
@return [Proc] An unmarshal proc { |marshalled(instance)| instance } | [
"@param",
"[",
":",
"input",
":",
"output",
"]",
"target",
"determines",
"whether",
"to",
"produce",
"the",
"an",
"unmarshal",
"Proc",
"for",
"the",
"rpc",
"input",
"parameter",
"or",
"its",
"output",
"parameter"
] | f3937f0e55227a4ef3a23f895d3b204a947610f8 | https://github.com/grpc/grpc/blob/f3937f0e55227a4ef3a23f895d3b204a947610f8/src/ruby/lib/grpc/generic/rpc_desc.rb#L43-L48 | train | Unmarshall a proc of the object. | [
30522,
13366,
4895,
7849,
7377,
2140,
1035,
4013,
2278,
1006,
4539,
1007,
8246,
6685,
2121,
29165,
4983,
1031,
1024,
7953,
1010,
1024,
6434,
1033,
1012,
2421,
1029,
1006,
4539,
1007,
4895,
7849,
7377,
2140,
1035,
2465,
1027,
4604,
1006,
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... |
soundcloud/lhm | lib/lhm/chunker.rb | Lhm.Chunker.execute | def execute
return unless @start && @limit
@next_to_insert = @start
while @next_to_insert <= @limit
stride = @throttler.stride
affected_rows = @connection.update(copy(bottom, top(stride)))
if @throttler && affected_rows > 0
@throttler.run
end
@printer.notify(bottom, @limit)
@next_to_insert = top(stride) + 1
break if @start == @limit
end
@printer.end
end | ruby | def execute
return unless @start && @limit
@next_to_insert = @start
while @next_to_insert <= @limit
stride = @throttler.stride
affected_rows = @connection.update(copy(bottom, top(stride)))
if @throttler && affected_rows > 0
@throttler.run
end
@printer.notify(bottom, @limit)
@next_to_insert = top(stride) + 1
break if @start == @limit
end
@printer.end
end | [
"def",
"execute",
"return",
"unless",
"@start",
"&&",
"@limit",
"@next_to_insert",
"=",
"@start",
"while",
"@next_to_insert",
"<=",
"@limit",
"stride",
"=",
"@throttler",
".",
"stride",
"affected_rows",
"=",
"@connection",
".",
"update",
"(",
"copy",
"(",
"botto... | Copy from origin to destination in chunks of size `stride`.
Use the `throttler` class to sleep between each stride. | [
"Copy",
"from",
"origin",
"to",
"destination",
"in",
"chunks",
"of",
"size",
"stride",
".",
"Use",
"the",
"throttler",
"class",
"to",
"sleep",
"between",
"each",
"stride",
"."
] | 50907121eee514649fa944fb300d5d8a64fa873e | https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/lib/lhm/chunker.rb#L27-L43 | train | Execute the query using the specified index. | [
30522,
13366,
15389,
2709,
4983,
1030,
2707,
1004,
1004,
1030,
5787,
1030,
2279,
1035,
2000,
1035,
19274,
1027,
1030,
2707,
2096,
1030,
2279,
1035,
2000,
1035,
19274,
1026,
1027,
1030,
5787,
18045,
1027,
1030,
24420,
2099,
1012,
18045,
5360... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2016-06-01/generated/azure_mgmt_network/virtual_network_gateways.rb | Azure::Network::Mgmt::V2016_06_01.VirtualNetworkGateways.begin_reset_with_http_info | def begin_reset_with_http_info(resource_group_name, virtual_network_gateway_name, parameters, custom_headers:nil)
begin_reset_async(resource_group_name, virtual_network_gateway_name, parameters, custom_headers:custom_headers).value!
end | ruby | def begin_reset_with_http_info(resource_group_name, virtual_network_gateway_name, parameters, custom_headers:nil)
begin_reset_async(resource_group_name, virtual_network_gateway_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_reset_with_http_info",
"(",
"resource_group_name",
",",
"virtual_network_gateway_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_reset_async",
"(",
"resource_group_name",
",",
"virtual_network_gateway_name",
",",
"parameters",
",",
"cu... | The Reset VirtualNetworkGateway operation resets the primary of the virtual
network gateway in the specified resource group through Network resource
provider.
@param resource_group_name [String] The name of the resource group.
@param virtual_network_gateway_name [String] The name of the virtual network
gateway.
@param parameters [VirtualNetworkGateway] Parameters supplied to the Begin
Reset Virtual Network Gateway operation through Network resource provider.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"The",
"Reset",
"VirtualNetworkGateway",
"operation",
"resets",
"the",
"primary",
"of",
"the",
"virtual",
"network",
"gateway",
"in",
"the",
"specified",
"resource",
"group",
"through",
"Network",
"resource",
"provider",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2016-06-01/generated/azure_mgmt_network/virtual_network_gateways.rb#L727-L729 | train | Resets a virtual network gateway. | [
30522,
13366,
4088,
1035,
25141,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7484,
1035,
2897,
1035,
11909,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
1035,
25141... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_iot_hub/lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb | Azure::IotHub::Mgmt::V2017_01_19.IotHubResource.list_event_hub_consumer_groups | def list_event_hub_consumer_groups(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:nil)
first_page = list_event_hub_consumer_groups_as_lazy(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_event_hub_consumer_groups(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:nil)
first_page = list_event_hub_consumer_groups_as_lazy(resource_group_name, resource_name, event_hub_endpoint_name, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_event_hub_consumer_groups",
"(",
"resource_group_name",
",",
"resource_name",
",",
"event_hub_endpoint_name",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_event_hub_consumer_groups_as_lazy",
"(",
"resource_group_name",
",",
"resource_name",
",... | Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
endpoint in an IoT hub.
Get a list of the consumer groups in the Event Hub-compatible device-to-cloud
endpoint in an IoT hub.
@param resource_group_name [String] The name of the resource group that
contains the IoT hub.
@param resource_name [String] The name of the IoT hub.
@param event_hub_endpoint_name [String] The name of the Event Hub-compatible
endpoint.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<String>] operation results. | [
"Get",
"a",
"list",
"of",
"the",
"consumer",
"groups",
"in",
"the",
"Event",
"Hub",
"-",
"compatible",
"device",
"-",
"to",
"-",
"cloud",
"endpoint",
"in",
"an",
"IoT",
"hub",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_iot_hub/lib/2017-01-19/generated/azure_mgmt_iot_hub/iot_hub_resource.rb#L636-L639 | train | Gets all consumer groups in an event hub endpoint. | [
30522,
13366,
2862,
1035,
2724,
1035,
9594,
1035,
7325,
1035,
2967,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7692,
1035,
2171,
1010,
2724,
1035,
9594,
1035,
2203,
8400,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
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... |
sds/overcommit | lib/overcommit/hook_context/pre_commit.rb | Overcommit::HookContext.PreCommit.amendment? | def amendment?
return @amendment unless @amendment.nil?
cmd = Overcommit::Utils.parent_command
amend_pattern = 'commit(\s.*)?\s--amend(\s|$)'
# Since the ps command can return invalid byte sequences for commands
# containing unicode characters, we replace the offending characters,
# since the pattern we're looking for will consist of ASCII characters
unless cmd.valid_encoding?
cmd = Overcommit::Utils.parent_command.encode('UTF-16be', invalid: :replace, replace: '?').
encode('UTF-8')
end
return @amendment if
# True if the command is a commit with the --amend flag
@amendment = !(/\s#{amend_pattern}/ =~ cmd).nil?
# Check for git aliases that call `commit --amend`
`git config --get-regexp "^alias\\." "#{amend_pattern}"`.
scan(/alias\.([-\w]+)/). # Extract the alias
each do |match|
return @amendment if
# True if the command uses a git alias for `commit --amend`
@amendment = !(/git(\.exe)?\s+#{match[0]}/ =~ cmd).nil?
end
@amendment
end | ruby | def amendment?
return @amendment unless @amendment.nil?
cmd = Overcommit::Utils.parent_command
amend_pattern = 'commit(\s.*)?\s--amend(\s|$)'
# Since the ps command can return invalid byte sequences for commands
# containing unicode characters, we replace the offending characters,
# since the pattern we're looking for will consist of ASCII characters
unless cmd.valid_encoding?
cmd = Overcommit::Utils.parent_command.encode('UTF-16be', invalid: :replace, replace: '?').
encode('UTF-8')
end
return @amendment if
# True if the command is a commit with the --amend flag
@amendment = !(/\s#{amend_pattern}/ =~ cmd).nil?
# Check for git aliases that call `commit --amend`
`git config --get-regexp "^alias\\." "#{amend_pattern}"`.
scan(/alias\.([-\w]+)/). # Extract the alias
each do |match|
return @amendment if
# True if the command uses a git alias for `commit --amend`
@amendment = !(/git(\.exe)?\s+#{match[0]}/ =~ cmd).nil?
end
@amendment
end | [
"def",
"amendment?",
"return",
"@amendment",
"unless",
"@amendment",
".",
"nil?",
"cmd",
"=",
"Overcommit",
"::",
"Utils",
".",
"parent_command",
"amend_pattern",
"=",
"'commit(\\s.*)?\\s--amend(\\s|$)'",
"# Since the ps command can return invalid byte sequences for commands",
... | rubocop:disable ClassLength
Returns whether this hook run was triggered by `git commit --amend` | [
"rubocop",
":",
"disable",
"ClassLength",
"Returns",
"whether",
"this",
"hook",
"run",
"was",
"triggered",
"by",
"git",
"commit",
"--",
"amend"
] | 35d60adb41da942178b789560968e3ad030b0ac7 | https://github.com/sds/overcommit/blob/35d60adb41da942178b789560968e3ad030b0ac7/lib/overcommit/hook_context/pre_commit.rb#L14-L42 | train | Returns the amendment flag for the current commit | [
30522,
13366,
7450,
1029,
2709,
1030,
7450,
4983,
1030,
7450,
1012,
9152,
2140,
1029,
4642,
2094,
1027,
2058,
9006,
22930,
1024,
1024,
21183,
12146,
1012,
6687,
1035,
3094,
27950,
1035,
5418,
1027,
1005,
10797,
1006,
1032,
1055,
1012,
1008,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
danger/danger | lib/danger/danger_core/plugins/dangerfile_messaging_plugin.rb | Danger.DangerfileMessagingPlugin.status_report | def status_report
{
errors: @errors.map(&:message).clone.freeze,
warnings: @warnings.map(&:message).clone.freeze,
messages: @messages.map(&:message).clone.freeze,
markdowns: @markdowns.clone.freeze
}
end | ruby | def status_report
{
errors: @errors.map(&:message).clone.freeze,
warnings: @warnings.map(&:message).clone.freeze,
messages: @messages.map(&:message).clone.freeze,
markdowns: @markdowns.clone.freeze
}
end | [
"def",
"status_report",
"{",
"errors",
":",
"@errors",
".",
"map",
"(",
":message",
")",
".",
"clone",
".",
"freeze",
",",
"warnings",
":",
"@warnings",
".",
"map",
"(",
":message",
")",
".",
"clone",
".",
"freeze",
",",
"messages",
":",
"@messages",
"... | @!group Reporting
A list of all messages passed to Danger, including
the markdowns.
@visibility hidden
@return [Hash] | [
"@!group",
"Reporting",
"A",
"list",
"of",
"all",
"messages",
"passed",
"to",
"Danger",
"including",
"the",
"markdowns",
"."
] | 0d6d09f2d949c287fe75202d947374042b0679f4 | https://github.com/danger/danger/blob/0d6d09f2d949c287fe75202d947374042b0679f4/lib/danger/danger_core/plugins/dangerfile_messaging_plugin.rb#L189-L196 | train | Returns a hash of the status report for the current object. | [
30522,
13366,
3570,
1035,
3189,
1063,
10697,
1024,
1030,
10697,
1012,
4949,
1006,
1004,
1024,
4471,
1007,
1012,
17598,
1012,
13184,
1010,
16234,
1024,
1030,
16234,
1012,
4949,
1006,
1004,
1024,
4471,
1007,
1012,
17598,
1012,
13184,
1010,
76... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/webhook_operations.rb | Azure::Automation::Mgmt::V2015_10_31.WebhookOperations.delete | def delete(resource_group_name, automation_account_name, webhook_name, custom_headers:nil)
response = delete_async(resource_group_name, automation_account_name, webhook_name, custom_headers:custom_headers).value!
nil
end | ruby | def delete(resource_group_name, automation_account_name, webhook_name, custom_headers:nil)
response = delete_async(resource_group_name, automation_account_name, webhook_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"delete",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"webhook_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_async",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"webhook_name",
",",
"custom_heade... | Delete the webhook by name.
@param resource_group_name [String] Name of an Azure Resource group.
@param automation_account_name [String] The name of the automation account.
@param webhook_name [String] The webhook name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Delete",
"the",
"webhook",
"by",
"name",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/webhook_operations.rb#L136-L139 | train | Deletes a webhook. | [
30522,
13366,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
19309,
1035,
4070,
1035,
2171,
1010,
4773,
6806,
6559,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
1035,
2004,
6038,
2278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_key_vault/lib/2018-02-14/generated/azure_mgmt_key_vault/vaults.rb | Azure::KeyVault::Mgmt::V2018_02_14.Vaults.list_by_subscription | def list_by_subscription(top:nil, custom_headers:nil)
first_page = list_by_subscription_as_lazy(top:top, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_by_subscription(top:nil, custom_headers:nil)
first_page = list_by_subscription_as_lazy(top:top, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_by_subscription",
"(",
"top",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_by_subscription_as_lazy",
"(",
"top",
":",
"top",
",",
"custom_headers",
":custom_headers",
")",
"first_page",
".",
"get_all_items",
"end"
] | The List operation gets information about the vaults associated with the
subscription.
@param top [Integer] Maximum number of results to return.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<Vault>] operation results. | [
"The",
"List",
"operation",
"gets",
"information",
"about",
"the",
"vaults",
"associated",
"with",
"the",
"subscription",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_key_vault/lib/2018-02-14/generated/azure_mgmt_key_vault/vaults.rb#L603-L606 | train | Gets all the items in a subscription. | [
30522,
13366,
2862,
1035,
2011,
1035,
15002,
1006,
2327,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2862,
1035,
2011,
1035,
15002,
1035,
2004,
1035,
13971,
1006,
2327,
1024,
2327,
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_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.add_custom_prebuilt_domain_with_http_info | def add_custom_prebuilt_domain_with_http_info(app_id, version_id, prebuilt_domain_object, custom_headers:nil)
add_custom_prebuilt_domain_async(app_id, version_id, prebuilt_domain_object, custom_headers:custom_headers).value!
end | ruby | def add_custom_prebuilt_domain_with_http_info(app_id, version_id, prebuilt_domain_object, custom_headers:nil)
add_custom_prebuilt_domain_async(app_id, version_id, prebuilt_domain_object, custom_headers:custom_headers).value!
end | [
"def",
"add_custom_prebuilt_domain_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"prebuilt_domain_object",
",",
"custom_headers",
":",
"nil",
")",
"add_custom_prebuilt_domain_async",
"(",
"app_id",
",",
"version_id",
",",
"prebuilt_domain_object",
",",
"custom_hea... | Adds a customizable prebuilt domain along with all of its intent and entity
models in a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param prebuilt_domain_object [PrebuiltDomainCreateBaseObject] A prebuilt
domain create object containing the name of the domain.
@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",
"domain",
"along",
"with",
"all",
"of",
"its",
"intent",
"and",
"entity",
"models",
"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#L4230-L4232 | train | Adds a prebuilt domain to a version of the application. | [
30522,
13366,
5587,
1035,
7661,
1035,
3653,
8569,
4014,
2102,
1035,
5884,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
3653,
8569,
4014,
2102,
1035,
5884,
1035,
4874,
1010,
7661,
1035,
20346,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_parameter_group.rb | Aws::RDS.DBClusterParameterGroup.delete | def delete(options = {})
options = options.merge(db_cluster_parameter_group_name: @name)
resp = @client.delete_db_cluster_parameter_group(options)
resp.data
end | ruby | def delete(options = {})
options = options.merge(db_cluster_parameter_group_name: @name)
resp = @client.delete_db_cluster_parameter_group(options)
resp.data
end | [
"def",
"delete",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"db_cluster_parameter_group_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"delete_db_cluster_parameter_group",
"(",
"options",
")",
"resp",
".",
"data",... | @example Request syntax with placeholder values
db_cluster_parameter_group.delete()
@param [Hash] options ({})
@return [EmptyStructure] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster_parameter_group.rb#L238-L242 | train | Delete a DB cluster parameter group | [
30522,
13366,
3972,
12870,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
16962,
1035,
9324,
1035,
16381,
1035,
2177,
1035,
2171,
1024,
1030,
2171,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
3972,
12870,
1035,
1696... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
wearefine/fae | app/helpers/fae/form_helper.rb | Fae.FormHelper.language_support | def language_support(f, attribute, options)
return if Fae.languages.blank?
attribute_array = attribute.to_s.split('_')
language_suffix = attribute_array.pop
return unless Fae.languages.has_key?(language_suffix.to_sym) || Fae.languages.has_key?(language_suffix)
label = attribute_array.push("(#{language_suffix})").join(' ').titleize
options[:label] = label unless options[:label].present?
if options[:wrapper_html].present?
options[:wrapper_html].deep_merge!({ data: { language: language_suffix } })
else
options[:wrapper_html] = { data: { language: language_suffix } }
end
end | ruby | def language_support(f, attribute, options)
return if Fae.languages.blank?
attribute_array = attribute.to_s.split('_')
language_suffix = attribute_array.pop
return unless Fae.languages.has_key?(language_suffix.to_sym) || Fae.languages.has_key?(language_suffix)
label = attribute_array.push("(#{language_suffix})").join(' ').titleize
options[:label] = label unless options[:label].present?
if options[:wrapper_html].present?
options[:wrapper_html].deep_merge!({ data: { language: language_suffix } })
else
options[:wrapper_html] = { data: { language: language_suffix } }
end
end | [
"def",
"language_support",
"(",
"f",
",",
"attribute",
",",
"options",
")",
"return",
"if",
"Fae",
".",
"languages",
".",
"blank?",
"attribute_array",
"=",
"attribute",
".",
"to_s",
".",
"split",
"(",
"'_'",
")",
"language_suffix",
"=",
"attribute_array",
".... | removes language suffix from label and adds data attr for languange nav | [
"removes",
"language",
"suffix",
"from",
"label",
"and",
"adds",
"data",
"attr",
"for",
"languange",
"nav"
] | 645d6b66945aeff54e27af6a95c4f8a1f7a67d39 | https://github.com/wearefine/fae/blob/645d6b66945aeff54e27af6a95c4f8a1f7a67d39/app/helpers/fae/form_helper.rb#L199-L214 | train | Returns the language support for the given attribute. | [
30522,
13366,
2653,
1035,
2490,
1006,
1042,
1010,
17961,
1010,
7047,
1007,
2709,
2065,
17282,
1012,
4155,
1012,
8744,
1029,
17961,
1035,
9140,
1027,
17961,
1012,
2000,
1035,
1055,
1012,
3975,
1006,
1005,
1035,
1005,
1007,
2653,
1035,
16809,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_redis/lib/2017-02-01/generated/azure_mgmt_redis/patch_schedules.rb | Azure::Redis::Mgmt::V2017_02_01.PatchSchedules.create_or_update_with_http_info | def create_or_update_with_http_info(resource_group_name, name, parameters, custom_headers:nil)
create_or_update_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
end | ruby | def create_or_update_with_http_info(resource_group_name, name, parameters, custom_headers:nil)
create_or_update_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"create_or_update_with_http_info",
"(",
"resource_group_name",
",",
"name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"create_or_update_async",
"(",
"resource_group_name",
",",
"name",
",",
"parameters",
",",
"custom_headers",
":custom_headers",
... | Create or replace the patching schedule for Redis cache (requires Premium
SKU).
@param resource_group_name [String] The name of the resource group.
@param name [String] The name of the Redis cache.
@param parameters [RedisPatchSchedule] Parameters to set the patching
schedule for Redis cache.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Create",
"or",
"replace",
"the",
"patching",
"schedule",
"for",
"Redis",
"cache",
"(",
"requires",
"Premium",
"SKU",
")",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_redis/lib/2017-02-01/generated/azure_mgmt_redis/patch_schedules.rb#L55-L57 | train | Creates or updates a virtual network specification. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3443,
1035,
2030,
1035,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb | Azure::Compute::Mgmt::V2016_04_30_preview.VirtualMachineScaleSets.list_skus_next | def list_skus_next(next_page_link, custom_headers:nil)
response = list_skus_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_skus_next(next_page_link, custom_headers:nil)
response = list_skus_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_skus_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_skus_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"response",
".",
... | Gets a list of SKUs available for your VM scale set, including the minimum
and maximum VM instances allowed for each SKU.
@param next_page_link [String] The NextLink from the previous successful call
to List operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [VirtualMachineScaleSetListSkusResult] operation results. | [
"Gets",
"a",
"list",
"of",
"SKUs",
"available",
"for",
"your",
"VM",
"scale",
"set",
"including",
"the",
"minimum",
"and",
"maximum",
"VM",
"instances",
"allowed",
"for",
"each",
"SKU",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb#L2175-L2178 | train | Gets the list of skus of the specified App Service Environment. | [
30522,
13366,
2862,
1035,
15315,
2271,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
15315,
2271,
1035,
2279,
1035,
2004,
6038,
2278,
1006,
2279,
1035,
3931,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
puppetlabs/puppet | lib/puppet/network/resolver.rb | Puppet::Network.Resolver.expired? | def expired?(service_name)
if entry = @record_cache[service_name]
return Time.now > (entry.resolution_time + entry.ttl)
else
return true
end
end | ruby | def expired?(service_name)
if entry = @record_cache[service_name]
return Time.now > (entry.resolution_time + entry.ttl)
else
return true
end
end | [
"def",
"expired?",
"(",
"service_name",
")",
"if",
"entry",
"=",
"@record_cache",
"[",
"service_name",
"]",
"return",
"Time",
".",
"now",
">",
"(",
"entry",
".",
"resolution_time",
"+",
"entry",
".",
"ttl",
")",
"else",
"return",
"true",
"end",
"end"
] | Checks if the cached entry for the given service has expired.
@param [String] service_name the name of the service to check
@return [Boolean] true if the entry has expired, false otherwise.
Always returns true if the record had no TTL. | [
"Checks",
"if",
"the",
"cached",
"entry",
"for",
"the",
"given",
"service",
"has",
"expired",
"."
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/network/resolver.rb#L127-L133 | train | Returns true if the service has expired | [
30522,
13366,
13735,
1029,
1006,
2326,
1035,
2171,
1007,
2065,
4443,
1027,
1030,
2501,
1035,
17053,
1031,
2326,
1035,
2171,
1033,
2709,
2051,
1012,
2085,
1028,
1006,
4443,
1012,
5813,
1035,
2051,
1009,
4443,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/config.rb | Mongoid.Config.load_configuration | def load_configuration(settings)
configuration = settings.with_indifferent_access
self.options = configuration[:options]
self.clients = configuration[:clients]
set_log_levels
end | ruby | def load_configuration(settings)
configuration = settings.with_indifferent_access
self.options = configuration[:options]
self.clients = configuration[:clients]
set_log_levels
end | [
"def",
"load_configuration",
"(",
"settings",
")",
"configuration",
"=",
"settings",
".",
"with_indifferent_access",
"self",
".",
"options",
"=",
"configuration",
"[",
":options",
"]",
"self",
".",
"clients",
"=",
"configuration",
"[",
":clients",
"]",
"set_log_le... | From a hash of settings, load all the configuration.
@example Load the configuration.
config.load_configuration(settings)
@param [ Hash ] settings The configuration settings.
@since 3.1.0 | [
"From",
"a",
"hash",
"of",
"settings",
"load",
"all",
"the",
"configuration",
"."
] | 56976e32610f4c2450882b0bfe14da099f0703f4 | https://github.com/mongodb/mongoid/blob/56976e32610f4c2450882b0bfe14da099f0703f4/lib/mongoid/config.rb#L143-L148 | train | Load the configuration from a hash | [
30522,
13366,
7170,
1035,
9563,
1006,
10906,
1007,
9563,
1027,
10906,
1012,
2007,
1035,
24436,
1035,
3229,
2969,
1012,
7047,
1027,
9563,
1031,
1024,
7047,
1033,
2969,
1012,
7846,
1027,
9563,
1031,
1024,
7846,
1033,
2275,
1035,
8833,
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_cdn/lib/2017-04-02/generated/azure_mgmt_cdn/origins.rb | Azure::CDN::Mgmt::V2017_04_02.Origins.list_by_endpoint_next | def list_by_endpoint_next(next_page_link, custom_headers:nil)
response = list_by_endpoint_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_endpoint_next(next_page_link, custom_headers:nil)
response = list_by_endpoint_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_endpoint_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_endpoint_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"resp... | Lists all of the existing origins within an endpoint.
@param next_page_link [String] The NextLink from the previous successful call
to List operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OriginListResult] operation results. | [
"Lists",
"all",
"of",
"the",
"existing",
"origins",
"within",
"an",
"endpoint",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_cdn/lib/2017-04-02/generated/azure_mgmt_cdn/origins.rb#L451-L454 | train | Gets the list of all the available service endpoints. | [
30522,
13366,
2862,
1035,
2011,
1035,
2203,
30524,
1035,
2279,
1035,
2004,
6038,
2278,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
20346,
2015,
1007,
1012,
3643,
999,
3433,
1012,
2303,
4983,
3433,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
chef/chef-zero | lib/chef_zero/server.rb | ChefZero.Server.listen | def listen(hosts, port)
hosts.each do |host|
@server.listen(host, port)
end
true
rescue Errno::EADDRINUSE
ChefZero::Log.warn("Port #{port} not available")
@server.listeners.each { |l| l.close }
@server.listeners.clear
false
end | ruby | def listen(hosts, port)
hosts.each do |host|
@server.listen(host, port)
end
true
rescue Errno::EADDRINUSE
ChefZero::Log.warn("Port #{port} not available")
@server.listeners.each { |l| l.close }
@server.listeners.clear
false
end | [
"def",
"listen",
"(",
"hosts",
",",
"port",
")",
"hosts",
".",
"each",
"do",
"|",
"host",
"|",
"@server",
".",
"listen",
"(",
"host",
",",
"port",
")",
"end",
"true",
"rescue",
"Errno",
"::",
"EADDRINUSE",
"ChefZero",
"::",
"Log",
".",
"warn",
"(",
... | Start a Chef Zero server in a forked process. This method returns the PID
to the forked process.
@param [Fixnum] wait
the number of seconds to wait for the server to start
@return [Thread]
the thread the background process is running in | [
"Start",
"a",
"Chef",
"Zero",
"server",
"in",
"a",
"forked",
"process",
".",
"This",
"method",
"returns",
"the",
"PID",
"to",
"the",
"forked",
"process",
"."
] | 5873d906942770a34f0cf0fed05973ec3240a275 | https://github.com/chef/chef-zero/blob/5873d906942770a34f0cf0fed05973ec3240a275/lib/chef_zero/server.rb#L270-L280 | train | Listen to the given hosts and port | [
30522,
13366,
4952,
1006,
6184,
1010,
3417,
1007,
6184,
1012,
2169,
2079,
1064,
3677,
1064,
1030,
8241,
1012,
4952,
1006,
3677,
1010,
3417,
1007,
2203,
2995,
5343,
9413,
19139,
1024,
1024,
19413,
14141,
6657,
8557,
10026,
6290,
2080,
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... |
apache/thrift | lib/rb/lib/thrift/transport/framed_transport.rb | Thrift.FramedTransport.flush | def flush
return @transport.flush unless @write
out = [@wbuf.length].pack('N')
# Array#pack should return a BINARY encoded String, so it shouldn't be necessary to force encoding
out << @wbuf
@transport.write(out)
@transport.flush
@wbuf = Bytes.empty_byte_buffer
end | ruby | def flush
return @transport.flush unless @write
out = [@wbuf.length].pack('N')
# Array#pack should return a BINARY encoded String, so it shouldn't be necessary to force encoding
out << @wbuf
@transport.write(out)
@transport.flush
@wbuf = Bytes.empty_byte_buffer
end | [
"def",
"flush",
"return",
"@transport",
".",
"flush",
"unless",
"@write",
"out",
"=",
"[",
"@wbuf",
".",
"length",
"]",
".",
"pack",
"(",
"'N'",
")",
"# Array#pack should return a BINARY encoded String, so it shouldn't be necessary to force encoding",
"out",
"<<",
"@wbu... | Writes the output buffer to the stream in the format of a 4-byte length
followed by the actual data. | [
"Writes",
"the",
"output",
"buffer",
"to",
"the",
"stream",
"in",
"the",
"format",
"of",
"a",
"4",
"-",
"byte",
"length",
"followed",
"by",
"the",
"actual",
"data",
"."
] | 27d8387c49a49fcf193893f834e9766ae0b051c1 | https://github.com/apache/thrift/blob/27d8387c49a49fcf193893f834e9766ae0b051c1/lib/rb/lib/thrift/transport/framed_transport.rb#L91-L100 | train | Flush the buffer to the transport. | [
30522,
13366,
13862,
2709,
1030,
3665,
1012,
13862,
4983,
1030,
4339,
2041,
1027,
1031,
1030,
25610,
16093,
1012,
3091,
1033,
1012,
5308,
1006,
1005,
1050,
1005,
1007,
1001,
9140,
1001,
5308,
2323,
2709,
1037,
12441,
12359,
5164,
1010,
2061... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hanami/hanami | lib/hanami/application_configuration.rb | Hanami.ApplicationConfiguration.root | def root(value = nil)
if value
@root = value
else
Utils::Kernel.Pathname(@root || Dir.pwd).realpath
end
end | ruby | def root(value = nil)
if value
@root = value
else
Utils::Kernel.Pathname(@root || Dir.pwd).realpath
end
end | [
"def",
"root",
"(",
"value",
"=",
"nil",
")",
"if",
"value",
"@root",
"=",
"value",
"else",
"Utils",
"::",
"Kernel",
".",
"Pathname",
"(",
"@root",
"||",
"Dir",
".",
"pwd",
")",
".",
"realpath",
"end",
"end"
] | The root of the application
By default it returns the current directory, for this reason, **all the
commands must be executed from the top level directory of the project**.
If for some reason, that constraint above cannot be satisfied, please
configure the root directory, so that commands can be executed from
everywhere.
This is part of a DSL, for this reason when this method is called with
an argument, it will set the corresponding instance variable. When
called without, it will return the already set value, or the default.
@overload root(value)
Sets the given value
@param value [String,Pathname,#to_pathname] The root directory of the app
@overload root
Gets the value
@return [Pathname]
@raise [Errno::ENOENT] if the path cannot be found
@since 0.1.0
@see http://www.ruby-doc.org/core/Dir.html#method-c-pwd
@example Getting the value
require 'hanami'
module Bookshelf
class Application < Hanami::Application
end
end
Bookshelf::Application.configuration.root # => #<Pathname:/path/to/root>
@example Setting the value
require 'hanami'
module Bookshelf
class Application < Hanami::Application
configure do
root '/path/to/another/root'
end
end
end | [
"The",
"root",
"of",
"the",
"application"
] | 8c6e5147e92ef869b25379448572da3698eacfdc | https://github.com/hanami/hanami/blob/8c6e5147e92ef869b25379448572da3698eacfdc/lib/hanami/application_configuration.rb#L151-L157 | train | Sets the root of the current directory. | [
30522,
13366,
7117,
1006,
3643,
1027,
9152,
2140,
1007,
2065,
3643,
1030,
7117,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activemodel/lib/active_model/error.rb | ActiveModel.Error.match? | def match?(attribute, type = nil, **options)
if @attribute != attribute || (type && @type != type)
return false
end
options.each do |key, value|
if @options[key] != value
return false
end
end
true
end | ruby | def match?(attribute, type = nil, **options)
if @attribute != attribute || (type && @type != type)
return false
end
options.each do |key, value|
if @options[key] != value
return false
end
end
true
end | [
"def",
"match?",
"(",
"attribute",
",",
"type",
"=",
"nil",
",",
"**",
"options",
")",
"if",
"@attribute",
"!=",
"attribute",
"||",
"(",
"type",
"&&",
"@type",
"!=",
"type",
")",
"return",
"false",
"end",
"options",
".",
"each",
"do",
"|",
"key",
","... | See if error matches provided +attribute+, +type+ and +options+. | [
"See",
"if",
"error",
"matches",
"provided",
"+",
"attribute",
"+",
"+",
"type",
"+",
"and",
"+",
"options",
"+",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activemodel/lib/active_model/error.rb#L46-L58 | train | Returns true if the object matches the given attribute and type. | [
30522,
13366,
2674,
1029,
1006,
17961,
1010,
2828,
1027,
9152,
2140,
1010,
1008,
1008,
7047,
1007,
2065,
1030,
17961,
999,
1027,
17961,
1064,
1064,
1006,
2828,
1004,
1004,
1030,
2828,
999,
1027,
2828,
1007,
2709,
6270,
2203,
7047,
1012,
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... |
hashicorp/vault-ruby | lib/vault/client.rb | Vault.Client.request | def request(verb, path, data = {}, headers = {})
# Build the URI and request object from the given information
uri = build_uri(verb, path, data)
request = class_for_request(verb).new(uri.request_uri)
if uri.userinfo()
request.basic_auth uri.user, uri.password
end
if proxy_address and uri.scheme.downcase == "https"
raise SecurityError, "no direct https connection to vault"
end
# Get a list of headers
headers = DEFAULT_HEADERS.merge(headers)
# Add the Vault token header - users could still override this on a
# per-request basis
if !token.nil?
headers[TOKEN_HEADER] ||= token
end
# Add headers
headers.each do |key, value|
request.add_field(key, value)
end
# Setup PATCH/POST/PUT
if [:patch, :post, :put].include?(verb)
if data.respond_to?(:read)
request.content_length = data.size
request.body_stream = data
elsif data.is_a?(Hash)
request.form_data = data
else
request.body = data
end
end
begin
# Create a connection using the block form, which will ensure the socket
# is properly closed in the event of an error.
response = pool.request(uri, request)
case response
when Net::HTTPRedirection
# On a redirect of a GET or HEAD request, the URL already contains
# the data as query string parameters.
if [:head, :get].include?(verb)
data = {}
end
request(verb, response[LOCATION_HEADER], data, headers)
when Net::HTTPSuccess
success(response)
else
error(response)
end
rescue *RESCUED_EXCEPTIONS => e
raise HTTPConnectionError.new(address, e)
end
end | ruby | def request(verb, path, data = {}, headers = {})
# Build the URI and request object from the given information
uri = build_uri(verb, path, data)
request = class_for_request(verb).new(uri.request_uri)
if uri.userinfo()
request.basic_auth uri.user, uri.password
end
if proxy_address and uri.scheme.downcase == "https"
raise SecurityError, "no direct https connection to vault"
end
# Get a list of headers
headers = DEFAULT_HEADERS.merge(headers)
# Add the Vault token header - users could still override this on a
# per-request basis
if !token.nil?
headers[TOKEN_HEADER] ||= token
end
# Add headers
headers.each do |key, value|
request.add_field(key, value)
end
# Setup PATCH/POST/PUT
if [:patch, :post, :put].include?(verb)
if data.respond_to?(:read)
request.content_length = data.size
request.body_stream = data
elsif data.is_a?(Hash)
request.form_data = data
else
request.body = data
end
end
begin
# Create a connection using the block form, which will ensure the socket
# is properly closed in the event of an error.
response = pool.request(uri, request)
case response
when Net::HTTPRedirection
# On a redirect of a GET or HEAD request, the URL already contains
# the data as query string parameters.
if [:head, :get].include?(verb)
data = {}
end
request(verb, response[LOCATION_HEADER], data, headers)
when Net::HTTPSuccess
success(response)
else
error(response)
end
rescue *RESCUED_EXCEPTIONS => e
raise HTTPConnectionError.new(address, e)
end
end | [
"def",
"request",
"(",
"verb",
",",
"path",
",",
"data",
"=",
"{",
"}",
",",
"headers",
"=",
"{",
"}",
")",
"# Build the URI and request object from the given information",
"uri",
"=",
"build_uri",
"(",
"verb",
",",
"path",
",",
"data",
")",
"request",
"=",
... | Make an HTTP request with the given verb, data, params, and headers. If
the response has a return type of JSON, the JSON is automatically parsed
and returned as a hash; otherwise it is returned as a string.
@raise [HTTPError]
if the request is not an HTTP 200 OK
@param [Symbol] verb
the lowercase symbol of the HTTP verb (e.g. :get, :delete)
@param [String] path
the absolute or relative path from {Defaults.address} to make the
request against
@param [#read, Hash, nil] data
the data to use (varies based on the +verb+)
@param [Hash] headers
the list of headers to use
@return [String, Hash]
the response body | [
"Make",
"an",
"HTTP",
"request",
"with",
"the",
"given",
"verb",
"data",
"params",
"and",
"headers",
".",
"If",
"the",
"response",
"has",
"a",
"return",
"type",
"of",
"JSON",
"the",
"JSON",
"is",
"automatically",
"parsed",
"and",
"returned",
"as",
"a",
"... | 02f0532a802ba1a2a0d8703a4585dab76eb9d864 | https://github.com/hashicorp/vault-ruby/blob/02f0532a802ba1a2a0d8703a4585dab76eb9d864/lib/vault/client.rb#L237-L296 | train | Create a new connection to the Vault | [
30522,
13366,
5227,
1006,
12034,
1010,
4130,
1010,
2951,
1027,
1063,
1065,
1010,
20346,
2015,
1027,
1063,
1065,
1007,
1001,
3857,
1996,
24471,
2072,
1998,
5227,
4874,
2013,
1996,
2445,
2592,
24471,
2072,
1027,
3857,
1035,
24471,
2072,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jekyll/jekyll | lib/jekyll/reader.rb | Jekyll.Reader.read | def read
@site.layouts = LayoutReader.new(site).read
read_directories
read_included_excludes
sort_files!
@site.data = DataReader.new(site).read(site.config["data_dir"])
CollectionReader.new(site).read
ThemeAssetsReader.new(site).read
end | ruby | def read
@site.layouts = LayoutReader.new(site).read
read_directories
read_included_excludes
sort_files!
@site.data = DataReader.new(site).read(site.config["data_dir"])
CollectionReader.new(site).read
ThemeAssetsReader.new(site).read
end | [
"def",
"read",
"@site",
".",
"layouts",
"=",
"LayoutReader",
".",
"new",
"(",
"site",
")",
".",
"read",
"read_directories",
"read_included_excludes",
"sort_files!",
"@site",
".",
"data",
"=",
"DataReader",
".",
"new",
"(",
"site",
")",
".",
"read",
"(",
"s... | Read Site data from disk and load it into internal data structures.
Returns nothing. | [
"Read",
"Site",
"data",
"from",
"disk",
"and",
"load",
"it",
"into",
"internal",
"data",
"structures",
"."
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/reader.rb#L14-L22 | train | Read the data from the site. | [
30522,
13366,
3191,
1030,
2609,
1012,
9621,
2015,
1027,
9621,
16416,
4063,
1012,
2047,
1006,
2609,
1007,
1012,
3191,
3191,
1035,
2472,
3111,
3191,
1035,
2443,
1035,
23329,
2015,
4066,
1035,
6764,
999,
1030,
2609,
1012,
2951,
1027,
2951,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-12-01/generated/azure_mgmt_network/p2s_vpn_gateways.rb | Azure::Network::Mgmt::V2018_12_01.P2sVpnGateways.generate_vpn_profile_async | def generate_vpn_profile_async(resource_group_name, gateway_name, parameters, custom_headers:nil)
# Send request
promise = begin_generate_vpn_profile_async(resource_group_name, gateway_name, parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Network::Mgmt::V2018_12_01::Models::VpnProfileResponse.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 generate_vpn_profile_async(resource_group_name, gateway_name, parameters, custom_headers:nil)
# Send request
promise = begin_generate_vpn_profile_async(resource_group_name, gateway_name, parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Network::Mgmt::V2018_12_01::Models::VpnProfileResponse.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",
"generate_vpn_profile_async",
"(",
"resource_group_name",
",",
"gateway_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_generate_vpn_profile_async",
"(",
"resource_group_name",
",",
"gateway_name",
",",
"pa... | @param resource_group_name [String] The name of the resource group.
@param gateway_name [String] The name of the P2SVpnGateway.
@param parameters [P2SVpnProfileParameters] Parameters supplied to the
generate P2SVpnGateway VPN client package operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"resource_group_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"resource",
"group",
".",
"@param",
"gateway_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"P2SVpnGateway",
".",
"@param",
"parameters",
"[",
"P2SVpnProfileParameters",
"]"... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-12-01/generated/azure_mgmt_network/p2s_vpn_gateways.rb#L460-L476 | train | Generates a VPN profile for the specified virtual wan gateway. | [
30522,
13366,
9699,
1035,
21210,
2078,
1035,
6337,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
11909,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,
4088,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_container_registry/lib/2018-02-01-preview/generated/azure_mgmt_container_registry/builds.rb | Azure::ContainerRegistry::Mgmt::V2018_02_01_preview.Builds.cancel | def cancel(resource_group_name, registry_name, build_id, custom_headers:nil)
response = cancel_async(resource_group_name, registry_name, build_id, custom_headers:custom_headers).value!
nil
end | ruby | def cancel(resource_group_name, registry_name, build_id, custom_headers:nil)
response = cancel_async(resource_group_name, registry_name, build_id, custom_headers:custom_headers).value!
nil
end | [
"def",
"cancel",
"(",
"resource_group_name",
",",
"registry_name",
",",
"build_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"cancel_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"build_id",
",",
"custom_headers",
":custom_headers",
... | Cancel an existing build.
@param resource_group_name [String] The name of the resource group to which
the container registry belongs.
@param registry_name [String] The name of the container registry.
@param build_id [String] The build ID.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Cancel",
"an",
"existing",
"build",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_registry/lib/2018-02-01-preview/generated/azure_mgmt_container_registry/builds.rb#L401-L404 | train | Cancels a build. | [
30522,
13366,
17542,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
3857,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
17542,
1035,
30524,
1035,
8909,
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... |
square/connect-ruby-sdk | lib/square_connect/models/tender_card_details.rb | SquareConnect.TenderCardDetails.entry_method= | def entry_method=(entry_method)
validator = EnumAttributeValidator.new('String', ["SWIPED", "KEYED", "EMV", "ON_FILE", "CONTACTLESS"])
unless validator.valid?(entry_method)
fail ArgumentError, "invalid value for 'entry_method', must be one of #{validator.allowable_values}."
end
@entry_method = entry_method
end | ruby | def entry_method=(entry_method)
validator = EnumAttributeValidator.new('String', ["SWIPED", "KEYED", "EMV", "ON_FILE", "CONTACTLESS"])
unless validator.valid?(entry_method)
fail ArgumentError, "invalid value for 'entry_method', must be one of #{validator.allowable_values}."
end
@entry_method = entry_method
end | [
"def",
"entry_method",
"=",
"(",
"entry_method",
")",
"validator",
"=",
"EnumAttributeValidator",
".",
"new",
"(",
"'String'",
",",
"[",
"\"SWIPED\"",
",",
"\"KEYED\"",
",",
"\"EMV\"",
",",
"\"ON_FILE\"",
",",
"\"CONTACTLESS\"",
"]",
")",
"unless",
"validator",
... | Custom attribute writer method checking allowed values (enum).
@param [Object] entry_method 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/tender_card_details.rb#L115-L121 | train | Set the entry_method attribute. | [
30522,
13366,
4443,
1035,
4118,
1027,
1006,
4443,
1035,
4118,
1007,
9398,
8844,
1027,
4372,
12248,
4779,
3089,
8569,
2618,
10175,
8524,
4263,
1012,
2047,
1006,
1005,
5164,
1005,
1010,
1031,
1000,
24452,
1000,
1010,
1000,
3145,
2098,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
meew0/discordrb | lib/discordrb/light/light_bot.rb | Discordrb::Light.LightBot.profile | def profile
response = Discordrb::API::User.profile(@token)
LightProfile.new(JSON.parse(response), self)
end | ruby | def profile
response = Discordrb::API::User.profile(@token)
LightProfile.new(JSON.parse(response), self)
end | [
"def",
"profile",
"response",
"=",
"Discordrb",
"::",
"API",
"::",
"User",
".",
"profile",
"(",
"@token",
")",
"LightProfile",
".",
"new",
"(",
"JSON",
".",
"parse",
"(",
"response",
")",
",",
"self",
")",
"end"
] | Create a new LightBot. This does no networking yet, all networking is done by the methods on this class.
@param token [String] The token that should be used to authenticate to Discord. Can be an OAuth token or a regular
user account token.
@return [LightProfile] the details of the user this bot is connected to. | [
"Create",
"a",
"new",
"LightBot",
".",
"This",
"does",
"no",
"networking",
"yet",
"all",
"networking",
"is",
"done",
"by",
"the",
"methods",
"on",
"this",
"class",
"."
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/light/light_bot.rb#L33-L36 | train | Returns the current profile | [
30522,
13366,
6337,
3433,
1027,
12532,
4103,
15185,
1024,
1024,
17928,
1024,
1024,
5310,
1012,
6337,
1006,
1030,
19204,
1007,
2422,
21572,
8873,
2571,
1012,
2047,
1006,
1046,
3385,
1012,
11968,
3366,
1006,
3433,
1007,
1010,
2969,
1007,
2203... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
watir/watir | lib/watir/elements/file_field.rb | Watir.FileField.set | def set(path)
raise Errno::ENOENT, path unless File.exist?(path)
self.value = path
end | ruby | def set(path)
raise Errno::ENOENT, path unless File.exist?(path)
self.value = path
end | [
"def",
"set",
"(",
"path",
")",
"raise",
"Errno",
"::",
"ENOENT",
",",
"path",
"unless",
"File",
".",
"exist?",
"(",
"path",
")",
"self",
".",
"value",
"=",
"path",
"end"
] | Set the file field to the given path
@param [String] path
@raise [Errno::ENOENT] if the file doesn't exist | [
"Set",
"the",
"file",
"field",
"to",
"the",
"given",
"path"
] | 2d8db09811c6221ae401b85b2f61f5fa66e463a3 | https://github.com/watir/watir/blob/2d8db09811c6221ae401b85b2f61f5fa66e463a3/lib/watir/elements/file_field.rb#L10-L14 | train | Set the file to the given path. | [
30522,
13366,
2275,
1006,
4130,
1007,
5333,
9413,
19139,
1024,
1024,
4372,
8913,
3372,
1010,
4130,
4983,
5371,
1012,
4839,
1029,
1006,
4130,
1007,
2969,
1012,
3643,
1027,
4130,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/models/v1_discount.rb | SquareConnect.V1Discount.color= | def color=(color)
validator = EnumAttributeValidator.new('String', ["9da2a6", "4ab200", "0b8000", "2952cc", "a82ee5", "e5457a", "b21212", "593c00", "e5BF00"])
unless validator.valid?(color)
fail ArgumentError, "invalid value for 'color', must be one of #{validator.allowable_values}."
end
@color = color
end | ruby | def color=(color)
validator = EnumAttributeValidator.new('String', ["9da2a6", "4ab200", "0b8000", "2952cc", "a82ee5", "e5457a", "b21212", "593c00", "e5BF00"])
unless validator.valid?(color)
fail ArgumentError, "invalid value for 'color', must be one of #{validator.allowable_values}."
end
@color = color
end | [
"def",
"color",
"=",
"(",
"color",
")",
"validator",
"=",
"EnumAttributeValidator",
".",
"new",
"(",
"'String'",
",",
"[",
"\"9da2a6\"",
",",
"\"4ab200\"",
",",
"\"0b8000\"",
",",
"\"2952cc\"",
",",
"\"a82ee5\"",
",",
"\"e5457a\"",
",",
"\"b21212\"",
",",
"\... | Custom attribute writer method checking allowed values (enum).
@param [Object] color 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_discount.rb#L160-L166 | train | Set the color of the image. | [
30522,
13366,
3609,
1027,
1006,
3609,
1007,
9398,
8844,
1027,
4372,
12248,
4779,
3089,
8569,
2618,
10175,
8524,
4263,
1012,
2047,
1006,
1005,
5164,
1005,
1010,
1031,
1000,
1023,
2850,
2475,
2050,
2575,
1000,
1010,
1000,
26424,
2497,
28332,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mongodb/mongo-ruby-driver | lib/mongo/cluster.rb | Mongo.Cluster.reconnect! | def reconnect!
@connecting = true
scan!
servers.each do |server|
server.reconnect!
end
@periodic_executor.restart!
@connecting = false
@connected = true
end | ruby | def reconnect!
@connecting = true
scan!
servers.each do |server|
server.reconnect!
end
@periodic_executor.restart!
@connecting = false
@connected = true
end | [
"def",
"reconnect!",
"@connecting",
"=",
"true",
"scan!",
"servers",
".",
"each",
"do",
"|",
"server",
"|",
"server",
".",
"reconnect!",
"end",
"@periodic_executor",
".",
"restart!",
"@connecting",
"=",
"false",
"@connected",
"=",
"true",
"end"
] | Reconnect all servers.
@example Reconnect the cluster's servers.
cluster.reconnect!
@return [ true ] Always true.
@since 2.1.0
@deprecated Use Client#reconnect to reconnect to the cluster instead of
calling this method. This method does not send SDAM events. | [
"Reconnect",
"all",
"servers",
"."
] | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/cluster.rb#L424-L433 | train | Reconnects to the server | [
30522,
13366,
28667,
18256,
6593,
999,
1030,
7176,
1027,
2995,
13594,
999,
14903,
1012,
2169,
2079,
1064,
8241,
1064,
8241,
1012,
28667,
18256,
6593,
999,
2203,
1030,
15861,
1035,
4654,
8586,
16161,
2099,
1012,
23818,
999,
1030,
7176,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/connection_operations.rb | Azure::Automation::Mgmt::V2015_10_31.ConnectionOperations.get_with_http_info | def get_with_http_info(resource_group_name, automation_account_name, connection_name, custom_headers:nil)
get_async(resource_group_name, automation_account_name, connection_name, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, automation_account_name, connection_name, custom_headers:nil)
get_async(resource_group_name, automation_account_name, connection_name, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"connection_name",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"connection_name",
",",
"custom_headers",
... | Retrieve the connection identified by connection name.
@param resource_group_name [String] Name of an Azure Resource group.
@param automation_account_name [String] The name of the automation account.
@param connection_name [String] The name of connection.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Retrieve",
"the",
"connection",
"identified",
"by",
"connection",
"name",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/connection_operations.rb#L150-L152 | train | Gets the specified connection s index. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
19309,
1035,
4070,
1035,
2171,
1010,
4434,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
2004,
6038,
2278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
tongueroo/jets | lib/jets/controller/rendering/rack_renderer.rb | Jets::Controller::Rendering.RackRenderer.renderer_options | def renderer_options
options = {
# script_name: "", # unfortunately doesnt seem to effect relative_url_root like desired
# input: ""
}
origin = headers["origin"]
if origin
uri = URI.parse(origin)
options[:https] = uri.scheme == "https"
end
# Important to not use rack_headers as local variable instead of headers.
# headers is a method that gets deleted to controller.headers and using it
# seems to cause issues.
rack_headers = rackify_headers(headers)
options.merge!(rack_headers)
# Note @options[:method] uses @options vs options on purpose
@options[:method] = event["httpMethod"].downcase if event["httpMethod"]
options
end | ruby | def renderer_options
options = {
# script_name: "", # unfortunately doesnt seem to effect relative_url_root like desired
# input: ""
}
origin = headers["origin"]
if origin
uri = URI.parse(origin)
options[:https] = uri.scheme == "https"
end
# Important to not use rack_headers as local variable instead of headers.
# headers is a method that gets deleted to controller.headers and using it
# seems to cause issues.
rack_headers = rackify_headers(headers)
options.merge!(rack_headers)
# Note @options[:method] uses @options vs options on purpose
@options[:method] = event["httpMethod"].downcase if event["httpMethod"]
options
end | [
"def",
"renderer_options",
"options",
"=",
"{",
"# script_name: \"\", # unfortunately doesnt seem to effect relative_url_root like desired",
"# input: \"\"",
"}",
"origin",
"=",
"headers",
"[",
"\"origin\"",
"]",
"if",
"origin",
"uri",
"=",
"URI",
".",
"parse",
"(",
"orig... | default options:
https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/renderer.rb#L41-L47 | [
"default",
"options",
":",
"https",
":",
"//",
"github",
".",
"com",
"/",
"rails",
"/",
"rails",
"/",
"blob",
"/",
"master",
"/",
"actionpack",
"/",
"lib",
"/",
"action_controller",
"/",
"renderer",
".",
"rb#L41",
"-",
"L47"
] | 46943a519224067e58aa3e2d5656e3ca083150f9 | https://github.com/tongueroo/jets/blob/46943a519224067e58aa3e2d5656e3ca083150f9/lib/jets/controller/rendering/rack_renderer.rb#L54-L75 | train | Returns the options hash for the renderer. | [
30522,
13366,
17552,
2121,
1035,
7047,
7047,
1027,
1063,
1001,
5896,
1035,
2171,
1024,
1000,
1000,
1010,
1001,
6854,
2987,
2102,
4025,
2000,
3466,
5816,
1035,
24471,
2140,
1035,
7117,
2066,
9059,
1001,
7953,
1024,
1000,
1000,
1065,
4761,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_authorization/lib/2018-09-01-preview/generated/azure_mgmt_authorization/role_assignments.rb | Azure::Authorization::Mgmt::V2018_09_01_preview.RoleAssignments.create_with_http_info | def create_with_http_info(scope, role_assignment_name, parameters, custom_headers:nil)
create_async(scope, role_assignment_name, parameters, custom_headers:custom_headers).value!
end | ruby | def create_with_http_info(scope, role_assignment_name, parameters, custom_headers:nil)
create_async(scope, role_assignment_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"create_with_http_info",
"(",
"scope",
",",
"role_assignment_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"create_async",
"(",
"scope",
",",
"role_assignment_name",
",",
"parameters",
",",
"custom_headers",
":custom_headers",
")",
".",
"v... | Creates a role assignment.
@param scope [String] The scope of the role assignment to create. The scope
can be any REST resource instance. For example, use
'/subscriptions/{subscription-id}/' for a subscription,
'/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a
resource group, and
'/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}'
for a resource.
@param role_assignment_name [String] The name of the role assignment to
create. It can be any valid GUID.
@param parameters [RoleAssignmentCreateParameters] Parameters for the role
assignment.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Creates",
"a",
"role",
"assignment",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_authorization/lib/2018-09-01-preview/generated/azure_mgmt_authorization/role_assignments.rb#L388-L390 | train | Creates a new role assignment. | [
30522,
13366,
3443,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
9531,
1010,
2535,
1035,
8775,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3443,
1035,
2004,
6038,
2278,
1006,
9531,
1010,
2535,
1035,
8775,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/parser.rb | CombinePDF.PDFParser._parse_ | def _parse_
out = []
str = ''
fresh = true
while @scanner.rest?
# last ||= 0
# out.last.tap do |o|
# if o.is_a?(Hash)
# puts "[#{@scanner.pos}] Parser has a Dictionary (#{o.class.name}) with data:"
# o.each do |k, v|
# puts " #{k}: is #{v.class.name} with data: #{v.to_s[0..4]}#{"..." if v.to_s.length > 5}"
# end
# else
# puts "[#{@scanner.pos}] Parser has #{o.class.name} with data: #{o.to_s[0..4]}#{"..." if o.to_s.length > 5}"
# end
# puts "next is #{@scanner.peek 8}"
# end unless (last == out.count) || (-1 == (last = out.count))
if @scanner.scan(/\[/)
out << _parse_
##########################################
## Parse a Name
##########################################
# old, probably working version: when str = @scanner.scan(/\/[\#\w\d\.\+\-\\\?\,]+/)
# I don't know how to write the /[\x21-\x7e___subtract_certain_hex_values_here____]+/
# all allowed regular caracters between ! and ~ : /[\x21-\x24\x26\x27\x2a-\x2e\x30-\x3b\x3d\x3f-\x5a\x5c\x5e-\x7a\x7c\x7e]+
# all characters that aren't white space or special: /[^\x00\x09\x0a\x0c\x0d\x20\x28\x29\x3c\x3e\x5b\x5d\x7b\x7d\x2f\x25]+
elsif str = @scanner.scan(/\/[^\x00\x09\x0a\x0c\x0d\x20\x28\x29\x3c\x3e\x5b\x5d\x7b\x7d\x2f\x25]*/)
out << (str[1..-1].gsub(/\#[0-9a-fA-F]{2}/) { |a| a[1..2].hex.chr }).to_sym
##########################################
## Parse a Number
##########################################
elsif str = @scanner.scan(/[\+\-\.\d]+/)
str =~ /\./ ? (out << str.to_f) : (out << str.to_i)
##########################################
## parse a Hex String
##########################################
elsif str = @scanner.scan(/\<[0-9a-fA-F]*\>/)
# warn "Found a hex string"
str = str.slice(1..-2).force_encoding(Encoding::ASCII_8BIT)
# str = "0#{str}" if str.length.odd?
out << unify_string([str].pack('H*').force_encoding(Encoding::ASCII_8BIT))
##########################################
## parse a space delimited Hex String
##########################################
elsif str = @scanner.scan(/\<[0-9a-fA-F\s]*\>/)
# warn "Found a space seperated hex string"
str = str.force_encoding(Encoding::ASCII_8BIT).split(/\s/).map! {|b| b.length.odd? ? "0#{b}" : b}
out << unify_string(str.pack('H*' * str.length).force_encoding(Encoding::ASCII_8BIT))
##########################################
## parse a Literal String
##########################################
elsif @scanner.scan(/\(/)
# warn "Found a literal string"
str = ''.force_encoding(Encoding::ASCII_8BIT)
count = 1
while count > 0 && @scanner.rest?
scn = @scanner.scan_until(/[\(\)]/)
unless scn
warn "Unknown error parsing string at #{@scanner.pos} for string: #{str}!"
count = 0 # error
next
end
str += scn.to_s
seperator_count = 0
seperator_count += 1 while str[-2 - seperator_count] == '\\'
case str[-1]
when '('
## The following solution might fail when (string ends with this sign: \\)
count += 1 unless seperator_count.odd?
when ')'
count -= 1 unless seperator_count.odd?
else
warn "Unknown error parsing string at #{@scanner.pos} for string: #{str}!"
count = 0 # error
end
end
# The PDF formatted string is: str[0..-2]
# now starting to convert to regular string
str_bytes = str.force_encoding(Encoding::ASCII_8BIT)[0..-2].bytes.to_a
str = []
until str_bytes.empty?
case str_bytes[0]
when 13 # eol - \r
# An end-of-line marker appearing within a literal string without a preceding REVERSE SOLIDUS
# shall be treated as a byte value of (0Ah),
# irrespective of whether the end-of-line marker was a CARRIAGE RETURN (0Dh), a LINE FEED (0Ah), or both.
str_bytes.shift
str_bytes.shift if str_bytes[0] == 10
str << 10
when 10 # eol - \n
# An end-of-line marker appearing within a literal string without a preceding REVERSE SOLIDUS
# shall be treated as a byte value of (0Ah),
# irrespective of whether the end-of-line marker was a CARRIAGE RETURN (0Dh), a LINE FEED (0Ah), or both.
str_bytes.shift
str_bytes.shift if str_bytes[0] == 13
str << 10
when 92 # "\\".ord == 92
str_bytes.shift
rep = str_bytes.shift
case rep
when 110 # n
str << 10 # new line
when 114 # r
str << 13 # CR
when 116 # t
str << 9 # tab
when 98 # b
str << 8
when 102 # f, form-feed
str << 12
when 48..57 # octal notation for byte?
rep -= 48
rep = (rep << 3) + (str_bytes.shift-48) if str_bytes[0].between?(48, 57)
rep = (rep << 3) + (str_bytes.shift-48) if str_bytes[0].between?(48, 57) && (((rep << 3) + (str_bytes[0] - 48)) <= 255)
str << rep
when 10 # new line, ignore
str_bytes.shift if str_bytes[0] == 13
true
when 13 # new line (or double notation for new line), ignore
str_bytes.shift if str_bytes[0] == 10
true
else
str << rep
end
else
str << str_bytes.shift
end
end
out << unify_string(str.pack('C*').force_encoding(Encoding::ASCII_8BIT))
##########################################
## parse a Dictionary
##########################################
elsif @scanner.scan(/<</)
data = _parse_
obj = {}
obj[data.shift] = data.shift while data[0]
out << obj
##########################################
## return content of array or dictionary
##########################################
elsif @scanner.scan(/\]/) || @scanner.scan(/>>/)
return out
##########################################
## parse a Stream
##########################################
elsif @scanner.scan(/stream[ \t]*[\r\n]/)
@scanner.pos += 1 if @scanner.peek(1) == "\n".freeze && @scanner.matched[-1] != "\n".freeze
# the following was dicarded because some PDF files didn't have an EOL marker as required
# str = @scanner.scan_until(/(\r\n|\r|\n)endstream/)
# instead, a non-strict RegExp is used:
str = @scanner.scan_until(/endstream/)
# raise error if the stream doesn't end.
unless str
raise ParsingError, "Parsing Error: PDF file error - a stream object wasn't properly closed using 'endstream'!"
end
# need to remove end of stream
if out.last.is_a? Hash
# out.last[:raw_stream_content] = str[0...-10] #cuts only one EON char (\n or \r)
out.last[:raw_stream_content] = unify_string str.sub(/(\r\n|\n|\r)?endstream\z/, '').force_encoding(Encoding::ASCII_8BIT)
else
warn 'Stream not attached to dictionary!'
out << str.sub(/(\r\n|\n|\r)?endstream\z/, '').force_encoding(Encoding::ASCII_8BIT)
end
##########################################
## parse an Object after finished
##########################################
elsif str = @scanner.scan(/endobj/)
# what to do when this is an object?
if out.last.is_a? Hash
out << out.pop.merge(indirect_generation_number: out.pop, indirect_reference_id: out.pop)
else
out << { indirect_without_dictionary: out.pop, indirect_generation_number: out.pop, indirect_reference_id: out.pop }
end
fresh = true
# fix wkhtmltopdf use of PDF 1.1 Dest using symbols instead of strings
out.last[:Dest] = unify_string(out.last[:Dest].to_s) if out.last[:Dest] && out.last[:Dest].is_a?(Symbol)
# puts "!!!!!!!!! Error with :indirect_reference_id\n\nObject #{out.last} :indirect_reference_id = #{out.last[:indirect_reference_id]}" unless out.last[:indirect_reference_id].is_a?(Numeric)
##########################################
## Parse an Object Reference
##########################################
elsif @scanner.scan(/R/)
out << { is_reference_only: true, indirect_generation_number: out.pop, indirect_reference_id: out.pop }
# @references << out.last
##########################################
## Parse Bool - true and after false
##########################################
elsif @scanner.scan(/true/)
out << true
elsif @scanner.scan(/false/)
out << false
##########################################
## Parse NULL - null
##########################################
elsif @scanner.scan(/null/)
out << nil
##########################################
## Parse file trailer
##########################################
elsif @scanner.scan(/trailer/)
if @scanner.skip_until(/<</)
data = _parse_
(@root_object ||= {}).clear
@root_object[data.shift] = data.shift while data[0]
end
##########################################
## XREF - check for encryption... anything else?
##########################################
elsif @scanner.scan(/xref/)
# skip list indetifier lines or list lines ([\d] [\d][\r\n]) ot ([\d] [\d] [nf][\r\n])
while @scanner.scan(/[\s]*[\d]+[ \t]+[\d]+[ \t]*[\n\r]+/) || @scanner.scan(/[ \t]*[\d]+[ \t]+[\d]+[ \t]+[nf][\s]*/)
nil
end
##########################################
## XREF location can be ignored
##########################################
elsif @scanner.scan(/startxref/)
@scanner.scan(/[\s]+[\d]+[\s]+/)
##########################################
## Skip Whitespace
##########################################
elsif @scanner.scan(/[\s]+/)
# Generally, do nothing
nil
##########################################
## EOF?
##########################################
elsif @scanner.scan(/\%\%EOF/)
##########
## If this was the last valid segment, ignore any trailing garbage
## (issue #49 resolution)
break unless @scanner.exist?(/\%\%EOF/)
##########################################
## Parse a comment
##########################################
elsif str = @scanner.scan(/\%/)
# is a comment, skip until new line
loop do
# break unless @scanner.scan(/[^\d\r\n]+/)
break if @scanner.check(/([\d]+[\s]+[\d]+[\s]+obj[\s]+\<\<)|([\n\r]+)/) || @scanner.eos? # || @scanner.scan(/[^\d]+[\r\n]+/) ||
@scanner.scan(/[^\d\r\n]+/) || @scanner.pos += 1
end
# puts "AFTER COMMENT: #{@scanner.peek 8}"
##########################################
## Fix wkhtmltopdf - missing 'endobj' keywords
##########################################
elsif @scanner.scan(/obj[\s]*/)
# Fix wkhtmltopdf PDF authoring issue - missing 'endobj' keywords
unless fresh || (out[-4].nil? || out[-4].is_a?(Hash))
keep = []
keep << out.pop # .tap {|i| puts "#{i} is an ID"}
keep << out.pop # .tap {|i| puts "#{i} is a REF"}
if out.last.is_a? Hash
out << out.pop.merge(indirect_generation_number: out.pop, indirect_reference_id: out.pop)
else
out << { indirect_without_dictionary: out.pop, indirect_generation_number: out.pop, indirect_reference_id: out.pop }
end
# fix wkhtmltopdf use of PDF 1.1 Dest using symbols instead of strings
out.last[:Dest] = unify_string(out.last[:Dest].to_s) if out.last[:Dest] && out.last[:Dest].is_a?(Symbol)
warn "'endobj' keyword was missing for Object ID: #{out.last[:indirect_reference_id]}, trying to auto-fix issue, but might fail."
out << keep.pop
out << keep.pop
end
fresh = false
##########################################
## Unknown, warn and advance
##########################################
else
# always advance
# warn "Advancing for unknown reason... #{@scanner.string[@scanner.pos - 4, 8]} ... #{@scanner.peek(4)}" unless @scanner.peek(1) =~ /[\s\n]/
warn 'Warning: parser advancing for unknown reason. Potential data-loss.'
@scanner.pos = @scanner.pos + 1
end
end
out
end | ruby | def _parse_
out = []
str = ''
fresh = true
while @scanner.rest?
# last ||= 0
# out.last.tap do |o|
# if o.is_a?(Hash)
# puts "[#{@scanner.pos}] Parser has a Dictionary (#{o.class.name}) with data:"
# o.each do |k, v|
# puts " #{k}: is #{v.class.name} with data: #{v.to_s[0..4]}#{"..." if v.to_s.length > 5}"
# end
# else
# puts "[#{@scanner.pos}] Parser has #{o.class.name} with data: #{o.to_s[0..4]}#{"..." if o.to_s.length > 5}"
# end
# puts "next is #{@scanner.peek 8}"
# end unless (last == out.count) || (-1 == (last = out.count))
if @scanner.scan(/\[/)
out << _parse_
##########################################
## Parse a Name
##########################################
# old, probably working version: when str = @scanner.scan(/\/[\#\w\d\.\+\-\\\?\,]+/)
# I don't know how to write the /[\x21-\x7e___subtract_certain_hex_values_here____]+/
# all allowed regular caracters between ! and ~ : /[\x21-\x24\x26\x27\x2a-\x2e\x30-\x3b\x3d\x3f-\x5a\x5c\x5e-\x7a\x7c\x7e]+
# all characters that aren't white space or special: /[^\x00\x09\x0a\x0c\x0d\x20\x28\x29\x3c\x3e\x5b\x5d\x7b\x7d\x2f\x25]+
elsif str = @scanner.scan(/\/[^\x00\x09\x0a\x0c\x0d\x20\x28\x29\x3c\x3e\x5b\x5d\x7b\x7d\x2f\x25]*/)
out << (str[1..-1].gsub(/\#[0-9a-fA-F]{2}/) { |a| a[1..2].hex.chr }).to_sym
##########################################
## Parse a Number
##########################################
elsif str = @scanner.scan(/[\+\-\.\d]+/)
str =~ /\./ ? (out << str.to_f) : (out << str.to_i)
##########################################
## parse a Hex String
##########################################
elsif str = @scanner.scan(/\<[0-9a-fA-F]*\>/)
# warn "Found a hex string"
str = str.slice(1..-2).force_encoding(Encoding::ASCII_8BIT)
# str = "0#{str}" if str.length.odd?
out << unify_string([str].pack('H*').force_encoding(Encoding::ASCII_8BIT))
##########################################
## parse a space delimited Hex String
##########################################
elsif str = @scanner.scan(/\<[0-9a-fA-F\s]*\>/)
# warn "Found a space seperated hex string"
str = str.force_encoding(Encoding::ASCII_8BIT).split(/\s/).map! {|b| b.length.odd? ? "0#{b}" : b}
out << unify_string(str.pack('H*' * str.length).force_encoding(Encoding::ASCII_8BIT))
##########################################
## parse a Literal String
##########################################
elsif @scanner.scan(/\(/)
# warn "Found a literal string"
str = ''.force_encoding(Encoding::ASCII_8BIT)
count = 1
while count > 0 && @scanner.rest?
scn = @scanner.scan_until(/[\(\)]/)
unless scn
warn "Unknown error parsing string at #{@scanner.pos} for string: #{str}!"
count = 0 # error
next
end
str += scn.to_s
seperator_count = 0
seperator_count += 1 while str[-2 - seperator_count] == '\\'
case str[-1]
when '('
## The following solution might fail when (string ends with this sign: \\)
count += 1 unless seperator_count.odd?
when ')'
count -= 1 unless seperator_count.odd?
else
warn "Unknown error parsing string at #{@scanner.pos} for string: #{str}!"
count = 0 # error
end
end
# The PDF formatted string is: str[0..-2]
# now starting to convert to regular string
str_bytes = str.force_encoding(Encoding::ASCII_8BIT)[0..-2].bytes.to_a
str = []
until str_bytes.empty?
case str_bytes[0]
when 13 # eol - \r
# An end-of-line marker appearing within a literal string without a preceding REVERSE SOLIDUS
# shall be treated as a byte value of (0Ah),
# irrespective of whether the end-of-line marker was a CARRIAGE RETURN (0Dh), a LINE FEED (0Ah), or both.
str_bytes.shift
str_bytes.shift if str_bytes[0] == 10
str << 10
when 10 # eol - \n
# An end-of-line marker appearing within a literal string without a preceding REVERSE SOLIDUS
# shall be treated as a byte value of (0Ah),
# irrespective of whether the end-of-line marker was a CARRIAGE RETURN (0Dh), a LINE FEED (0Ah), or both.
str_bytes.shift
str_bytes.shift if str_bytes[0] == 13
str << 10
when 92 # "\\".ord == 92
str_bytes.shift
rep = str_bytes.shift
case rep
when 110 # n
str << 10 # new line
when 114 # r
str << 13 # CR
when 116 # t
str << 9 # tab
when 98 # b
str << 8
when 102 # f, form-feed
str << 12
when 48..57 # octal notation for byte?
rep -= 48
rep = (rep << 3) + (str_bytes.shift-48) if str_bytes[0].between?(48, 57)
rep = (rep << 3) + (str_bytes.shift-48) if str_bytes[0].between?(48, 57) && (((rep << 3) + (str_bytes[0] - 48)) <= 255)
str << rep
when 10 # new line, ignore
str_bytes.shift if str_bytes[0] == 13
true
when 13 # new line (or double notation for new line), ignore
str_bytes.shift if str_bytes[0] == 10
true
else
str << rep
end
else
str << str_bytes.shift
end
end
out << unify_string(str.pack('C*').force_encoding(Encoding::ASCII_8BIT))
##########################################
## parse a Dictionary
##########################################
elsif @scanner.scan(/<</)
data = _parse_
obj = {}
obj[data.shift] = data.shift while data[0]
out << obj
##########################################
## return content of array or dictionary
##########################################
elsif @scanner.scan(/\]/) || @scanner.scan(/>>/)
return out
##########################################
## parse a Stream
##########################################
elsif @scanner.scan(/stream[ \t]*[\r\n]/)
@scanner.pos += 1 if @scanner.peek(1) == "\n".freeze && @scanner.matched[-1] != "\n".freeze
# the following was dicarded because some PDF files didn't have an EOL marker as required
# str = @scanner.scan_until(/(\r\n|\r|\n)endstream/)
# instead, a non-strict RegExp is used:
str = @scanner.scan_until(/endstream/)
# raise error if the stream doesn't end.
unless str
raise ParsingError, "Parsing Error: PDF file error - a stream object wasn't properly closed using 'endstream'!"
end
# need to remove end of stream
if out.last.is_a? Hash
# out.last[:raw_stream_content] = str[0...-10] #cuts only one EON char (\n or \r)
out.last[:raw_stream_content] = unify_string str.sub(/(\r\n|\n|\r)?endstream\z/, '').force_encoding(Encoding::ASCII_8BIT)
else
warn 'Stream not attached to dictionary!'
out << str.sub(/(\r\n|\n|\r)?endstream\z/, '').force_encoding(Encoding::ASCII_8BIT)
end
##########################################
## parse an Object after finished
##########################################
elsif str = @scanner.scan(/endobj/)
# what to do when this is an object?
if out.last.is_a? Hash
out << out.pop.merge(indirect_generation_number: out.pop, indirect_reference_id: out.pop)
else
out << { indirect_without_dictionary: out.pop, indirect_generation_number: out.pop, indirect_reference_id: out.pop }
end
fresh = true
# fix wkhtmltopdf use of PDF 1.1 Dest using symbols instead of strings
out.last[:Dest] = unify_string(out.last[:Dest].to_s) if out.last[:Dest] && out.last[:Dest].is_a?(Symbol)
# puts "!!!!!!!!! Error with :indirect_reference_id\n\nObject #{out.last} :indirect_reference_id = #{out.last[:indirect_reference_id]}" unless out.last[:indirect_reference_id].is_a?(Numeric)
##########################################
## Parse an Object Reference
##########################################
elsif @scanner.scan(/R/)
out << { is_reference_only: true, indirect_generation_number: out.pop, indirect_reference_id: out.pop }
# @references << out.last
##########################################
## Parse Bool - true and after false
##########################################
elsif @scanner.scan(/true/)
out << true
elsif @scanner.scan(/false/)
out << false
##########################################
## Parse NULL - null
##########################################
elsif @scanner.scan(/null/)
out << nil
##########################################
## Parse file trailer
##########################################
elsif @scanner.scan(/trailer/)
if @scanner.skip_until(/<</)
data = _parse_
(@root_object ||= {}).clear
@root_object[data.shift] = data.shift while data[0]
end
##########################################
## XREF - check for encryption... anything else?
##########################################
elsif @scanner.scan(/xref/)
# skip list indetifier lines or list lines ([\d] [\d][\r\n]) ot ([\d] [\d] [nf][\r\n])
while @scanner.scan(/[\s]*[\d]+[ \t]+[\d]+[ \t]*[\n\r]+/) || @scanner.scan(/[ \t]*[\d]+[ \t]+[\d]+[ \t]+[nf][\s]*/)
nil
end
##########################################
## XREF location can be ignored
##########################################
elsif @scanner.scan(/startxref/)
@scanner.scan(/[\s]+[\d]+[\s]+/)
##########################################
## Skip Whitespace
##########################################
elsif @scanner.scan(/[\s]+/)
# Generally, do nothing
nil
##########################################
## EOF?
##########################################
elsif @scanner.scan(/\%\%EOF/)
##########
## If this was the last valid segment, ignore any trailing garbage
## (issue #49 resolution)
break unless @scanner.exist?(/\%\%EOF/)
##########################################
## Parse a comment
##########################################
elsif str = @scanner.scan(/\%/)
# is a comment, skip until new line
loop do
# break unless @scanner.scan(/[^\d\r\n]+/)
break if @scanner.check(/([\d]+[\s]+[\d]+[\s]+obj[\s]+\<\<)|([\n\r]+)/) || @scanner.eos? # || @scanner.scan(/[^\d]+[\r\n]+/) ||
@scanner.scan(/[^\d\r\n]+/) || @scanner.pos += 1
end
# puts "AFTER COMMENT: #{@scanner.peek 8}"
##########################################
## Fix wkhtmltopdf - missing 'endobj' keywords
##########################################
elsif @scanner.scan(/obj[\s]*/)
# Fix wkhtmltopdf PDF authoring issue - missing 'endobj' keywords
unless fresh || (out[-4].nil? || out[-4].is_a?(Hash))
keep = []
keep << out.pop # .tap {|i| puts "#{i} is an ID"}
keep << out.pop # .tap {|i| puts "#{i} is a REF"}
if out.last.is_a? Hash
out << out.pop.merge(indirect_generation_number: out.pop, indirect_reference_id: out.pop)
else
out << { indirect_without_dictionary: out.pop, indirect_generation_number: out.pop, indirect_reference_id: out.pop }
end
# fix wkhtmltopdf use of PDF 1.1 Dest using symbols instead of strings
out.last[:Dest] = unify_string(out.last[:Dest].to_s) if out.last[:Dest] && out.last[:Dest].is_a?(Symbol)
warn "'endobj' keyword was missing for Object ID: #{out.last[:indirect_reference_id]}, trying to auto-fix issue, but might fail."
out << keep.pop
out << keep.pop
end
fresh = false
##########################################
## Unknown, warn and advance
##########################################
else
# always advance
# warn "Advancing for unknown reason... #{@scanner.string[@scanner.pos - 4, 8]} ... #{@scanner.peek(4)}" unless @scanner.peek(1) =~ /[\s\n]/
warn 'Warning: parser advancing for unknown reason. Potential data-loss.'
@scanner.pos = @scanner.pos + 1
end
end
out
end | [
"def",
"_parse_",
"out",
"=",
"[",
"]",
"str",
"=",
"''",
"fresh",
"=",
"true",
"while",
"@scanner",
".",
"rest?",
"# last ||= 0",
"# out.last.tap do |o|",
"# \tif o.is_a?(Hash)",
"# \t\tputs \"[#{@scanner.pos}] Parser has a Dictionary (#{o.class.name}) with data:\"",
"# \t\t... | the actual recoursive parsing is done here.
this is an internal function, but it was left exposed for posible future features. | [
"the",
"actual",
"recoursive",
"parsing",
"is",
"done",
"here",
"."
] | 09054051019c069f551f3e60be789577c0f93900 | https://github.com/boazsegev/combine_pdf/blob/09054051019c069f551f3e60be789577c0f93900/lib/combine_pdf/parser.rb#L208-L488 | train | Parse a name sequence | [
30522,
13366,
1035,
11968,
3366,
1035,
2041,
1027,
1031,
1033,
2358,
2099,
1027,
1005,
1005,
4840,
1027,
2995,
2096,
1030,
26221,
1012,
2717,
1029,
1001,
2197,
1064,
1064,
1027,
1014,
1001,
2041,
1012,
2197,
1012,
11112,
2079,
1064,
1051,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GeorgeKaraszi/ActiveRecordExtended | lib/active_record_extended/utilities.rb | ActiveRecordExtended.Utilities.literal_key | def literal_key(key)
case key
when TrueClass then "'t'"
when FalseClass then "'f'"
when Numeric then key
else
key = key.to_s
key.start_with?("'") && key.end_with?("'") ? key : "'#{key}'"
end
end | ruby | def literal_key(key)
case key
when TrueClass then "'t'"
when FalseClass then "'f'"
when Numeric then key
else
key = key.to_s
key.start_with?("'") && key.end_with?("'") ? key : "'#{key}'"
end
end | [
"def",
"literal_key",
"(",
"key",
")",
"case",
"key",
"when",
"TrueClass",
"then",
"\"'t'\"",
"when",
"FalseClass",
"then",
"\"'f'\"",
"when",
"Numeric",
"then",
"key",
"else",
"key",
"=",
"key",
".",
"to_s",
"key",
".",
"start_with?",
"(",
"\"'\"",
")",
... | Ensures the key is properly single quoted and treated as a actual PG key reference. | [
"Ensures",
"the",
"key",
"is",
"properly",
"single",
"quoted",
"and",
"treated",
"as",
"a",
"actual",
"PG",
"key",
"reference",
"."
] | aca74eebb64b9957a2c8765bef6e43c7d5736fd8 | https://github.com/GeorgeKaraszi/ActiveRecordExtended/blob/aca74eebb64b9957a2c8765bef6e43c7d5736fd8/lib/active_record_extended/utilities.rb#L122-L131 | train | Return the literal key for a given key. | [
30522,
13366,
18204,
1035,
3145,
1006,
3145,
1007,
2553,
3145,
2043,
2995,
26266,
2059,
1000,
1005,
1056,
1005,
1000,
2043,
6270,
26266,
2059,
1000,
1005,
1042,
1005,
1000,
2043,
16371,
25531,
2059,
3145,
2842,
3145,
1027,
3145,
1012,
2000,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kaminari/kaminari | kaminari-core/lib/kaminari/models/page_scope_methods.rb | Kaminari.PageScopeMethods.current_page | def current_page
offset_without_padding = offset_value
offset_without_padding -= @_padding if defined?(@_padding) && @_padding
offset_without_padding = 0 if offset_without_padding < 0
(offset_without_padding / limit_value) + 1
rescue ZeroDivisionError
raise ZeroPerPageOperation, "Current page was incalculable. Perhaps you called .per(0)?"
end | ruby | def current_page
offset_without_padding = offset_value
offset_without_padding -= @_padding if defined?(@_padding) && @_padding
offset_without_padding = 0 if offset_without_padding < 0
(offset_without_padding / limit_value) + 1
rescue ZeroDivisionError
raise ZeroPerPageOperation, "Current page was incalculable. Perhaps you called .per(0)?"
end | [
"def",
"current_page",
"offset_without_padding",
"=",
"offset_value",
"offset_without_padding",
"-=",
"@_padding",
"if",
"defined?",
"(",
"@_padding",
")",
"&&",
"@_padding",
"offset_without_padding",
"=",
"0",
"if",
"offset_without_padding",
"<",
"0",
"(",
"offset_with... | Current page number | [
"Current",
"page",
"number"
] | e2078ce46b145b811423dc8b5993e4bc87dc88b8 | https://github.com/kaminari/kaminari/blob/e2078ce46b145b811423dc8b5993e4bc87dc88b8/kaminari-core/lib/kaminari/models/page_scope_methods.rb#L47-L55 | train | Returns the current page number | [
30522,
13366,
2783,
1035,
3931,
16396,
1035,
2302,
1035,
11687,
4667,
1027,
16396,
1035,
3643,
16396,
1035,
2302,
1035,
11687,
4667,
1011,
1027,
1030,
1035,
11687,
4667,
2065,
4225,
1029,
1006,
1030,
1035,
11687,
4667,
1007,
1004,
1004,
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... |
mongodb/mongo-ruby-driver | lib/mongo/cursor.rb | Mongo.Cursor.each | def each
process(@initial_result).each { |doc| yield doc }
while more?
return kill_cursors if exhausted?
get_more.each { |doc| yield doc }
end
end | ruby | def each
process(@initial_result).each { |doc| yield doc }
while more?
return kill_cursors if exhausted?
get_more.each { |doc| yield doc }
end
end | [
"def",
"each",
"process",
"(",
"@initial_result",
")",
".",
"each",
"{",
"|",
"doc",
"|",
"yield",
"doc",
"}",
"while",
"more?",
"return",
"kill_cursors",
"if",
"exhausted?",
"get_more",
".",
"each",
"{",
"|",
"doc",
"|",
"yield",
"doc",
"}",
"end",
"e... | Iterate through documents returned from the query.
@example Iterate over the documents in the cursor.
cursor.each do |doc|
...
end
@return [ Enumerator ] The enumerator.
@since 2.0.0 | [
"Iterate",
"through",
"documents",
"returned",
"from",
"the",
"query",
"."
] | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/cursor.rb#L127-L133 | train | Yields the results of the iterator. | [
30522,
13366,
2169,
2832,
1006,
1030,
3988,
1035,
2765,
1007,
1012,
2169,
30524,
2203,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
slim-template/slim | lib/slim/controls.rb | Slim.Controls.on_slim_output | def on_slim_output(escape, code, content)
if code =~ IF_RE
tmp = unique_name
[:multi,
# Capture the result of the code in a variable. We can't do
# `[:dynamic, code]` because it's probably not a complete
# expression (which is a requirement for Temple).
[:block, "#{tmp} = #{code}",
# Capture the content of a block in a separate buffer. This means
# that `yield` will not output the content to the current buffer,
# but rather return the output.
#
# The capturing can be disabled with the option :disable_capture.
# Output code in the block writes directly to the output buffer then.
# Rails handles this by replacing the output buffer for helpers.
options[:disable_capture] ? compile(content) : [:capture, unique_name, compile(content)]],
# Output the content.
[:escape, escape, [:dynamic, tmp]]]
else
[:multi, [:escape, escape, [:dynamic, code]], content]
end
end | ruby | def on_slim_output(escape, code, content)
if code =~ IF_RE
tmp = unique_name
[:multi,
# Capture the result of the code in a variable. We can't do
# `[:dynamic, code]` because it's probably not a complete
# expression (which is a requirement for Temple).
[:block, "#{tmp} = #{code}",
# Capture the content of a block in a separate buffer. This means
# that `yield` will not output the content to the current buffer,
# but rather return the output.
#
# The capturing can be disabled with the option :disable_capture.
# Output code in the block writes directly to the output buffer then.
# Rails handles this by replacing the output buffer for helpers.
options[:disable_capture] ? compile(content) : [:capture, unique_name, compile(content)]],
# Output the content.
[:escape, escape, [:dynamic, tmp]]]
else
[:multi, [:escape, escape, [:dynamic, code]], content]
end
end | [
"def",
"on_slim_output",
"(",
"escape",
",",
"code",
",",
"content",
")",
"if",
"code",
"=~",
"IF_RE",
"tmp",
"=",
"unique_name",
"[",
":multi",
",",
"# Capture the result of the code in a variable. We can't do",
"# `[:dynamic, code]` because it's probably not a complete",
... | Handle output expression `[:slim, :output, escape, code, content]`
@param [Boolean] escape Escape html
@param [String] code Ruby code
@param [Array] content Temple expression
@return [Array] Compiled temple expression | [
"Handle",
"output",
"expression",
"[",
":",
"slim",
":",
"output",
"escape",
"code",
"content",
"]"
] | ae8e7338fcfb67256d2f6b50c64fc317210e31a2 | https://github.com/slim-template/slim/blob/ae8e7338fcfb67256d2f6b50c64fc317210e31a2/lib/slim/controls.rb#L25-L49 | train | Returns the result of the slim output. | [
30522,
13366,
2006,
1035,
11754,
1035,
6434,
1006,
4019,
1010,
3642,
1010,
4180,
1007,
2065,
3642,
1027,
1066,
2065,
1035,
2128,
1056,
8737,
1027,
4310,
1035,
2171,
1031,
1024,
4800,
1010,
1001,
5425,
1996,
2765,
1997,
1996,
3642,
1999,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.resume_application_backup_with_http_info | def resume_application_backup_with_http_info(application_id, timeout:60, custom_headers:nil)
resume_application_backup_async(application_id, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def resume_application_backup_with_http_info(application_id, timeout:60, custom_headers:nil)
resume_application_backup_async(application_id, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"resume_application_backup_with_http_info",
"(",
"application_id",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"resume_application_backup_async",
"(",
"application_id",
",",
"timeout",
":",
"timeout",
",",
"custom_headers",
":custom_headers",... | Resumes periodic backup of a Service Fabric application which was previously
suspended.
The previously suspended Service Fabric application resumes taking periodic
backup as per the backup policy currently configured for the same.
@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 custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Resumes",
"periodic",
"backup",
"of",
"a",
"Service",
"Fabric",
"application",
"which",
"was",
"previously",
"suspended",
"."
] | 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#L23732-L23734 | train | Resumes a backup of the application. | [
30522,
13366,
13746,
1035,
4646,
1035,
10200,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
4646,
1035,
8909,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
13746,
1035,
4646,
1035,
10200,
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... |
jekyll/jekyll | lib/jekyll/cache.rb | Jekyll.Cache.[] | def [](key)
return @cache[key] if @cache.key?(key)
path = path_to(hash(key))
if disk_cache_enabled? && File.file?(path) && File.readable?(path)
@cache[key] = load(path)
else
raise
end
end | ruby | def [](key)
return @cache[key] if @cache.key?(key)
path = path_to(hash(key))
if disk_cache_enabled? && File.file?(path) && File.readable?(path)
@cache[key] = load(path)
else
raise
end
end | [
"def",
"[]",
"(",
"key",
")",
"return",
"@cache",
"[",
"key",
"]",
"if",
"@cache",
".",
"key?",
"(",
"key",
")",
"path",
"=",
"path_to",
"(",
"hash",
"(",
"key",
")",
")",
"if",
"disk_cache_enabled?",
"&&",
"File",
".",
"file?",
"(",
"path",
")",
... | Retrieve a cached item
Raises if key does not exist in cache
Returns cached value | [
"Retrieve",
"a",
"cached",
"item",
"Raises",
"if",
"key",
"does",
"not",
"exist",
"in",
"cache"
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/cache.rb#L81-L90 | train | Get the result of the key in the cache. | [
30522,
13366,
1031,
1033,
1006,
3145,
1007,
2709,
1030,
17053,
1031,
3145,
1033,
2065,
1030,
17053,
1012,
3145,
1029,
1006,
3145,
1007,
4130,
1027,
4130,
1035,
2000,
1006,
23325,
1006,
3145,
1007,
1007,
2065,
9785,
1035,
17053,
1035,
9124,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
randym/axlsx | lib/axlsx/drawing/pic.rb | Axlsx.Pic.end_at | def end_at(x, y=nil)
use_two_cell_anchor unless @anchor.is_a?(TwoCellAnchor)
@anchor.end_at x, y
@anchor.to
end | ruby | def end_at(x, y=nil)
use_two_cell_anchor unless @anchor.is_a?(TwoCellAnchor)
@anchor.end_at x, y
@anchor.to
end | [
"def",
"end_at",
"(",
"x",
",",
"y",
"=",
"nil",
")",
"use_two_cell_anchor",
"unless",
"@anchor",
".",
"is_a?",
"(",
"TwoCellAnchor",
")",
"@anchor",
".",
"end_at",
"x",
",",
"y",
"@anchor",
".",
"to",
"end"
] | noop if not using a two cell anchor
@param [Integer] x The column
@param [Integer] y The row
@return [Marker] | [
"noop",
"if",
"not",
"using",
"a",
"two",
"cell",
"anchor"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/drawing/pic.rb#L159-L163 | train | Returns the end of the cell at x y | [
30522,
13366,
2203,
1035,
2012,
1006,
1060,
1010,
1061,
1027,
9152,
2140,
1007,
2224,
1035,
2048,
1035,
3526,
1035,
8133,
4983,
1030,
8133,
1012,
2003,
1035,
1037,
1029,
1006,
2048,
29109,
5802,
9905,
2099,
1007,
1030,
8133,
1012,
2203,
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_web/lib/2016-03-01/generated/azure_mgmt_web/web_site_management_client.rb | Azure::Web::Mgmt::V2016_03_01.WebSiteManagementClient.validate_move | def validate_move(resource_group_name, move_resource_envelope, custom_headers:nil)
response = validate_move_async(resource_group_name, move_resource_envelope, custom_headers:custom_headers).value!
nil
end | ruby | def validate_move(resource_group_name, move_resource_envelope, custom_headers:nil)
response = validate_move_async(resource_group_name, move_resource_envelope, custom_headers:custom_headers).value!
nil
end | [
"def",
"validate_move",
"(",
"resource_group_name",
",",
"move_resource_envelope",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"validate_move_async",
"(",
"resource_group_name",
",",
"move_resource_envelope",
",",
"custom_headers",
":custom_headers",
")",
"."... | Validate whether a resource can be moved.
Validate whether a resource can be moved.
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param move_resource_envelope [CsmMoveResourceEnvelope] Object that
represents the resource to move.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Validate",
"whether",
"a",
"resource",
"can",
"be",
"moved",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2016-03-01/generated/azure_mgmt_web/web_site_management_client.rb#L1554-L1557 | train | Validates the move resource envelope. | [
30522,
13366,
9398,
3686,
1035,
2693,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2693,
1035,
7692,
1035,
11255,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
9398,
3686,
1035,
2693,
1035,
2004,
6038,
2278,
1006,
7692,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/overcommit | lib/overcommit/hook_context/pre_commit.rb | Overcommit::HookContext.PreCommit.restore_working_tree | def restore_working_tree
result = Overcommit::Utils.execute(%w[git stash pop --index --quiet])
unless result.success?
raise Overcommit::Exceptions::HookCleanupFailed,
"Unable to restore working tree after #{hook_script_name} hooks run:" \
"\nSTDOUT:#{result.stdout}\nSTDERR:#{result.stderr}"
end
end | ruby | def restore_working_tree
result = Overcommit::Utils.execute(%w[git stash pop --index --quiet])
unless result.success?
raise Overcommit::Exceptions::HookCleanupFailed,
"Unable to restore working tree after #{hook_script_name} hooks run:" \
"\nSTDOUT:#{result.stdout}\nSTDERR:#{result.stderr}"
end
end | [
"def",
"restore_working_tree",
"result",
"=",
"Overcommit",
"::",
"Utils",
".",
"execute",
"(",
"%w[",
"git",
"stash",
"pop",
"--index",
"--quiet",
"]",
")",
"unless",
"result",
".",
"success?",
"raise",
"Overcommit",
"::",
"Exceptions",
"::",
"HookCleanupFailed... | Applies the stash to the working tree to restore the user's state. | [
"Applies",
"the",
"stash",
"to",
"the",
"working",
"tree",
"to",
"restore",
"the",
"user",
"s",
"state",
"."
] | 35d60adb41da942178b789560968e3ad030b0ac7 | https://github.com/sds/overcommit/blob/35d60adb41da942178b789560968e3ad030b0ac7/lib/overcommit/hook_context/pre_commit.rb#L163-L170 | train | Restore the working tree from the working tree. | [
30522,
13366,
9239,
1035,
2551,
1035,
3392,
2765,
1027,
2058,
9006,
22930,
1024,
1024,
21183,
12146,
1012,
15389,
1006,
1003,
1059,
1031,
21025,
2102,
2358,
11823,
3769,
1011,
1011,
5950,
1011,
1011,
4251,
1033,
1007,
4983,
2765,
1012,
3112... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/resource.rb | Aws::IAM.Resource.create_signing_certificate | def create_signing_certificate(options = {})
resp = @client.upload_signing_certificate(options)
SigningCertificate.new(
id: resp.data.certificate.certificate_id,
data: resp.data.certificate,
client: @client
)
end | ruby | def create_signing_certificate(options = {})
resp = @client.upload_signing_certificate(options)
SigningCertificate.new(
id: resp.data.certificate.certificate_id,
data: resp.data.certificate,
client: @client
)
end | [
"def",
"create_signing_certificate",
"(",
"options",
"=",
"{",
"}",
")",
"resp",
"=",
"@client",
".",
"upload_signing_certificate",
"(",
"options",
")",
"SigningCertificate",
".",
"new",
"(",
"id",
":",
"resp",
".",
"data",
".",
"certificate",
".",
"certificat... | @example Request syntax with placeholder values
signingcertificate = iam.create_signing_certificate({
user_name: "existingUserNameType",
certificate_body: "certificateBodyType", # required
})
@param [Hash] options ({})
@option options [String] :user_name
The name of the user the signing certificate is for.
This parameter allows (through its [regex pattern][1]) a string of
characters consisting of upper and lowercase alphanumeric characters
with no spaces. You can also include any of the following characters:
\_+=,.@-
[1]: http://wikipedia.org/wiki/regex
@option options [required, String] :certificate_body
The contents of the signing certificate.
The [regex pattern][1] used to validate this parameter is a string of
characters consisting of the following:
* Any printable ASCII character ranging from the space character
(\\u0020) through the end of the ASCII character range
* The printable characters in the Basic Latin and Latin-1 Supplement
character set (through \\u00FF)
* The special characters tab (\\u0009), line feed (\\u000A), and
carriage return (\\u000D)
[1]: http://wikipedia.org/wiki/regex
@return [SigningCertificate] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-iam/lib/aws-sdk-iam/resource.rb#L645-L652 | train | Create a signing certificate | [
30522,
13366,
3443,
1035,
6608,
1035,
8196,
1006,
7047,
1027,
1063,
1065,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
2039,
11066,
1035,
6608,
30524,
1007,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jeremytregunna/ruby-trello | lib/trello/card.rb | Trello.Card.remove_upvote | def remove_upvote
begin
client.delete("/cards/#{id}/membersVoted/#{me.id}")
rescue Trello::Error => e
fail e unless e.message =~ /has not voted/i
end
self
end | ruby | def remove_upvote
begin
client.delete("/cards/#{id}/membersVoted/#{me.id}")
rescue Trello::Error => e
fail e unless e.message =~ /has not voted/i
end
self
end | [
"def",
"remove_upvote",
"begin",
"client",
".",
"delete",
"(",
"\"/cards/#{id}/membersVoted/#{me.id}\"",
")",
"rescue",
"Trello",
"::",
"Error",
"=>",
"e",
"fail",
"e",
"unless",
"e",
".",
"message",
"=~",
"/",
"/i",
"end",
"self",
"end"
] | Recind upvote. Noop if authenticated user hasn't previously voted | [
"Recind",
"upvote",
".",
"Noop",
"if",
"authenticated",
"user",
"hasn",
"t",
"previously",
"voted"
] | ad79c9d8152ad5395b3b61c43170908f1912bfb2 | https://github.com/jeremytregunna/ruby-trello/blob/ad79c9d8152ad5395b3b61c43170908f1912bfb2/lib/trello/card.rb#L392-L400 | train | Remove the upvote
from the card | [
30522,
13366,
6366,
1035,
2039,
22994,
2063,
4088,
7396,
1012,
3972,
12870,
1006,
1000,
1013,
5329,
1013,
1001,
1063,
8909,
1065,
1013,
2372,
22994,
2098,
1013,
1001,
1063,
2033,
1012,
8909,
1065,
1000,
1007,
5343,
29461,
7174,
1024,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
meew0/discordrb | lib/discordrb/data/server.rb | Discordrb.Server.modify_embed | def modify_embed(enabled, channel, reason = nil)
cache_embed_data if @embed_enabled.nil?
channel_id = channel ? channel.resolve_id : @embed_channel_id
response = JSON.parse(API::Server.modify_embed(@bot.token, @id, enabled, channel_id, reason))
@embed_enabled = response['enabled']
@embed_channel_id = response['channel_id']
end | ruby | def modify_embed(enabled, channel, reason = nil)
cache_embed_data if @embed_enabled.nil?
channel_id = channel ? channel.resolve_id : @embed_channel_id
response = JSON.parse(API::Server.modify_embed(@bot.token, @id, enabled, channel_id, reason))
@embed_enabled = response['enabled']
@embed_channel_id = response['channel_id']
end | [
"def",
"modify_embed",
"(",
"enabled",
",",
"channel",
",",
"reason",
"=",
"nil",
")",
"cache_embed_data",
"if",
"@embed_enabled",
".",
"nil?",
"channel_id",
"=",
"channel",
"?",
"channel",
".",
"resolve_id",
":",
"@embed_channel_id",
"response",
"=",
"JSON",
... | Changes the channel on the server's embed (widget), and sets whether it is enabled.
@param enabled [true, false] whether the embed (widget) is enabled
@param channel [Channel, String, Integer, #resolve_id] the channel to be referenced by the embed
@param reason [String, nil] the reason to be shown in the audit log for this action | [
"Changes",
"the",
"channel",
"on",
"the",
"server",
"s",
"embed",
"(",
"widget",
")",
"and",
"sets",
"whether",
"it",
"is",
"enabled",
"."
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/data/server.rb#L233-L239 | train | Modify embed settings | [
30522,
13366,
19933,
1035,
7861,
8270,
1006,
9124,
1010,
3149,
1010,
3114,
1027,
9152,
2140,
1007,
17053,
1035,
7861,
8270,
1035,
2951,
2065,
1030,
7861,
8270,
1035,
9124,
1012,
9152,
2140,
1029,
3149,
1035,
8909,
1027,
3149,
1029,
3149,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/diagnostics.rb | Azure::Web::Mgmt::V2018_02_01.Diagnostics.list_site_detectors | def list_site_detectors(resource_group_name, site_name, diagnostic_category, custom_headers:nil)
first_page = list_site_detectors_as_lazy(resource_group_name, site_name, diagnostic_category, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_site_detectors(resource_group_name, site_name, diagnostic_category, custom_headers:nil)
first_page = list_site_detectors_as_lazy(resource_group_name, site_name, diagnostic_category, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_site_detectors",
"(",
"resource_group_name",
",",
"site_name",
",",
"diagnostic_category",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_site_detectors_as_lazy",
"(",
"resource_group_name",
",",
"site_name",
",",
"diagnostic_category",
",",... | Get Detectors
Get Detectors
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param site_name [String] Site Name
@param diagnostic_category [String] Diagnostic Category
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<DetectorDefinition>] operation results. | [
"Get",
"Detectors"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/diagnostics.rb#L1036-L1039 | train | Gets all the detectors for a site. | [
30522,
13366,
2862,
1035,
2609,
1035,
25971,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2609,
1035,
2171,
1010,
16474,
1035,
4696,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2862,
1035,
2609,
1035,
25971,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_recovery_services_site_recovery/lib/2016-08-10/generated/azure_mgmt_recovery_services_site_recovery/replication_storage_classification_mappings.rb | Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10.ReplicationStorageClassificationMappings.list_by_replication_storage_classifications_as_lazy | def list_by_replication_storage_classifications_as_lazy(fabric_name, storage_classification_name, custom_headers:nil)
response = list_by_replication_storage_classifications_async(fabric_name, storage_classification_name, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_replication_storage_classifications_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_by_replication_storage_classifications_as_lazy(fabric_name, storage_classification_name, custom_headers:nil)
response = list_by_replication_storage_classifications_async(fabric_name, storage_classification_name, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_replication_storage_classifications_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_by_replication_storage_classifications_as_lazy",
"(",
"fabric_name",
",",
"storage_classification_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_replication_storage_classifications_async",
"(",
"fabric_name",
",",
"storage_classification_name"... | Gets the list of storage classification mappings objects under a storage.
Lists the storage classification mappings for the fabric.
@param fabric_name [String] Fabric name.
@param storage_classification_name [String] Storage classfication name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [StorageClassificationMappingCollection] which provide lazy access to
pages of the response. | [
"Gets",
"the",
"list",
"of",
"storage",
"classification",
"mappings",
"objects",
"under",
"a",
"storage",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_recovery_services_site_recovery/lib/2016-08-10/generated/azure_mgmt_recovery_services_site_recovery/replication_storage_classification_mappings.rb#L832-L841 | train | Gets all the image objects in a storage classification. | [
30522,
13366,
2862,
1035,
2011,
1035,
21647,
1035,
5527,
1035,
26739,
1035,
2004,
1035,
13971,
1006,
8313,
1035,
2171,
1010,
5527,
1035,
5579,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
watir/watir | lib/watir/attribute_helper.rb | Watir.AttributeHelper.attribute | def attribute(type, method, attr)
typed_attributes[type] << [method, attr]
define_attribute(type, method, attr)
end | ruby | def attribute(type, method, attr)
typed_attributes[type] << [method, attr]
define_attribute(type, method, attr)
end | [
"def",
"attribute",
"(",
"type",
",",
"method",
",",
"attr",
")",
"typed_attributes",
"[",
"type",
"]",
"<<",
"[",
"method",
",",
"attr",
"]",
"define_attribute",
"(",
"type",
",",
"method",
",",
"attr",
")",
"end"
] | YARD macro to generated friendly
documentation for attributes.
@macro [attach] attribute
@method $2
@return [$1] value of $3 property | [
"YARD",
"macro",
"to",
"generated",
"friendly",
"documentation",
"for",
"attributes",
"."
] | 2d8db09811c6221ae401b85b2f61f5fa66e463a3 | https://github.com/watir/watir/blob/2d8db09811c6221ae401b85b2f61f5fa66e463a3/lib/watir/attribute_helper.rb#L48-L51 | train | Add an attribute to the object. | [
30522,
13366,
17961,
1006,
2828,
1010,
4118,
1010,
2012,
16344,
1007,
21189,
1035,
12332,
1031,
2828,
1033,
1026,
1026,
1031,
4118,
1010,
2012,
16344,
1033,
9375,
1035,
17961,
1006,
2828,
1010,
4118,
1010,
2012,
16344,
1007,
2203,
102,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/task.rb | Ufo.Task.adjust_security_groups | def adjust_security_groups(options)
return options unless options[:network_configuration] &&
options[:network_configuration][:awsvpc_configuration]
awsvpc_conf = options[:network_configuration][:awsvpc_configuration]
security_groups = awsvpc_conf[:security_groups]
if [nil, '', 'nil'].include?(security_groups)
security_groups = []
end
if security_groups.empty?
fetch = Network::Fetch.new(network[:vpc])
sg = fetch.security_group_id
security_groups << sg
security_groups.uniq!
end
# override security groups
options[:network_configuration][:awsvpc_configuration][:security_groups] = security_groups
options
end | ruby | def adjust_security_groups(options)
return options unless options[:network_configuration] &&
options[:network_configuration][:awsvpc_configuration]
awsvpc_conf = options[:network_configuration][:awsvpc_configuration]
security_groups = awsvpc_conf[:security_groups]
if [nil, '', 'nil'].include?(security_groups)
security_groups = []
end
if security_groups.empty?
fetch = Network::Fetch.new(network[:vpc])
sg = fetch.security_group_id
security_groups << sg
security_groups.uniq!
end
# override security groups
options[:network_configuration][:awsvpc_configuration][:security_groups] = security_groups
options
end | [
"def",
"adjust_security_groups",
"(",
"options",
")",
"return",
"options",
"unless",
"options",
"[",
":network_configuration",
"]",
"&&",
"options",
"[",
":network_configuration",
"]",
"[",
":awsvpc_configuration",
"]",
"awsvpc_conf",
"=",
"options",
"[",
":network_co... | Ensures at least 1 security group is assigned if awsvpc_configuration
is provided. | [
"Ensures",
"at",
"least",
"1",
"security",
"group",
"is",
"assigned",
"if",
"awsvpc_configuration",
"is",
"provided",
"."
] | 16ac3dad28edcab2693c0e7d89a1971aca65b8f9 | https://github.com/tongueroo/ufo/blob/16ac3dad28edcab2693c0e7d89a1971aca65b8f9/lib/ufo/task.rb#L119-L139 | train | Adjust security groups in the specified options | [
30522,
13366,
14171,
1035,
3036,
1035,
2967,
1006,
7047,
1007,
2709,
7047,
4983,
7047,
1031,
1024,
2897,
1035,
9563,
1033,
1004,
1004,
7047,
1031,
1024,
2897,
1035,
9563,
1033,
1031,
1024,
22091,
2015,
2615,
15042,
1035,
9563,
1033,
22091,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_key_vault/lib/2018-02-14/generated/azure_mgmt_key_vault/vaults.rb | Azure::KeyVault::Mgmt::V2018_02_14.Vaults.update_access_policy | def update_access_policy(resource_group_name, vault_name, operation_kind, parameters, custom_headers:nil)
response = update_access_policy_async(resource_group_name, vault_name, operation_kind, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def update_access_policy(resource_group_name, vault_name, operation_kind, parameters, custom_headers:nil)
response = update_access_policy_async(resource_group_name, vault_name, operation_kind, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"update_access_policy",
"(",
"resource_group_name",
",",
"vault_name",
",",
"operation_kind",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"update_access_policy_async",
"(",
"resource_group_name",
",",
"vault_name",
",",
"operation_... | Update access policies in a key vault in the specified subscription.
@param resource_group_name [String] The name of the Resource Group to which
the vault belongs.
@param vault_name [String] Name of the vault
@param operation_kind [AccessPolicyUpdateKind] Name of the operation.
Possible values include: 'add', 'replace', 'remove'
@param parameters [VaultAccessPolicyParameters] Access policy to merge into
the vault
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [VaultAccessPolicyParameters] operation results. | [
"Update",
"access",
"policies",
"in",
"a",
"key",
"vault",
"in",
"the",
"specified",
"subscription",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_key_vault/lib/2018-02-14/generated/azure_mgmt_key_vault/vaults.rb#L384-L387 | train | Updates the access policy of the specified vault. | [
30522,
13366,
10651,
1035,
3229,
1035,
3343,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
11632,
1035,
2171,
1010,
3169,
1035,
2785,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
10651,
1035,
3229,
1035,
3343,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
awesome-print/awesome_print | lib/awesome_print/ext/mongo_mapper.rb | AwesomePrint.MongoMapper.awesome_mongo_mapper_class | def awesome_mongo_mapper_class(object)
return object.inspect if !defined?(::ActiveSupport::OrderedHash) || !object.respond_to?(:keys)
data = object.keys.sort.inject(::ActiveSupport::OrderedHash.new) do |hash, c|
hash[c.first] = (c.last.type || 'undefined').to_s.underscore.intern
hash
end
# Add in associations
if @options[:mongo_mapper][:show_associations]
object.associations.each do |name, assoc|
data[name.to_s] = assoc
end
end
name = "class #{awesome_simple(object.to_s, :class)}"
base = "< #{awesome_simple(object.superclass.to_s, :class)}"
[name, base, awesome_hash(data)].join(' ')
end | ruby | def awesome_mongo_mapper_class(object)
return object.inspect if !defined?(::ActiveSupport::OrderedHash) || !object.respond_to?(:keys)
data = object.keys.sort.inject(::ActiveSupport::OrderedHash.new) do |hash, c|
hash[c.first] = (c.last.type || 'undefined').to_s.underscore.intern
hash
end
# Add in associations
if @options[:mongo_mapper][:show_associations]
object.associations.each do |name, assoc|
data[name.to_s] = assoc
end
end
name = "class #{awesome_simple(object.to_s, :class)}"
base = "< #{awesome_simple(object.superclass.to_s, :class)}"
[name, base, awesome_hash(data)].join(' ')
end | [
"def",
"awesome_mongo_mapper_class",
"(",
"object",
")",
"return",
"object",
".",
"inspect",
"if",
"!",
"defined?",
"(",
"::",
"ActiveSupport",
"::",
"OrderedHash",
")",
"||",
"!",
"object",
".",
"respond_to?",
"(",
":keys",
")",
"data",
"=",
"object",
".",
... | Format MongoMapper class object.
------------------------------------------------------------------------------ | [
"Format",
"MongoMapper",
"class",
"object",
".",
"------------------------------------------------------------------------------"
] | 4564fd74721562cbef2443f7d97109bf9192343d | https://github.com/awesome-print/awesome_print/blob/4564fd74721562cbef2443f7d97109bf9192343d/lib/awesome_print/ext/mongo_mapper.rb#L37-L56 | train | Returns a unique identifier for the given object. | [
30522,
13366,
12476,
1035,
12256,
3995,
1035,
4949,
4842,
1035,
2465,
1006,
4874,
1007,
2709,
4874,
1012,
22459,
2065,
999,
4225,
1029,
1006,
1024,
1024,
3161,
6342,
9397,
11589,
1024,
1024,
3641,
14949,
2232,
1007,
1064,
1064,
999,
4874,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
chaps-io/public_activity | lib/public_activity/common.rb | PublicActivity.Common.create_activity! | def create_activity!(*args)
return unless self.public_activity_enabled?
options = prepare_settings(*args)
if call_hook_safe(options[:key].split('.').last)
reset_activity_instance_options
return PublicActivity::Adapter.create_activity!(self, options)
end
end | ruby | def create_activity!(*args)
return unless self.public_activity_enabled?
options = prepare_settings(*args)
if call_hook_safe(options[:key].split('.').last)
reset_activity_instance_options
return PublicActivity::Adapter.create_activity!(self, options)
end
end | [
"def",
"create_activity!",
"(",
"*",
"args",
")",
"return",
"unless",
"self",
".",
"public_activity_enabled?",
"options",
"=",
"prepare_settings",
"(",
"args",
")",
"if",
"call_hook_safe",
"(",
"options",
"[",
":key",
"]",
".",
"split",
"(",
"'.'",
")",
".",... | Directly saves activity to database. Works the same as create_activity
but throws validation error for each supported ORM.
@see #create_activity | [
"Directly",
"saves",
"activity",
"to",
"database",
".",
"Works",
"the",
"same",
"as",
"create_activity",
"but",
"throws",
"validation",
"error",
"for",
"each",
"supported",
"ORM",
"."
] | e4357cd14db67299e0cbbd656300f51b7069ea9b | https://github.com/chaps-io/public_activity/blob/e4357cd14db67299e0cbbd656300f51b7069ea9b/lib/public_activity/common.rb#L266-L274 | train | Create an activity | [
30522,
13366,
3443,
1035,
4023,
999,
1006,
1008,
12098,
5620,
1007,
2709,
4983,
2969,
1012,
2270,
1035,
4023,
1035,
9124,
1029,
7047,
1027,
7374,
1035,
10906,
1006,
1008,
12098,
5620,
1007,
2065,
2655,
1035,
8103,
1035,
3647,
1006,
7047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/fields/common_address_field.rb | Mail.CommonAddressField.formatted | def formatted
list = element.addresses.map { |a| a.format }
Mail::AddressContainer.new(self, list)
end | ruby | def formatted
list = element.addresses.map { |a| a.format }
Mail::AddressContainer.new(self, list)
end | [
"def",
"formatted",
"list",
"=",
"element",
".",
"addresses",
".",
"map",
"{",
"|",
"a",
"|",
"a",
".",
"format",
"}",
"Mail",
"::",
"AddressContainer",
".",
"new",
"(",
"self",
",",
"list",
")",
"end"
] | Returns the formatted string of all the addresses in the address list | [
"Returns",
"the",
"formatted",
"string",
"of",
"all",
"the",
"addresses",
"in",
"the",
"address",
"list"
] | fb53fb369eb2bf0494ac70675970c90cdcc3f495 | https://github.com/mikel/mail/blob/fb53fb369eb2bf0494ac70675970c90cdcc3f495/lib/mail/fields/common_address_field.rb#L52-L55 | train | Returns the formatted address list | [
30522,
13366,
4289,
3064,
2862,
1027,
5783,
1012,
11596,
1012,
4949,
1063,
1064,
1037,
1064,
1037,
1012,
4289,
1065,
5653,
1024,
1024,
4769,
8663,
18249,
2121,
1012,
2047,
1006,
2969,
1010,
2862,
1007,
2203,
102,
0,
0,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
javan/whenever | lib/whenever/job_list.rb | Whenever.JobList.pre_set | def pre_set(variable_string = nil)
return if variable_string.nil? || variable_string == ""
pairs = variable_string.split('&')
pairs.each do |pair|
next unless pair.index('=')
variable, value = *pair.split('=')
unless variable.nil? || variable == "" || value.nil? || value == ""
variable = variable.strip.to_sym
set(variable, value.strip)
@pre_set_variables[variable] = value
end
end
end | ruby | def pre_set(variable_string = nil)
return if variable_string.nil? || variable_string == ""
pairs = variable_string.split('&')
pairs.each do |pair|
next unless pair.index('=')
variable, value = *pair.split('=')
unless variable.nil? || variable == "" || value.nil? || value == ""
variable = variable.strip.to_sym
set(variable, value.strip)
@pre_set_variables[variable] = value
end
end
end | [
"def",
"pre_set",
"(",
"variable_string",
"=",
"nil",
")",
"return",
"if",
"variable_string",
".",
"nil?",
"||",
"variable_string",
"==",
"\"\"",
"pairs",
"=",
"variable_string",
".",
"split",
"(",
"'&'",
")",
"pairs",
".",
"each",
"do",
"|",
"pair",
"|",
... | Takes a string like: "variable1=something&variable2=somethingelse"
and breaks it into variable/value pairs. Used for setting variables at runtime from the command line.
Only works for setting values as strings. | [
"Takes",
"a",
"string",
"like",
":",
"variable1",
"=",
"something&variable2",
"=",
"somethingelse",
"and",
"breaks",
"it",
"into",
"variable",
"/",
"value",
"pairs",
".",
"Used",
"for",
"setting",
"variables",
"at",
"runtime",
"from",
"the",
"command",
"line",... | e1a3ffe571f5b948a97d609a7d983b214dc41160 | https://github.com/javan/whenever/blob/e1a3ffe571f5b948a97d609a7d983b214dc41160/lib/whenever/job_list.rb#L85-L98 | train | Set the pre_set variables | [
30522,
13366,
3653,
1035,
2275,
1006,
8023,
1035,
5164,
1027,
9152,
2140,
1007,
30524,
1064,
3940,
1064,
2279,
4983,
3940,
1012,
5950,
1006,
1005,
1027,
1005,
1007,
8023,
1010,
3643,
1027,
1008,
3940,
1012,
3975,
1006,
1005,
1027,
1005,
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... |
gocardless/hutch | lib/hutch/broker.rb | Hutch.Broker.bindings | def bindings
results = Hash.new { |hash, key| hash[key] = [] }
api_client.bindings.each do |binding|
next if binding['destination'] == binding['routing_key']
next unless binding['source'] == @config[:mq_exchange]
next unless binding['vhost'] == @config[:mq_vhost]
results[binding['destination']] << binding['routing_key']
end
results
end | ruby | def bindings
results = Hash.new { |hash, key| hash[key] = [] }
api_client.bindings.each do |binding|
next if binding['destination'] == binding['routing_key']
next unless binding['source'] == @config[:mq_exchange]
next unless binding['vhost'] == @config[:mq_vhost]
results[binding['destination']] << binding['routing_key']
end
results
end | [
"def",
"bindings",
"results",
"=",
"Hash",
".",
"new",
"{",
"|",
"hash",
",",
"key",
"|",
"hash",
"[",
"key",
"]",
"=",
"[",
"]",
"}",
"api_client",
".",
"bindings",
".",
"each",
"do",
"|",
"binding",
"|",
"next",
"if",
"binding",
"[",
"'destinatio... | Return a mapping of queue names to the routing keys they're bound to. | [
"Return",
"a",
"mapping",
"of",
"queue",
"names",
"to",
"the",
"routing",
"keys",
"they",
"re",
"bound",
"to",
"."
] | 9314b3b8c84abeb78170730757f3eb8ccc4f54c5 | https://github.com/gocardless/hutch/blob/9314b3b8c84abeb78170730757f3eb8ccc4f54c5/lib/hutch/broker.rb#L182-L191 | train | Returns a hash of all the bindings that are available for the current connection | [
30522,
13366,
8031,
2015,
3463,
1027,
23325,
1012,
2047,
1063,
1064,
23325,
1010,
3145,
1064,
23325,
1031,
3145,
1033,
1027,
1031,
1033,
1065,
17928,
1035,
7396,
1012,
8031,
2015,
1012,
2169,
2079,
1064,
8031,
1064,
2279,
2065,
8031,
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... |
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_replica_info_with_http_info | def get_replica_info_with_http_info(partition_id, replica_id, timeout:60, custom_headers:nil)
get_replica_info_async(partition_id, replica_id, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def get_replica_info_with_http_info(partition_id, replica_id, timeout:60, custom_headers:nil)
get_replica_info_async(partition_id, replica_id, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"get_replica_info_with_http_info",
"(",
"partition_id",
",",
"replica_id",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"get_replica_info_async",
"(",
"partition_id",
",",
"replica_id",
",",
"timeout",
":",
"timeout",
",",
"custom_header... | Gets the information about a replica of a Service Fabric partition.
The response includes the id, role, status, health, node name, uptime, and
other details about the replica.
@param partition_id The identity of the partition.
@param replica_id [String] The identifier of the replica.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"information",
"about",
"a",
"replica",
"of",
"a",
"Service",
"Fabric",
"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#L14597-L14599 | train | Gets the information about the replica. | [
30522,
13366,
2131,
1035,
15059,
1035,
18558,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
13571,
1035,
8909,
1010,
15059,
1035,
8909,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
15059,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/dsc_compilation_job_operations.rb | Azure::Automation::Mgmt::V2015_10_31.DscCompilationJobOperations.get_stream_with_http_info | def get_stream_with_http_info(resource_group_name, automation_account_name, job_id, job_stream_id, custom_headers:nil)
get_stream_async(resource_group_name, automation_account_name, job_id, job_stream_id, custom_headers:custom_headers).value!
end | ruby | def get_stream_with_http_info(resource_group_name, automation_account_name, job_id, job_stream_id, custom_headers:nil)
get_stream_async(resource_group_name, automation_account_name, job_id, job_stream_id, custom_headers:custom_headers).value!
end | [
"def",
"get_stream_with_http_info",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"job_id",
",",
"job_stream_id",
",",
"custom_headers",
":",
"nil",
")",
"get_stream_async",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"job_id",
",",... | Retrieve the job stream identified by job stream id.
@param resource_group_name [String] Name of an Azure Resource group.
@param automation_account_name [String] The name of the automation account.
@param job_id The job id.
@param job_stream_id [String] The job stream id.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Retrieve",
"the",
"job",
"stream",
"identified",
"by",
"job",
"stream",
"id",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/dsc_compilation_job_operations.rb#L363-L365 | train | Gets the stream of the specified job. | [
30522,
13366,
2131,
1035,
5460,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
19309,
1035,
4070,
1035,
2171,
1010,
3105,
1035,
8909,
1010,
3105,
1035,
5460,
1035,
8909,
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_event_hub/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/namespaces.rb | Azure::EventHub::Mgmt::V2018_01_01_preview.Namespaces.list_ipfilter_rules_next | def list_ipfilter_rules_next(next_page_link, custom_headers:nil)
response = list_ipfilter_rules_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_ipfilter_rules_next(next_page_link, custom_headers:nil)
response = list_ipfilter_rules_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_ipfilter_rules_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_ipfilter_rules_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
... | Gets a list of IP Filter rules for a Namespace.
@param next_page_link [String] The NextLink from the previous successful call
to List operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [IpFilterRuleListResult] operation results. | [
"Gets",
"a",
"list",
"of",
"IP",
"Filter",
"rules",
"for",
"a",
"Namespace",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_event_hub/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/namespaces.rb#L1959-L1962 | train | Gets the ip filter rules. | [
30522,
13366,
2862,
1035,
12997,
8873,
21928,
1035,
3513,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
12997,
8873,
21928,
1035,
3513,
1035,
2279,
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... |
kmuto/review | lib/epubmaker/epubcommon.rb | EPUBMaker.EPUBCommon.mytoc | def mytoc
@title = CGI.escapeHTML(@producer.res.v('toctitle'))
@body = %Q( <h1 class="toc-title">#{CGI.escapeHTML(@producer.res.v('toctitle'))}</h1>\n)
if @producer.config['epubmaker']['flattoc'].nil?
@body << hierarchy_ncx('ul')
else
@body << flat_ncx('ul', @producer.config['epubmaker']['flattocindent'])
end
@language = @producer.config['language']
@stylesheets = @producer.config['stylesheet']
tmplfile = if @producer.config['htmlversion'].to_i == 5
File.expand_path('./html/layout-html5.html.erb', ReVIEW::Template::TEMPLATE_DIR)
else
File.expand_path('./html/layout-xhtml1.html.erb', ReVIEW::Template::TEMPLATE_DIR)
end
tmpl = ReVIEW::Template.load(tmplfile)
tmpl.result(binding)
end | ruby | def mytoc
@title = CGI.escapeHTML(@producer.res.v('toctitle'))
@body = %Q( <h1 class="toc-title">#{CGI.escapeHTML(@producer.res.v('toctitle'))}</h1>\n)
if @producer.config['epubmaker']['flattoc'].nil?
@body << hierarchy_ncx('ul')
else
@body << flat_ncx('ul', @producer.config['epubmaker']['flattocindent'])
end
@language = @producer.config['language']
@stylesheets = @producer.config['stylesheet']
tmplfile = if @producer.config['htmlversion'].to_i == 5
File.expand_path('./html/layout-html5.html.erb', ReVIEW::Template::TEMPLATE_DIR)
else
File.expand_path('./html/layout-xhtml1.html.erb', ReVIEW::Template::TEMPLATE_DIR)
end
tmpl = ReVIEW::Template.load(tmplfile)
tmpl.result(binding)
end | [
"def",
"mytoc",
"@title",
"=",
"CGI",
".",
"escapeHTML",
"(",
"@producer",
".",
"res",
".",
"v",
"(",
"'toctitle'",
")",
")",
"@body",
"=",
"%Q( <h1 class=\"toc-title\">#{CGI.escapeHTML(@producer.res.v('toctitle'))}</h1>\\n)",
"if",
"@producer",
".",
"config",
"[",
... | Return own toc content. | [
"Return",
"own",
"toc",
"content",
"."
] | 77d1273e671663f05db2992281fd891b776badf0 | https://github.com/kmuto/review/blob/77d1273e671663f05db2992281fd891b776badf0/lib/epubmaker/epubcommon.rb#L291-L310 | train | This method is used to generate the Toc object | [
30522,
13366,
2026,
3406,
2278,
1030,
2516,
1027,
1039,
5856,
1012,
4019,
11039,
19968,
1006,
1030,
3135,
1012,
24501,
1012,
1058,
1006,
1005,
2000,
6593,
4183,
2571,
1005,
1007,
1007,
1030,
2303,
1027,
1003,
1053,
1006,
1026,
1044,
2487,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.begin_create_or_update | def begin_create_or_update(resource_group_name, service_endpoint_policy_name, service_endpoint_policy_definition_name, service_endpoint_policy_definitions, custom_headers:nil)
response = begin_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 begin_create_or_update(resource_group_name, service_endpoint_policy_name, service_endpoint_policy_definition_name, service_endpoint_policy_definitions, custom_headers:nil)
response = begin_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",
"begin_create_or_update",
"(",
"resource_group_name",
",",
"service_endpoint_policy_name",
",",
"service_endpoint_policy_definition_name",
",",
"service_endpoint_policy_definitions",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_create_or_update_async",
"... | 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#L431-L434 | train | Creates or updates a service endpoint policy. | [
30522,
13366,
4088,
1035,
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,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_service_bus/lib/2017-04-01/generated/azure_mgmt_service_bus/disaster_recovery_configs.rb | Azure::ServiceBus::Mgmt::V2017_04_01.DisasterRecoveryConfigs.list_authorization_rules_with_http_info | def list_authorization_rules_with_http_info(resource_group_name, namespace_name, alias_parameter, custom_headers:nil)
list_authorization_rules_async(resource_group_name, namespace_name, alias_parameter, custom_headers:custom_headers).value!
end | ruby | def list_authorization_rules_with_http_info(resource_group_name, namespace_name, alias_parameter, custom_headers:nil)
list_authorization_rules_async(resource_group_name, namespace_name, alias_parameter, custom_headers:custom_headers).value!
end | [
"def",
"list_authorization_rules_with_http_info",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"alias_parameter",
",",
"custom_headers",
":",
"nil",
")",
"list_authorization_rules_async",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"alias_parameter",
",... | Gets the authorization rules for a namespace.
@param resource_group_name [String] Name of the Resource group within the
Azure subscription.
@param namespace_name [String] The namespace name
@param alias_parameter [String] The Disaster Recovery configuration name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"authorization",
"rules",
"for",
"a",
"namespace",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_service_bus/lib/2017-04-01/generated/azure_mgmt_service_bus/disaster_recovery_configs.rb#L780-L782 | train | Gets the authorization rules for the specified namespace. | [
30522,
13366,
2862,
1035,
20104,
1035,
3513,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3415,
15327,
1035,
2171,
1010,
14593,
1035,
16381,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2862,
1035... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jekyll/jekyll | lib/jekyll/renderer.rb | Jekyll.Renderer.render_layout | def render_layout(output, layout, info)
payload["content"] = output
payload["layout"] = Utils.deep_merge_hashes(layout.data, payload["layout"] || {})
render_liquid(
layout.content,
payload,
info,
layout.relative_path
)
end | ruby | def render_layout(output, layout, info)
payload["content"] = output
payload["layout"] = Utils.deep_merge_hashes(layout.data, payload["layout"] || {})
render_liquid(
layout.content,
payload,
info,
layout.relative_path
)
end | [
"def",
"render_layout",
"(",
"output",
",",
"layout",
",",
"info",
")",
"payload",
"[",
"\"content\"",
"]",
"=",
"output",
"payload",
"[",
"\"layout\"",
"]",
"=",
"Utils",
".",
"deep_merge_hashes",
"(",
"layout",
".",
"data",
",",
"payload",
"[",
"\"layout... | Render layout content into document.output
Returns String rendered content | [
"Render",
"layout",
"content",
"into",
"document",
".",
"output"
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/renderer.rb#L192-L202 | train | Render the layout | [
30522,
13366,
17552,
1035,
9621,
1006,
6434,
1010,
9621,
1010,
18558,
1007,
18093,
1031,
1000,
4180,
1000,
1033,
1027,
6434,
18093,
1031,
1000,
9621,
1000,
1033,
1027,
21183,
12146,
1012,
2784,
1035,
13590,
1035,
23325,
2229,
1006,
9621,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2017-11-01/generated/azure_mgmt_network/express_route_circuit_authorizations.rb | Azure::Network::Mgmt::V2017_11_01.ExpressRouteCircuitAuthorizations.begin_delete_with_http_info | def begin_delete_with_http_info(resource_group_name, circuit_name, authorization_name, custom_headers:nil)
begin_delete_async(resource_group_name, circuit_name, authorization_name, custom_headers:custom_headers).value!
end | ruby | def begin_delete_with_http_info(resource_group_name, circuit_name, authorization_name, custom_headers:nil)
begin_delete_async(resource_group_name, circuit_name, authorization_name, custom_headers:custom_headers).value!
end | [
"def",
"begin_delete_with_http_info",
"(",
"resource_group_name",
",",
"circuit_name",
",",
"authorization_name",
",",
"custom_headers",
":",
"nil",
")",
"begin_delete_async",
"(",
"resource_group_name",
",",
"circuit_name",
",",
"authorization_name",
",",
"custom_headers",... | Deletes the specified authorization from the specified express route circuit.
@param resource_group_name [String] The name of the resource group.
@param circuit_name [String] The name of the express route circuit.
@param authorization_name [String] The name of the authorization.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Deletes",
"the",
"specified",
"authorization",
"from",
"the",
"specified",
"express",
"route",
"circuit",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2017-11-01/generated/azure_mgmt_network/express_route_circuit_authorizations.rb#L328-L330 | train | Deletes the specified ExpressRouteCircuit authorization. | [
30522,
13366,
4088,
1035,
3972,
12870,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4984,
1035,
2171,
1010,
20104,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
1035,
3972,
12870,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/generator/generator_fetcher.rb | GitHubChangelogGenerator.Generator.sha_in_release_branch | def sha_in_release_branch(sha)
branch = @options[:release_branch] || @fetcher.default_branch
commits_in_branch = @fetcher.fetch_compare(@fetcher.oldest_commit["sha"], branch)
shas_in_branch = commits_in_branch["commits"].collect { |commit| commit["sha"] }
shas_in_branch.include?(sha)
end | ruby | def sha_in_release_branch(sha)
branch = @options[:release_branch] || @fetcher.default_branch
commits_in_branch = @fetcher.fetch_compare(@fetcher.oldest_commit["sha"], branch)
shas_in_branch = commits_in_branch["commits"].collect { |commit| commit["sha"] }
shas_in_branch.include?(sha)
end | [
"def",
"sha_in_release_branch",
"(",
"sha",
")",
"branch",
"=",
"@options",
"[",
":release_branch",
"]",
"||",
"@fetcher",
".",
"default_branch",
"commits_in_branch",
"=",
"@fetcher",
".",
"fetch_compare",
"(",
"@fetcher",
".",
"oldest_commit",
"[",
"\"sha\"",
"]"... | Detect if a sha occurs in the --release-branch. Uses the github repo
default branch if not specified.
@param [String] sha SHA to check.
@return [Boolean] True if SHA is in the branch git history. | [
"Detect",
"if",
"a",
"sha",
"occurs",
"in",
"the",
"--",
"release",
"-",
"branch",
".",
"Uses",
"the",
"github",
"repo",
"default",
"branch",
"if",
"not",
"specified",
"."
] | f18c64b5cc0d7473b059275b88385ac11ca8b564 | https://github.com/github-changelog-generator/github-changelog-generator/blob/f18c64b5cc0d7473b059275b88385ac11ca8b564/lib/github_changelog_generator/generator/generator_fetcher.rb#L200-L205 | train | Returns the sha in the release branch | [
30522,
13366,
21146,
1035,
1999,
1035,
2713,
1035,
3589,
1006,
21146,
1007,
3589,
1027,
1030,
7047,
1031,
1024,
2713,
1035,
3589,
1033,
1064,
1064,
1030,
18584,
2121,
1012,
12398,
1035,
3589,
27791,
1035,
1999,
1035,
3589,
1027,
1030,
18584... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_policy_insights/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_states.rb | Azure::PolicyInsights::Mgmt::V2018_04_04.PolicyStates.list_query_results_for_subscription_with_http_info | def list_query_results_for_subscription_with_http_info(policy_states_resource, subscription_id, query_options:nil, custom_headers:nil)
list_query_results_for_subscription_async(policy_states_resource, subscription_id, query_options:query_options, custom_headers:custom_headers).value!
end | ruby | def list_query_results_for_subscription_with_http_info(policy_states_resource, subscription_id, query_options:nil, custom_headers:nil)
list_query_results_for_subscription_async(policy_states_resource, subscription_id, query_options:query_options, custom_headers:custom_headers).value!
end | [
"def",
"list_query_results_for_subscription_with_http_info",
"(",
"policy_states_resource",
",",
"subscription_id",
",",
"query_options",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"list_query_results_for_subscription_async",
"(",
"policy_states_resource",
",",
"subscr... | Queries policy states for the resources under the subscription.
@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 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 [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Queries",
"policy",
"states",
"for",
"the",
"resources",
"under",
"the",
"subscription",
"."
] | 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#L297-L299 | train | Gets the list of policy states that are associated with the subscription. | [
30522,
13366,
2862,
1035,
23032,
1035,
3463,
1035,
2005,
1035,
15002,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
3343,
1035,
2163,
1035,
7692,
1010,
15002,
1035,
8909,
1010,
23032,
1035,
7047,
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... |
chaps-io/public_activity | lib/public_activity/renderable.rb | PublicActivity.Renderable.render | def render(context, params = {})
partial_root = params.delete(:root) || 'public_activity'
partial_path = nil
layout_root = params.delete(:layout_root) || 'layouts'
if params.has_key? :display
if params[:display].to_sym == :"i18n"
text = self.text(params)
return context.render :text => text, :plain => text
else
partial_path = File.join(partial_root, params[:display].to_s)
end
end
context.render(
params.merge({
:partial => prepare_partial(partial_root, partial_path),
:layout => prepare_layout(layout_root, params.delete(:layout)),
:locals => prepare_locals(params)
})
)
end | ruby | def render(context, params = {})
partial_root = params.delete(:root) || 'public_activity'
partial_path = nil
layout_root = params.delete(:layout_root) || 'layouts'
if params.has_key? :display
if params[:display].to_sym == :"i18n"
text = self.text(params)
return context.render :text => text, :plain => text
else
partial_path = File.join(partial_root, params[:display].to_s)
end
end
context.render(
params.merge({
:partial => prepare_partial(partial_root, partial_path),
:layout => prepare_layout(layout_root, params.delete(:layout)),
:locals => prepare_locals(params)
})
)
end | [
"def",
"render",
"(",
"context",
",",
"params",
"=",
"{",
"}",
")",
"partial_root",
"=",
"params",
".",
"delete",
"(",
":root",
")",
"||",
"'public_activity'",
"partial_path",
"=",
"nil",
"layout_root",
"=",
"params",
".",
"delete",
"(",
":layout_root",
")... | Renders activity from views.
@param [ActionView::Base] context
@return [nil] nil
Renders activity to the given ActionView context with included
AV::Helpers::RenderingHelper (most commonly just ActionView::Base)
The *preferred* *way* of rendering activities is
to provide a template specifying how the rendering should be happening.
However, one may choose using _I18n_ based approach when developing
an application that supports plenty of languages.
If partial view exists that matches the *key* attribute
renders that partial with local variables set to contain both
Activity and activity_parameters (hash with indifferent access)
Otherwise, it outputs the I18n translation to the context
@example Render a list of all activities from a view (erb)
<ul>
<% for activity in PublicActivity::Activity.all %>
<li><%= render_activity(activity) %></li>
<% end %>
</ul>
= Layouts
You can supply a layout that will be used for activity partials
with :layout param.
Keep in mind that layouts for partials are also partials.
@example Supply a layout
# in views:
# All examples look for a layout in app/views/layouts/_activity.erb
render_activity @activity, :layout => "activity"
render_activity @activity, :layout => "layouts/activity"
render_activity @activity, :layout => :activity
# app/views/layouts/_activity.erb
<p><%= a.created_at %></p>
<%= yield %>
== Custom Layout Location
You can customize the layout directory by supplying :layout_root
or by using an absolute path.
@example Declare custom layout location
# Both examples look for a layout in "app/views/custom/_layout.erb"
render_activity @activity, :layout_root => "custom"
render_activity @activity, :layout => "/custom/layout"
= Creating a template
To use templates for formatting how the activity should render,
create a template based on activity key, for example:
Given a key _activity.article.create_, create directory tree
_app/views/public_activity/article/_ and create the _create_ partial there
Note that if a key consists of more than three parts splitted by commas, your
directory structure will have to be deeper, for example:
activity.article.comments.destroy => app/views/public_activity/articles/comments/_destroy.html.erb
== Custom Directory
You can override the default `public_directory` template root with the :root parameter
@example Custom template root
# look for templates inside of /app/views/custom instead of /app/views/public_directory
render_activity @activity, :root => "custom"
== Variables in templates
From within a template there are two variables at your disposal:
* activity (aliased as *a* for a shortcut)
* params (aliased as *p*) [converted into a HashWithIndifferentAccess]
@example Template for key: _activity.article.create_ (erb)
<p>
Article <strong><%= p[:name] %></strong>
was written by <em><%= p["author"] %></em>
<%= distance_of_time_in_words_to_now(a.created_at) %>
</p> | [
"Renders",
"activity",
"from",
"views",
"."
] | e4357cd14db67299e0cbbd656300f51b7069ea9b | https://github.com/chaps-io/public_activity/blob/e4357cd14db67299e0cbbd656300f51b7069ea9b/lib/public_activity/renderable.rb#L98-L119 | train | Renders the activity. | [
30522,
13366,
17552,
1006,
6123,
1010,
11498,
5244,
1027,
1063,
1065,
1007,
7704,
1035,
7117,
1027,
11498,
5244,
1012,
3972,
12870,
1006,
1024,
7117,
1007,
1064,
1064,
1005,
2270,
1035,
4023,
1005,
7704,
1035,
4130,
1027,
9152,
2140,
9621,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | spec/spec_helper/project_helper.rb | SpecHelper.ProjectHelper.compare_settings | def compare_settings(produced, expected, params)
it 'should match build settings' do
# Find faulty settings in different categories
missing_settings = expected.keys.reject { |k| produced.key?(k) }
unexpected_settings = produced.keys.reject { |k| expected.key?(k) }
wrong_settings = (expected.keys - missing_settings).select do |k|
produced_setting = produced[k]
produced_setting = produced_setting.join(' ') if produced_setting.respond_to? :join
produced_setting != expected[k]
end
# Build pretty description for what is going on
description = []
description << "Doesn't match build settings for \e[1m#{params}\e[0m"
if wrong_settings.count > 0
description << 'Wrong build settings:'
description += wrong_settings.map { |s| "* #{s.to_s.yellow} is #{produced[s].to_s.red}, but should be #{expected[s].to_s.green}" }
description << ''
end
if missing_settings.count > 0
description << 'Missing build settings:'
description << missing_settings.map { |s| "* #{s.to_s.red} (#{expected[s]})" }
description << ''
end
if unexpected_settings.count > 0
description << 'Unexpected additional build settings:'
description += unexpected_settings.map { |s| "* #{s.to_s.green} (#{produced[s]})" }
description << ''
end
# Expect
faulty_settings = missing_settings + unexpected_settings + wrong_settings
faulty_settings.should.satisfy(description * "\n") do
faulty_settings.length == 0
end
end
end | ruby | def compare_settings(produced, expected, params)
it 'should match build settings' do
# Find faulty settings in different categories
missing_settings = expected.keys.reject { |k| produced.key?(k) }
unexpected_settings = produced.keys.reject { |k| expected.key?(k) }
wrong_settings = (expected.keys - missing_settings).select do |k|
produced_setting = produced[k]
produced_setting = produced_setting.join(' ') if produced_setting.respond_to? :join
produced_setting != expected[k]
end
# Build pretty description for what is going on
description = []
description << "Doesn't match build settings for \e[1m#{params}\e[0m"
if wrong_settings.count > 0
description << 'Wrong build settings:'
description += wrong_settings.map { |s| "* #{s.to_s.yellow} is #{produced[s].to_s.red}, but should be #{expected[s].to_s.green}" }
description << ''
end
if missing_settings.count > 0
description << 'Missing build settings:'
description << missing_settings.map { |s| "* #{s.to_s.red} (#{expected[s]})" }
description << ''
end
if unexpected_settings.count > 0
description << 'Unexpected additional build settings:'
description += unexpected_settings.map { |s| "* #{s.to_s.green} (#{produced[s]})" }
description << ''
end
# Expect
faulty_settings = missing_settings + unexpected_settings + wrong_settings
faulty_settings.should.satisfy(description * "\n") do
faulty_settings.length == 0
end
end
end | [
"def",
"compare_settings",
"(",
"produced",
",",
"expected",
",",
"params",
")",
"it",
"'should match build settings'",
"do",
"# Find faulty settings in different categories",
"missing_settings",
"=",
"expected",
".",
"keys",
".",
"reject",
"{",
"|",
"k",
"|",
"produc... | Generates test cases to compare two settings hashes.
@param [Hash{String => String}] produced
the produced build settings.
@param [Hash{String => String}] expected
the expected build settings.
@param [#to_s] params
the parameters used to construct the produced build settings. | [
"Generates",
"test",
"cases",
"to",
"compare",
"two",
"settings",
"hashes",
"."
] | 3be1684437a6f8e69c7836ad4c85a2b78663272f | https://github.com/CocoaPods/Xcodeproj/blob/3be1684437a6f8e69c7836ad4c85a2b78663272f/spec/spec_helper/project_helper.rb#L29-L68 | train | Compare build settings with the produced settings | [
30522,
13366,
12826,
1035,
10906,
1006,
2550,
1010,
3517,
1010,
11498,
5244,
1007,
2009,
1005,
2323,
2674,
3857,
10906,
1005,
2079,
1001,
2424,
28927,
10906,
1999,
2367,
7236,
4394,
1035,
10906,
1027,
3517,
1012,
6309,
1012,
15454,
1063,
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... |
rails/rails | railties/lib/rails/application.rb | Rails.Application.message_verifier | def message_verifier(verifier_name)
@message_verifiers[verifier_name] ||= begin
secret = key_generator.generate_key(verifier_name.to_s)
ActiveSupport::MessageVerifier.new(secret)
end
end | ruby | def message_verifier(verifier_name)
@message_verifiers[verifier_name] ||= begin
secret = key_generator.generate_key(verifier_name.to_s)
ActiveSupport::MessageVerifier.new(secret)
end
end | [
"def",
"message_verifier",
"(",
"verifier_name",
")",
"@message_verifiers",
"[",
"verifier_name",
"]",
"||=",
"begin",
"secret",
"=",
"key_generator",
".",
"generate_key",
"(",
"verifier_name",
".",
"to_s",
")",
"ActiveSupport",
"::",
"MessageVerifier",
".",
"new",
... | Returns a message verifier object.
This verifier can be used to generate and verify signed messages in the application.
It is recommended not to use the same verifier for different things, so you can get different
verifiers passing the +verifier_name+ argument.
==== Parameters
* +verifier_name+ - the name of the message verifier.
==== Examples
message = Rails.application.message_verifier('sensitive_data').generate('my sensible data')
Rails.application.message_verifier('sensitive_data').verify(message)
# => 'my sensible data'
See the +ActiveSupport::MessageVerifier+ documentation for more information. | [
"Returns",
"a",
"message",
"verifier",
"object",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/railties/lib/rails/application.rb#L199-L204 | train | Returns a message verifier for the given name. | [
30522,
13366,
4471,
1035,
2310,
3089,
8873,
2121,
1006,
2310,
3089,
8873,
2121,
1035,
30524,
2121,
1035,
2171,
1033,
1064,
1064,
1027,
4088,
3595,
1027,
3145,
1035,
13103,
1012,
9699,
1035,
3145,
1006,
2310,
3089,
8873,
2121,
1035,
2171,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sporkmonger/addressable | lib/addressable/uri.rb | Addressable.URI.fragment= | def fragment=(new_fragment)
if new_fragment && !new_fragment.respond_to?(:to_str)
raise TypeError, "Can't convert #{new_fragment.class} into String."
end
@fragment = new_fragment ? new_fragment.to_str : nil
# Reset dependent values
remove_instance_variable(:@normalized_fragment) if defined?(@normalized_fragment)
remove_composite_values
# Ensure we haven't created an invalid URI
validate()
end | ruby | def fragment=(new_fragment)
if new_fragment && !new_fragment.respond_to?(:to_str)
raise TypeError, "Can't convert #{new_fragment.class} into String."
end
@fragment = new_fragment ? new_fragment.to_str : nil
# Reset dependent values
remove_instance_variable(:@normalized_fragment) if defined?(@normalized_fragment)
remove_composite_values
# Ensure we haven't created an invalid URI
validate()
end | [
"def",
"fragment",
"=",
"(",
"new_fragment",
")",
"if",
"new_fragment",
"&&",
"!",
"new_fragment",
".",
"respond_to?",
"(",
":to_str",
")",
"raise",
"TypeError",
",",
"\"Can't convert #{new_fragment.class} into String.\"",
"end",
"@fragment",
"=",
"new_fragment",
"?",... | Sets the fragment component for this URI.
@param [String, #to_str] new_fragment The new fragment component. | [
"Sets",
"the",
"fragment",
"component",
"for",
"this",
"URI",
"."
] | 5894c95a7768435cb46d1355954611dbd194832e | https://github.com/sporkmonger/addressable/blob/5894c95a7768435cb46d1355954611dbd194832e/lib/addressable/uri.rb#L1809-L1821 | train | Set the fragment of this URI. | [
30522,
13366,
15778,
1027,
1006,
2047,
1035,
15778,
1007,
2065,
2047,
1035,
15778,
1004,
1004,
999,
2047,
1035,
15778,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
2000,
1035,
2358,
2099,
1007,
5333,
2828,
2121,
29165,
1010,
1000,
2064,
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... |
rails/rails | activerecord/lib/active_record/querying.rb | ActiveRecord.Querying.find_by_sql | def find_by_sql(sql, binds = [], preparable: nil, &block)
result_set = connection.select_all(sanitize_sql(sql), "#{name} Load", binds, preparable: preparable)
column_types = result_set.column_types.dup
attribute_types.each_key { |k| column_types.delete k }
message_bus = ActiveSupport::Notifications.instrumenter
payload = {
record_count: result_set.length,
class_name: name
}
message_bus.instrument("instantiation.active_record", payload) do
if result_set.includes_column?(inheritance_column)
result_set.map { |record| instantiate(record, column_types, &block) }
else
# Instantiate a homogeneous set
result_set.map { |record| instantiate_instance_of(self, record, column_types, &block) }
end
end
end | ruby | def find_by_sql(sql, binds = [], preparable: nil, &block)
result_set = connection.select_all(sanitize_sql(sql), "#{name} Load", binds, preparable: preparable)
column_types = result_set.column_types.dup
attribute_types.each_key { |k| column_types.delete k }
message_bus = ActiveSupport::Notifications.instrumenter
payload = {
record_count: result_set.length,
class_name: name
}
message_bus.instrument("instantiation.active_record", payload) do
if result_set.includes_column?(inheritance_column)
result_set.map { |record| instantiate(record, column_types, &block) }
else
# Instantiate a homogeneous set
result_set.map { |record| instantiate_instance_of(self, record, column_types, &block) }
end
end
end | [
"def",
"find_by_sql",
"(",
"sql",
",",
"binds",
"=",
"[",
"]",
",",
"preparable",
":",
"nil",
",",
"&",
"block",
")",
"result_set",
"=",
"connection",
".",
"select_all",
"(",
"sanitize_sql",
"(",
"sql",
")",
",",
"\"#{name} Load\"",
",",
"binds",
",",
... | Executes a custom SQL query against your database and returns all the results. The results will
be returned as an array, with the requested columns encapsulated as attributes of the model you call
this method from. For example, if you call <tt>Product.find_by_sql</tt>, then the results will be returned in
a +Product+ object with the attributes you specified in the SQL query.
If you call a complicated SQL query which spans multiple tables, the columns specified by the
SELECT will be attributes of the model, whether or not they are columns of the corresponding
table.
The +sql+ parameter is a full SQL query as a string. It will be called as is; there will be
no database agnostic conversions performed. This should be a last resort because using
database-specific terms will lock you into using that particular database engine, or require you to
change your call if you switch engines.
# A simple SQL query spanning multiple tables
Post.find_by_sql "SELECT p.title, c.author FROM posts p, comments c WHERE p.id = c.post_id"
# => [#<Post:0x36bff9c @attributes={"title"=>"Ruby Meetup", "first_name"=>"Quentin"}>, ...]
You can use the same string replacement techniques as you can with <tt>ActiveRecord::QueryMethods#where</tt>:
Post.find_by_sql ["SELECT title FROM posts WHERE author = ? AND created > ?", author_id, start_date]
Post.find_by_sql ["SELECT body FROM comments WHERE author = :user_id OR approved_by = :user_id", { :user_id => user_id }] | [
"Executes",
"a",
"custom",
"SQL",
"query",
"against",
"your",
"database",
"and",
"returns",
"all",
"the",
"results",
".",
"The",
"results",
"will",
"be",
"returned",
"as",
"an",
"array",
"with",
"the",
"requested",
"columns",
"encapsulated",
"as",
"attributes"... | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activerecord/lib/active_record/querying.rb#L45-L64 | train | Find records by SQL | [
30522,
13366,
2424,
1035,
2011,
1035,
29296,
1006,
29296,
1010,
20817,
1027,
1031,
1033,
1010,
17463,
25236,
1024,
9152,
2140,
1010,
1004,
3796,
1007,
2765,
1035,
2275,
1027,
4434,
1012,
7276,
1035,
2035,
1006,
2624,
25090,
4371,
1035,
2929... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/status.rb | Ufo.Status.run | def run
unless stack_exists?(@stack_name)
puts "The stack #{@stack_name.color(:green)} does not exist."
return
end
resp = cloudformation.describe_stacks(stack_name: @stack_name)
stack = resp.stacks.first
puts "The current status for the stack #{@stack_name.color(:green)} is #{stack.stack_status.color(:green)}"
status_poller = Stack::Status.new(@stack_name)
if stack.stack_status =~ /_IN_PROGRESS$/
puts "Stack events (tailing):"
# tail all events until done
status_poller.hide_time_took = true
status_poller.wait
else
puts "Stack events:"
# show the last events that was user initiated
status_poller.refresh_events
status_poller.show_events(true)
end
end | ruby | def run
unless stack_exists?(@stack_name)
puts "The stack #{@stack_name.color(:green)} does not exist."
return
end
resp = cloudformation.describe_stacks(stack_name: @stack_name)
stack = resp.stacks.first
puts "The current status for the stack #{@stack_name.color(:green)} is #{stack.stack_status.color(:green)}"
status_poller = Stack::Status.new(@stack_name)
if stack.stack_status =~ /_IN_PROGRESS$/
puts "Stack events (tailing):"
# tail all events until done
status_poller.hide_time_took = true
status_poller.wait
else
puts "Stack events:"
# show the last events that was user initiated
status_poller.refresh_events
status_poller.show_events(true)
end
end | [
"def",
"run",
"unless",
"stack_exists?",
"(",
"@stack_name",
")",
"puts",
"\"The stack #{@stack_name.color(:green)} does not exist.\"",
"return",
"end",
"resp",
"=",
"cloudformation",
".",
"describe_stacks",
"(",
"stack_name",
":",
"@stack_name",
")",
"stack",
"=",
"res... | used for the ufo status command | [
"used",
"for",
"the",
"ufo",
"status",
"command"
] | 16ac3dad28edcab2693c0e7d89a1971aca65b8f9 | https://github.com/tongueroo/ufo/blob/16ac3dad28edcab2693c0e7d89a1971aca65b8f9/lib/ufo/status.rb#L4-L28 | train | Runs the stack events | [
30522,
13366,
30524,
1035,
2171,
1007,
8509,
1000,
1996,
9991,
1001,
1063,
1030,
9991,
1035,
2171,
1012,
3609,
1006,
1024,
2665,
1007,
1065,
2515,
2025,
4839,
1012,
1000,
2709,
2203,
24501,
2361,
1027,
6112,
14192,
3370,
1012,
6235,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
randym/axlsx | lib/axlsx/drawing/scatter_series.rb | Axlsx.ScatterSeries.to_xml_string | def to_xml_string(str = '')
super(str) do
# needs to override the super color here to push in ln/and something else!
if color
str << '<c:spPr><a:solidFill>'
str << ('<a:srgbClr val="' << color << '"/>')
str << '</a:solidFill>'
str << '<a:ln><a:solidFill>'
str << ('<a:srgbClr val="' << color << '"/></a:solidFill></a:ln>')
str << '</c:spPr>'
str << '<c:marker>'
str << '<c:spPr><a:solidFill>'
str << ('<a:srgbClr val="' << color << '"/>')
str << '</a:solidFill>'
str << '<a:ln><a:solidFill>'
str << ('<a:srgbClr val="' << color << '"/></a:solidFill></a:ln>')
str << '</c:spPr>'
str << '</c:marker>'
end
if ln_width
str << '<c:spPr>'
str << '<a:ln w="' << ln_width.to_s << '"/>'
str << '</c:spPr>'
end
@xData.to_xml_string(str) unless @xData.nil?
@yData.to_xml_string(str) unless @yData.nil?
str << ('<c:smooth val="' << ((smooth) ? '1' : '0') << '"/>')
end
str
end | ruby | def to_xml_string(str = '')
super(str) do
# needs to override the super color here to push in ln/and something else!
if color
str << '<c:spPr><a:solidFill>'
str << ('<a:srgbClr val="' << color << '"/>')
str << '</a:solidFill>'
str << '<a:ln><a:solidFill>'
str << ('<a:srgbClr val="' << color << '"/></a:solidFill></a:ln>')
str << '</c:spPr>'
str << '<c:marker>'
str << '<c:spPr><a:solidFill>'
str << ('<a:srgbClr val="' << color << '"/>')
str << '</a:solidFill>'
str << '<a:ln><a:solidFill>'
str << ('<a:srgbClr val="' << color << '"/></a:solidFill></a:ln>')
str << '</c:spPr>'
str << '</c:marker>'
end
if ln_width
str << '<c:spPr>'
str << '<a:ln w="' << ln_width.to_s << '"/>'
str << '</c:spPr>'
end
@xData.to_xml_string(str) unless @xData.nil?
@yData.to_xml_string(str) unless @yData.nil?
str << ('<c:smooth val="' << ((smooth) ? '1' : '0') << '"/>')
end
str
end | [
"def",
"to_xml_string",
"(",
"str",
"=",
"''",
")",
"super",
"(",
"str",
")",
"do",
"# needs to override the super color here to push in ln/and something else!",
"if",
"color",
"str",
"<<",
"'<c:spPr><a:solidFill>'",
"str",
"<<",
"(",
"'<a:srgbClr val=\"'",
"<<",
"color... | Serializes the object
@param [String] str
@return [String] | [
"Serializes",
"the",
"object"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/drawing/scatter_series.rb#L67-L96 | train | Returns the XML string for this object. | [
30522,
13366,
2000,
1035,
20950,
1035,
5164,
1006,
2358,
2099,
1027,
1005,
1005,
1007,
3565,
1006,
2358,
2099,
1007,
2079,
1001,
3791,
2000,
2058,
15637,
1996,
3565,
3609,
2182,
2000,
5245,
1999,
1048,
2078,
1013,
1998,
2242,
2842,
999,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/tag.rb | Aws::AutoScaling.Tag.delete | def delete(options = {})
options = Aws::Util.deep_merge(options, tags: [{
resource_type: @resource_type,
resource_id: @resource_id,
key: @key
}])
resp = @client.delete_tags(options)
resp.data
end | ruby | def delete(options = {})
options = Aws::Util.deep_merge(options, tags: [{
resource_type: @resource_type,
resource_id: @resource_id,
key: @key
}])
resp = @client.delete_tags(options)
resp.data
end | [
"def",
"delete",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"Aws",
"::",
"Util",
".",
"deep_merge",
"(",
"options",
",",
"tags",
":",
"[",
"{",
"resource_type",
":",
"@resource_type",
",",
"resource_id",
":",
"@resource_id",
",",
"key",
":",
"... | @example Request syntax with placeholder values
tag.delete({
tags: [ # required
{
resource_id: "XmlString",
resource_type: "XmlString",
key: "TagKey", # required
value: "TagValue",
propagate_at_launch: false,
},
],
})
@param [Hash] options ({})
@option options [required, Array<Types::Tag>] :tags
One or more tags.
@return [EmptyStructure] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/tag.rb#L247-L255 | train | Delete all tags from the cluster | [
30522,
13366,
3972,
12870,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
22091,
2015,
1024,
1024,
21183,
4014,
1012,
2784,
1035,
30524,
7692,
1035,
8909,
1024,
1030,
7692,
1035,
8909,
1010,
3145,
1024,
1030,
3145,
1065,
1033,
1007,
24501,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hashicorp/vault-ruby | lib/vault/request.rb | Vault.Request.extract_headers! | def extract_headers!(options = {})
extract = {
wrap_ttl: Vault::Client::WRAP_TTL_HEADER,
}
{}.tap do |h|
extract.each do |k,v|
if options[k]
h[v] = options.delete(k)
end
end
end
end | ruby | def extract_headers!(options = {})
extract = {
wrap_ttl: Vault::Client::WRAP_TTL_HEADER,
}
{}.tap do |h|
extract.each do |k,v|
if options[k]
h[v] = options.delete(k)
end
end
end
end | [
"def",
"extract_headers!",
"(",
"options",
"=",
"{",
"}",
")",
"extract",
"=",
"{",
"wrap_ttl",
":",
"Vault",
"::",
"Client",
"::",
"WRAP_TTL_HEADER",
",",
"}",
"{",
"}",
".",
"tap",
"do",
"|",
"h",
"|",
"extract",
".",
"each",
"do",
"|",
"k",
",",... | Removes the given header fields from options and returns the result. This
modifies the given options in place.
@param [Hash] options
@return [Hash] | [
"Removes",
"the",
"given",
"header",
"fields",
"from",
"options",
"and",
"returns",
"the",
"result",
".",
"This",
"modifies",
"the",
"given",
"options",
"in",
"place",
"."
] | 02f0532a802ba1a2a0d8703a4585dab76eb9d864 | https://github.com/hashicorp/vault-ruby/blob/02f0532a802ba1a2a0d8703a4585dab76eb9d864/lib/vault/request.rb#L29-L41 | train | Extract the HTTP headers from the request. | [
30522,
13366,
14817,
1035,
20346,
2015,
999,
1006,
7047,
1027,
1063,
1065,
1007,
14817,
1027,
1063,
10236,
1035,
23746,
2140,
1024,
11632,
1024,
1024,
7396,
1024,
1024,
10236,
1035,
23746,
2140,
1035,
20346,
1010,
1065,
1063,
1065,
1012,
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 | data/azure_cognitiveservices_customvisionprediction/lib/3.0/generated/azure_cognitiveservices_customvisionprediction/customvisionprediction_client.rb | Azure::CognitiveServices::Customvisionprediction::V3_0.CustomvisionpredictionClient.classify_image_with_no_store | def classify_image_with_no_store(project_id, published_name, image_data, application:nil, custom_headers:nil)
response = classify_image_with_no_store_async(project_id, published_name, image_data, application:application, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def classify_image_with_no_store(project_id, published_name, image_data, application:nil, custom_headers:nil)
response = classify_image_with_no_store_async(project_id, published_name, image_data, application:application, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"classify_image_with_no_store",
"(",
"project_id",
",",
"published_name",
",",
"image_data",
",",
"application",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"classify_image_with_no_store_async",
"(",
"project_id",
",",
"published_name",
... | Classify an image without saving the result.
@param project_id The project id.
@param published_name [String] Specifies the name of the model to evaluate
against.
@param image_data Binary image data. Supported formats are JPEG, GIF, PNG,
and BMP. Supports images up to 0MB.
@param application [String] Optional. Specifies the name of application using
the endpoint.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ImagePrediction] operation results. | [
"Classify",
"an",
"image",
"without",
"saving",
"the",
"result",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_customvisionprediction/lib/3.0/generated/azure_cognitiveservices_customvisionprediction/customvisionprediction_client.rb#L479-L482 | train | Classifies an image using the specified name. | [
30522,
13366,
26268,
1035,
3746,
1035,
2007,
1035,
2053,
1035,
3573,
1006,
2622,
1035,
8909,
1010,
2405,
1035,
2171,
1010,
3746,
1035,
2951,
1010,
4646,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-s3/lib/aws-sdk-s3/bucket.rb | Aws::S3.Bucket.put_object | def put_object(options = {})
options = options.merge(bucket: @name)
resp = @client.put_object(options)
Object.new(
bucket_name: @name,
key: options[:key],
client: @client
)
end | ruby | def put_object(options = {})
options = options.merge(bucket: @name)
resp = @client.put_object(options)
Object.new(
bucket_name: @name,
key: options[:key],
client: @client
)
end | [
"def",
"put_object",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"bucket",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"put_object",
"(",
"options",
")",
"Object",
".",
"new",
"(",
"bucket_name",
":",
"@name",
... | @example Request syntax with placeholder values
object = bucket.put_object({
acl: "private", # accepts private, public-read, public-read-write, authenticated-read, aws-exec-read, bucket-owner-read, bucket-owner-full-control
body: source_file,
cache_control: "CacheControl",
content_disposition: "ContentDisposition",
content_encoding: "ContentEncoding",
content_language: "ContentLanguage",
content_length: 1,
content_md5: "ContentMD5",
content_type: "ContentType",
expires: Time.now,
grant_full_control: "GrantFullControl",
grant_read: "GrantRead",
grant_read_acp: "GrantReadACP",
grant_write_acp: "GrantWriteACP",
key: "ObjectKey", # required
metadata: {
"MetadataKey" => "MetadataValue",
},
server_side_encryption: "AES256", # accepts AES256, aws:kms
storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE
website_redirect_location: "WebsiteRedirectLocation",
sse_customer_algorithm: "SSECustomerAlgorithm",
sse_customer_key: "SSECustomerKey",
sse_customer_key_md5: "SSECustomerKeyMD5",
ssekms_key_id: "SSEKMSKeyId",
request_payer: "requester", # accepts requester
tagging: "TaggingHeader",
object_lock_mode: "GOVERNANCE", # accepts GOVERNANCE, COMPLIANCE
object_lock_retain_until_date: Time.now,
object_lock_legal_hold_status: "ON", # accepts ON, OFF
})
@param [Hash] options ({})
@option options [String] :acl
The canned ACL to apply to the object.
@option options [String, IO] :body
Object data.
@option options [String] :cache_control
Specifies caching behavior along the request/reply chain.
@option options [String] :content_disposition
Specifies presentational information for the object.
@option options [String] :content_encoding
Specifies what content encodings have been applied to the object and
thus what decoding mechanisms must be applied to obtain the media-type
referenced by the Content-Type header field.
@option options [String] :content_language
The language the content is in.
@option options [Integer] :content_length
Size of the body in bytes. This parameter is useful when the size of
the body cannot be determined automatically.
@option options [String] :content_md5
The base64-encoded 128-bit MD5 digest of the part data. This parameter
is auto-populated when using the command from the CLI
@option options [String] :content_type
A standard MIME type describing the format of the object data.
@option options [Time,DateTime,Date,Integer,String] :expires
The date and time at which the object is no longer cacheable.
@option options [String] :grant_full_control
Gives the grantee READ, READ\_ACP, and WRITE\_ACP permissions on the
object.
@option options [String] :grant_read
Allows grantee to read the object data and its metadata.
@option options [String] :grant_read_acp
Allows grantee to read the object ACL.
@option options [String] :grant_write_acp
Allows grantee to write the ACL for the applicable object.
@option options [required, String] :key
Object key for which the PUT operation was initiated.
@option options [Hash<String,String>] :metadata
A map of metadata to store with the object in S3.
@option options [String] :server_side_encryption
The Server-side encryption algorithm used when storing this object in
S3 (e.g., AES256, aws:kms).
@option options [String] :storage_class
The type of storage to use for the object. Defaults to 'STANDARD'.
@option options [String] :website_redirect_location
If the bucket is configured as a website, redirects requests for this
object to another object in the same bucket or to an external URL.
Amazon S3 stores the value of this header in the object metadata.
@option options [String] :sse_customer_algorithm
Specifies the algorithm to use to when encrypting the object (e.g.,
AES256).
@option options [String] :sse_customer_key
Specifies the customer-provided encryption key for Amazon S3 to use in
encrypting data. This value is used to store the object and then it is
discarded; Amazon does not store the encryption key. The key must be
appropriate for use with the algorithm specified in the
x-amz-server-side-encryption-customer-algorithm header.
@option options [String] :sse_customer_key_md5
Specifies the 128-bit MD5 digest of the encryption key according to
RFC 1321. Amazon S3 uses this header for a message integrity check to
ensure the encryption key was transmitted without error.
@option options [String] :ssekms_key_id
Specifies the AWS KMS key ID to use for object encryption. All GET and
PUT requests for an object protected by AWS KMS will fail if not made
via SSL or using SigV4. Documentation on configuring any of the
officially supported AWS SDKs and CLI can be found at
http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version
@option options [String] :request_payer
Confirms that the requester knows that she or he will be charged for
the request. Bucket owners need not specify this parameter in their
requests. Documentation on downloading objects from requester pays
buckets can be found at
http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
@option options [String] :tagging
The tag-set for the object. The tag-set must be encoded as URL Query
parameters. (For example, "Key1=Value1")
@option options [String] :object_lock_mode
The Object Lock mode that you want to apply to this object.
@option options [Time,DateTime,Date,Integer,String] :object_lock_retain_until_date
The date and time when you want this object's Object Lock to expire.
@option options [String] :object_lock_legal_hold_status
The Legal Hold status that you want to apply to the specified object.
@return [Object] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-s3/lib/aws-sdk-s3/bucket.rb#L419-L427 | train | Put an object in the bucket. | [
30522,
13366,
2404,
1035,
4874,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
13610,
1024,
1030,
2171,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
2404,
1035,
4874,
1006,
7047,
1007,
4874,
1012,
2047,
1006,
13610,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.list_offers | def list_offers(location, publisher_name, custom_headers:nil)
response = list_offers_async(location, publisher_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_offers(location, publisher_name, custom_headers:nil)
response = list_offers_async(location, publisher_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_offers",
"(",
"location",
",",
"publisher_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_offers_async",
"(",
"location",
",",
"publisher_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body... | Gets a list of virtual machine image offers for the specified location and
publisher.
@param location [String] The name of a supported Azure region.
@param publisher_name [String] A valid image publisher.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array] operation results. | [
"Gets",
"a",
"list",
"of",
"virtual",
"machine",
"image",
"offers",
"for",
"the",
"specified",
"location",
"and",
"publisher",
"."
] | 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#L267-L270 | train | Gets the list of all the offers for a given location. | [
30522,
13366,
2862,
1035,
4107,
1006,
3295,
1010,
6674,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
4107,
1035,
2004,
6038,
2278,
1006,
3295,
1010,
6674,
1035,
2171,
1010,
7661,
1035,
20346,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
piotrmurach/github | lib/github_api/client/orgs/teams.rb | Github.Client::Orgs::Teams.team_repo? | def team_repo?(*args)
arguments(args, required: [:id, :user, :repo])
response = get_request("/teams/#{arguments.id}/repos/#{arguments.user}/#{arguments.repo}", arguments.params)
response.status == 204
rescue Github::Error::NotFound
false
end | ruby | def team_repo?(*args)
arguments(args, required: [:id, :user, :repo])
response = get_request("/teams/#{arguments.id}/repos/#{arguments.user}/#{arguments.repo}", arguments.params)
response.status == 204
rescue Github::Error::NotFound
false
end | [
"def",
"team_repo?",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":id",
",",
":user",
",",
":repo",
"]",
")",
"response",
"=",
"get_request",
"(",
"\"/teams/#{arguments.id}/repos/#{arguments.user}/#{arguments.repo}\"",
",",
"argumen... | Check if a repository belongs to a team
@see https://developer.github.com/v3/orgs/teams/#get-team-repo
@example
github = Github.new oauth_token: '...'
github.orgs.teams.team_repo? 'team-id', 'user-name', 'repo-name'
@api public | [
"Check",
"if",
"a",
"repository",
"belongs",
"to",
"a",
"team"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/orgs/teams.rb#L356-L363 | train | Check if a team has a repository on a team | [
30522,
13366,
2136,
1035,
16360,
2080,
1029,
1006,
1008,
12098,
5620,
1007,
9918,
1006,
12098,
5620,
1010,
3223,
1024,
1031,
1024,
8909,
1010,
1024,
30524,
1063,
9918,
1012,
8909,
1065,
1013,
16360,
2891,
1013,
1001,
1063,
9918,
1012,
5310,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | gym/lib/gym/code_signing_mapping.rb | Gym.CodeSigningMapping.app_identifier_contains? | def app_identifier_contains?(str, contains)
return str.to_s.gsub("-", "").gsub(" ", "").gsub("InHouse", "enterprise").downcase.include?(contains.to_s.gsub("-", "").gsub(" ", "").downcase)
end | ruby | def app_identifier_contains?(str, contains)
return str.to_s.gsub("-", "").gsub(" ", "").gsub("InHouse", "enterprise").downcase.include?(contains.to_s.gsub("-", "").gsub(" ", "").downcase)
end | [
"def",
"app_identifier_contains?",
"(",
"str",
",",
"contains",
")",
"return",
"str",
".",
"to_s",
".",
"gsub",
"(",
"\"-\"",
",",
"\"\"",
")",
".",
"gsub",
"(",
"\" \"",
",",
"\"\"",
")",
".",
"gsub",
"(",
"\"InHouse\"",
",",
"\"enterprise\"",
")",
".... | Helper method to remove "-" and " " and downcase app identifier
and compare if an app identifier includes a certain string
We do some `gsub`bing, because we can't really know the profile type, so we'll just look at the name and see if it includes
the export method (which it usually does, but with different notations) | [
"Helper",
"method",
"to",
"remove",
"-",
"and",
"and",
"downcase",
"app",
"identifier",
"and",
"compare",
"if",
"an",
"app",
"identifier",
"includes",
"a",
"certain",
"string",
"We",
"do",
"some",
"gsub",
"bing",
"because",
"we",
"can",
"t",
"really",
"kno... | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/gym/lib/gym/code_signing_mapping.rb#L71-L73 | train | Returns true if the string contains the string | [
30522,
13366,
10439,
1035,
8909,
4765,
18095,
1035,
3397,
1029,
1006,
2358,
2099,
1010,
3397,
1007,
2709,
2358,
2099,
1012,
2000,
1035,
1055,
1012,
28177,
12083,
1006,
1000,
1011,
1000,
1010,
1000,
1000,
1007,
1012,
28177,
12083,
1006,
1000... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb | Aws::RDS.DBSnapshot.attributes | def attributes(options = {})
batches = Enumerator.new do |y|
batch = []
options = options.merge(db_snapshot_identifier: @snapshot_id)
resp = @client.describe_db_snapshot_attributes(options)
resp.data.db_snapshot_attributes_result.db_snapshot_attributes.each do |d|
batch << DBSnapshotAttribute.new(
snapshot_id: @snapshot_id,
name: d.attribute_name,
data: d,
client: @client
)
end
y.yield(batch)
end
DBSnapshotAttribute::Collection.new(batches)
end | ruby | def attributes(options = {})
batches = Enumerator.new do |y|
batch = []
options = options.merge(db_snapshot_identifier: @snapshot_id)
resp = @client.describe_db_snapshot_attributes(options)
resp.data.db_snapshot_attributes_result.db_snapshot_attributes.each do |d|
batch << DBSnapshotAttribute.new(
snapshot_id: @snapshot_id,
name: d.attribute_name,
data: d,
client: @client
)
end
y.yield(batch)
end
DBSnapshotAttribute::Collection.new(batches)
end | [
"def",
"attributes",
"(",
"options",
"=",
"{",
"}",
")",
"batches",
"=",
"Enumerator",
".",
"new",
"do",
"|",
"y",
"|",
"batch",
"=",
"[",
"]",
"options",
"=",
"options",
".",
"merge",
"(",
"db_snapshot_identifier",
":",
"@snapshot_id",
")",
"resp",
"=... | @!group Associations
@example Request syntax with placeholder values
db_snapshot.attributes()
@param [Hash] options ({})
@return [DBSnapshotAttribute::Collection] | [
"@!group",
"Associations",
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-rds/lib/aws-sdk-rds/db_snapshot.rb#L853-L869 | train | Returns an Enumerator of DBSnapshotAttribute objects. | [
30522,
13366,
12332,
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,
16962,
1035,
20057,
12326,
1035,
8909,
4765,
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... |
decidim/decidim | decidim-core/app/helpers/decidim/scopes_helper.rb | Decidim.ScopesHelper.scopes_picker_field | def scopes_picker_field(form, name, root: false, options: { checkboxes_on_top: true })
root = current_participatory_space.scope if root == false
form.scopes_picker name, options do |scope|
{ url: decidim.scopes_picker_path(root: root, current: scope&.id, field: form.label_for(name)),
text: scope_name_for_picker(scope, I18n.t("decidim.scopes.global")) }
end
end | ruby | def scopes_picker_field(form, name, root: false, options: { checkboxes_on_top: true })
root = current_participatory_space.scope if root == false
form.scopes_picker name, options do |scope|
{ url: decidim.scopes_picker_path(root: root, current: scope&.id, field: form.label_for(name)),
text: scope_name_for_picker(scope, I18n.t("decidim.scopes.global")) }
end
end | [
"def",
"scopes_picker_field",
"(",
"form",
",",
"name",
",",
"root",
":",
"false",
",",
"options",
":",
"{",
"checkboxes_on_top",
":",
"true",
"}",
")",
"root",
"=",
"current_participatory_space",
".",
"scope",
"if",
"root",
"==",
"false",
"form",
".",
"sc... | Renders a scopes picker field in a form.
form - FormBuilder object
name - attribute name
options - An optional Hash with options:
- checkboxes_on_top - Show checked picker values on top (default) or below the picker prompt
Returns nothing. | [
"Renders",
"a",
"scopes",
"picker",
"field",
"in",
"a",
"form",
".",
"form",
"-",
"FormBuilder",
"object",
"name",
"-",
"attribute",
"name",
"options",
"-",
"An",
"optional",
"Hash",
"with",
"options",
":",
"-",
"checkboxes_on_top",
"-",
"Show",
"checked",
... | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/app/helpers/decidim/scopes_helper.rb#L41-L47 | train | Creates a scopes picker field | [
30522,
13366,
9531,
2015,
1035,
4060,
2121,
1035,
2492,
1006,
2433,
1010,
2171,
1010,
7117,
1024,
6270,
1010,
7047,
1024,
1063,
4638,
8758,
2229,
1035,
2006,
1035,
2327,
1024,
2995,
1065,
1007,
7117,
1027,
2783,
1035,
2112,
28775,
4502,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
activerecord-hackery/ransack | lib/ransack/adapters/active_record/ransack/constants.rb | Ransack.Constants.escape_wildcards | def escape_wildcards(unescaped)
case ActiveRecord::Base.connection.adapter_name
when "Mysql2".freeze, "PostgreSQL".freeze
# Necessary for PostgreSQL and MySQL
unescaped.to_s.gsub(/([\\%_.])/, '\\\\\\1')
else
unescaped
end
end | ruby | def escape_wildcards(unescaped)
case ActiveRecord::Base.connection.adapter_name
when "Mysql2".freeze, "PostgreSQL".freeze
# Necessary for PostgreSQL and MySQL
unescaped.to_s.gsub(/([\\%_.])/, '\\\\\\1')
else
unescaped
end
end | [
"def",
"escape_wildcards",
"(",
"unescaped",
")",
"case",
"ActiveRecord",
"::",
"Base",
".",
"connection",
".",
"adapter_name",
"when",
"\"Mysql2\"",
".",
"freeze",
",",
"\"PostgreSQL\"",
".",
"freeze",
"# Necessary for PostgreSQL and MySQL",
"unescaped",
".",
"to_s",... | replace % \ to \% \\ | [
"replace",
"%",
"\\",
"to",
"\\",
"%",
"\\\\"
] | d44bfe6fe21ab374ceea9d060267d0d38b09ef28 | https://github.com/activerecord-hackery/ransack/blob/d44bfe6fe21ab374ceea9d060267d0d38b09ef28/lib/ransack/adapters/active_record/ransack/constants.rb#L103-L111 | train | Escape the wildcards in the URL | [
30522,
13366,
4019,
1035,
3748,
17965,
1006,
16655,
15782,
5669,
1007,
2553,
3161,
2890,
27108,
2094,
1024,
1024,
2918,
1012,
4434,
1012,
15581,
2121,
1035,
2171,
2043,
1000,
2026,
2015,
4160,
2140,
2475,
1000,
1012,
13184,
1010,
1000,
2695... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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.enable_service_backup | def enable_service_backup(service_id, enable_backup_description, timeout:60, custom_headers:nil)
response = enable_service_backup_async(service_id, enable_backup_description, timeout:timeout, custom_headers:custom_headers).value!
nil
end | ruby | def enable_service_backup(service_id, enable_backup_description, timeout:60, custom_headers:nil)
response = enable_service_backup_async(service_id, enable_backup_description, timeout:timeout, custom_headers:custom_headers).value!
nil
end | [
"def",
"enable_service_backup",
"(",
"service_id",
",",
"enable_backup_description",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"enable_service_backup_async",
"(",
"service_id",
",",
"enable_backup_description",
",",
"timeout",
... | Enables periodic backup of stateful partitions under this Service Fabric
service.
Enables periodic backup of stateful partitions which are part of this Service
Fabric service. Each partition is backed up individually as per the specified
backup policy description. In case the application, which the service is part
of, is already enabled for backup then this operation would override the
policy being used to take the periodic backup for this service and its
partitions (unless explicitly overridden at the partition level).
Note only C# based Reliable Actor and Reliable Stateful services are
currently supported for periodic backup.
@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 enable_backup_description [EnableBackupDescription] Specifies the
parameters for enabling backup.
@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. | [
"Enables",
"periodic",
"backup",
"of",
"stateful",
"partitions",
"under",
"this",
"Service",
"Fabric",
"service",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L23831-L23834 | train | Enables service backup of a service. | [
30522,
13366,
9585,
1035,
2326,
1035,
10200,
1006,
2326,
1035,
8909,
1010,
9585,
1035,
10200,
1035,
6412,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
9585,
1035,
2326,
1035,
10200,
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/util/windows/sid.rb | Puppet::Util::Windows.SID.string_to_sid_ptr | def string_to_sid_ptr(string_sid, &block)
FFI::MemoryPointer.from_string_to_wide_string(string_sid) do |lpcwstr|
FFI::MemoryPointer.new(:pointer, 1) do |sid_ptr_ptr|
if ConvertStringSidToSidW(lpcwstr, sid_ptr_ptr) == FFI::WIN32_FALSE
raise Puppet::Util::Windows::Error.new(_("Failed to convert string SID: %{string_sid}") % { string_sid: string_sid })
end
sid_ptr_ptr.read_win32_local_pointer do |sid_ptr|
yield sid_ptr
end
end
end
# yielded sid_ptr has already had LocalFree called, nothing to return
nil
end | ruby | def string_to_sid_ptr(string_sid, &block)
FFI::MemoryPointer.from_string_to_wide_string(string_sid) do |lpcwstr|
FFI::MemoryPointer.new(:pointer, 1) do |sid_ptr_ptr|
if ConvertStringSidToSidW(lpcwstr, sid_ptr_ptr) == FFI::WIN32_FALSE
raise Puppet::Util::Windows::Error.new(_("Failed to convert string SID: %{string_sid}") % { string_sid: string_sid })
end
sid_ptr_ptr.read_win32_local_pointer do |sid_ptr|
yield sid_ptr
end
end
end
# yielded sid_ptr has already had LocalFree called, nothing to return
nil
end | [
"def",
"string_to_sid_ptr",
"(",
"string_sid",
",",
"&",
"block",
")",
"FFI",
"::",
"MemoryPointer",
".",
"from_string_to_wide_string",
"(",
"string_sid",
")",
"do",
"|",
"lpcwstr",
"|",
"FFI",
"::",
"MemoryPointer",
".",
"new",
"(",
":pointer",
",",
"1",
")... | Convert a SID string, e.g. "S-1-5-32-544" to a pointer (containing the
address of the binary SID structure). The returned value can be used in
Win32 APIs that expect a PSID, e.g. IsValidSid. The account for this
SID may or may not exist. | [
"Convert",
"a",
"SID",
"string",
"e",
".",
"g",
".",
"S",
"-",
"1",
"-",
"5",
"-",
"32",
"-",
"544",
"to",
"a",
"pointer",
"(",
"containing",
"the",
"address",
"of",
"the",
"binary",
"SID",
"structure",
")",
".",
"The",
"returned",
"value",
"can",
... | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/util/windows/sid.rb#L180-L196 | train | Convert a string SID to a sid_ptr | [
30522,
13366,
5164,
1035,
2000,
1035,
15765,
1035,
13866,
2099,
1006,
5164,
1035,
15765,
1010,
1004,
3796,
1007,
21461,
2072,
1024,
1024,
3638,
8400,
2121,
1012,
2013,
1035,
5164,
1035,
2000,
1035,
2898,
1035,
5164,
1006,
5164,
1035,
15765,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/assets.rb | Azure::MediaServices::Mgmt::V2018_07_01.Assets.get_encryption_key | def get_encryption_key(resource_group_name, account_name, asset_name, custom_headers:nil)
response = get_encryption_key_async(resource_group_name, account_name, asset_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_encryption_key(resource_group_name, account_name, asset_name, custom_headers:nil)
response = get_encryption_key_async(resource_group_name, account_name, asset_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_encryption_key",
"(",
"resource_group_name",
",",
"account_name",
",",
"asset_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_encryption_key_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"asset_name",
",",
"custom_headers... | Gets the Asset storage key
Gets the Asset storage encryption keys used to decrypt content created by
version 2 of the Media Services API
@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 asset_name [String] The Asset name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [StorageEncryptedAssetDecryptionData] operation results. | [
"Gets",
"the",
"Asset",
"storage",
"key"
] | 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/assets.rb#L724-L727 | train | Gets encryption key for an asset. | [
30522,
13366,
2131,
1035,
21999,
1035,
3145,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
11412,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
21999,
1035,
3145,
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... |
haml/haml | lib/haml/util.rb | Haml.Util.parse_haml_magic_comment | def parse_haml_magic_comment(str)
scanner = StringScanner.new(str.dup.force_encoding(Encoding::ASCII_8BIT))
bom = scanner.scan(/\xEF\xBB\xBF/n)
return bom unless scanner.scan(/-\s*#\s*/n)
if coding = try_parse_haml_emacs_magic_comment(scanner)
return bom, coding
end
return bom unless scanner.scan(/.*?coding[=:]\s*([\w-]+)/in)
return bom, scanner[1]
end | ruby | def parse_haml_magic_comment(str)
scanner = StringScanner.new(str.dup.force_encoding(Encoding::ASCII_8BIT))
bom = scanner.scan(/\xEF\xBB\xBF/n)
return bom unless scanner.scan(/-\s*#\s*/n)
if coding = try_parse_haml_emacs_magic_comment(scanner)
return bom, coding
end
return bom unless scanner.scan(/.*?coding[=:]\s*([\w-]+)/in)
return bom, scanner[1]
end | [
"def",
"parse_haml_magic_comment",
"(",
"str",
")",
"scanner",
"=",
"StringScanner",
".",
"new",
"(",
"str",
".",
"dup",
".",
"force_encoding",
"(",
"Encoding",
"::",
"ASCII_8BIT",
")",
")",
"bom",
"=",
"scanner",
".",
"scan",
"(",
"/",
"\\xEF",
"\\xBB",
... | Parses a magic comment at the beginning of a Haml file.
The parsing rules are basically the same as Ruby's.
@return [(Boolean, String or nil)]
Whether the document begins with a UTF-8 BOM,
and the declared encoding of the document (or nil if none is declared) | [
"Parses",
"a",
"magic",
"comment",
"at",
"the",
"beginning",
"of",
"a",
"Haml",
"file",
".",
"The",
"parsing",
"rules",
"are",
"basically",
"the",
"same",
"as",
"Ruby",
"s",
"."
] | 9aa0fbe4a91b999978927be569d2ad0cd39076f1 | https://github.com/haml/haml/blob/9aa0fbe4a91b999978927be569d2ad0cd39076f1/lib/haml/util.rb#L233-L243 | train | Parse a Haml magic comment | [
30522,
13366,
11968,
3366,
1035,
10654,
2140,
1035,
3894,
1035,
7615,
1006,
2358,
2099,
1007,
26221,
1027,
7817,
9336,
3678,
1012,
2047,
1006,
2358,
2099,
1012,
4241,
2361,
1012,
2486,
1035,
17181,
1006,
17181,
1024,
1024,
2004,
6895,
2072,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/device_settings.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.DeviceSettings.update_network_settings | def update_network_settings(device_name, parameters, resource_group_name, manager_name, custom_headers:nil)
response = update_network_settings_async(device_name, parameters, resource_group_name, manager_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def update_network_settings(device_name, parameters, resource_group_name, manager_name, custom_headers:nil)
response = update_network_settings_async(device_name, parameters, resource_group_name, manager_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"update_network_settings",
"(",
"device_name",
",",
"parameters",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"update_network_settings_async",
"(",
"device_name",
",",
"parameters",
",",
"resource_grou... | Updates the network settings on the specified device.
@param device_name [String] The device name
@param parameters [NetworkSettingsPatch] The network settings to be updated.
@param resource_group_name [String] The resource group name
@param manager_name [String] The manager name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [NetworkSettings] operation results. | [
"Updates",
"the",
"network",
"settings",
"on",
"the",
"specified",
"device",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/device_settings.rb#L278-L281 | train | Updates network settings of the specified device. | [
30522,
13366,
10651,
30524,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
10651,
1035,
2897,
1035,
10906,
1035,
2004,
6038,
2278,
1006,
5080,
1035,
2171,
1010,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_authorization/lib/2018-09-01-preview/generated/azure_mgmt_authorization/role_assignments.rb | Azure::Authorization::Mgmt::V2018_09_01_preview.RoleAssignments.get_by_id | def get_by_id(role_id, custom_headers:nil)
response = get_by_id_async(role_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_by_id(role_id, custom_headers:nil)
response = get_by_id_async(role_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_by_id",
"(",
"role_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_by_id_async",
"(",
"role_id",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"response",
".",
"nil?",
"end"
] | Gets a role assignment by ID.
@param role_id [String] The ID of the role assignment to get.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [RoleAssignment] operation results. | [
"Gets",
"a",
"role",
"assignment",
"by",
"ID",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_authorization/lib/2018-09-01-preview/generated/azure_mgmt_authorization/role_assignments.rb#L761-L764 | train | Gets the specified role. | [
30522,
13366,
2131,
1035,
2011,
1035,
8909,
1006,
2535,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
2011,
1035,
8909,
1035,
2004,
6038,
2278,
1006,
2535,
1035,
8909,
1010,
7661,
1035,
20346,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hashicorp/vagrant | lib/vagrant/guest.rb | Vagrant.Guest.detect! | def detect!
guest_name = @machine.config.vm.guest
initialize_capabilities!(guest_name, @guests, @capabilities, @machine)
rescue Errors::CapabilityHostExplicitNotDetected => e
raise Errors::GuestExplicitNotDetected, value: e.extra_data[:value]
rescue Errors::CapabilityHostNotDetected
raise Errors::GuestNotDetected
end | ruby | def detect!
guest_name = @machine.config.vm.guest
initialize_capabilities!(guest_name, @guests, @capabilities, @machine)
rescue Errors::CapabilityHostExplicitNotDetected => e
raise Errors::GuestExplicitNotDetected, value: e.extra_data[:value]
rescue Errors::CapabilityHostNotDetected
raise Errors::GuestNotDetected
end | [
"def",
"detect!",
"guest_name",
"=",
"@machine",
".",
"config",
".",
"vm",
".",
"guest",
"initialize_capabilities!",
"(",
"guest_name",
",",
"@guests",
",",
"@capabilities",
",",
"@machine",
")",
"rescue",
"Errors",
"::",
"CapabilityHostExplicitNotDetected",
"=>",
... | This will detect the proper guest OS for the machine and set up
the class to actually execute capabilities. | [
"This",
"will",
"detect",
"the",
"proper",
"guest",
"OS",
"for",
"the",
"machine",
"and",
"set",
"up",
"the",
"class",
"to",
"actually",
"execute",
"capabilities",
"."
] | c22a145c59790c098f95d50141d9afb48e1ef55f | https://github.com/hashicorp/vagrant/blob/c22a145c59790c098f95d50141d9afb48e1ef55f/lib/vagrant/guest.rb#L32-L39 | train | Detects the guests and capabilities. | [
30522,
13366,
11487,
999,
4113,
1035,
2171,
1027,
1030,
3698,
1012,
9530,
8873,
2290,
1012,
1058,
2213,
1012,
4113,
3988,
4697,
1035,
9859,
999,
1006,
4113,
1035,
2171,
1010,
1030,
6368,
1010,
1030,
9859,
1010,
1030,
3698,
1007,
5343,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_recovery_services_backup/lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/protection_containers.rb | Azure::RecoveryServicesBackup::Mgmt::V2016_12_01.ProtectionContainers.register | def register(vault_name, resource_group_name, fabric_name, container_name, parameters, custom_headers:nil)
response = register_async(vault_name, resource_group_name, fabric_name, container_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def register(vault_name, resource_group_name, fabric_name, container_name, parameters, custom_headers:nil)
response = register_async(vault_name, resource_group_name, fabric_name, container_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"register",
"(",
"vault_name",
",",
"resource_group_name",
",",
"fabric_name",
",",
"container_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"register_async",
"(",
"vault_name",
",",
"resource_group_name",
",",
"fabric_nam... | Registers the container with Recovery Services vault.
This is an asynchronous operation. To track the operation status, use
location header to call get latest status of
the operation.
@param vault_name [String] The name of the recovery services vault.
@param resource_group_name [String] The name of the resource group where the
recovery services vault is present.
@param fabric_name [String] Fabric name associated with the container.
@param container_name [String] Name of the container to be registered.
@param parameters [ProtectionContainerResource] Request body for operation
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ProtectionContainerResource] operation results. | [
"Registers",
"the",
"container",
"with",
"Recovery",
"Services",
"vault",
".",
"This",
"is",
"an",
"asynchronous",
"operation",
".",
"To",
"track",
"the",
"operation",
"status",
"use",
"location",
"header",
"to",
"call",
"get",
"latest",
"status",
"of",
"the",... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_recovery_services_backup/lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/protection_containers.rb#L154-L157 | train | Registers a container in the specified vault. | [
30522,
13366,
4236,
1006,
11632,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
8313,
1035,
2171,
1010,
11661,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4236,
1035,
2004,
6038,
2278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rmagick/rmagick | doc/ex/get_type_metrics.rb | Magick.Draw.brace | def brace(w, h)
raise(ArgumentError, 'width must be != 0') unless w != 0
raise(ArgumentError, 'height must be != 0') unless h != 0
path("M0,0 Q#{w},0 #{w / 2.0},#{-h / 4.0} T#{w},#{-h / 2.0}" \
"Q0,#{-h / 2.0} #{w / 2.0},#{-(3.0 * h / 4.0)} T0,#{-h}")
end | ruby | def brace(w, h)
raise(ArgumentError, 'width must be != 0') unless w != 0
raise(ArgumentError, 'height must be != 0') unless h != 0
path("M0,0 Q#{w},0 #{w / 2.0},#{-h / 4.0} T#{w},#{-h / 2.0}" \
"Q0,#{-h / 2.0} #{w / 2.0},#{-(3.0 * h / 4.0)} T0,#{-h}")
end | [
"def",
"brace",
"(",
"w",
",",
"h",
")",
"raise",
"(",
"ArgumentError",
",",
"'width must be != 0'",
")",
"unless",
"w",
"!=",
"0",
"raise",
"(",
"ArgumentError",
",",
"'height must be != 0'",
")",
"unless",
"h",
"!=",
"0",
"path",
"(",
"\"M0,0 Q#{w},0 #{w /... | (w,h) - width & height of rectangle enclosing brace.
Normally the brace is drawn with its opening to the
left and its lower point on the origin.
Set w < 0 to draw right-opening brace. Set h < 0 to
position top point at origin.
The placement & orientation is affected by the
current user coordinate system. | [
"(",
"w",
"h",
")",
"-",
"width",
"&",
"height",
"of",
"rectangle",
"enclosing",
"brace",
".",
"Normally",
"the",
"brace",
"is",
"drawn",
"with",
"its",
"opening",
"to",
"the",
"left",
"and",
"its",
"lower",
"point",
"on",
"the",
"origin",
"."
] | ef6688ed9d76bf123c2ea1a483eff8635051adb7 | https://github.com/rmagick/rmagick/blob/ef6688ed9d76bf123c2ea1a483eff8635051adb7/doc/ex/get_type_metrics.rb#L16-L22 | train | Returns a new object with the given width and height. | [
30522,
13366,
17180,
1006,
1059,
1010,
1044,
1007,
5333,
1006,
6685,
2121,
29165,
1010,
1005,
9381,
2442,
2022,
999,
1027,
1014,
1005,
1007,
4983,
1059,
999,
1027,
1014,
5333,
1006,
6685,
2121,
29165,
1010,
1005,
4578,
2442,
2022,
999,
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... |
RailsEventStore/rails_event_store | ruby_event_store/lib/ruby_event_store/specification.rb | RubyEventStore.Specification.of_type | def of_type(*types)
Specification.new(reader, result.dup{ |r| r.with_types = types.flatten })
end | ruby | def of_type(*types)
Specification.new(reader, result.dup{ |r| r.with_types = types.flatten })
end | [
"def",
"of_type",
"(",
"*",
"types",
")",
"Specification",
".",
"new",
"(",
"reader",
",",
"result",
".",
"dup",
"{",
"|",
"r",
"|",
"r",
".",
"with_types",
"=",
"types",
".",
"flatten",
"}",
")",
"end"
] | Limits the query to certain event type(s).
{http://railseventstore.org/docs/read/ Find out more}.
@types [Class, Array(Class)] types of event to look for.
@return [Specification] | [
"Limits",
"the",
"query",
"to",
"certain",
"event",
"type",
"(",
"s",
")",
".",
"{",
"http",
":",
"//",
"railseventstore",
".",
"org",
"/",
"docs",
"/",
"read",
"/",
"Find",
"out",
"more",
"}",
"."
] | 3ee4f3148499794154ee6fec74ccf6d4670d85ac | https://github.com/RailsEventStore/rails_event_store/blob/3ee4f3148499794154ee6fec74ccf6d4670d85ac/ruby_event_store/lib/ruby_event_store/specification.rb#L193-L195 | train | Returns a new Specification with the given types. | [
30522,
13366,
1997,
1035,
2828,
1006,
1008,
4127,
1007,
12827,
1012,
2047,
1006,
8068,
1010,
2765,
1012,
4241,
2361,
1063,
1064,
1054,
1064,
1054,
1012,
2007,
1035,
4127,
1027,
4127,
1012,
4257,
6528,
1065,
1007,
2203,
102,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_pattern_any_entity_model_with_http_info | def create_pattern_any_entity_model_with_http_info(app_id, version_id, extractor_create_object, custom_headers:nil)
create_pattern_any_entity_model_async(app_id, version_id, extractor_create_object, custom_headers:custom_headers).value!
end | ruby | def create_pattern_any_entity_model_with_http_info(app_id, version_id, extractor_create_object, custom_headers:nil)
create_pattern_any_entity_model_async(app_id, version_id, extractor_create_object, custom_headers:custom_headers).value!
end | [
"def",
"create_pattern_any_entity_model_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"extractor_create_object",
",",
"custom_headers",
":",
"nil",
")",
"create_pattern_any_entity_model_async",
"(",
"app_id",
",",
"version_id",
",",
"extractor_create_object",
",",
... | Adds a pattern.any entity extractor to a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param extractor_create_object [PatternAnyModelCreateObject] A model object
containing the name and explicit list for the new Pattern.Any entity
extractor.
@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",
"pattern",
".",
"any",
"entity",
"extractor",
"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#L6029-L6031 | train | Creates an entity model in a version of the application. | [
30522,
13366,
3443,
1035,
5418,
1035,
2151,
1035,
9178,
1035,
2944,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
14817,
2953,
1035,
3443,
1035,
4874,
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... |
sporkmonger/addressable | lib/addressable/uri.rb | Addressable.URI.display_uri | def display_uri
display_uri = self.normalize
display_uri.host = ::Addressable::IDNA.to_unicode(display_uri.host)
return display_uri
end | ruby | def display_uri
display_uri = self.normalize
display_uri.host = ::Addressable::IDNA.to_unicode(display_uri.host)
return display_uri
end | [
"def",
"display_uri",
"display_uri",
"=",
"self",
".",
"normalize",
"display_uri",
".",
"host",
"=",
"::",
"Addressable",
"::",
"IDNA",
".",
"to_unicode",
"(",
"display_uri",
".",
"host",
")",
"return",
"display_uri",
"end"
] | Creates a URI suitable for display to users. If semantic attacks are
likely, the application should try to detect these and warn the user.
See <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a>,
section 7.6 for more information.
@return [Addressable::URI] A URI suitable for display purposes. | [
"Creates",
"a",
"URI",
"suitable",
"for",
"display",
"to",
"users",
".",
"If",
"semantic",
"attacks",
"are",
"likely",
"the",
"application",
"should",
"try",
"to",
"detect",
"these",
"and",
"warn",
"the",
"user",
".",
"See",
"<a",
"href",
"=",
"http",
":... | 5894c95a7768435cb46d1355954611dbd194832e | https://github.com/sporkmonger/addressable/blob/5894c95a7768435cb46d1355954611dbd194832e/lib/addressable/uri.rb#L2175-L2179 | train | Returns the URI containing the URI containing the URI containing the URI containing the URI containing the URI containing the URI containing the URI. | [
30522,
13366,
4653,
1035,
24471,
2072,
4653,
1035,
24471,
2072,
1027,
2969,
1012,
3671,
4697,
4653,
1035,
24471,
2072,
1012,
3677,
1027,
1024,
1024,
4769,
3085,
1024,
1024,
8909,
2532,
1012,
2000,
1035,
27260,
1006,
4653,
1035,
24471,
2072,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ruby-git/ruby-git | lib/git/base.rb | Git.Base.config | def config(name = nil, value = nil)
if(name && value)
# set value
lib.config_set(name, value)
elsif (name)
# return value
lib.config_get(name)
else
# return hash
lib.config_list
end
end | ruby | def config(name = nil, value = nil)
if(name && value)
# set value
lib.config_set(name, value)
elsif (name)
# return value
lib.config_get(name)
else
# return hash
lib.config_list
end
end | [
"def",
"config",
"(",
"name",
"=",
"nil",
",",
"value",
"=",
"nil",
")",
"if",
"(",
"name",
"&&",
"value",
")",
"# set value",
"lib",
".",
"config_set",
"(",
"name",
",",
"value",
")",
"elsif",
"(",
"name",
")",
"# return value",
"lib",
".",
"config_... | g.config('user.name', 'Scott Chacon') # sets value
g.config('user.email', 'email@email.com') # sets value
g.config('user.name') # returns 'Scott Chacon'
g.config # returns whole config hash | [
"g",
".",
"config",
"(",
"user",
".",
"name",
"Scott",
"Chacon",
")",
"#",
"sets",
"value",
"g",
".",
"config",
"(",
"user",
".",
"email",
"email"
] | 9bd4407c56068e1604f14a1b6c0c5a84868e6378 | https://github.com/ruby-git/ruby-git/blob/9bd4407c56068e1604f14a1b6c0c5a84868e6378/lib/git/base.rb#L114-L125 | train | Get the configuration hash | [
30522,
13366,
9530,
8873,
2290,
1006,
2171,
1027,
9152,
2140,
1010,
3643,
1027,
9152,
2140,
1007,
2065,
1006,
2171,
1004,
1004,
3643,
1007,
1001,
2275,
3643,
5622,
2497,
1012,
9530,
8873,
2290,
1035,
2275,
1006,
2171,
1010,
3643,
1007,
34... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.add_user | def add_user(options = {})
options = options.merge(group_name: @name)
resp = @client.add_user_to_group(options)
resp.data
end | ruby | def add_user(options = {})
options = options.merge(group_name: @name)
resp = @client.add_user_to_group(options)
resp.data
end | [
"def",
"add_user",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"group_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"add_user_to_group",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @!group Actions
@example Request syntax with placeholder values
group.add_user({
user_name: "existingUserNameType", # required
})
@param [Hash] options ({})
@option options [required, String] :user_name
The name of the user to add.
This parameter allows (through its [regex pattern][1]) a string of
characters consisting of upper and lowercase alphanumeric characters
with no spaces. You can also include any of the following characters:
\_+=,.@-
[1]: http://wikipedia.org/wiki/regex
@return [EmptyStructure] | [
"@!group",
"Actions",
"@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#L230-L234 | train | Add a user to a group | [
30522,
13366,
5587,
1035,
5310,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
2177,
1035,
2171,
1024,
1030,
2171,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
5587,
1035,
5310,
1035,
2000,
1035,
2177,
1006,
7047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.