repo stringclasses 235 values | path stringlengths 11 168 | func_name stringlengths 12 143 | original_string stringlengths 83 6.91k | language stringclasses 1 value | code stringlengths 83 6.91k | code_tokens listlengths 15 1.01k | docstring stringlengths 5 25.7k | docstring_tokens listlengths 1 427 | sha stringclasses 235 values | url stringlengths 99 268 | partition stringclasses 1 value | summary stringlengths 7 202 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
rails/rails | activesupport/lib/active_support/xml_mini/jdom.rb | ActiveSupport.XmlMini_JDOM.parse | def parse(data)
if data.respond_to?(:read)
data = data.read
end
if data.blank?
{}
else
@dbf = DocumentBuilderFactory.new_instance
# secure processing of java xml
# https://archive.is/9xcQQ
@dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false)
@dbf.setFeature("http://xml.org/sax/features/external-general-entities", false)
@dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false)
@dbf.setFeature(javax.xml.XMLConstants::FEATURE_SECURE_PROCESSING, true)
xml_string_reader = StringReader.new(data)
xml_input_source = InputSource.new(xml_string_reader)
doc = @dbf.new_document_builder.parse(xml_input_source)
merge_element!({ CONTENT_KEY => "" }, doc.document_element, XmlMini.depth)
end
end | ruby | def parse(data)
if data.respond_to?(:read)
data = data.read
end
if data.blank?
{}
else
@dbf = DocumentBuilderFactory.new_instance
# secure processing of java xml
# https://archive.is/9xcQQ
@dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false)
@dbf.setFeature("http://xml.org/sax/features/external-general-entities", false)
@dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false)
@dbf.setFeature(javax.xml.XMLConstants::FEATURE_SECURE_PROCESSING, true)
xml_string_reader = StringReader.new(data)
xml_input_source = InputSource.new(xml_string_reader)
doc = @dbf.new_document_builder.parse(xml_input_source)
merge_element!({ CONTENT_KEY => "" }, doc.document_element, XmlMini.depth)
end
end | [
"def",
"parse",
"(",
"data",
")",
"if",
"data",
".",
"respond_to?",
"(",
":read",
")",
"data",
"=",
"data",
".",
"read",
"end",
"if",
"data",
".",
"blank?",
"{",
"}",
"else",
"@dbf",
"=",
"DocumentBuilderFactory",
".",
"new_instance",
"# secure processing ... | Parse an XML Document string or IO into a simple hash using Java's jdom.
data::
XML Document string or IO to parse | [
"Parse",
"an",
"XML",
"Document",
"string",
"or",
"IO",
"into",
"a",
"simple",
"hash",
"using",
"Java",
"s",
"jdom",
".",
"data",
"::",
"XML",
"Document",
"string",
"or",
"IO",
"to",
"parse"
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/xml_mini/jdom.rb#L33-L53 | train | Parse the XML string data | [
30522,
13366,
11968,
3366,
1006,
2951,
1007,
2065,
2951,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
3191,
1007,
2951,
1027,
2951,
1012,
3191,
2203,
2065,
2951,
1012,
8744,
1029,
1063,
1065,
2842,
1030,
16962,
2546,
1027,
6254,
8569,
23891,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/scss-lint | lib/scss_lint/linter.rb | SCSSLint.Linter.offset_to | def offset_to(source_position, pattern, offset = 0)
actual_line = source_position.line - 1
actual_offset = source_position.offset + offset - 1
return nil if actual_line >= engine.lines.size
actual_index = engine.lines[actual_line].index(pattern, actual_offset)
actual_index && actual_index + 1 - source_position.offset
end | ruby | def offset_to(source_position, pattern, offset = 0)
actual_line = source_position.line - 1
actual_offset = source_position.offset + offset - 1
return nil if actual_line >= engine.lines.size
actual_index = engine.lines[actual_line].index(pattern, actual_offset)
actual_index && actual_index + 1 - source_position.offset
end | [
"def",
"offset_to",
"(",
"source_position",
",",
"pattern",
",",
"offset",
"=",
"0",
")",
"actual_line",
"=",
"source_position",
".",
"line",
"-",
"1",
"actual_offset",
"=",
"source_position",
".",
"offset",
"+",
"offset",
"-",
"1",
"return",
"nil",
"if",
... | Starting at source_position (plus offset), search for pattern and return
the offset from the source_position.
@param source_position [Sass::Source::Position]
@param pattern [String, RegExp] the pattern to search for
@param offset [Integer]
@return [Integer] the offset at which [pattern] was found. | [
"Starting",
"at",
"source_position",
"(",
"plus",
"offset",
")",
"search",
"for",
"pattern",
"and",
"return",
"the",
"offset",
"from",
"the",
"source_position",
"."
] | e99afe4ede041a431a06e585c12ce82f6ad50116 | https://github.com/sds/scss-lint/blob/e99afe4ede041a431a06e585c12ce82f6ad50116/lib/scss_lint/linter.rb#L204-L213 | train | Returns the index of the pattern in the source position | [
30522,
13366,
16396,
1035,
2000,
1006,
3120,
1035,
2597,
1010,
5418,
1010,
16396,
1027,
1014,
1007,
5025,
1035,
2240,
1027,
3120,
1035,
2597,
1012,
2240,
1011,
1015,
5025,
1035,
16396,
1027,
3120,
1035,
2597,
1012,
16396,
1009,
16396,
1011,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb | Azure::KeyVault::V2016_10_01.KeyVaultClient.get_certificates | def get_certificates(vault_base_url, maxresults:nil, custom_headers:nil)
first_page = get_certificates_as_lazy(vault_base_url, maxresults:maxresults, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def get_certificates(vault_base_url, maxresults:nil, custom_headers:nil)
first_page = get_certificates_as_lazy(vault_base_url, maxresults:maxresults, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"get_certificates",
"(",
"vault_base_url",
",",
"maxresults",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"get_certificates_as_lazy",
"(",
"vault_base_url",
",",
"maxresults",
":",
"maxresults",
",",
"custom_headers",
":custom_headers... | List certificates in a specified key vault
The GetCertificates operation returns the set of certificates resources in
the specified key vault. This operation requires the certificates/list
permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param maxresults [Integer] Maximum number of results to return in a page. If
not specified the service will return up to 25 results.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<CertificateItem>] operation results. | [
"List",
"certificates",
"in",
"a",
"specified",
"key",
"vault"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb#L4025-L4028 | train | Gets the certificates associated with the specified vault. | [
30522,
13366,
2131,
1035,
17987,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
4098,
6072,
11314,
2015,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2131,
1035,
17987,
1035,
2004,
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... |
danger/danger | lib/danger/plugin_support/plugin_linter.rb | Danger.PluginLinter.link | def link(ref)
if ref.kind_of?(Range)
"@see - " + "https://github.com/dbgrandi/danger-prose/blob/v2.0.0/lib/danger_plugin.rb#L#{ref.min}#-L#{ref.max}".blue
elsif ref.kind_of?(Integer)
"@see - " + "https://github.com/dbgrandi/danger-prose/blob/v2.0.0/lib/danger_plugin.rb#L#{ref}".blue
else
"@see - " + "https://github.com/dbgrandi/danger-prose/blob/v2.0.0/lib/danger_plugin.rb".blue
end
end | ruby | def link(ref)
if ref.kind_of?(Range)
"@see - " + "https://github.com/dbgrandi/danger-prose/blob/v2.0.0/lib/danger_plugin.rb#L#{ref.min}#-L#{ref.max}".blue
elsif ref.kind_of?(Integer)
"@see - " + "https://github.com/dbgrandi/danger-prose/blob/v2.0.0/lib/danger_plugin.rb#L#{ref}".blue
else
"@see - " + "https://github.com/dbgrandi/danger-prose/blob/v2.0.0/lib/danger_plugin.rb".blue
end
end | [
"def",
"link",
"(",
"ref",
")",
"if",
"ref",
".",
"kind_of?",
"(",
"Range",
")",
"\"@see - \"",
"+",
"\"https://github.com/dbgrandi/danger-prose/blob/v2.0.0/lib/danger_plugin.rb#L#{ref.min}#-L#{ref.max}\"",
".",
"blue",
"elsif",
"ref",
".",
"kind_of?",
"(",
"Integer",
"... | Generates a link to see an example of said rule | [
"Generates",
"a",
"link",
"to",
"see",
"an",
"example",
"of",
"said",
"rule"
] | 0d6d09f2d949c287fe75202d947374042b0679f4 | https://github.com/danger/danger/blob/0d6d09f2d949c287fe75202d947374042b0679f4/lib/danger/plugin_support/plugin_linter.rb#L132-L140 | train | Link a reference to a specific resource | [
30522,
13366,
4957,
1006,
25416,
1007,
2065,
25416,
1012,
2785,
1035,
1997,
1029,
1006,
2846,
1007,
1000,
1030,
2156,
1011,
1000,
1009,
1000,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
16962,
17643,
16089,
1013,
5473,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-ec2/lib/aws-sdk-ec2/vpc.rb | Aws::EC2.Vpc.route_tables | def route_tables(options = {})
batches = Enumerator.new do |y|
options = Aws::Util.deep_merge(options, filters: [{
name: "vpc-id",
values: [@id]
}])
resp = @client.describe_route_tables(options)
resp.each_page do |page|
batch = []
page.data.route_tables.each do |r|
batch << RouteTable.new(
id: r.route_table_id,
data: r,
client: @client
)
end
y.yield(batch)
end
end
RouteTable::Collection.new(batches)
end | ruby | def route_tables(options = {})
batches = Enumerator.new do |y|
options = Aws::Util.deep_merge(options, filters: [{
name: "vpc-id",
values: [@id]
}])
resp = @client.describe_route_tables(options)
resp.each_page do |page|
batch = []
page.data.route_tables.each do |r|
batch << RouteTable.new(
id: r.route_table_id,
data: r,
client: @client
)
end
y.yield(batch)
end
end
RouteTable::Collection.new(batches)
end | [
"def",
"route_tables",
"(",
"options",
"=",
"{",
"}",
")",
"batches",
"=",
"Enumerator",
".",
"new",
"do",
"|",
"y",
"|",
"options",
"=",
"Aws",
"::",
"Util",
".",
"deep_merge",
"(",
"options",
",",
"filters",
":",
"[",
"{",
"name",
":",
"\"vpc-id\""... | @example Request syntax with placeholder values
route_tables = vpc.route_tables({
filters: [
{
name: "String",
values: ["String"],
},
],
dry_run: false,
route_table_ids: ["String"],
})
@param [Hash] options ({})
@option options [Array<Types::Filter>] :filters
One or more filters.
* `association.route-table-association-id` - The ID of an association
ID for the route table.
* `association.route-table-id` - The ID of the route table involved in
the association.
* `association.subnet-id` - The ID of the subnet involved in the
association.
* `association.main` - Indicates whether the route table is the main
route table for the VPC (`true` \| `false`). Route tables that do
not have an association ID are not returned in the response.
* `owner-id` - The ID of the AWS account that owns the route table.
* `route-table-id` - The ID of the route table.
* `route.destination-cidr-block` - The IPv4 CIDR range specified in a
route in the table.
* `route.destination-ipv6-cidr-block` - The IPv6 CIDR range specified
in a route in the route table.
* `route.destination-prefix-list-id` - The ID (prefix) of the AWS
service specified in a route in the table.
* `route.egress-only-internet-gateway-id` - The ID of an egress-only
Internet gateway specified in a route in the route table.
* `route.gateway-id` - The ID of a gateway specified in a route in the
table.
* `route.instance-id` - The ID of an instance specified in a route in
the table.
* `route.nat-gateway-id` - The ID of a NAT gateway.
* `route.transit-gateway-id` - The ID of a transit gateway.
* `route.origin` - Describes how the route was created.
`CreateRouteTable` indicates that the route was automatically
created when the route table was created; `CreateRoute` indicates
that the route was manually added to the route table;
`EnableVgwRoutePropagation` indicates that the route was propagated
by route propagation.
* `route.state` - The state of a route in the route table (`active` \|
`blackhole`). The blackhole state indicates that the route's target
isn't available (for example, the specified gateway isn't attached
to the VPC, the specified NAT instance has been terminated, and so
on).
* `route.vpc-peering-connection-id` - The ID of a VPC peering
connection specified in a route in the table.
* `tag`\:<key> - The key/value combination of a tag assigned to
the resource. Use the tag key in the filter name and the tag value
as the filter value. For example, to find all resources that have a
tag with the key `Owner` and the value `TeamA`, specify `tag:Owner`
for the filter name and `TeamA` for the filter value.
* `tag-key` - The key of a tag assigned to the resource. Use this
filter to find all resources assigned a tag with a specific key,
regardless of the tag value.
* `transit-gateway-id` - The ID of a transit gateway.
* `vpc-id` - The ID of the VPC for the route table.
@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 [Array<String>] :route_table_ids
One or more route table IDs.
Default: Describes all your route tables.
@return [RouteTable::Collection] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/vpc.rb#L1600-L1620 | train | Returns a RouteTable object for this VPC | [
30522,
13366,
2799,
1035,
7251,
1006,
7047,
1027,
1063,
1065,
1007,
14108,
2229,
1027,
4372,
17897,
16259,
1012,
2047,
2079,
1064,
1061,
1064,
7047,
1027,
22091,
2015,
1024,
1024,
21183,
4014,
1012,
2784,
1035,
13590,
1006,
7047,
1010,
1773... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jekyll/jekyll | lib/jekyll/readers/post_reader.rb | Jekyll.PostReader.read_publishable | def read_publishable(dir, magic_dir, matcher)
read_content(dir, magic_dir, matcher)
.tap { |docs| docs.each(&:read) }
.select { |doc| processable?(doc) }
end | ruby | def read_publishable(dir, magic_dir, matcher)
read_content(dir, magic_dir, matcher)
.tap { |docs| docs.each(&:read) }
.select { |doc| processable?(doc) }
end | [
"def",
"read_publishable",
"(",
"dir",
",",
"magic_dir",
",",
"matcher",
")",
"read_content",
"(",
"dir",
",",
"magic_dir",
",",
"matcher",
")",
".",
"tap",
"{",
"|",
"docs",
"|",
"docs",
".",
"each",
"(",
":read",
")",
"}",
".",
"select",
"{",
"|",
... | Read all the files in <source>/<dir>/<magic_dir> and create a new
Document object with each one insofar as it matches the regexp matcher.
dir - The String relative path of the directory to read.
Returns nothing. | [
"Read",
"all",
"the",
"files",
"in",
"<source",
">",
"/",
"<dir",
">",
"/",
"<magic_dir",
">",
"and",
"create",
"a",
"new",
"Document",
"object",
"with",
"each",
"one",
"insofar",
"as",
"it",
"matches",
"the",
"regexp",
"matcher",
"."
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/readers/post_reader.rb#L36-L40 | train | Read all the documents that are published by the given matcher. | [
30522,
13366,
3191,
1035,
10172,
3085,
1006,
16101,
1010,
3894,
1035,
16101,
1010,
2674,
2121,
1007,
3191,
1035,
4180,
1006,
16101,
1010,
3894,
1035,
16101,
1010,
2674,
2121,
1007,
1012,
11112,
1063,
1064,
9986,
2015,
1064,
9986,
2015,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activesupport/lib/active_support/core_ext/range/compare_range.rb | ActiveSupport.CompareWithRange.include? | def include?(value)
if value.is_a?(::Range)
# 1...10 includes 1..9 but it does not include 1..10.
# 1..10 includes 1...11 but it does not include 1...12.
operator = exclude_end? && !value.exclude_end? ? :< : :<=
value_max = !exclude_end? && value.exclude_end? ? value.max : value.last
super(value.first) && value_max.send(operator, last)
else
super
end
end | ruby | def include?(value)
if value.is_a?(::Range)
# 1...10 includes 1..9 but it does not include 1..10.
# 1..10 includes 1...11 but it does not include 1...12.
operator = exclude_end? && !value.exclude_end? ? :< : :<=
value_max = !exclude_end? && value.exclude_end? ? value.max : value.last
super(value.first) && value_max.send(operator, last)
else
super
end
end | [
"def",
"include?",
"(",
"value",
")",
"if",
"value",
".",
"is_a?",
"(",
"::",
"Range",
")",
"# 1...10 includes 1..9 but it does not include 1..10.",
"# 1..10 includes 1...11 but it does not include 1...12.",
"operator",
"=",
"exclude_end?",
"&&",
"!",
"value",
".",
"exclu... | Extends the default Range#=== to support range comparisons.
(1..5) === (1..5) # => true
(1..5) === (2..3) # => true
(1..5) === (1...6) # => true
(1..5) === (2..6) # => false
The native Range#=== behavior is untouched.
('a'..'f') === ('c') # => true
(5..9) === (11) # => false
Extends the default Range#include? to support range comparisons.
(1..5).include?(1..5) # => true
(1..5).include?(2..3) # => true
(1..5).include?(1...6) # => true
(1..5).include?(2..6) # => false
The native Range#include? behavior is untouched.
('a'..'f').include?('c') # => true
(5..9).include?(11) # => false | [
"Extends",
"the",
"default",
"Range#",
"===",
"to",
"support",
"range",
"comparisons",
".",
"(",
"1",
"..",
"5",
")",
"===",
"(",
"1",
"..",
"5",
")",
"#",
"=",
">",
"true",
"(",
"1",
"..",
"5",
")",
"===",
"(",
"2",
"..",
"3",
")",
"#",
"=",... | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/core_ext/range/compare_range.rb#L35-L45 | train | Returns true if the array contains the given value. | [
30522,
13366,
2421,
1029,
1006,
3643,
1007,
2065,
3643,
1012,
2003,
1035,
1037,
1029,
1006,
1024,
1024,
2846,
1007,
1001,
1015,
1012,
1012,
1012,
2184,
2950,
1015,
1012,
1012,
1023,
2021,
2009,
2515,
2025,
2421,
1015,
1012,
1012,
2184,
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... |
square/connect-ruby-sdk | lib/square_connect/models/charge_request.rb | SquareConnect.ChargeRequest.customer_card_id= | def customer_card_id=(customer_card_id)
if !customer_card_id.nil? && customer_card_id.to_s.length > 192
fail ArgumentError, "invalid value for 'customer_card_id', the character length must be smaller than or equal to 192."
end
@customer_card_id = customer_card_id
end | ruby | def customer_card_id=(customer_card_id)
if !customer_card_id.nil? && customer_card_id.to_s.length > 192
fail ArgumentError, "invalid value for 'customer_card_id', the character length must be smaller than or equal to 192."
end
@customer_card_id = customer_card_id
end | [
"def",
"customer_card_id",
"=",
"(",
"customer_card_id",
")",
"if",
"!",
"customer_card_id",
".",
"nil?",
"&&",
"customer_card_id",
".",
"to_s",
".",
"length",
">",
"192",
"fail",
"ArgumentError",
",",
"\"invalid value for 'customer_card_id', the character length must be ... | Custom attribute writer method with validation
@param [Object] customer_card_id Value to be assigned | [
"Custom",
"attribute",
"writer",
"method",
"with",
"validation"
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/models/charge_request.rb#L251-L258 | train | Sets the customer card ID. | [
30522,
13366,
8013,
1035,
4003,
1035,
8909,
1027,
1006,
8013,
1035,
4003,
1035,
8909,
1007,
2065,
999,
8013,
1035,
4003,
1035,
8909,
1012,
9152,
2140,
1029,
1004,
1004,
8013,
1035,
4003,
1035,
8909,
1012,
2000,
1035,
1055,
1012,
3091,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
wearefine/fae | app/helpers/fae/form_helper.rb | Fae.FormHelper.set_prompt | def set_prompt(f, attribute, options)
options[:prompt] = 'Select One' if is_association?(f, attribute) && f.object.class.reflect_on_association(attribute).macro == :belongs_to && options[:prompt].nil? && !options[:two_pane]
end | ruby | def set_prompt(f, attribute, options)
options[:prompt] = 'Select One' if is_association?(f, attribute) && f.object.class.reflect_on_association(attribute).macro == :belongs_to && options[:prompt].nil? && !options[:two_pane]
end | [
"def",
"set_prompt",
"(",
"f",
",",
"attribute",
",",
"options",
")",
"options",
"[",
":prompt",
"]",
"=",
"'Select One'",
"if",
"is_association?",
"(",
"f",
",",
"attribute",
")",
"&&",
"f",
".",
"object",
".",
"class",
".",
"reflect_on_association",
"(",... | sets default prompt for pulldowns | [
"sets",
"default",
"prompt",
"for",
"pulldowns"
] | 645d6b66945aeff54e27af6a95c4f8a1f7a67d39 | https://github.com/wearefine/fae/blob/645d6b66945aeff54e27af6a95c4f8a1f7a67d39/app/helpers/fae/form_helper.rb#L194-L196 | train | Set the prompt for the given attribute | [
30522,
13366,
2275,
1035,
25732,
1006,
1042,
1010,
17961,
1010,
7047,
1007,
7047,
1031,
1024,
25732,
1033,
1027,
1005,
7276,
2028,
1005,
2065,
2003,
1035,
2523,
1029,
1006,
1042,
1010,
17961,
1007,
1004,
1004,
1042,
1012,
4874,
1012,
2465,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/recommendations.rb | Azure::Web::Mgmt::V2018_02_01.Recommendations.list_recommended_rules_for_web_app_next | def list_recommended_rules_for_web_app_next(next_page_link, custom_headers:nil)
response = list_recommended_rules_for_web_app_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_recommended_rules_for_web_app_next(next_page_link, custom_headers:nil)
response = list_recommended_rules_for_web_app_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_recommended_rules_for_web_app_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_recommended_rules_for_web_app_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
... | Get all recommendations for an app.
Get all recommendations for an app.
@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 [RecommendationCollection] operation results. | [
"Get",
"all",
"recommendations",
"for",
"an",
"app",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/recommendations.rb#L1156-L1159 | train | Gets the list of recommended rules for the App Service Environment. | [
30522,
13366,
2862,
1035,
6749,
1035,
3513,
1035,
2005,
1035,
4773,
1035,
10439,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
6749,
1035,
3513,
1035,
2005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
decidim/decidim | decidim-core/lib/decidim/data_portability_file_reader.rb | Decidim.DataPortabilityFileReader.file_name | def file_name
name = ""
name += @user.nickname
name += "-"
name += @organization.name.parameterize
name += "-"
name += token
name + ".zip"
end | ruby | def file_name
name = ""
name += @user.nickname
name += "-"
name += @organization.name.parameterize
name += "-"
name += token
name + ".zip"
end | [
"def",
"file_name",
"name",
"=",
"\"\"",
"name",
"+=",
"@user",
".",
"nickname",
"name",
"+=",
"\"-\"",
"name",
"+=",
"@organization",
".",
"name",
".",
"parameterize",
"name",
"+=",
"\"-\"",
"name",
"+=",
"token",
"name",
"+",
"\".zip\"",
"end"
] | Public: Initialize the reader with a user, and token
user - The user of data portability to be zipped.
token - The token to be send by email, and return to controller.
Returns a String with the filename of the file to be read or generate. | [
"Public",
":",
"Initialize",
"the",
"reader",
"with",
"a",
"user",
"and",
"token"
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/lib/decidim/data_portability_file_reader.rb#L19-L27 | train | Returns the file name for the file | [
30522,
13366,
5371,
1035,
2171,
2171,
1027,
1000,
1000,
2171,
1009,
1027,
1030,
5310,
1012,
8367,
2171,
1009,
1027,
1000,
1011,
1000,
2171,
1009,
1027,
1030,
3029,
1012,
2171,
1012,
16381,
4697,
2171,
1009,
1027,
1000,
1011,
1000,
2171,
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... |
jekyll/jekyll-admin | lib/jekyll-admin/path_helper.rb | JekyllAdmin.PathHelper.directory_path | def directory_path
sanitized_path(
case namespace
when "collections"
File.join(collection.relative_directory, params["splat"].first)
when "data"
File.join(DataFile.data_dir, params["splat"].first)
when "drafts"
File.join("_drafts", params["splat"].first)
else
params["splat"].first
end
)
end | ruby | def directory_path
sanitized_path(
case namespace
when "collections"
File.join(collection.relative_directory, params["splat"].first)
when "data"
File.join(DataFile.data_dir, params["splat"].first)
when "drafts"
File.join("_drafts", params["splat"].first)
else
params["splat"].first
end
)
end | [
"def",
"directory_path",
"sanitized_path",
"(",
"case",
"namespace",
"when",
"\"collections\"",
"File",
".",
"join",
"(",
"collection",
".",
"relative_directory",
",",
"params",
"[",
"\"splat\"",
"]",
".",
"first",
")",
"when",
"\"data\"",
"File",
".",
"join",
... | Returns the path to the requested file's containing directory | [
"Returns",
"the",
"path",
"to",
"the",
"requested",
"file",
"s",
"containing",
"directory"
] | bc053b3b93faba679e8666091c42c47970e3bb5e | https://github.com/jekyll/jekyll-admin/blob/bc053b3b93faba679e8666091c42c47970e3bb5e/lib/jekyll-admin/path_helper.rb#L54-L67 | train | Returns the path to the directory containing the given object. | [
30522,
13366,
14176,
1035,
4130,
2624,
25090,
5422,
1035,
4130,
1006,
2553,
3415,
15327,
2043,
1000,
6407,
1000,
5371,
1012,
3693,
1006,
3074,
1012,
5816,
1035,
14176,
1010,
11498,
5244,
1031,
1000,
11867,
20051,
1000,
1033,
1012,
2034,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
projectcypress/health-data-standards | lib/hqmf-parser/2.0/population_criteria.rb | HQMF2.PopulationCriteria.handle_type | def handle_type(id_generator)
if @type != 'AGGREGATE'
# Generate the precondition for this population
if @preconditions.length > 1 ||
(@preconditions.length == 1 && @preconditions[0].conjunction != conjunction_code)
@preconditions = [Precondition.new(id_generator.next_id, conjunction_code, @preconditions)]
end
else
# Extract the data criteria this population references
dc = handle_observation_criteria
@preconditions = [Precondition.new(id_generator.next_id, nil, nil, false, HQMF2::Reference.new(dc.id))]
end
end | ruby | def handle_type(id_generator)
if @type != 'AGGREGATE'
# Generate the precondition for this population
if @preconditions.length > 1 ||
(@preconditions.length == 1 && @preconditions[0].conjunction != conjunction_code)
@preconditions = [Precondition.new(id_generator.next_id, conjunction_code, @preconditions)]
end
else
# Extract the data criteria this population references
dc = handle_observation_criteria
@preconditions = [Precondition.new(id_generator.next_id, nil, nil, false, HQMF2::Reference.new(dc.id))]
end
end | [
"def",
"handle_type",
"(",
"id_generator",
")",
"if",
"@type",
"!=",
"'AGGREGATE'",
"# Generate the precondition for this population",
"if",
"@preconditions",
".",
"length",
">",
"1",
"||",
"(",
"@preconditions",
".",
"length",
"==",
"1",
"&&",
"@preconditions",
"["... | Create a new population criteria from the supplied HQMF entry
@param [Nokogiri::XML::Element] the HQMF entry
Handles how the code should deal with the type definition (aggregate vs non-aggregate) | [
"Create",
"a",
"new",
"population",
"criteria",
"from",
"the",
"supplied",
"HQMF",
"entry"
] | 252d4f0927c513eacde6b9ea41b76faa1423c34b | https://github.com/projectcypress/health-data-standards/blob/252d4f0927c513eacde6b9ea41b76faa1423c34b/lib/hqmf-parser/2.0/population_criteria.rb#L27-L39 | train | Handle the type of population | [
30522,
13366,
5047,
1035,
2828,
1006,
8909,
1035,
13103,
1007,
2065,
1030,
2828,
999,
1027,
1005,
9572,
1005,
1001,
9699,
1996,
3653,
8663,
20562,
2005,
2023,
2313,
2065,
1030,
3653,
8663,
20562,
2015,
1012,
3091,
1028,
1015,
1064,
1064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-s3/lib/aws-sdk-s3/object_summary.rb | Aws::S3.ObjectSummary.delete | def delete(options = {})
options = options.merge(
bucket: @bucket_name,
key: @key
)
resp = @client.delete_object(options)
resp.data
end | ruby | def delete(options = {})
options = options.merge(
bucket: @bucket_name,
key: @key
)
resp = @client.delete_object(options)
resp.data
end | [
"def",
"delete",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"bucket",
":",
"@bucket_name",
",",
"key",
":",
"@key",
")",
"resp",
"=",
"@client",
".",
"delete_object",
"(",
"options",
")",
"resp",
".",
"data",
"e... | @example Request syntax with placeholder values
object_summary.delete({
mfa: "MFA",
version_id: "ObjectVersionId",
request_payer: "requester", # accepts requester
bypass_governance_retention: false,
})
@param [Hash] options ({})
@option options [String] :mfa
The concatenation of the authentication device's serial number, a
space, and the value that is displayed on your authentication device.
@option options [String] :version_id
VersionId used to reference a specific version of the object.
@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 [Boolean] :bypass_governance_retention
Indicates whether S3 Object Lock should bypass Governance-mode
restrictions to process this operation.
@return [Types::DeleteObjectOutput] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-s3/lib/aws-sdk-s3/object_summary.rb#L427-L434 | train | Delete the object from the bucket. | [
30522,
13366,
3972,
12870,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
13610,
1024,
1030,
13610,
1035,
2171,
1010,
3145,
1024,
1030,
3145,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
3972,
12870,
1035,
4874,
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... |
middleman/middleman | middleman-core/lib/middleman-core/util/files.rb | Middleman.Util.glob_directory | def glob_directory(path)
results = ::Dir[path]
return results unless RUBY_PLATFORM =~ /darwin/
results.map { |r| r.encode('UTF-8', 'UTF-8-MAC') }
end | ruby | def glob_directory(path)
results = ::Dir[path]
return results unless RUBY_PLATFORM =~ /darwin/
results.map { |r| r.encode('UTF-8', 'UTF-8-MAC') }
end | [
"def",
"glob_directory",
"(",
"path",
")",
"results",
"=",
"::",
"Dir",
"[",
"path",
"]",
"return",
"results",
"unless",
"RUBY_PLATFORM",
"=~",
"/",
"/",
"results",
".",
"map",
"{",
"|",
"r",
"|",
"r",
".",
"encode",
"(",
"'UTF-8'",
",",
"'UTF-8-MAC'",... | Glob a directory and try to keep path encoding consistent.
@param [String] path The glob path.
@return [Array<String>] | [
"Glob",
"a",
"directory",
"and",
"try",
"to",
"keep",
"path",
"encoding",
"consistent",
"."
] | a0dd9f78094813162895511e8516e0c5507cee50 | https://github.com/middleman/middleman/blob/a0dd9f78094813162895511e8516e0c5507cee50/middleman-core/lib/middleman-core/util/files.rb#L40-L46 | train | Globs a directory and returns an array of the files in the directory. | [
30522,
13366,
1043,
4135,
2497,
1035,
14176,
1006,
4130,
1007,
3463,
1027,
1024,
1024,
16101,
1031,
4130,
1033,
2709,
3463,
4983,
10090,
1035,
4132,
1027,
1066,
1013,
11534,
1013,
3463,
1012,
4949,
1063,
1064,
1054,
1064,
1054,
1012,
4372,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hashicorp/vagrant | lib/vagrant/box_collection.rb | Vagrant.BoxCollection.clean | def clean(name)
return false if exists?(name)
path = File.join(directory, dir_name(name))
FileUtils.rm_rf(path)
end | ruby | def clean(name)
return false if exists?(name)
path = File.join(directory, dir_name(name))
FileUtils.rm_rf(path)
end | [
"def",
"clean",
"(",
"name",
")",
"return",
"false",
"if",
"exists?",
"(",
"name",
")",
"path",
"=",
"File",
".",
"join",
"(",
"directory",
",",
"dir_name",
"(",
"name",
")",
")",
"FileUtils",
".",
"rm_rf",
"(",
"path",
")",
"end"
] | Cleans the directory for a box by removing the folders that are
empty. | [
"Cleans",
"the",
"directory",
"for",
"a",
"box",
"by",
"removing",
"the",
"folders",
"that",
"are",
"empty",
"."
] | c22a145c59790c098f95d50141d9afb48e1ef55f | https://github.com/hashicorp/vagrant/blob/c22a145c59790c098f95d50141d9afb48e1ef55f/lib/vagrant/box_collection.rb#L374-L378 | train | clean the file | [
30522,
13366,
4550,
1006,
2171,
1007,
2709,
6270,
2065,
6526,
1029,
1006,
2171,
1007,
4130,
1027,
5371,
1012,
3693,
1006,
14176,
1010,
16101,
1035,
2171,
1006,
2171,
1007,
1007,
5371,
21823,
4877,
1012,
28549,
1035,
21792,
1006,
4130,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-10-01/generated/azure_mgmt_network/connection_monitors.rb | Azure::Network::Mgmt::V2018_10_01.ConnectionMonitors.query | def query(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
response = query_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def query(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
response = query_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"query",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"connection_monitor_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"query_async",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"connection_monitor_name",
",",
... | Query a snapshot of the most recent connection states.
@param resource_group_name [String] The name of the resource group containing
Network Watcher.
@param network_watcher_name [String] The name of the Network Watcher
resource.
@param connection_monitor_name [String] The name given to the connection
monitor.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ConnectionMonitorQueryResult] operation results. | [
"Query",
"a",
"snapshot",
"of",
"the",
"most",
"recent",
"connection",
"states",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-10-01/generated/azure_mgmt_network/connection_monitors.rb#L324-L327 | train | Gets the list of all the available network endpoints in a connection monitor. | [
30522,
13366,
23032,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2897,
1035,
3422,
2121,
1035,
2171,
1010,
4434,
1035,
8080,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
23032,
1035,
2004,
6038,
2278,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_cdn/lib/2015-06-01/generated/azure_mgmt_cdn/endpoints.rb | Azure::CDN::Mgmt::V2015_06_01.Endpoints.begin_stop | def begin_stop(endpoint_name, profile_name, resource_group_name, custom_headers:nil)
response = begin_stop_async(endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_stop(endpoint_name, profile_name, resource_group_name, custom_headers:nil)
response = begin_stop_async(endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_stop",
"(",
"endpoint_name",
",",
"profile_name",
",",
"resource_group_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_stop_async",
"(",
"endpoint_name",
",",
"profile_name",
",",
"resource_group_name",
",",
"custom_headers",
":cus... | Stops an existing running CDN endpoint.
@param endpoint_name [String] Name of the endpoint within the CDN profile.
@param profile_name [String] Name of the CDN profile within the resource
group.
@param resource_group_name [String] Name of the resource group within the
Azure subscription.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Endpoint] operation results. | [
"Stops",
"an",
"existing",
"running",
"CDN",
"endpoint",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_cdn/lib/2015-06-01/generated/azure_mgmt_cdn/endpoints.rb#L1156-L1159 | train | Stops an endpoint. | [
30522,
13366,
4088,
1035,
2644,
1006,
2203,
8400,
1035,
2171,
1010,
6337,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
2644,
1035,
2004,
6038,
2278,
1006,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mongodb/mongo-ruby-driver | lib/mongo/cluster.rb | Mongo.Cluster.scan! | def scan!(sync=true)
if sync
servers_list.each do |server|
server.scan!
end
else
servers_list.each do |server|
server.monitor.scan_semaphore.signal
end
end
true
end | ruby | def scan!(sync=true)
if sync
servers_list.each do |server|
server.scan!
end
else
servers_list.each do |server|
server.monitor.scan_semaphore.signal
end
end
true
end | [
"def",
"scan!",
"(",
"sync",
"=",
"true",
")",
"if",
"sync",
"servers_list",
".",
"each",
"do",
"|",
"server",
"|",
"server",
".",
"scan!",
"end",
"else",
"servers_list",
".",
"each",
"do",
"|",
"server",
"|",
"server",
".",
"monitor",
".",
"scan_semap... | Force a scan of all known servers in the cluster.
If the sync parameter is true which is the default, the scan is
performed synchronously in the thread which called this method.
Each server in the cluster is checked sequentially. If there are
many servers in the cluster or they are slow to respond, this
can be a long running operation.
If the sync parameter is false, this method instructs all server
monitor threads to perform an immediate scan and returns without
waiting for scan results.
@note In both synchronous and asynchronous scans, each monitor
thread maintains a minimum interval between scans, meaning
calling this method may not initiate a scan on a particular server
the very next instant.
@example Force a full cluster scan.
cluster.scan!
@return [ true ] Always true.
@since 2.0.0 | [
"Force",
"a",
"scan",
"of",
"all",
"known",
"servers",
"in",
"the",
"cluster",
"."
] | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/cluster.rb#L458-L469 | train | Scan the servers and return the result | [
30522,
13366,
13594,
999,
1006,
26351,
1027,
2995,
1007,
2065,
26351,
14903,
1035,
2862,
1012,
2169,
2079,
1064,
8241,
1064,
8241,
1012,
13594,
999,
2203,
2842,
14903,
1035,
2862,
1012,
2169,
2079,
1064,
8241,
1064,
8241,
1012,
8080,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/identity_provider.rb | Azure::ApiManagement::Mgmt::V2018_01_01.IdentityProvider.get_entity_tag_with_http_info | def get_entity_tag_with_http_info(resource_group_name, service_name, identity_provider_name, custom_headers:nil)
get_entity_tag_async(resource_group_name, service_name, identity_provider_name, custom_headers:custom_headers).value!
end | ruby | def get_entity_tag_with_http_info(resource_group_name, service_name, identity_provider_name, custom_headers:nil)
get_entity_tag_async(resource_group_name, service_name, identity_provider_name, custom_headers:custom_headers).value!
end | [
"def",
"get_entity_tag_with_http_info",
"(",
"resource_group_name",
",",
"service_name",
",",
"identity_provider_name",
",",
"custom_headers",
":",
"nil",
")",
"get_entity_tag_async",
"(",
"resource_group_name",
",",
"service_name",
",",
"identity_provider_name",
",",
"cust... | Gets the entity state (Etag) version of the identityProvider specified by its
identifier.
@param resource_group_name [String] The name of the resource group.
@param service_name [String] The name of the API Management service.
@param identity_provider_name [IdentityProviderType] Identity Provider Type
identifier. Possible values include: 'facebook', 'google', 'microsoft',
'twitter', 'aad', 'aadB2C'
@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",
"entity",
"state",
"(",
"Etag",
")",
"version",
"of",
"the",
"identityProvider",
"specified",
"by",
"its",
"identifier",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/identity_provider.rb#L154-L156 | train | Gets the entity tag for the specified identity provider. | [
30522,
13366,
2131,
1035,
9178,
1035,
6415,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
4767,
1035,
10802,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
opal/opal | lib/opal/config.rb | Opal.Config.config_option | def config_option(name, default_value, options = {})
compiler = options.fetch(:compiler_option, nil)
valid_values = options.fetch(:valid_values, [true, false])
config_options[name] = {
default: default_value,
compiler: compiler
}
define_singleton_method(name) { config.fetch(name, default_value) }
define_singleton_method("#{name}=") do |value|
unless valid_values.any? { |valid_value| valid_value === value }
raise ArgumentError, "Not a valid value for option #{self}.#{name}, provided #{value.inspect}. "\
"Must be #{valid_values.inspect} === #{value.inspect}"
end
config[name] = value
end
end | ruby | def config_option(name, default_value, options = {})
compiler = options.fetch(:compiler_option, nil)
valid_values = options.fetch(:valid_values, [true, false])
config_options[name] = {
default: default_value,
compiler: compiler
}
define_singleton_method(name) { config.fetch(name, default_value) }
define_singleton_method("#{name}=") do |value|
unless valid_values.any? { |valid_value| valid_value === value }
raise ArgumentError, "Not a valid value for option #{self}.#{name}, provided #{value.inspect}. "\
"Must be #{valid_values.inspect} === #{value.inspect}"
end
config[name] = value
end
end | [
"def",
"config_option",
"(",
"name",
",",
"default_value",
",",
"options",
"=",
"{",
"}",
")",
"compiler",
"=",
"options",
".",
"fetch",
"(",
":compiler_option",
",",
"nil",
")",
"valid_values",
"=",
"options",
".",
"fetch",
"(",
":valid_values",
",",
"[",... | Defines a new configuration option
@param [String] name the option name
@param [Object] default_value the option's default value
@!macro [attach] property
@!attribute [rw] $1 | [
"Defines",
"a",
"new",
"configuration",
"option"
] | 41aedc0fd62aab00d3c117ba0caf00206bedd981 | https://github.com/opal/opal/blob/41aedc0fd62aab00d3c117ba0caf00206bedd981/lib/opal/config.rb#L21-L39 | train | Define a configuration option. | [
30522,
13366,
9530,
8873,
2290,
1035,
5724,
1006,
2171,
1010,
12398,
1035,
3643,
1010,
7047,
1027,
1063,
1065,
1007,
21624,
1027,
7047,
1012,
18584,
1006,
1024,
21624,
1035,
5724,
1010,
9152,
2140,
1007,
9398,
1035,
5300,
1027,
7047,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
meew0/discordrb | lib/discordrb/permissions.rb | Discordrb.PermissionCalculator.permission? | def permission?(action, channel = nil)
# If the member is the server owner, it irrevocably has all permissions.
return true if owner?
# First, check whether the user has Manage Roles defined.
# (Coincidentally, Manage Permissions is the same permission as Manage Roles, and a
# Manage Permissions deny overwrite will override Manage Roles, so we can just check for
# Manage Roles once and call it a day.)
return true if defined_permission?(:administrator, channel)
# Otherwise, defer to defined_permission
defined_permission?(action, channel)
end | ruby | def permission?(action, channel = nil)
# If the member is the server owner, it irrevocably has all permissions.
return true if owner?
# First, check whether the user has Manage Roles defined.
# (Coincidentally, Manage Permissions is the same permission as Manage Roles, and a
# Manage Permissions deny overwrite will override Manage Roles, so we can just check for
# Manage Roles once and call it a day.)
return true if defined_permission?(:administrator, channel)
# Otherwise, defer to defined_permission
defined_permission?(action, channel)
end | [
"def",
"permission?",
"(",
"action",
",",
"channel",
"=",
"nil",
")",
"# If the member is the server owner, it irrevocably has all permissions.",
"return",
"true",
"if",
"owner?",
"# First, check whether the user has Manage Roles defined.",
"# (Coincidentally, Manage Permissions is the... | Checks whether this user can do the particular action, regardless of whether it has the permission defined,
through for example being the server owner or having the Manage Roles permission
@param action [Symbol] The permission that should be checked. See also {Permissions::FLAGS} for a list.
@param channel [Channel, nil] If channel overrides should be checked too, this channel specifies where the overrides should be checked.
@example Check if the bot can send messages to a specific channel in a server.
bot_profile = bot.profile.on(event.server)
can_send_messages = bot_profile.permission?(:send_messages, channel)
@return [true, false] whether or not this user has the permission. | [
"Checks",
"whether",
"this",
"user",
"can",
"do",
"the",
"particular",
"action",
"regardless",
"of",
"whether",
"it",
"has",
"the",
"permission",
"defined",
"through",
"for",
"example",
"being",
"the",
"server",
"owner",
"or",
"having",
"the",
"Manage",
"Roles... | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/permissions.rb#L135-L147 | train | Check whether the current member has the specified permission. | [
30522,
13366,
6656,
1029,
1006,
2895,
1010,
3149,
1027,
9152,
2140,
1007,
1001,
2065,
1996,
2266,
2003,
1996,
8241,
3954,
1010,
2009,
20868,
2890,
6767,
3540,
6321,
2038,
2035,
6656,
2015,
1012,
2709,
2995,
2065,
3954,
1029,
1001,
2034,
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... |
hashicorp/vagrant | lib/vagrant/bundler.rb | Vagrant.Bundler.activate_solution | def activate_solution(solution)
retried = false
begin
@logger.debug("Activating solution set: #{solution.map(&:full_name)}")
solution.each do |activation_request|
unless activation_request.full_spec.activated?
@logger.debug("Activating gem #{activation_request.full_spec.full_name}")
activation_request.full_spec.activate
if(defined?(::Bundler))
@logger.debug("Marking gem #{activation_request.full_spec.full_name} loaded within Bundler.")
::Bundler.rubygems.mark_loaded activation_request.full_spec
end
end
end
rescue Gem::LoadError => e
# Depending on the version of Ruby, the ordering of the solution set
# will be either 0..n (molinillo) or n..0 (pre-molinillo). Instead of
# attempting to determine what's in use, or if it has some how changed
# again, just reverse order on failure and attempt again.
if retried
@logger.error("Failed to load solution set - #{e.class}: #{e}")
matcher = e.message.match(/Could not find '(?<gem_name>[^']+)'/)
if matcher && !matcher["gem_name"].empty?
desired_activation_request = solution.detect do |request|
request.name == matcher["gem_name"]
end
if desired_activation_request && !desired_activation_request.full_spec.activated?
activation_request = desired_activation_request
@logger.warn("Found misordered activation request for #{desired_activation_request.full_name}. Moving to solution HEAD.")
solution.delete(desired_activation_request)
solution.unshift(desired_activation_request)
retry
end
end
raise
else
@logger.debug("Failed to load solution set. Retrying with reverse order.")
retried = true
solution.reverse!
retry
end
end
end | ruby | def activate_solution(solution)
retried = false
begin
@logger.debug("Activating solution set: #{solution.map(&:full_name)}")
solution.each do |activation_request|
unless activation_request.full_spec.activated?
@logger.debug("Activating gem #{activation_request.full_spec.full_name}")
activation_request.full_spec.activate
if(defined?(::Bundler))
@logger.debug("Marking gem #{activation_request.full_spec.full_name} loaded within Bundler.")
::Bundler.rubygems.mark_loaded activation_request.full_spec
end
end
end
rescue Gem::LoadError => e
# Depending on the version of Ruby, the ordering of the solution set
# will be either 0..n (molinillo) or n..0 (pre-molinillo). Instead of
# attempting to determine what's in use, or if it has some how changed
# again, just reverse order on failure and attempt again.
if retried
@logger.error("Failed to load solution set - #{e.class}: #{e}")
matcher = e.message.match(/Could not find '(?<gem_name>[^']+)'/)
if matcher && !matcher["gem_name"].empty?
desired_activation_request = solution.detect do |request|
request.name == matcher["gem_name"]
end
if desired_activation_request && !desired_activation_request.full_spec.activated?
activation_request = desired_activation_request
@logger.warn("Found misordered activation request for #{desired_activation_request.full_name}. Moving to solution HEAD.")
solution.delete(desired_activation_request)
solution.unshift(desired_activation_request)
retry
end
end
raise
else
@logger.debug("Failed to load solution set. Retrying with reverse order.")
retried = true
solution.reverse!
retry
end
end
end | [
"def",
"activate_solution",
"(",
"solution",
")",
"retried",
"=",
"false",
"begin",
"@logger",
".",
"debug",
"(",
"\"Activating solution set: #{solution.map(&:full_name)}\"",
")",
"solution",
".",
"each",
"do",
"|",
"activation_request",
"|",
"unless",
"activation_reque... | Activate a given solution | [
"Activate",
"a",
"given",
"solution"
] | c22a145c59790c098f95d50141d9afb48e1ef55f | https://github.com/hashicorp/vagrant/blob/c22a145c59790c098f95d50141d9afb48e1ef55f/lib/vagrant/bundler.rb#L483-L526 | train | Activates the given solution set. | [
30522,
13366,
20544,
1035,
5576,
1006,
5576,
1007,
2128,
18886,
2098,
1027,
6270,
4088,
1030,
8833,
4590,
1012,
2139,
8569,
2290,
1006,
1000,
2552,
17441,
5576,
2275,
1024,
1001,
1063,
5576,
1012,
4949,
1006,
1004,
1024,
2440,
1035,
2171,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_api_management/lib/2016-07-07/generated/azure_mgmt_api_management/product_groups.rb | Azure::ApiManagement::Mgmt::V2016_07_07.ProductGroups.remove | def remove(resource_group_name, service_name, product_id, group_id, custom_headers:nil)
response = remove_async(resource_group_name, service_name, product_id, group_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def remove(resource_group_name, service_name, product_id, group_id, custom_headers:nil)
response = remove_async(resource_group_name, service_name, product_id, group_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"remove",
"(",
"resource_group_name",
",",
"service_name",
",",
"product_id",
",",
"group_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"remove_async",
"(",
"resource_group_name",
",",
"service_name",
",",
"product_id",
",",
"group_id",
",",... | Deletes the association between the specified group and product.
@param resource_group_name [String] The name of the resource group.
@param service_name [String] The name of the API Management service.
@param product_id [String] Product identifier. Must be unique in the current
API Management service instance.
@param group_id [String] Group identifier. Must be unique in the current API
Management service instance.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ErrorBodyContract] operation results. | [
"Deletes",
"the",
"association",
"between",
"the",
"specified",
"group",
"and",
"product",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2016-07-07/generated/azure_mgmt_api_management/product_groups.rb#L294-L297 | train | Remove a product from the group. | [
30522,
13366,
6366,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
4031,
1035,
8909,
1010,
2177,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
6366,
1035,
2004,
6038,
2278,
1006,
7692,
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... |
sensu/sensu | lib/sensu/utilities.rb | Sensu.Utilities.in_time_window? | def in_time_window?(condition)
if condition.has_key?(:begin) && condition.has_key?(:end)
begin_time = Time.parse(condition[:begin])
end_time = Time.parse(condition[:end])
if end_time < begin_time
if Time.now < end_time
begin_time = Time.new(*begin_time.strftime("%Y %m %d 00 00 00 %:z").split("\s"))
else
end_time = Time.new(*end_time.strftime("%Y %m %d 23 59 59 %:z").split("\s"))
end
end
Time.now >= begin_time && Time.now <= end_time
else
false
end
end | ruby | def in_time_window?(condition)
if condition.has_key?(:begin) && condition.has_key?(:end)
begin_time = Time.parse(condition[:begin])
end_time = Time.parse(condition[:end])
if end_time < begin_time
if Time.now < end_time
begin_time = Time.new(*begin_time.strftime("%Y %m %d 00 00 00 %:z").split("\s"))
else
end_time = Time.new(*end_time.strftime("%Y %m %d 23 59 59 %:z").split("\s"))
end
end
Time.now >= begin_time && Time.now <= end_time
else
false
end
end | [
"def",
"in_time_window?",
"(",
"condition",
")",
"if",
"condition",
".",
"has_key?",
"(",
":begin",
")",
"&&",
"condition",
".",
"has_key?",
"(",
":end",
")",
"begin_time",
"=",
"Time",
".",
"parse",
"(",
"condition",
"[",
":begin",
"]",
")",
"end_time",
... | Determine if the current time falls within a time window. The
provided condition must have a `:begin` and `:end` time, eg.
"11:30:00 PM", or `false` will be returned.
@param condition [Hash]
@option condition [String] :begin time.
@option condition [String] :end time.
@return [TrueClass, FalseClass] | [
"Determine",
"if",
"the",
"current",
"time",
"falls",
"within",
"a",
"time",
"window",
".",
"The",
"provided",
"condition",
"must",
"have",
"a",
":",
"begin",
"and",
":",
"end",
"time",
"eg",
".",
"11",
":",
"30",
":",
"00",
"PM",
"or",
"false",
"wil... | 51319e4b58c8d9986f101ad71ff729aa3e51e951 | https://github.com/sensu/sensu/blob/51319e4b58c8d9986f101ad71ff729aa3e51e951/lib/sensu/utilities.rb#L331-L346 | train | Returns true if the time window is within the time window | [
30522,
13366,
1999,
1035,
2051,
1035,
3332,
1029,
1006,
4650,
1007,
2065,
4650,
1012,
2038,
1035,
3145,
1029,
1006,
1024,
4088,
1007,
1004,
1004,
4650,
1012,
2038,
1035,
3145,
1029,
1006,
1024,
2203,
1007,
4088,
1035,
2051,
1027,
2051,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
randym/axlsx | lib/axlsx/drawing/series.rb | Axlsx.Series.to_xml_string | def to_xml_string(str = '')
str << '<c:ser>'
str << ('<c:idx val="' << index.to_s << '"/>')
str << ('<c:order val="' << (order || index).to_s << '"/>')
title.to_xml_string(str) unless title.nil?
yield if block_given?
str << '</c:ser>'
end | ruby | def to_xml_string(str = '')
str << '<c:ser>'
str << ('<c:idx val="' << index.to_s << '"/>')
str << ('<c:order val="' << (order || index).to_s << '"/>')
title.to_xml_string(str) unless title.nil?
yield if block_given?
str << '</c:ser>'
end | [
"def",
"to_xml_string",
"(",
"str",
"=",
"''",
")",
"str",
"<<",
"'<c:ser>'",
"str",
"<<",
"(",
"'<c:idx val=\"'",
"<<",
"index",
".",
"to_s",
"<<",
"'\"/>'",
")",
"str",
"<<",
"(",
"'<c:order val=\"'",
"<<",
"(",
"order",
"||",
"index",
")",
".",
"to_... | Serializes the object
@param [String] str
@return [String] | [
"Serializes",
"the",
"object"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/drawing/series.rb#L60-L67 | train | Returns the XML string for this object. | [
30522,
13366,
2000,
1035,
20950,
1035,
5164,
1006,
2358,
2099,
1027,
1005,
1005,
1007,
2358,
2099,
1026,
1026,
1005,
1026,
1039,
1024,
14262,
1028,
1005,
2358,
2099,
1026,
1026,
1006,
1005,
1026,
1039,
1024,
8909,
2595,
11748,
1027,
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... |
jekyll/jekyll | lib/jekyll/cleaner.rb | Jekyll.Cleaner.parent_dirs | def parent_dirs(file)
parent_dir = File.dirname(file)
if parent_dir == site.dest
[]
else
[parent_dir] + parent_dirs(parent_dir)
end
end | ruby | def parent_dirs(file)
parent_dir = File.dirname(file)
if parent_dir == site.dest
[]
else
[parent_dir] + parent_dirs(parent_dir)
end
end | [
"def",
"parent_dirs",
"(",
"file",
")",
"parent_dir",
"=",
"File",
".",
"dirname",
"(",
"file",
")",
"if",
"parent_dir",
"==",
"site",
".",
"dest",
"[",
"]",
"else",
"[",
"parent_dir",
"]",
"+",
"parent_dirs",
"(",
"parent_dir",
")",
"end",
"end"
] | Private: The list of parent directories of a given file
Returns an Array with the directory paths | [
"Private",
":",
"The",
"list",
"of",
"parent",
"directories",
"of",
"a",
"given",
"file"
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/cleaner.rb#L75-L82 | train | Returns an array of all the directories of the parent directories of the file. | [
30522,
13366,
6687,
1035,
16101,
2015,
1006,
5371,
1007,
6687,
1035,
16101,
1027,
5371,
1012,
16101,
18442,
1006,
5371,
1007,
2065,
6687,
1035,
16101,
1027,
1027,
2609,
1012,
4078,
2102,
1031,
1033,
2842,
1031,
6687,
1035,
16101,
1033,
1009... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_container_registry/lib/2018-09-01/generated/azure_mgmt_container_registry/runs.rb | Azure::ContainerRegistry::Mgmt::V2018_09_01.Runs.begin_cancel | def begin_cancel(resource_group_name, registry_name, run_id, custom_headers:nil)
response = begin_cancel_async(resource_group_name, registry_name, run_id, custom_headers:custom_headers).value!
nil
end | ruby | def begin_cancel(resource_group_name, registry_name, run_id, custom_headers:nil)
response = begin_cancel_async(resource_group_name, registry_name, run_id, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_cancel",
"(",
"resource_group_name",
",",
"registry_name",
",",
"run_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_cancel_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"run_id",
",",
"custom_headers",
":custom_head... | Cancel an existing run.
@param resource_group_name [String] The name of the resource group to which
the container registry belongs.
@param registry_name [String] The name of the container registry.
@param run_id [String] The run ID.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Cancel",
"an",
"existing",
"run",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_registry/lib/2018-09-01/generated/azure_mgmt_container_registry/runs.rb#L569-L572 | train | Cancels a run. | [
30522,
13366,
4088,
1035,
17542,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
2448,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
17542,
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... |
oauth-xx/oauth2 | lib/oauth2/mac_token.rb | OAuth2.MACToken.algorithm= | def algorithm=(alg)
@algorithm = begin
case alg.to_s
when 'hmac-sha-1'
OpenSSL::Digest::SHA1.new
when 'hmac-sha-256'
OpenSSL::Digest::SHA256.new
else
raise(ArgumentError, 'Unsupported algorithm')
end
end
end | ruby | def algorithm=(alg)
@algorithm = begin
case alg.to_s
when 'hmac-sha-1'
OpenSSL::Digest::SHA1.new
when 'hmac-sha-256'
OpenSSL::Digest::SHA256.new
else
raise(ArgumentError, 'Unsupported algorithm')
end
end
end | [
"def",
"algorithm",
"=",
"(",
"alg",
")",
"@algorithm",
"=",
"begin",
"case",
"alg",
".",
"to_s",
"when",
"'hmac-sha-1'",
"OpenSSL",
"::",
"Digest",
"::",
"SHA1",
".",
"new",
"when",
"'hmac-sha-256'",
"OpenSSL",
"::",
"Digest",
"::",
"SHA256",
".",
"new",
... | Set the HMAC algorithm
@param [String] alg the algorithm to use (one of 'hmac-sha-1', 'hmac-sha-256') | [
"Set",
"the",
"HMAC",
"algorithm"
] | f08ff9da169136ab133aa2faab0d74a4407deffb | https://github.com/oauth-xx/oauth2/blob/f08ff9da169136ab133aa2faab0d74a4407deffb/lib/oauth2/mac_token.rb#L97-L108 | train | Sets the algorithm for this key. | [
30522,
13366,
9896,
1027,
1006,
2632,
2290,
1007,
1030,
9896,
1027,
4088,
2553,
2632,
2290,
1012,
2000,
1035,
1055,
2043,
1005,
20287,
6305,
1011,
21146,
1011,
1015,
1005,
7480,
14540,
1024,
1024,
17886,
1024,
1024,
21146,
2487,
1012,
2047,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
danger/danger | lib/danger/core_ext/file_list.rb | Danger.FileList.include? | def include?(pattern)
self.each do |current|
return true if File.fnmatch(pattern, current) || pattern == current
end
return false
end | ruby | def include?(pattern)
self.each do |current|
return true if File.fnmatch(pattern, current) || pattern == current
end
return false
end | [
"def",
"include?",
"(",
"pattern",
")",
"self",
".",
"each",
"do",
"|",
"current",
"|",
"return",
"true",
"if",
"File",
".",
"fnmatch",
"(",
"pattern",
",",
"current",
")",
"||",
"pattern",
"==",
"current",
"end",
"return",
"false",
"end"
] | Information about pattern: http://ruby-doc.org/core-2.2.0/File.html#method-c-fnmatch
e.g. "**/something.*" for any file called something with any extension | [
"Information",
"about",
"pattern",
":",
"http",
":",
"//",
"ruby",
"-",
"doc",
".",
"org",
"/",
"core",
"-",
"2",
".",
"2",
".",
"0",
"/",
"File",
".",
"html#method",
"-",
"c",
"-",
"fnmatch",
"e",
".",
"g",
".",
"**",
"/",
"something",
".",
"*... | 0d6d09f2d949c287fe75202d947374042b0679f4 | https://github.com/danger/danger/blob/0d6d09f2d949c287fe75202d947374042b0679f4/lib/danger/core_ext/file_list.rb#L9-L14 | train | Returns true if the file matches the pattern | [
30522,
13366,
2421,
1029,
1006,
5418,
1007,
2969,
1012,
2169,
2079,
1064,
2783,
1064,
2709,
2995,
2065,
5371,
1012,
1042,
2078,
18900,
2818,
1006,
5418,
1010,
2783,
1007,
1064,
1064,
5418,
1027,
1027,
2783,
2203,
2709,
6270,
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... |
meew0/discordrb | lib/discordrb/bot.rb | Discordrb.Bot.create_guild_role | def create_guild_role(data)
role_data = data['role']
server_id = data['guild_id'].to_i
server = @servers[server_id]
new_role = Role.new(role_data, self, server)
existing_role = server.role(new_role.id)
if existing_role
existing_role.update_from(new_role)
else
server.add_role(new_role)
end
end | ruby | def create_guild_role(data)
role_data = data['role']
server_id = data['guild_id'].to_i
server = @servers[server_id]
new_role = Role.new(role_data, self, server)
existing_role = server.role(new_role.id)
if existing_role
existing_role.update_from(new_role)
else
server.add_role(new_role)
end
end | [
"def",
"create_guild_role",
"(",
"data",
")",
"role_data",
"=",
"data",
"[",
"'role'",
"]",
"server_id",
"=",
"data",
"[",
"'guild_id'",
"]",
".",
"to_i",
"server",
"=",
"@servers",
"[",
"server_id",
"]",
"new_role",
"=",
"Role",
".",
"new",
"(",
"role_d... | Internal handler for GUILD_ROLE_CREATE | [
"Internal",
"handler",
"for",
"GUILD_ROLE_CREATE"
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/bot.rb#L921-L932 | train | Create a guild role | [
30522,
13366,
3443,
1035,
9054,
1035,
2535,
1006,
2951,
1007,
2535,
1035,
2951,
1027,
2951,
1031,
1005,
2535,
1005,
1033,
8241,
1035,
8909,
1027,
2951,
1031,
1005,
9054,
1035,
8909,
1005,
1033,
1012,
2000,
1035,
1045,
8241,
1027,
1030,
14... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.Base.filter! | def filter!(type, base = settings)
filter! type, base.superclass if base.superclass.respond_to?(:filters)
base.filters[type].each { |args| process_route(*args) }
end | ruby | def filter!(type, base = settings)
filter! type, base.superclass if base.superclass.respond_to?(:filters)
base.filters[type].each { |args| process_route(*args) }
end | [
"def",
"filter!",
"(",
"type",
",",
"base",
"=",
"settings",
")",
"filter!",
"type",
",",
"base",
".",
"superclass",
"if",
"base",
".",
"superclass",
".",
"respond_to?",
"(",
":filters",
")",
"base",
".",
"filters",
"[",
"type",
"]",
".",
"each",
"{",
... | Run filters defined on the class and all superclasses. | [
"Run",
"filters",
"defined",
"on",
"the",
"class",
"and",
"all",
"superclasses",
"."
] | 9116c90fcbb82ac03b4b33c58cfbde1fcf745e99 | https://github.com/github/linguist/blob/9116c90fcbb82ac03b4b33c58cfbde1fcf745e99/samples/Ruby/sinatra.rb#L831-L834 | train | Filters the route | [
30522,
13366,
11307,
999,
1006,
2828,
1010,
2918,
1027,
10906,
1007,
11307,
999,
2828,
1010,
2918,
1012,
3565,
26266,
2065,
2918,
1012,
3565,
26266,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
17736,
1007,
2918,
1012,
17736,
1031,
2828,
1033,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_relay/lib/2016-07-01/generated/azure_mgmt_relay/hybrid_connections.rb | Azure::Relay::Mgmt::V2016_07_01.HybridConnections.list_by_namespace | def list_by_namespace(resource_group_name, namespace_name, custom_headers:nil)
first_page = list_by_namespace_as_lazy(resource_group_name, namespace_name, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_by_namespace(resource_group_name, namespace_name, custom_headers:nil)
first_page = list_by_namespace_as_lazy(resource_group_name, namespace_name, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_by_namespace",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_by_namespace_as_lazy",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"custom_headers",
":custom_headers",
")",
"first_... | Lists the HybridConnection within the namespace.
@param resource_group_name [String] Name of the Resource group within the
Azure subscription.
@param namespace_name [String] The Namespace Name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<HybridConnection>] operation results. | [
"Lists",
"the",
"HybridConnection",
"within",
"the",
"namespace",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_relay/lib/2016-07-01/generated/azure_mgmt_relay/hybrid_connections.rb#L36-L39 | train | Gets all the vulnerability assessment of a namespace. | [
30522,
13366,
2862,
1035,
2011,
1035,
3415,
15327,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3415,
15327,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2862,
1035,
2011,
1035,
3415,
15327,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.get_aad_metadata | def get_aad_metadata(timeout:60, custom_headers:nil)
response = get_aad_metadata_async(timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_aad_metadata(timeout:60, custom_headers:nil)
response = get_aad_metadata_async(timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_aad_metadata",
"(",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_aad_metadata_async",
"(",
"timeout",
":",
"timeout",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unles... | Gets the Azure Active Directory metadata used for secured connection to
cluster.
Gets the Azure Active Directory metadata used for secured connection to
cluster.
This API is not supposed to be called separately. It provides information
needed to set up an Azure Active Directory secured connection with a Service
Fabric cluster.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [AadMetadataObject] operation results. | [
"Gets",
"the",
"Azure",
"Active",
"Directory",
"metadata",
"used",
"for",
"secured",
"connection",
"to",
"cluster",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L3106-L3109 | train | Gets the metadata of the AAD. | [
30522,
13366,
2131,
1035,
9779,
2094,
1035,
27425,
1006,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
9779,
2094,
1035,
27425,
1035,
2004,
6038,
2278,
1006,
2051,
5833,
1024,
2051,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/customer_creation_source_filter.rb | SquareConnect.CustomerCreationSourceFilter.rule= | def rule=(rule)
validator = EnumAttributeValidator.new('String', ["INCLUDE", "EXCLUDE"])
unless validator.valid?(rule)
fail ArgumentError, "invalid value for 'rule', must be one of #{validator.allowable_values}."
end
@rule = rule
end | ruby | def rule=(rule)
validator = EnumAttributeValidator.new('String', ["INCLUDE", "EXCLUDE"])
unless validator.valid?(rule)
fail ArgumentError, "invalid value for 'rule', must be one of #{validator.allowable_values}."
end
@rule = rule
end | [
"def",
"rule",
"=",
"(",
"rule",
")",
"validator",
"=",
"EnumAttributeValidator",
".",
"new",
"(",
"'String'",
",",
"[",
"\"INCLUDE\"",
",",
"\"EXCLUDE\"",
"]",
")",
"unless",
"validator",
".",
"valid?",
"(",
"rule",
")",
"fail",
"ArgumentError",
",",
"\"i... | Custom attribute writer method checking allowed values (enum).
@param [Object] rule 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/customer_creation_source_filter.rb#L96-L102 | train | Set the rule to use for this filter. | [
30522,
13366,
3627,
1027,
1006,
3627,
1007,
9398,
8844,
1027,
4372,
12248,
4779,
3089,
8569,
2618,
10175,
8524,
4263,
1012,
2047,
1006,
1005,
5164,
1005,
1010,
1031,
1000,
2421,
1000,
1010,
1000,
23329,
1000,
1033,
1007,
4983,
9398,
8844,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.copy_image_store_content_with_http_info | def copy_image_store_content_with_http_info(image_store_copy_description, timeout:60, custom_headers:nil)
copy_image_store_content_async(image_store_copy_description, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def copy_image_store_content_with_http_info(image_store_copy_description, timeout:60, custom_headers:nil)
copy_image_store_content_async(image_store_copy_description, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"copy_image_store_content_with_http_info",
"(",
"image_store_copy_description",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"copy_image_store_content_async",
"(",
"image_store_copy_description",
",",
"timeout",
":",
"timeout",
",",
"custom_head... | Copies image store content internally
Copies the image store content from the source image store relative path to
the destination image store relative path.
@param image_store_copy_description [ImageStoreCopyDescription] Describes the
copy description for the image store.
@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. | [
"Copies",
"image",
"store",
"content",
"internally"
] | 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#L19644-L19646 | train | Copies the image store content to an image store. | [
30522,
13366,
6100,
1035,
3746,
1035,
3573,
1035,
4180,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
3746,
1035,
3573,
1035,
6100,
1035,
6412,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
6100,
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... |
tongueroo/jets | lib/jets/router.rb | Jets.Router.resources | def resources(name)
get "#{name}", to: "#{name}#index"
get "#{name}/new", to: "#{name}#new" unless api_mode?
get "#{name}/:id", to: "#{name}#show"
post "#{name}", to: "#{name}#create"
get "#{name}/:id/edit", to: "#{name}#edit" unless api_mode?
put "#{name}/:id", to: "#{name}#update"
post "#{name}/:id", to: "#{name}#update" # for binary uploads
patch "#{name}/:id", to: "#{name}#update"
delete "#{name}/:id", to: "#{name}#delete"
end | ruby | def resources(name)
get "#{name}", to: "#{name}#index"
get "#{name}/new", to: "#{name}#new" unless api_mode?
get "#{name}/:id", to: "#{name}#show"
post "#{name}", to: "#{name}#create"
get "#{name}/:id/edit", to: "#{name}#edit" unless api_mode?
put "#{name}/:id", to: "#{name}#update"
post "#{name}/:id", to: "#{name}#update" # for binary uploads
patch "#{name}/:id", to: "#{name}#update"
delete "#{name}/:id", to: "#{name}#delete"
end | [
"def",
"resources",
"(",
"name",
")",
"get",
"\"#{name}\"",
",",
"to",
":",
"\"#{name}#index\"",
"get",
"\"#{name}/new\"",
",",
"to",
":",
"\"#{name}#new\"",
"unless",
"api_mode?",
"get",
"\"#{name}/:id\"",
",",
"to",
":",
"\"#{name}#show\"",
"post",
"\"#{name}\""... | resources macro expands to all the routes | [
"resources",
"macro",
"expands",
"to",
"all",
"the",
"routes"
] | 46943a519224067e58aa3e2d5656e3ca083150f9 | https://github.com/tongueroo/jets/blob/46943a519224067e58aa3e2d5656e3ca083150f9/lib/jets/router.rb#L60-L70 | train | Get all the resources for a given name | [
30522,
13366,
4219,
1006,
2171,
1007,
2131,
1000,
1001,
1063,
2171,
1065,
1000,
1010,
2000,
1024,
1000,
1001,
1063,
2171,
1065,
1001,
5950,
1000,
2131,
1000,
1001,
1063,
2171,
1065,
1013,
2047,
1000,
1010,
2000,
1024,
1000,
1001,
1063,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
primer/octicons | lib/octicons_gem/lib/octicons/octicon.rb | Octicons.Octicon.size | def size
size = {
width: @width,
height: @height
}
# Specific size
unless @options[:width].nil? && @options[:height].nil?
size[:width] = @options[:width].nil? ? calculate_width(@options[:height]) : @options[:width]
size[:height] = @options[:height].nil? ? calculate_height(@options[:width]) : @options[:height]
end
size
end | ruby | def size
size = {
width: @width,
height: @height
}
# Specific size
unless @options[:width].nil? && @options[:height].nil?
size[:width] = @options[:width].nil? ? calculate_width(@options[:height]) : @options[:width]
size[:height] = @options[:height].nil? ? calculate_height(@options[:width]) : @options[:height]
end
size
end | [
"def",
"size",
"size",
"=",
"{",
"width",
":",
"@width",
",",
"height",
":",
"@height",
"}",
"# Specific size",
"unless",
"@options",
"[",
":width",
"]",
".",
"nil?",
"&&",
"@options",
"[",
":height",
"]",
".",
"nil?",
"size",
"[",
":width",
"]",
"=",
... | determine the height and width of the octicon based on :size option | [
"determine",
"the",
"height",
"and",
"width",
"of",
"the",
"octicon",
"based",
"on",
":",
"size",
"option"
] | 6fe5475945d5633818b49ce55619ec039789b1c8 | https://github.com/primer/octicons/blob/6fe5475945d5633818b49ce55619ec039789b1c8/lib/octicons_gem/lib/octicons/octicon.rb#L65-L78 | train | Returns the size of the image | [
30522,
13366,
2946,
2946,
1027,
1063,
9381,
1024,
1030,
9381,
1010,
4578,
1024,
1030,
4578,
1065,
1001,
3563,
2946,
4983,
1030,
7047,
1031,
1024,
9381,
1033,
1012,
9152,
2140,
1029,
1004,
1004,
1030,
7047,
1031,
1024,
4578,
1033,
1012,
91... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/static_file.rb | Jekyll.StaticFile.url | def url
@url ||= begin
base = if @collection.nil?
cleaned_relative_path
else
Jekyll::URL.new(
:template => @collection.url_template,
:placeholders => placeholders
)
end.to_s.chomp("/")
base << extname
end
end | ruby | def url
@url ||= begin
base = if @collection.nil?
cleaned_relative_path
else
Jekyll::URL.new(
:template => @collection.url_template,
:placeholders => placeholders
)
end.to_s.chomp("/")
base << extname
end
end | [
"def",
"url",
"@url",
"||=",
"begin",
"base",
"=",
"if",
"@collection",
".",
"nil?",
"cleaned_relative_path",
"else",
"Jekyll",
"::",
"URL",
".",
"new",
"(",
":template",
"=>",
"@collection",
".",
"url_template",
",",
":placeholders",
"=>",
"placeholders",
")"... | Applies a similar URL-building technique as Jekyll::Document that takes
the collection's URL template into account. The default URL template can
be overriden in the collection's configuration in _config.yml. | [
"Applies",
"a",
"similar",
"URL",
"-",
"building",
"technique",
"as",
"Jekyll",
"::",
"Document",
"that",
"takes",
"the",
"collection",
"s",
"URL",
"template",
"into",
"account",
".",
"The",
"default",
"URL",
"template",
"can",
"be",
"overriden",
"in",
"the"... | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/static_file.rb#L158-L170 | train | Returns the URL for the current resource. | [
30522,
13366,
24471,
2140,
1030,
24471,
2140,
1064,
1064,
1027,
4088,
2918,
1027,
2065,
1030,
3074,
1012,
9152,
2140,
1029,
12176,
1035,
5816,
1035,
4130,
2842,
15333,
4801,
3363,
1024,
1024,
24471,
2140,
1012,
2047,
1006,
1024,
23561,
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... |
sds/scss-lint | lib/scss_lint/linter/selector_format.rb | SCSSLint.Linter::SelectorFormat.violated_convention | def violated_convention(name_string, type)
convention_name = convention_name(type)
existing_convention = CONVENTIONS[convention_name]
convention = (existing_convention || {
validator: ->(name) { name =~ /#{convention_name}/ }
}).merge(
explanation: convention_explanation(type), # Allow explanation to be customized
)
convention unless convention[:validator].call(name_string)
end | ruby | def violated_convention(name_string, type)
convention_name = convention_name(type)
existing_convention = CONVENTIONS[convention_name]
convention = (existing_convention || {
validator: ->(name) { name =~ /#{convention_name}/ }
}).merge(
explanation: convention_explanation(type), # Allow explanation to be customized
)
convention unless convention[:validator].call(name_string)
end | [
"def",
"violated_convention",
"(",
"name_string",
",",
"type",
")",
"convention_name",
"=",
"convention_name",
"(",
"type",
")",
"existing_convention",
"=",
"CONVENTIONS",
"[",
"convention_name",
"]",
"convention",
"=",
"(",
"existing_convention",
"||",
"{",
"valida... | Checks the given name and returns the violated convention if it failed. | [
"Checks",
"the",
"given",
"name",
"and",
"returns",
"the",
"violated",
"convention",
"if",
"it",
"failed",
"."
] | e99afe4ede041a431a06e585c12ce82f6ad50116 | https://github.com/sds/scss-lint/blob/e99afe4ede041a431a06e585c12ce82f6ad50116/lib/scss_lint/linter/selector_format.rb#L83-L95 | train | Returns the convention that is violated by the given name_string. | [
30522,
13366,
14424,
1035,
4680,
1006,
2171,
1035,
5164,
1010,
2828,
1007,
4680,
1035,
2171,
1027,
4680,
1035,
2171,
1006,
2828,
1007,
4493,
1035,
4680,
1027,
12472,
1031,
4680,
1035,
2171,
1033,
4680,
1027,
1006,
4493,
1035,
4680,
1064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/elastic_pools.rb | Azure::SQL::Mgmt::V2014_04_01.ElasticPools.list_metric_definitions_with_http_info | def list_metric_definitions_with_http_info(resource_group_name, server_name, elastic_pool_name, custom_headers:nil)
list_metric_definitions_async(resource_group_name, server_name, elastic_pool_name, custom_headers:custom_headers).value!
end | ruby | def list_metric_definitions_with_http_info(resource_group_name, server_name, elastic_pool_name, custom_headers:nil)
list_metric_definitions_async(resource_group_name, server_name, elastic_pool_name, custom_headers:custom_headers).value!
end | [
"def",
"list_metric_definitions_with_http_info",
"(",
"resource_group_name",
",",
"server_name",
",",
"elastic_pool_name",
",",
"custom_headers",
":",
"nil",
")",
"list_metric_definitions_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"elastic_pool_name",
",",
... | Returns elastic pool metric definitions.
@param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param server_name [String] The name of the server.
@param elastic_pool_name [String] The name of the elastic pool.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Returns",
"elastic",
"pool",
"metric",
"definitions",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/elastic_pools.rb#L567-L569 | train | Gets the metric definitions for the elastic pool. | [
30522,
13366,
2862,
1035,
12046,
1035,
15182,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
21274,
1035,
4770,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2862,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/haml-lint | lib/haml_lint/document.rb | HamlLint.Document.strip_frontmatter | def strip_frontmatter(source)
frontmatter = /
# From the start of the string
\A
# First-capture match --- followed by optional whitespace up
# to a newline then 0 or more chars followed by an optional newline.
# This matches the --- and the contents of the frontmatter
(---\s*\n.*?\n?)
# From the start of the line
^
# Second capture match --- or ... followed by optional whitespace
# and newline. This matches the closing --- for the frontmatter.
(---|\.\.\.)\s*$\n?/mx
if config['skip_frontmatter'] && match = source.match(frontmatter)
newlines = match[0].count("\n")
source.sub!(frontmatter, "\n" * newlines)
end
source
end | ruby | def strip_frontmatter(source)
frontmatter = /
# From the start of the string
\A
# First-capture match --- followed by optional whitespace up
# to a newline then 0 or more chars followed by an optional newline.
# This matches the --- and the contents of the frontmatter
(---\s*\n.*?\n?)
# From the start of the line
^
# Second capture match --- or ... followed by optional whitespace
# and newline. This matches the closing --- for the frontmatter.
(---|\.\.\.)\s*$\n?/mx
if config['skip_frontmatter'] && match = source.match(frontmatter)
newlines = match[0].count("\n")
source.sub!(frontmatter, "\n" * newlines)
end
source
end | [
"def",
"strip_frontmatter",
"(",
"source",
")",
"frontmatter",
"=",
"/",
"\\A",
"\\s",
"\\n",
"\\n",
"\\.",
"\\.",
"\\.",
"\\s",
"\\n",
"/mx",
"if",
"config",
"[",
"'skip_frontmatter'",
"]",
"&&",
"match",
"=",
"source",
".",
"match",
"(",
"frontmatter",
... | Removes YAML frontmatter | [
"Removes",
"YAML",
"frontmatter"
] | 024c773667e54cf88db938c2b368977005d70ee8 | https://github.com/sds/haml-lint/blob/024c773667e54cf88db938c2b368977005d70ee8/lib/haml_lint/document.rb#L102-L122 | train | Strip frontmatter from the source | [
30522,
13366,
6167,
1035,
2392,
18900,
3334,
1006,
3120,
1007,
2392,
18900,
3334,
1027,
1013,
1001,
2013,
1996,
2707,
1997,
1996,
5164,
1032,
1037,
1001,
2034,
1011,
5425,
2674,
1011,
1011,
1011,
2628,
2011,
11887,
12461,
15327,
2039,
1001,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
randym/axlsx | lib/axlsx/workbook/workbook.rb | Axlsx.Workbook.[] | def [](cell_def)
sheet_name = cell_def.split('!')[0] if cell_def.match('!')
worksheet = self.worksheets.select { |s| s.name == sheet_name }.first
raise ArgumentError, 'Unknown Sheet' unless sheet_name && worksheet.is_a?(Worksheet)
worksheet[cell_def.gsub(/.+!/,"")]
end | ruby | def [](cell_def)
sheet_name = cell_def.split('!')[0] if cell_def.match('!')
worksheet = self.worksheets.select { |s| s.name == sheet_name }.first
raise ArgumentError, 'Unknown Sheet' unless sheet_name && worksheet.is_a?(Worksheet)
worksheet[cell_def.gsub(/.+!/,"")]
end | [
"def",
"[]",
"(",
"cell_def",
")",
"sheet_name",
"=",
"cell_def",
".",
"split",
"(",
"'!'",
")",
"[",
"0",
"]",
"if",
"cell_def",
".",
"match",
"(",
"'!'",
")",
"worksheet",
"=",
"self",
".",
"worksheets",
".",
"select",
"{",
"|",
"s",
"|",
"s",
... | returns a range of cells in a worksheet
@param [String] cell_def The excel style reference defining the worksheet and cells. The range must specify the sheet to
retrieve the cells from. e.g. range('Sheet1!A1:B2') will return an array of four cells [A1, A2, B1, B2] while range('Sheet1!A1') will return a single Cell.
@return [Cell, Array] | [
"returns",
"a",
"range",
"of",
"cells",
"in",
"a",
"worksheet"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/workbook.rb#L344-L349 | train | Returns the index of the cell_def in the worksheet. | [
30522,
13366,
1031,
1033,
1006,
3526,
1035,
13366,
1007,
7123,
1035,
2171,
1027,
3526,
1035,
13366,
1012,
3975,
1006,
1005,
999,
1005,
1007,
1031,
1014,
1033,
2065,
3526,
1035,
13366,
1012,
2674,
1006,
1005,
999,
1005,
1007,
2573,
21030,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/hub_virtual_network_connections.rb | Azure::Network::Mgmt::V2018_07_01.HubVirtualNetworkConnections.list | def list(resource_group_name, virtual_hub_name, custom_headers:nil)
first_page = list_as_lazy(resource_group_name, virtual_hub_name, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list(resource_group_name, virtual_hub_name, custom_headers:nil)
first_page = list_as_lazy(resource_group_name, virtual_hub_name, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list",
"(",
"resource_group_name",
",",
"virtual_hub_name",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_as_lazy",
"(",
"resource_group_name",
",",
"virtual_hub_name",
",",
"custom_headers",
":custom_headers",
")",
"first_page",
".",
"get_a... | Retrieves the details of all HubVirtualNetworkConnections.
@param resource_group_name [String] The resource group name of the
VirtualHub.
@param virtual_hub_name [String] The name of the VirtualHub.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<HubVirtualNetworkConnection>] operation results. | [
"Retrieves",
"the",
"details",
"of",
"all",
"HubVirtualNetworkConnections",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/hub_virtual_network_connections.rb#L134-L137 | train | Gets all the virtual hubs in a virtual hub. | [
30522,
13366,
2862,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7484,
1035,
9594,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2862,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.get_closed_list_with_http_info | def get_closed_list_with_http_info(app_id, version_id, cl_entity_id, custom_headers:nil)
get_closed_list_async(app_id, version_id, cl_entity_id, custom_headers:custom_headers).value!
end | ruby | def get_closed_list_with_http_info(app_id, version_id, cl_entity_id, custom_headers:nil)
get_closed_list_async(app_id, version_id, cl_entity_id, custom_headers:custom_headers).value!
end | [
"def",
"get_closed_list_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"cl_entity_id",
",",
"custom_headers",
":",
"nil",
")",
"get_closed_list_async",
"(",
"app_id",
",",
"version_id",
",",
"cl_entity_id",
",",
"custom_headers",
":custom_headers",
")",
".",
... | Gets information about a list entity in a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param cl_entity_id The list model 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. | [
"Gets",
"information",
"about",
"a",
"list",
"entity",
"in",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L3048-L3050 | train | Gets the list of all the entities in a version of the application. | [
30522,
13366,
2131,
1035,
2701,
1035,
2862,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
18856,
1035,
9178,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
2701,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/option_group.rb | Aws::RDS.OptionGroup.copy | def copy(options = {})
options = options.merge(source_option_group_identifier: @name)
resp = @client.copy_option_group(options)
OptionGroup.new(
name: resp.data.option_group.option_group_name,
data: resp.data.option_group,
client: @client
)
end | ruby | def copy(options = {})
options = options.merge(source_option_group_identifier: @name)
resp = @client.copy_option_group(options)
OptionGroup.new(
name: resp.data.option_group.option_group_name,
data: resp.data.option_group,
client: @client
)
end | [
"def",
"copy",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"source_option_group_identifier",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"copy_option_group",
"(",
"options",
")",
"OptionGroup",
".",
"new",
"(",
"na... | @example Request syntax with placeholder values
optiongroup = option_group.copy({
target_option_group_identifier: "String", # required
target_option_group_description: "String", # required
tags: [
{
key: "String",
value: "String",
},
],
})
@param [Hash] options ({})
@option options [required, String] :target_option_group_identifier
The identifier for the copied option group.
Constraints:
* Can't be null, empty, or blank
* Must contain from 1 to 255 letters, numbers, or hyphens
* First character must be a letter
* Can't end with a hyphen or contain two consecutive hyphens
Example: `my-option-group`
@option options [required, String] :target_option_group_description
The description for the copied option group.
@option options [Array<Types::Tag>] :tags
A list of tags. For more information, see [Tagging Amazon RDS
Resources][1] in the *Amazon RDS User Guide.*
[1]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.html
@return [OptionGroup] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-rds/lib/aws-sdk-rds/option_group.rb#L293-L301 | train | Copy the option group to the current one. | [
30522,
13366,
6100,
30524,
1035,
5724,
1035,
2177,
1006,
7047,
1007,
5724,
17058,
1012,
2047,
1006,
2171,
1024,
24501,
2361,
1012,
2951,
1012,
5724,
1035,
2177,
1012,
5724,
1035,
2177,
1035,
2171,
1010,
2951,
1024,
24501,
2361,
1012,
2951,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
github-changelog-generator/github-changelog-generator | lib/github_changelog_generator.rb | GitHubChangelogGenerator.ChangelogGenerator.run | def run
log = @generator.compound_changelog
if @options.write_to_file?
output_filename = @options[:output].to_s
File.open(output_filename, "wb") { |file| file.write(log) }
puts "Done!"
puts "Generated log placed in #{Dir.pwd}/#{output_filename}"
else
puts log
end
end | ruby | def run
log = @generator.compound_changelog
if @options.write_to_file?
output_filename = @options[:output].to_s
File.open(output_filename, "wb") { |file| file.write(log) }
puts "Done!"
puts "Generated log placed in #{Dir.pwd}/#{output_filename}"
else
puts log
end
end | [
"def",
"run",
"log",
"=",
"@generator",
".",
"compound_changelog",
"if",
"@options",
".",
"write_to_file?",
"output_filename",
"=",
"@options",
"[",
":output",
"]",
".",
"to_s",
"File",
".",
"open",
"(",
"output_filename",
",",
"\"wb\"",
")",
"{",
"|",
"file... | Class, responsible for whole changelog generation cycle
@return initialised instance of ChangelogGenerator
The entry point of this script to generate changelog
@raise (ChangelogGeneratorError) Is thrown when one of specified tags was not found in list of tags. | [
"Class",
"responsible",
"for",
"whole",
"changelog",
"generation",
"cycle"
] | f18c64b5cc0d7473b059275b88385ac11ca8b564 | https://github.com/github-changelog-generator/github-changelog-generator/blob/f18c64b5cc0d7473b059275b88385ac11ca8b564/lib/github_changelog_generator.rb#L34-L45 | train | Runs the compound changelog generator. | [
30522,
13366,
2448,
8833,
1027,
1030,
13103,
1012,
7328,
1035,
2689,
21197,
2065,
1030,
7047,
1012,
4339,
1035,
2000,
1035,
5371,
1029,
6434,
1035,
5371,
18442,
1027,
1030,
7047,
1031,
1024,
6434,
1033,
1012,
2000,
1035,
1055,
5371,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
puppetlabs/puppet | lib/puppet/application.rb | Puppet.Application.run | def run
# I don't really like the names of these lifecycle phases. It would be nice to change them to some more meaningful
# names, and make deprecated aliases. --cprice 2012-03-16
exit_on_fail(_("Could not get application-specific default settings")) do
initialize_app_defaults
end
Puppet::ApplicationSupport.push_application_context(self.class.run_mode, self.class.get_environment_mode)
exit_on_fail(_("Could not initialize")) { preinit }
exit_on_fail(_("Could not parse application options")) { parse_options }
exit_on_fail(_("Could not prepare for execution")) { setup }
if deprecated?
Puppet.deprecation_warning(_("`puppet %{name}` is deprecated and will be removed in a future release.") % { name: name })
end
exit_on_fail(_("Could not configure routes from %{route_file}") % { route_file: Puppet[:route_file] }) { configure_indirector_routes }
exit_on_fail(_("Could not log runtime debug info")) { log_runtime_environment }
exit_on_fail(_("Could not run")) { run_command }
end | ruby | def run
# I don't really like the names of these lifecycle phases. It would be nice to change them to some more meaningful
# names, and make deprecated aliases. --cprice 2012-03-16
exit_on_fail(_("Could not get application-specific default settings")) do
initialize_app_defaults
end
Puppet::ApplicationSupport.push_application_context(self.class.run_mode, self.class.get_environment_mode)
exit_on_fail(_("Could not initialize")) { preinit }
exit_on_fail(_("Could not parse application options")) { parse_options }
exit_on_fail(_("Could not prepare for execution")) { setup }
if deprecated?
Puppet.deprecation_warning(_("`puppet %{name}` is deprecated and will be removed in a future release.") % { name: name })
end
exit_on_fail(_("Could not configure routes from %{route_file}") % { route_file: Puppet[:route_file] }) { configure_indirector_routes }
exit_on_fail(_("Could not log runtime debug info")) { log_runtime_environment }
exit_on_fail(_("Could not run")) { run_command }
end | [
"def",
"run",
"# I don't really like the names of these lifecycle phases. It would be nice to change them to some more meaningful",
"# names, and make deprecated aliases. --cprice 2012-03-16",
"exit_on_fail",
"(",
"_",
"(",
"\"Could not get application-specific default settings\"",
")",
")",
... | Execute the application.
@api public
@return [void] | [
"Execute",
"the",
"application",
"."
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/application.rb#L361-L383 | train | Runs the application lifecycle phases. | [
30522,
13366,
2448,
1001,
1045,
2123,
1005,
1056,
2428,
2066,
1996,
3415,
1997,
2122,
2166,
23490,
12335,
1012,
2009,
2052,
2022,
3835,
2000,
2689,
2068,
2000,
2070,
2062,
15902,
1001,
3415,
1010,
1998,
2191,
2139,
28139,
12921,
14593,
2229... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-ec2/lib/aws-sdk-ec2/route_table.rb | Aws::EC2.RouteTable.associate_with_subnet | def associate_with_subnet(options = {})
options = options.merge(route_table_id: @id)
resp = @client.associate_route_table(options)
RouteTableAssociation.new(
id: resp.data.association_id,
client: @client
)
end | ruby | def associate_with_subnet(options = {})
options = options.merge(route_table_id: @id)
resp = @client.associate_route_table(options)
RouteTableAssociation.new(
id: resp.data.association_id,
client: @client
)
end | [
"def",
"associate_with_subnet",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"route_table_id",
":",
"@id",
")",
"resp",
"=",
"@client",
".",
"associate_route_table",
"(",
"options",
")",
"RouteTableAssociation",
".",
"new",... | @!group Actions
@example Request syntax with placeholder values
routetableassociation = route_table.associate_with_subnet({
dry_run: false,
subnet_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] :subnet_id
The ID of the subnet.
@return [RouteTableAssociation] | [
"@!group",
"Actions",
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/route_table.rb#L205-L212 | train | Associate this route table with a subnet | [
30522,
13366,
5482,
1035,
2007,
1035,
4942,
7159,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
2799,
1035,
2795,
1035,
8909,
1024,
1030,
8909,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
5482,
1035,
2799,
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_web/lib/2015-08-01/generated/azure_mgmt_web/app_service_certificate_orders.rb | Azure::Web::Mgmt::V2015_08_01.AppServiceCertificateOrders.create_or_update | def create_or_update(resource_group_name, certificate_order_name, certificate_distinguished_name, custom_headers:nil)
response = create_or_update_async(resource_group_name, certificate_order_name, certificate_distinguished_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_or_update(resource_group_name, certificate_order_name, certificate_distinguished_name, custom_headers:nil)
response = create_or_update_async(resource_group_name, certificate_order_name, certificate_distinguished_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_or_update",
"(",
"resource_group_name",
",",
"certificate_order_name",
",",
"certificate_distinguished_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_or_update_async",
"(",
"resource_group_name",
",",
"certificate_order_name",
",",
"c... | Create or update a certificate purchase order.
Create or update a certificate purchase order.
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param certificate_order_name [String] Name of the certificate order.
@param certificate_distinguished_name [AppServiceCertificateOrder]
Distinguished name to to use for the certificate order.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [AppServiceCertificateOrder] operation results. | [
"Create",
"or",
"update",
"a",
"certificate",
"purchase",
"order",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2015-08-01/generated/azure_mgmt_web/app_service_certificate_orders.rb#L426-L429 | train | Creates or updates a certificate order certificate distinguished name. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8196,
1035,
2344,
1035,
2171,
1010,
8196,
1035,
5182,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3443,
1035,
2030,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
projectcypress/health-data-standards | lib/hqmf-parser/2.0/data_criteria.rb | HQMF2.DataCriteria.basic_setup | def basic_setup
@status = attr_val('./*/cda:statusCode/@code')
@id_xpath = './*/cda:id/@extension'
@id = "#{attr_val('./*/cda:id/@extension')}_#{attr_val('./*/cda:id/@root')}"
@comments = @entry.xpath("./#{CRITERIA_GLOB}/cda:text/cda:xml/cda:qdmUserComments/cda:item/text()",
HQMF2::Document::NAMESPACES).map(&:content)
@code_list_xpath = './*/cda:code'
@value_xpath = './*/cda:value'
@is_derived_specific_occurrence_variable = false
simple_extractions = DataCriteriaBaseExtractions.new(@entry)
@template_ids = simple_extractions.extract_template_ids
@local_variable_name = simple_extractions.extract_local_variable_name
@temporal_references = simple_extractions.extract_temporal_references
@derivation_operator = simple_extractions.extract_derivation_operator
@children_criteria = simple_extractions.extract_child_criteria
@subset_operators = simple_extractions.extract_subset_operators
@negation, @negation_code_list_id = simple_extractions.extract_negation
end | ruby | def basic_setup
@status = attr_val('./*/cda:statusCode/@code')
@id_xpath = './*/cda:id/@extension'
@id = "#{attr_val('./*/cda:id/@extension')}_#{attr_val('./*/cda:id/@root')}"
@comments = @entry.xpath("./#{CRITERIA_GLOB}/cda:text/cda:xml/cda:qdmUserComments/cda:item/text()",
HQMF2::Document::NAMESPACES).map(&:content)
@code_list_xpath = './*/cda:code'
@value_xpath = './*/cda:value'
@is_derived_specific_occurrence_variable = false
simple_extractions = DataCriteriaBaseExtractions.new(@entry)
@template_ids = simple_extractions.extract_template_ids
@local_variable_name = simple_extractions.extract_local_variable_name
@temporal_references = simple_extractions.extract_temporal_references
@derivation_operator = simple_extractions.extract_derivation_operator
@children_criteria = simple_extractions.extract_child_criteria
@subset_operators = simple_extractions.extract_subset_operators
@negation, @negation_code_list_id = simple_extractions.extract_negation
end | [
"def",
"basic_setup",
"@status",
"=",
"attr_val",
"(",
"'./*/cda:statusCode/@code'",
")",
"@id_xpath",
"=",
"'./*/cda:id/@extension'",
"@id",
"=",
"\"#{attr_val('./*/cda:id/@extension')}_#{attr_val('./*/cda:id/@root')}\"",
"@comments",
"=",
"@entry",
".",
"xpath",
"(",
"\"./#... | Handles elments that can be extracted directly from the xml. Utilises the "BaseExtractions" class. | [
"Handles",
"elments",
"that",
"can",
"be",
"extracted",
"directly",
"from",
"the",
"xml",
".",
"Utilises",
"the",
"BaseExtractions",
"class",
"."
] | 252d4f0927c513eacde6b9ea41b76faa1423c34b | https://github.com/projectcypress/health-data-standards/blob/252d4f0927c513eacde6b9ea41b76faa1423c34b/lib/hqmf-parser/2.0/data_criteria.rb#L184-L201 | train | This method is called by the basic_setup method. | [
30522,
13366,
3937,
1035,
16437,
1030,
3570,
1027,
2012,
16344,
1035,
11748,
1006,
1005,
1012,
1013,
1008,
1013,
3729,
2050,
1024,
3570,
16044,
1013,
1030,
3642,
1005,
1007,
1030,
8909,
1035,
26726,
8988,
1027,
1005,
1012,
1013,
1008,
1013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_customvisiontraining/lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb | Azure::CognitiveServices::Customvisiontraining::V3_0.CustomvisiontrainingClient.train_project_with_http_info | def train_project_with_http_info(project_id, training_type:nil, reserved_budget_in_hours:0, force_train:false, notification_email_address:nil, custom_headers:nil)
train_project_async(project_id, training_type:training_type, reserved_budget_in_hours:reserved_budget_in_hours, force_train:force_train, notification_email_address:notification_email_address, custom_headers:custom_headers).value!
end | ruby | def train_project_with_http_info(project_id, training_type:nil, reserved_budget_in_hours:0, force_train:false, notification_email_address:nil, custom_headers:nil)
train_project_async(project_id, training_type:training_type, reserved_budget_in_hours:reserved_budget_in_hours, force_train:force_train, notification_email_address:notification_email_address, custom_headers:custom_headers).value!
end | [
"def",
"train_project_with_http_info",
"(",
"project_id",
",",
"training_type",
":",
"nil",
",",
"reserved_budget_in_hours",
":",
"0",
",",
"force_train",
":",
"false",
",",
"notification_email_address",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"train_pro... | Queues project for training.
@param project_id The project id.
@param training_type [Enum] The type of training to use to train the project
(default: Regular). Possible values include: 'Regular', 'Advanced'
@param reserved_budget_in_hours [Integer] The number of hours reserved as
budget for training (if applicable).
@param force_train [Boolean] Whether to force train even if dataset and
configuration does not change (default: false).
@param notification_email_address [String] The email address to send
notification to when training finishes (default: null).
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Queues",
"project",
"for",
"training",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_customvisiontraining/lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb#L3329-L3331 | train | Train a project. | [
30522,
13366,
3345,
1035,
2622,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2622,
1035,
8909,
1010,
2731,
1035,
2828,
1024,
9152,
2140,
1010,
9235,
1035,
5166,
1035,
1999,
1035,
2847,
1024,
1014,
1010,
2486,
1035,
3345,
1024,
6270,
1010,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/workflow_triggers.rb | Azure::Logic::Mgmt::V2016_06_01.WorkflowTriggers.reset_with_http_info | def reset_with_http_info(resource_group_name, workflow_name, trigger_name, custom_headers:nil)
reset_async(resource_group_name, workflow_name, trigger_name, custom_headers:custom_headers).value!
end | ruby | def reset_with_http_info(resource_group_name, workflow_name, trigger_name, custom_headers:nil)
reset_async(resource_group_name, workflow_name, trigger_name, custom_headers:custom_headers).value!
end | [
"def",
"reset_with_http_info",
"(",
"resource_group_name",
",",
"workflow_name",
",",
"trigger_name",
",",
"custom_headers",
":",
"nil",
")",
"reset_async",
"(",
"resource_group_name",
",",
"workflow_name",
",",
"trigger_name",
",",
"custom_headers",
":custom_headers",
... | Resets a workflow trigger.
@param resource_group_name [String] The resource group name.
@param workflow_name [String] The workflow name.
@param trigger_name [String] The workflow trigger name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Resets",
"a",
"workflow",
"trigger",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/workflow_triggers.rb#L244-L246 | train | Resets the specified trigger. | [
30522,
13366,
25141,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2147,
12314,
1035,
2171,
1010,
9495,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
25141,
1035,
2004,
6038,
2278,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_api_management/lib/2019-01-01/generated/azure_mgmt_api_management/api_operation.rb | Azure::ApiManagement::Mgmt::V2019_01_01.ApiOperation.list_by_api | def list_by_api(resource_group_name, service_name, api_id, filter:nil, top:nil, skip:nil, tags:nil, custom_headers:nil)
first_page = list_by_api_as_lazy(resource_group_name, service_name, api_id, filter:filter, top:top, skip:skip, tags:tags, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_by_api(resource_group_name, service_name, api_id, filter:nil, top:nil, skip:nil, tags:nil, custom_headers:nil)
first_page = list_by_api_as_lazy(resource_group_name, service_name, api_id, filter:filter, top:top, skip:skip, tags:tags, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_by_api",
"(",
"resource_group_name",
",",
"service_name",
",",
"api_id",
",",
"filter",
":",
"nil",
",",
"top",
":",
"nil",
",",
"skip",
":",
"nil",
",",
"tags",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_by... | Lists a collection of the operations for the specified API.
@param resource_group_name [String] The name of the resource group.
@param service_name [String] The name of the API Management service.
@param api_id [String] API revision identifier. Must be unique in the current
API Management service instance. Non-current revision has ;rev=n as a suffix
where n is the revision number.
@param filter [String] | Field | Usage | Supported
operators | Supported functions
|</br>|-------------|-------------|-------------|-------------|</br>| name |
filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
| </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof,
contains, startswith, endswith | </br>| method | filter | ge, le, eq, ne, gt,
lt | substringof, contains, startswith, endswith | </br>| description |
filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith
| </br>| urlTemplate | filter | ge, le, eq, ne, gt, lt | substringof,
contains, startswith, endswith | </br>
@param top [Integer] Number of records to return.
@param skip [Integer] Number of records to skip.
@param tags [String] Include tags in the response.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<OperationContract>] operation results. | [
"Lists",
"a",
"collection",
"of",
"the",
"operations",
"for",
"the",
"specified",
"API",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2019-01-01/generated/azure_mgmt_api_management/api_operation.rb#L50-L53 | train | Gets all the items in a given API. | [
30522,
13366,
2862,
1035,
2011,
1035,
17928,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
17928,
1035,
8909,
1010,
11307,
1024,
9152,
2140,
1010,
2327,
1024,
9152,
2140,
1010,
13558,
1024,
9152,
2140,
1010,
22073,
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.create_role | def create_role(name: 'new role', colour: 0, hoist: false, mentionable: false, permissions: 104_324_161, reason: nil)
colour = colour.respond_to?(:combined) ? colour.combined : colour
permissions = if permissions.is_a?(Array)
Permissions.bits(permissions)
elsif permissions.respond_to?(:bits)
permissions.bits
else
permissions
end
response = API::Server.create_role(@bot.token, @id, name, colour, hoist, mentionable, permissions, reason)
role = Role.new(JSON.parse(response), @bot, self)
@roles << role
role
end | ruby | def create_role(name: 'new role', colour: 0, hoist: false, mentionable: false, permissions: 104_324_161, reason: nil)
colour = colour.respond_to?(:combined) ? colour.combined : colour
permissions = if permissions.is_a?(Array)
Permissions.bits(permissions)
elsif permissions.respond_to?(:bits)
permissions.bits
else
permissions
end
response = API::Server.create_role(@bot.token, @id, name, colour, hoist, mentionable, permissions, reason)
role = Role.new(JSON.parse(response), @bot, self)
@roles << role
role
end | [
"def",
"create_role",
"(",
"name",
":",
"'new role'",
",",
"colour",
":",
"0",
",",
"hoist",
":",
"false",
",",
"mentionable",
":",
"false",
",",
"permissions",
":",
"104_324_161",
",",
"reason",
":",
"nil",
")",
"colour",
"=",
"colour",
".",
"respond_to... | Creates a role on this server which can then be modified. It will be initialized
with the regular role defaults the client uses unless specified, i.e. name is "new role",
permissions are the default, colour is the default etc.
@param name [String] Name of the role to create
@param colour [Integer, ColourRGB, #combined] The roles colour
@param hoist [true, false]
@param mentionable [true, false]
@param permissions [Integer, Array<Symbol>, Permissions, #bits] The permissions to write to the new role.
@param reason [String] The reason the for the creation of this role.
@return [Role] the created role. | [
"Creates",
"a",
"role",
"on",
"this",
"server",
"which",
"can",
"then",
"be",
"modified",
".",
"It",
"will",
"be",
"initialized",
"with",
"the",
"regular",
"role",
"defaults",
"the",
"client",
"uses",
"unless",
"specified",
"i",
".",
"e",
".",
"name",
"i... | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/data/server.rb#L484-L500 | train | Creates a role | [
30522,
13366,
3443,
1035,
2535,
1006,
2171,
1024,
1005,
2047,
2535,
1005,
1010,
6120,
1024,
1014,
1010,
7570,
2923,
1024,
6270,
1010,
5254,
3085,
1024,
6270,
1010,
6656,
2015,
1024,
9645,
1035,
27234,
1035,
17365,
1010,
3114,
1024,
9152,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/network_watchers.rb | Azure::Network::Mgmt::V2018_08_01.NetworkWatchers.check_connectivity | def check_connectivity(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
response = check_connectivity_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def check_connectivity(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
response = check_connectivity_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"check_connectivity",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"check_connectivity_async",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"parameters",
",",
... | Verifies the possibility of establishing a direct TCP connection from a
virtual machine to a given endpoint including another VM or an arbitrary
remote server.
@param resource_group_name [String] The name of the network watcher resource
group.
@param network_watcher_name [String] The name of the network watcher
resource.
@param parameters [ConnectivityParameters] Parameters that determine how the
connectivity check will be performed.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ConnectivityInformation] operation results. | [
"Verifies",
"the",
"possibility",
"of",
"establishing",
"a",
"direct",
"TCP",
"connection",
"from",
"a",
"virtual",
"machine",
"to",
"a",
"given",
"endpoint",
"including",
"another",
"VM",
"or",
"an",
"arbitrary",
"remote",
"server",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/network_watchers.rb#L1007-L1010 | train | Check connectivity of the specified virtual network. | [
30522,
13366,
4638,
1035,
20831,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2897,
1035,
3422,
2121,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4638,
1035,
20831,
1035,
2004,
6038,
2278,
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... |
jnunemaker/flipper | lib/flipper/dsl.rb | Flipper.DSL.preload | def preload(names)
features = names.map { |name| feature(name) }
@adapter.get_multi(features)
features
end | ruby | def preload(names)
features = names.map { |name| feature(name) }
@adapter.get_multi(features)
features
end | [
"def",
"preload",
"(",
"names",
")",
"features",
"=",
"names",
".",
"map",
"{",
"|",
"name",
"|",
"feature",
"(",
"name",
")",
"}",
"@adapter",
".",
"get_multi",
"(",
"features",
")",
"features",
"end"
] | Public: Preload the features with the given names.
names - An Array of String or Symbol names of the features.
Returns an Array of Flipper::Feature. | [
"Public",
":",
"Preload",
"the",
"features",
"with",
"the",
"given",
"names",
"."
] | df0352b663ad3ed45d68710f10a8170249ff9d78 | https://github.com/jnunemaker/flipper/blob/df0352b663ad3ed45d68710f10a8170249ff9d78/lib/flipper/dsl.rb#L190-L194 | train | Preload the features from the given names | [
30522,
13366,
3653,
11066,
1006,
3415,
1007,
2838,
1027,
3415,
1012,
4949,
1063,
1064,
2171,
1064,
3444,
1006,
2171,
1007,
1065,
1030,
15581,
2121,
1012,
2131,
1035,
4800,
1006,
2838,
1007,
2838,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.put_property | def put_property(name_id, property_description, timeout:60, custom_headers:nil)
response = put_property_async(name_id, property_description, timeout:timeout, custom_headers:custom_headers).value!
nil
end | ruby | def put_property(name_id, property_description, timeout:60, custom_headers:nil)
response = put_property_async(name_id, property_description, timeout:timeout, custom_headers:custom_headers).value!
nil
end | [
"def",
"put_property",
"(",
"name_id",
",",
"property_description",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"put_property_async",
"(",
"name_id",
",",
"property_description",
",",
"timeout",
":",
"timeout",
",",
"custo... | Creates or updates a Service Fabric property.
Creates or updates the specified Service Fabric property under a given name.
@param name_id [String] The Service Fabric name, without the 'fabric:' URI
scheme.
@param property_description [PropertyDescription] Describes the Service
Fabric property to be created.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Creates",
"or",
"updates",
"a",
"Service",
"Fabric",
"property",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L26728-L26731 | train | Put a property in a container. | [
30522,
13366,
2404,
1035,
3200,
1006,
2171,
1035,
8909,
1010,
3200,
1035,
6412,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2404,
1035,
3200,
1035,
2004,
6038,
2278,
1006,
2171,
1035,
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... |
decidim/decidim | decidim-core/config/initializers/carrierwave.rb | CarrierWave.MiniMagick.quality | def quality(percentage)
manipulate! do |img|
img.quality(percentage.to_s)
img = yield(img) if block_given?
img
end
end | ruby | def quality(percentage)
manipulate! do |img|
img.quality(percentage.to_s)
img = yield(img) if block_given?
img
end
end | [
"def",
"quality",
"(",
"percentage",
")",
"manipulate!",
"do",
"|",
"img",
"|",
"img",
".",
"quality",
"(",
"percentage",
".",
"to_s",
")",
"img",
"=",
"yield",
"(",
"img",
")",
"if",
"block_given?",
"img",
"end",
"end"
] | this method allow us to specify a quality for our image
e.g. <process quality: 60> | [
"this",
"method",
"allow",
"us",
"to",
"specify",
"a",
"quality",
"for",
"our",
"image",
"e",
".",
"g",
".",
"<process",
"quality",
":",
"60",
">"
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/config/initializers/carrierwave.rb#L7-L13 | train | Returns a new image with the quality of the image. | [
30522,
13366,
3737,
1006,
7017,
1007,
17708,
999,
2079,
1064,
10047,
2290,
1064,
10047,
2290,
1012,
3737,
1006,
7017,
1012,
2000,
1035,
1055,
1007,
10047,
2290,
1027,
10750,
1006,
10047,
2290,
1007,
2065,
3796,
1035,
2445,
1029,
10047,
2290... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/sprockets | lib/sprockets/server.rb | Sprockets.Server.ok_response | def ok_response(asset, env)
if head_request?(env)
[ 200, headers(env, asset, 0), [] ]
else
[ 200, headers(env, asset, asset.length), asset ]
end
end | ruby | def ok_response(asset, env)
if head_request?(env)
[ 200, headers(env, asset, 0), [] ]
else
[ 200, headers(env, asset, asset.length), asset ]
end
end | [
"def",
"ok_response",
"(",
"asset",
",",
"env",
")",
"if",
"head_request?",
"(",
"env",
")",
"[",
"200",
",",
"headers",
"(",
"env",
",",
"asset",
",",
"0",
")",
",",
"[",
"]",
"]",
"else",
"[",
"200",
",",
"headers",
"(",
"env",
",",
"asset",
... | Returns a 200 OK response tuple | [
"Returns",
"a",
"200",
"OK",
"response",
"tuple"
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/server.rb#L125-L131 | train | Returns an array of HTTP 200 responses | [
30522,
13366,
7929,
30524,
1035,
5227,
1029,
1006,
4372,
2615,
1007,
1031,
3263,
1010,
20346,
2015,
1006,
4372,
2615,
1010,
11412,
1010,
1014,
1007,
1010,
1031,
1033,
1033,
2842,
1031,
3263,
1010,
20346,
2015,
1006,
4372,
2615,
1010,
11412,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/databases.rb | Azure::SQL::Mgmt::V2014_04_01.Databases.list_by_elastic_pool_with_http_info | def list_by_elastic_pool_with_http_info(resource_group_name, server_name, elastic_pool_name, custom_headers:nil)
list_by_elastic_pool_async(resource_group_name, server_name, elastic_pool_name, custom_headers:custom_headers).value!
end | ruby | def list_by_elastic_pool_with_http_info(resource_group_name, server_name, elastic_pool_name, custom_headers:nil)
list_by_elastic_pool_async(resource_group_name, server_name, elastic_pool_name, custom_headers:custom_headers).value!
end | [
"def",
"list_by_elastic_pool_with_http_info",
"(",
"resource_group_name",
",",
"server_name",
",",
"elastic_pool_name",
",",
"custom_headers",
":",
"nil",
")",
"list_by_elastic_pool_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"elastic_pool_name",
",",
"cust... | Returns a list of databases in an elastic pool.
@param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param server_name [String] The name of the server.
@param elastic_pool_name [String] The name of the elastic pool to be
retrieved.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Returns",
"a",
"list",
"of",
"databases",
"in",
"an",
"elastic",
"pool",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/databases.rb#L678-L680 | train | Gets the elastic pool information. | [
30522,
13366,
2862,
1035,
2011,
1035,
21274,
1035,
4770,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
21274,
1035,
4770,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/notification_recipient_user.rb | Azure::ApiManagement::Mgmt::V2018_01_01.NotificationRecipientUser.create_or_update | def create_or_update(resource_group_name, service_name, notification_name, uid, custom_headers:nil)
response = create_or_update_async(resource_group_name, service_name, notification_name, uid, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_or_update(resource_group_name, service_name, notification_name, uid, custom_headers:nil)
response = create_or_update_async(resource_group_name, service_name, notification_name, uid, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_or_update",
"(",
"resource_group_name",
",",
"service_name",
",",
"notification_name",
",",
"uid",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_or_update_async",
"(",
"resource_group_name",
",",
"service_name",
",",
"notification_name"... | Adds the API Management User to the list of Recipients for the Notification.
@param resource_group_name [String] The name of the resource group.
@param service_name [String] The name of the API Management service.
@param notification_name [NotificationName] Notification Name Identifier.
Possible values include: 'RequestPublisherNotificationMessage',
'PurchasePublisherNotificationMessage', 'NewApplicationNotificationMessage',
'BCC', 'NewIssuePublisherNotificationMessage', 'AccountClosedPublisher',
'QuotaLimitApproachingPublisherNotificationMessage'
@param uid [String] User identifier. Must be unique in the current API
Management service instance.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [RecipientUserContract] operation results. | [
"Adds",
"the",
"API",
"Management",
"User",
"to",
"the",
"list",
"of",
"Recipients",
"for",
"the",
"Notification",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/notification_recipient_user.rb#L270-L273 | train | Creates or updates a notification. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
26828,
1035,
2171,
1010,
21318,
2094,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3443,
1035,
2030,
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... |
meew0/discordrb | lib/discordrb/data/server.rb | Discordrb.Server.update_data | def update_data(new_data = nil)
new_data ||= JSON.parse(API::Server.resolve(@bot.token, @id))
@name = new_data[:name] || new_data['name'] || @name
@region_id = new_data[:region] || new_data['region'] || @region_id
@icon_id = new_data[:icon] || new_data['icon'] || @icon_id
@afk_timeout = new_data[:afk_timeout] || new_data['afk_timeout'] || @afk_timeout
afk_channel_id = new_data[:afk_channel_id] || new_data['afk_channel_id'] || @afk_channel
@afk_channel_id = afk_channel_id.nil? ? nil : afk_channel_id.resolve_id
embed_channel_id = new_data[:embed_channel_id] || new_data['embed_channel_id'] || @embed_channel
@embed_channel_id = embed_channel_id.nil? ? nil : embed_channel_id.resolve_id
system_channel_id = new_data[:system_channel_id] || new_data['system_channel_id'] || @system_channel
@system_channel_id = system_channel_id.nil? ? nil : system_channel_id.resolve_id
@embed_enabled = new_data[:embed_enabled] || new_data['embed_enabled']
@splash = new_data[:splash_id] || new_data['splash_id'] || @splash_id
@verification_level = new_data[:verification_level] || new_data['verification_level'] || @verification_level
@explicit_content_filter = new_data[:explicit_content_filter] || new_data['explicit_content_filter'] || @explicit_content_filter
@default_message_notifications = new_data[:default_message_notifications] || new_data['default_message_notifications'] || @default_message_notifications
end | ruby | def update_data(new_data = nil)
new_data ||= JSON.parse(API::Server.resolve(@bot.token, @id))
@name = new_data[:name] || new_data['name'] || @name
@region_id = new_data[:region] || new_data['region'] || @region_id
@icon_id = new_data[:icon] || new_data['icon'] || @icon_id
@afk_timeout = new_data[:afk_timeout] || new_data['afk_timeout'] || @afk_timeout
afk_channel_id = new_data[:afk_channel_id] || new_data['afk_channel_id'] || @afk_channel
@afk_channel_id = afk_channel_id.nil? ? nil : afk_channel_id.resolve_id
embed_channel_id = new_data[:embed_channel_id] || new_data['embed_channel_id'] || @embed_channel
@embed_channel_id = embed_channel_id.nil? ? nil : embed_channel_id.resolve_id
system_channel_id = new_data[:system_channel_id] || new_data['system_channel_id'] || @system_channel
@system_channel_id = system_channel_id.nil? ? nil : system_channel_id.resolve_id
@embed_enabled = new_data[:embed_enabled] || new_data['embed_enabled']
@splash = new_data[:splash_id] || new_data['splash_id'] || @splash_id
@verification_level = new_data[:verification_level] || new_data['verification_level'] || @verification_level
@explicit_content_filter = new_data[:explicit_content_filter] || new_data['explicit_content_filter'] || @explicit_content_filter
@default_message_notifications = new_data[:default_message_notifications] || new_data['default_message_notifications'] || @default_message_notifications
end | [
"def",
"update_data",
"(",
"new_data",
"=",
"nil",
")",
"new_data",
"||=",
"JSON",
".",
"parse",
"(",
"API",
"::",
"Server",
".",
"resolve",
"(",
"@bot",
".",
"token",
",",
"@id",
")",
")",
"@name",
"=",
"new_data",
"[",
":name",
"]",
"||",
"new_data... | Updates the cached data with new data
@note For internal use only
@!visibility private | [
"Updates",
"the",
"cached",
"data",
"with",
"new",
"data"
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/data/server.rb#L775-L795 | train | Update the data from the server | [
30522,
13366,
10651,
1035,
2951,
1006,
2047,
1035,
2951,
1027,
9152,
2140,
1007,
2047,
1035,
2951,
1064,
1064,
1027,
1046,
3385,
1012,
11968,
3366,
1006,
17928,
1024,
1024,
8241,
1012,
10663,
1006,
1030,
28516,
1012,
19204,
1010,
1030,
8909... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/api/checkout_api.rb | SquareConnect.CheckoutApi.create_checkout | def create_checkout(location_id, body, opts = {})
data, _status_code, _headers = create_checkout_with_http_info(location_id, body, opts)
return data
end | ruby | def create_checkout(location_id, body, opts = {})
data, _status_code, _headers = create_checkout_with_http_info(location_id, body, opts)
return data
end | [
"def",
"create_checkout",
"(",
"location_id",
",",
"body",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"create_checkout_with_http_info",
"(",
"location_id",
",",
"body",
",",
"opts",
")",
"return",
"data",
"end"
] | CreateCheckout
Links a `checkoutId` to a `checkout_page_url` that customers will be directed to in order to provide their payment information using a payment processing workflow hosted on connect.squareup.com.
@param location_id The ID of the business location to associate the checkout with.
@param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
@param [Hash] opts the optional parameters
@return [CreateCheckoutResponse] | [
"CreateCheckout",
"Links",
"a",
"checkoutId",
"to",
"a",
"checkout_page_url",
"that",
"customers",
"will",
"be",
"directed",
"to",
"in",
"order",
"to",
"provide",
"their",
"payment",
"information",
"using",
"a",
"payment",
"processing",
"workflow",
"hosted",
"on",... | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/checkout_api.rb#L26-L29 | train | Creates a checkout | [
30522,
13366,
3443,
1035,
4638,
5833,
1006,
3295,
1035,
8909,
1010,
2303,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
3443,
1035,
4638,
5833,
1035,
2007,
1035,
8299,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.get_regex_entity_role | def get_regex_entity_role(app_id, version_id, entity_id, role_id, custom_headers:nil)
response = get_regex_entity_role_async(app_id, version_id, entity_id, role_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_regex_entity_role(app_id, version_id, entity_id, role_id, custom_headers:nil)
response = get_regex_entity_role_async(app_id, version_id, entity_id, role_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_regex_entity_role",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"role_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_regex_entity_role_async",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"role_id",
",",
"... | Get one role for a given regular expression entity in a version of the
application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param entity_id entity ID.
@param role_id entity role ID.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [EntityRole] operation results. | [
"Get",
"one",
"role",
"for",
"a",
"given",
"regular",
"expression",
"entity",
"in",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L9715-L9718 | train | Gets the regex entity role. | [
30522,
13366,
2131,
1035,
19723,
10288,
1035,
9178,
1035,
2535,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
9178,
1035,
8909,
1010,
2535,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
piotrmurach/github | lib/github_api/client/users/keys.rb | Github.Client::Users::Keys.update | def update(*args)
arguments(args, required: [:id]) do
permit VALID_KEY_PARAM_NAMES
end
patch_request("/user/keys/#{arguments.id}", arguments.params)
end | ruby | def update(*args)
arguments(args, required: [:id]) do
permit VALID_KEY_PARAM_NAMES
end
patch_request("/user/keys/#{arguments.id}", arguments.params)
end | [
"def",
"update",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":id",
"]",
")",
"do",
"permit",
"VALID_KEY_PARAM_NAMES",
"end",
"patch_request",
"(",
"\"/user/keys/#{arguments.id}\"",
",",
"arguments",
".",
"params",
")",
"end"
] | Update a public key for the authenticated user
@param [Hash] params
@option [String] :title
Required string
@option [String] :key
Required string. sha key
@example
github = Github.new oauth_token: '...'
github.users.keys.update 'key-id', "title": "octocat@octomac",
"key": "ssh-rsa AAA..."
@api public | [
"Update",
"a",
"public",
"key",
"for",
"the",
"authenticated",
"user"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/users/keys.rb#L85-L90 | train | Update a user s key | [
30522,
13366,
10651,
1006,
1008,
12098,
5620,
1007,
9918,
1006,
12098,
5620,
1010,
3223,
1024,
1031,
1024,
8909,
1033,
1007,
2079,
9146,
9398,
1035,
3145,
1035,
11498,
2213,
1035,
3415,
2203,
8983,
1035,
5227,
1006,
1000,
1013,
5310,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_website.rb | Aws::S3.BucketWebsite.put | def put(options = {})
options = options.merge(bucket: @bucket_name)
resp = @client.put_bucket_website(options)
resp.data
end | ruby | def put(options = {})
options = options.merge(bucket: @bucket_name)
resp = @client.put_bucket_website(options)
resp.data
end | [
"def",
"put",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"bucket",
":",
"@bucket_name",
")",
"resp",
"=",
"@client",
".",
"put_bucket_website",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
bucket_website.put({
content_md5: "ContentMD5",
website_configuration: { # required
error_document: {
key: "ObjectKey", # required
},
index_document: {
suffix: "Suffix", # required
},
redirect_all_requests_to: {
host_name: "HostName", # required
protocol: "http", # accepts http, https
},
routing_rules: [
{
condition: {
http_error_code_returned_equals: "HttpErrorCodeReturnedEquals",
key_prefix_equals: "KeyPrefixEquals",
},
redirect: { # required
host_name: "HostName",
http_redirect_code: "HttpRedirectCode",
protocol: "http", # accepts http, https
replace_key_prefix_with: "ReplaceKeyPrefixWith",
replace_key_with: "ReplaceKeyWith",
},
},
],
},
})
@param [Hash] options ({})
@option options [String] :content_md5
@option options [required, Types::WebsiteConfiguration] :website_configuration
@return [EmptyStructure] | [
"@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_website.rb#L236-L240 | train | Put the website to the bucket | [
30522,
13366,
2404,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
13610,
1024,
1030,
13610,
1035,
2171,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
2404,
1035,
13610,
1035,
4037,
1006,
7047,
1007,
24501,
2361,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/workflows.rb | Azure::Logic::Mgmt::V2016_06_01.Workflows.list_callback_url | def list_callback_url(resource_group_name, workflow_name, list_callback_url, custom_headers:nil)
response = list_callback_url_async(resource_group_name, workflow_name, list_callback_url, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_callback_url(resource_group_name, workflow_name, list_callback_url, custom_headers:nil)
response = list_callback_url_async(resource_group_name, workflow_name, list_callback_url, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_callback_url",
"(",
"resource_group_name",
",",
"workflow_name",
",",
"list_callback_url",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_callback_url_async",
"(",
"resource_group_name",
",",
"workflow_name",
",",
"list_callback_url",
",",
"... | Get the workflow callback Url.
@param resource_group_name [String] The resource group name.
@param workflow_name [String] The workflow name.
@param list_callback_url [GetCallbackUrlParameters] Which callback url to
list.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [WorkflowTriggerCallbackUrl] operation results. | [
"Get",
"the",
"workflow",
"callback",
"Url",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/workflows.rb#L873-L876 | train | Gets the list of all the available workflow rules. | [
30522,
13366,
2862,
1035,
2655,
5963,
1035,
24471,
2140,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2147,
12314,
1035,
2171,
1010,
2862,
1035,
2655,
5963,
1035,
24471,
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... |
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_keys | def list_keys(resource_group_name, resource_name, custom_headers:nil)
first_page = list_keys_as_lazy(resource_group_name, resource_name, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_keys(resource_group_name, resource_name, custom_headers:nil)
first_page = list_keys_as_lazy(resource_group_name, resource_name, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_keys",
"(",
"resource_group_name",
",",
"resource_name",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_keys_as_lazy",
"(",
"resource_group_name",
",",
"resource_name",
",",
"custom_headers",
":custom_headers",
")",
"first_page",
".",
"g... | Get the security metadata for an IoT hub. For more information, see:
https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
Get the security metadata for an IoT hub. For more information, see:
https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security.
@param resource_group_name [String] The name of the resource group that
contains the IoT hub.
@param resource_name [String] The name of the IoT hub.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<SharedAccessSignatureAuthorizationRule>] operation results. | [
"Get",
"the",
"security",
"metadata",
"for",
"an",
"IoT",
"hub",
".",
"For",
"more",
"information",
"see",
":",
"https",
":",
"//",
"docs",
".",
"microsoft",
".",
"com",
"/",
"azure",
"/",
"iot",
"-",
"hub",
"/",
"iot",
"-",
"hub",
"-",
"devguide",
... | 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#L1502-L1505 | train | Gets all the keys of the specified virtual machine. | [
30522,
13366,
2862,
1035,
6309,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7692,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2862,
1035,
6309,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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.start_quorum_loss_with_http_info | def start_quorum_loss_with_http_info(service_id, partition_id, operation_id, quorum_loss_mode, quorum_loss_duration, timeout:60, custom_headers:nil)
start_quorum_loss_async(service_id, partition_id, operation_id, quorum_loss_mode, quorum_loss_duration, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def start_quorum_loss_with_http_info(service_id, partition_id, operation_id, quorum_loss_mode, quorum_loss_duration, timeout:60, custom_headers:nil)
start_quorum_loss_async(service_id, partition_id, operation_id, quorum_loss_mode, quorum_loss_duration, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"start_quorum_loss_with_http_info",
"(",
"service_id",
",",
"partition_id",
",",
"operation_id",
",",
"quorum_loss_mode",
",",
"quorum_loss_duration",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"start_quorum_loss_async",
"(",
"service_id",... | Induces quorum loss for a given stateful service partition.
Induces quorum loss for a given stateful service partition. This API is
useful for a temporary quorum loss situation on your service.
Call the GetQuorumLossProgress API with the same OperationId to return
information on the operation started with this API.
This can only be called on stateful persisted (HasPersistedState==true)
services. Do not use this API on stateless services or stateful in-memory
only services.
@param service_id [String] The identity of the service. This is typically the
full name of the service without the 'fabric:' URI scheme.
Starting from version 6.0, hierarchical names are delimited with the "~"
character.
For example, if the service name is "fabric:/myapp/app1/svc1", the service
identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
versions.
@param partition_id The identity of the partition.
@param operation_id A GUID that identifies a call of this API. This is
passed into the corresponding GetProgress API
@param quorum_loss_mode [QuorumLossMode] This enum is passed to the
StartQuorumLoss API to indicate what type of quorum loss to induce. Possible
values include: 'Invalid', 'QuorumReplicas', 'AllReplicas'
@param quorum_loss_duration [Integer] The amount of time for which the
partition will be kept in quorum loss. This must be specified in seconds.
@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. | [
"Induces",
"quorum",
"loss",
"for",
"a",
"given",
"stateful",
"service",
"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#L21055-L21057 | train | Start quorum loss of the specified partition. | [
30522,
13366,
2707,
1035,
22035,
6824,
1035,
3279,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2326,
1035,
8909,
1010,
13571,
1035,
8909,
1010,
3169,
1035,
8909,
1010,
22035,
6824,
1035,
3279,
1035,
5549,
1010,
22035,
6824,
1035,
3279,
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... |
daddyz/phonelib | lib/phonelib/phone_analyzer.rb | Phonelib.PhoneAnalyzer.better_result | def better_result(base_result, result = nil)
base_result ||= {}
return base_result unless result
return result unless base_result.values.find { |e| e[:possible].any? }
return result if result.values.find { |e| e[:valid].any? }
base_result
end | ruby | def better_result(base_result, result = nil)
base_result ||= {}
return base_result unless result
return result unless base_result.values.find { |e| e[:possible].any? }
return result if result.values.find { |e| e[:valid].any? }
base_result
end | [
"def",
"better_result",
"(",
"base_result",
",",
"result",
"=",
"nil",
")",
"base_result",
"||=",
"{",
"}",
"return",
"base_result",
"unless",
"result",
"return",
"result",
"unless",
"base_result",
".",
"values",
".",
"find",
"{",
"|",
"e",
"|",
"e",
"[",
... | method checks which result is better to return | [
"method",
"checks",
"which",
"result",
"is",
"better",
"to",
"return"
] | aa0023eab7c896b71275bf342bc7f49735cbdbbf | https://github.com/daddyz/phonelib/blob/aa0023eab7c896b71275bf342bc7f49735cbdbbf/lib/phonelib/phone_analyzer.rb#L38-L47 | train | Returns the better result for the given base result. | [
30522,
13366,
2488,
1035,
2765,
1006,
2918,
1035,
2765,
1010,
2765,
1027,
9152,
2140,
1007,
2918,
1035,
2765,
1064,
1064,
1027,
1063,
1065,
2709,
2918,
1035,
2765,
4983,
2765,
2709,
2765,
4983,
2918,
1035,
2765,
1012,
5300,
1012,
2424,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_policy_insights/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/remediations.rb | Azure::PolicyInsights::Mgmt::V2018_07_01_preview.Remediations.list_for_resource_as_lazy | def list_for_resource_as_lazy(resource_id, query_options:nil, custom_headers:nil)
response = list_for_resource_async(resource_id, query_options:query_options, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_for_resource_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_for_resource_as_lazy(resource_id, query_options:nil, custom_headers:nil)
response = list_for_resource_async(resource_id, query_options:query_options, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_for_resource_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_for_resource_as_lazy",
"(",
"resource_id",
",",
"query_options",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_for_resource_async",
"(",
"resource_id",
",",
"query_options",
":query_options",
",",
"custom_headers",
":custom_head... | Gets all remediations for a resource.
@param resource_id [String] Resource 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 [RemediationListResult] which provide lazy access to pages of the
response. | [
"Gets",
"all",
"remediations",
"for",
"a",
"resource",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_policy_insights/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/remediations.rb#L3218-L3227 | train | Gets the list of all the available CDNs for the resource. | [
30522,
13366,
2862,
1035,
2005,
1035,
7692,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
8909,
1010,
23032,
1035,
7047,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2005,
1035,
7692,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
strongself/Generamba | lib/generamba/template/creator/template_creator.rb | Generamba.TemplateCreator.create_template | def create_template(properties)
template_dir_path = Pathname.new(File.dirname(__FILE__)).join(NEW_TEMPLATE_FOLDER)
rambaspec_template_file_path = template_dir_path.join(RAMBASPEC_TEMPLATE_NAME)
code_file_path = template_dir_path.join(CODE_FOLDER)
tests_file_path = template_dir_path.join(TESTS_FOLDER)
file_source = IO.read(rambaspec_template_file_path)
template = Liquid::Template.parse(file_source)
output = template.render(properties)
result_name = properties[TEMPLATE_NAME_KEY] + RAMBASPEC_EXTENSION
result_dir_path = Pathname.new(properties[TEMPLATE_NAME_KEY])
FileUtils.mkdir_p result_dir_path
FileUtils.cp_r(code_file_path, result_dir_path)
FileUtils.cp_r(tests_file_path, result_dir_path)
File.open(result_dir_path.join(result_name), 'w+') {|f|
f.write(output)
}
end | ruby | def create_template(properties)
template_dir_path = Pathname.new(File.dirname(__FILE__)).join(NEW_TEMPLATE_FOLDER)
rambaspec_template_file_path = template_dir_path.join(RAMBASPEC_TEMPLATE_NAME)
code_file_path = template_dir_path.join(CODE_FOLDER)
tests_file_path = template_dir_path.join(TESTS_FOLDER)
file_source = IO.read(rambaspec_template_file_path)
template = Liquid::Template.parse(file_source)
output = template.render(properties)
result_name = properties[TEMPLATE_NAME_KEY] + RAMBASPEC_EXTENSION
result_dir_path = Pathname.new(properties[TEMPLATE_NAME_KEY])
FileUtils.mkdir_p result_dir_path
FileUtils.cp_r(code_file_path, result_dir_path)
FileUtils.cp_r(tests_file_path, result_dir_path)
File.open(result_dir_path.join(result_name), 'w+') {|f|
f.write(output)
}
end | [
"def",
"create_template",
"(",
"properties",
")",
"template_dir_path",
"=",
"Pathname",
".",
"new",
"(",
"File",
".",
"dirname",
"(",
"__FILE__",
")",
")",
".",
"join",
"(",
"NEW_TEMPLATE_FOLDER",
")",
"rambaspec_template_file_path",
"=",
"template_dir_path",
".",... | Generates and saves to filesystem a new template with a .rambaspec file and sample code and tests files
@param properties [Hash] User-inputted template properties
@return [Void] | [
"Generates",
"and",
"saves",
"to",
"filesystem",
"a",
"new",
"template",
"with",
"a",
".",
"rambaspec",
"file",
"and",
"sample",
"code",
"and",
"tests",
"files",
"@param",
"properties",
"[",
"Hash",
"]",
"User",
"-",
"inputted",
"template",
"properties"
] | 9ef343805f3a66f58bc36e120e822d5436a4da97 | https://github.com/strongself/Generamba/blob/9ef343805f3a66f58bc36e120e822d5436a4da97/lib/generamba/template/creator/template_creator.rb#L15-L36 | train | Create a new template | [
30522,
13366,
3443,
1035,
23561,
1006,
5144,
1007,
23561,
1035,
16101,
1035,
4130,
1027,
4130,
18442,
1012,
2047,
1006,
5371,
1012,
16101,
18442,
1006,
1035,
1035,
5371,
1035,
1035,
1007,
1007,
1012,
3693,
1006,
2047,
1035,
23561,
1035,
196... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/route_filter_rules.rb | Azure::Network::Mgmt::V2018_07_01.RouteFilterRules.begin_update | def begin_update(resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers:nil)
response = begin_update_async(resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_update(resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers:nil)
response = begin_update_async(resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_update",
"(",
"resource_group_name",
",",
"route_filter_name",
",",
"rule_name",
",",
"route_filter_rule_parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_update_async",
"(",
"resource_group_name",
",",
"route_filter_name",
",",
... | Updates a route in the specified route filter.
@param resource_group_name [String] The name of the resource group.
@param route_filter_name [String] The name of the route filter.
@param rule_name [String] The name of the route filter rule.
@param route_filter_rule_parameters [PatchRouteFilterRule] Parameters
supplied to the update route filter rule operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [RouteFilterRule] operation results. | [
"Updates",
"a",
"route",
"in",
"the",
"specified",
"route",
"filter",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/route_filter_rules.rb#L566-L569 | train | Updates a route filter rule. | [
30522,
13366,
4088,
1035,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2799,
1035,
11307,
1035,
2171,
1010,
3627,
1035,
2171,
1010,
2799,
1035,
11307,
1035,
3627,
1035,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
resque/resque | lib/resque/worker.rb | Resque.Worker.unregister_worker | def unregister_worker(exception = nil)
# If we're still processing a job, make sure it gets logged as a
# failure.
if (hash = processing) && !hash.empty?
job = Job.new(hash['queue'], hash['payload'])
# Ensure the proper worker is attached to this job, even if
# it's not the precise instance that died.
job.worker = self
begin
job.fail(exception || DirtyExit.new("Job still being processed"))
rescue RuntimeError => e
log_with_severity :error, e.message
end
end
kill_background_threads
data_store.unregister_worker(self) do
Stat.clear("processed:#{self}")
Stat.clear("failed:#{self}")
end
rescue Exception => exception_while_unregistering
message = exception_while_unregistering.message
if exception
message += "\nOriginal Exception (#{exception.class}): #{exception.message}"
message += "\n #{exception.backtrace.join(" \n")}" if exception.backtrace
end
fail(exception_while_unregistering.class,
message,
exception_while_unregistering.backtrace)
end | ruby | def unregister_worker(exception = nil)
# If we're still processing a job, make sure it gets logged as a
# failure.
if (hash = processing) && !hash.empty?
job = Job.new(hash['queue'], hash['payload'])
# Ensure the proper worker is attached to this job, even if
# it's not the precise instance that died.
job.worker = self
begin
job.fail(exception || DirtyExit.new("Job still being processed"))
rescue RuntimeError => e
log_with_severity :error, e.message
end
end
kill_background_threads
data_store.unregister_worker(self) do
Stat.clear("processed:#{self}")
Stat.clear("failed:#{self}")
end
rescue Exception => exception_while_unregistering
message = exception_while_unregistering.message
if exception
message += "\nOriginal Exception (#{exception.class}): #{exception.message}"
message += "\n #{exception.backtrace.join(" \n")}" if exception.backtrace
end
fail(exception_while_unregistering.class,
message,
exception_while_unregistering.backtrace)
end | [
"def",
"unregister_worker",
"(",
"exception",
"=",
"nil",
")",
"# If we're still processing a job, make sure it gets logged as a",
"# failure.",
"if",
"(",
"hash",
"=",
"processing",
")",
"&&",
"!",
"hash",
".",
"empty?",
"job",
"=",
"Job",
".",
"new",
"(",
"hash"... | Unregisters ourself as a worker. Useful when shutting down. | [
"Unregisters",
"ourself",
"as",
"a",
"worker",
".",
"Useful",
"when",
"shutting",
"down",
"."
] | adb633a0f6b98b1eb5a5a85bb36ebac9309978fd | https://github.com/resque/resque/blob/adb633a0f6b98b1eb5a5a85bb36ebac9309978fd/lib/resque/worker.rb#L667-L697 | train | Unregisters a worker from the worker pool. | [
30522,
13366,
4895,
2890,
24063,
2121,
1035,
7309,
1006,
6453,
1027,
9152,
2140,
1007,
1001,
2065,
2057,
1005,
2128,
2145,
6364,
1037,
3105,
1010,
2191,
2469,
2009,
4152,
26618,
2004,
1037,
1001,
4945,
1012,
2065,
1006,
23325,
1027,
6364,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sumoheavy/jira-ruby | lib/jira/base_factory.rb | JIRA.BaseFactory.target_class | def target_class
# Need to do a little bit of work here as Module.const_get doesn't work
# with nested class names, i.e. JIRA::Resource::Foo.
#
# So create a method chain from the class components. This code will
# unroll to:
# Module.const_get('JIRA').const_get('Resource').const_get('Foo')
#
target_class_name = self.class.name.sub(/Factory$/, '')
class_components = target_class_name.split('::')
class_components.inject(Module) do |mod, const_name|
mod.const_get(const_name)
end
end | ruby | def target_class
# Need to do a little bit of work here as Module.const_get doesn't work
# with nested class names, i.e. JIRA::Resource::Foo.
#
# So create a method chain from the class components. This code will
# unroll to:
# Module.const_get('JIRA').const_get('Resource').const_get('Foo')
#
target_class_name = self.class.name.sub(/Factory$/, '')
class_components = target_class_name.split('::')
class_components.inject(Module) do |mod, const_name|
mod.const_get(const_name)
end
end | [
"def",
"target_class",
"# Need to do a little bit of work here as Module.const_get doesn't work",
"# with nested class names, i.e. JIRA::Resource::Foo.",
"#",
"# So create a method chain from the class components. This code will",
"# unroll to:",
"# Module.const_get('JIRA').const_get('Resource').co... | Return the name of the class which this factory generates, i.e.
JIRA::Resource::FooFactory creates JIRA::Resource::Foo instances. | [
"Return",
"the",
"name",
"of",
"the",
"class",
"which",
"this",
"factory",
"generates",
"i",
".",
"e",
".",
"JIRA",
"::",
"Resource",
"::",
"FooFactory",
"creates",
"JIRA",
"::",
"Resource",
"::",
"Foo",
"instances",
"."
] | 25e896f227ab81c528e9678708cb546d2f62f018 | https://github.com/sumoheavy/jira-ruby/blob/25e896f227ab81c528e9678708cb546d2f62f018/lib/jira/base_factory.rb#L12-L26 | train | Returns the class name of the target class. | [
30522,
13366,
4539,
1035,
2465,
1001,
2342,
2000,
2079,
1037,
2210,
2978,
1997,
2147,
2182,
2004,
11336,
1012,
9530,
3367,
1035,
2131,
2987,
1005,
1056,
2147,
1001,
2007,
9089,
2098,
2465,
3415,
1010,
1045,
1012,
1041,
1012,
10147,
2527,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rocketjob/symmetric-encryption | lib/symmetric_encryption/header.rb | SymmetricEncryption.Header.to_s | def to_s
flags = 0
flags |= FLAG_COMPRESSED if compressed?
flags |= FLAG_IV if iv
flags |= FLAG_KEY if key
flags |= FLAG_CIPHER_NAME if cipher_name
flags |= FLAG_AUTH_TAG if auth_tag
header = "#{MAGIC_HEADER}#{version.chr(SymmetricEncryption::BINARY_ENCODING)}#{flags.chr(SymmetricEncryption::BINARY_ENCODING)}"
if iv
header << [iv.length].pack('v')
header << iv
end
if key
encrypted = cipher.binary_encrypt(key, header: false)
header << [encrypted.length].pack('v')
header << encrypted
end
if cipher_name
header << [cipher_name.length].pack('v')
header << cipher_name
end
if auth_tag
header << [auth_tag.length].pack('v')
header << auth_tag
end
header
end | ruby | def to_s
flags = 0
flags |= FLAG_COMPRESSED if compressed?
flags |= FLAG_IV if iv
flags |= FLAG_KEY if key
flags |= FLAG_CIPHER_NAME if cipher_name
flags |= FLAG_AUTH_TAG if auth_tag
header = "#{MAGIC_HEADER}#{version.chr(SymmetricEncryption::BINARY_ENCODING)}#{flags.chr(SymmetricEncryption::BINARY_ENCODING)}"
if iv
header << [iv.length].pack('v')
header << iv
end
if key
encrypted = cipher.binary_encrypt(key, header: false)
header << [encrypted.length].pack('v')
header << encrypted
end
if cipher_name
header << [cipher_name.length].pack('v')
header << cipher_name
end
if auth_tag
header << [auth_tag.length].pack('v')
header << auth_tag
end
header
end | [
"def",
"to_s",
"flags",
"=",
"0",
"flags",
"|=",
"FLAG_COMPRESSED",
"if",
"compressed?",
"flags",
"|=",
"FLAG_IV",
"if",
"iv",
"flags",
"|=",
"FLAG_KEY",
"if",
"key",
"flags",
"|=",
"FLAG_CIPHER_NAME",
"if",
"cipher_name",
"flags",
"|=",
"FLAG_AUTH_TAG",
"if",... | Returns [String] this header as a string | [
"Returns",
"[",
"String",
"]",
"this",
"header",
"as",
"a",
"string"
] | 064ba8d57ffac44a3ed80f5e76fa1a54d660ff98 | https://github.com/rocketjob/symmetric-encryption/blob/064ba8d57ffac44a3ed80f5e76fa1a54d660ff98/lib/symmetric_encryption/header.rb#L199-L231 | train | Returns the header for the encryption. | [
30522,
13366,
2000,
1035,
1055,
9245,
1027,
1014,
9245,
1064,
1027,
5210,
1035,
16620,
2065,
16620,
1029,
9245,
1064,
1027,
5210,
1035,
4921,
2065,
4921,
9245,
1064,
1027,
5210,
1035,
3145,
2065,
3145,
9245,
1064,
1027,
5210,
1035,
27715,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | supply/lib/supply/client.rb | Supply.Client.listings | def listings
ensure_active_edit!
result = call_google_api { client.list_listings(current_package_name, current_edit.id) }
return result.listings.map do |row|
Listing.new(self, row.language, row)
end
end | ruby | def listings
ensure_active_edit!
result = call_google_api { client.list_listings(current_package_name, current_edit.id) }
return result.listings.map do |row|
Listing.new(self, row.language, row)
end
end | [
"def",
"listings",
"ensure_active_edit!",
"result",
"=",
"call_google_api",
"{",
"client",
".",
"list_listings",
"(",
"current_package_name",
",",
"current_edit",
".",
"id",
")",
"}",
"return",
"result",
".",
"listings",
".",
"map",
"do",
"|",
"row",
"|",
"Lis... | @!group Getting data
Get a list of all languages - returns the list
make sure to have an active edit | [
"@!group",
"Getting",
"data"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/supply/lib/supply/client.rb#L176-L184 | train | Returns an array of Listings objects for this page. | [
30522,
13366,
26213,
5676,
1035,
3161,
1035,
10086,
999,
2765,
1027,
2655,
1035,
8224,
1035,
17928,
1063,
7396,
1012,
2862,
1035,
26213,
1006,
2783,
1035,
7427,
1035,
2171,
1010,
2783,
1035,
10086,
1012,
8909,
1007,
1065,
2709,
2765,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hashicorp/vagrant | lib/vagrant/environment.rb | Vagrant.Environment.process_configured_plugins | def process_configured_plugins
return if !Vagrant.plugins_enabled?
errors = vagrantfile.config.vagrant.validate(nil)
if !errors["vagrant"].empty?
raise Errors::ConfigInvalid,
errors: Util::TemplateRenderer.render(
"config/validation_failed",
errors: errors)
end
# Check if defined plugins are installed
installed = Plugin::Manager.instance.installed_plugins
needs_install = []
config_plugins = vagrantfile.config.vagrant.plugins
config_plugins.each do |name, info|
if !installed[name]
needs_install << name
end
end
if !needs_install.empty?
ui.warn(I18n.t("vagrant.plugins.local.uninstalled_plugins",
plugins: needs_install.sort.join(", ")))
if !Vagrant.auto_install_local_plugins?
answer = nil
until ["y", "n"].include?(answer)
answer = ui.ask(I18n.t("vagrant.plugins.local.request_plugin_install") + " [N]: ")
answer = answer.strip.downcase
answer = "n" if answer.to_s.empty?
end
if answer == "n"
raise Errors::PluginMissingLocalError,
plugins: needs_install.sort.join(", ")
end
end
needs_install.each do |name|
pconfig = Util::HashWithIndifferentAccess.new(config_plugins[name])
ui.info(I18n.t("vagrant.commands.plugin.installing", name: name))
options = {sources: Vagrant::Bundler::DEFAULT_GEM_SOURCES.dup, env_local: true}
options[:sources] = pconfig[:sources] if pconfig[:sources]
options[:require] = pconfig[:entry_point] if pconfig[:entry_point]
options[:version] = pconfig[:version] if pconfig[:version]
spec = Plugin::Manager.instance.install_plugin(name, options)
ui.info(I18n.t("vagrant.commands.plugin.installed",
name: spec.name, version: spec.version.to_s))
end
ui.info("\n")
# Force halt after installation and require command to be run again. This
# will proper load any new locally installed plugins which are now available.
ui.warn(I18n.t("vagrant.plugins.local.install_rerun_command"))
exit(-1)
end
Vagrant::Plugin::Manager.instance.local_file.installed_plugins
end | ruby | def process_configured_plugins
return if !Vagrant.plugins_enabled?
errors = vagrantfile.config.vagrant.validate(nil)
if !errors["vagrant"].empty?
raise Errors::ConfigInvalid,
errors: Util::TemplateRenderer.render(
"config/validation_failed",
errors: errors)
end
# Check if defined plugins are installed
installed = Plugin::Manager.instance.installed_plugins
needs_install = []
config_plugins = vagrantfile.config.vagrant.plugins
config_plugins.each do |name, info|
if !installed[name]
needs_install << name
end
end
if !needs_install.empty?
ui.warn(I18n.t("vagrant.plugins.local.uninstalled_plugins",
plugins: needs_install.sort.join(", ")))
if !Vagrant.auto_install_local_plugins?
answer = nil
until ["y", "n"].include?(answer)
answer = ui.ask(I18n.t("vagrant.plugins.local.request_plugin_install") + " [N]: ")
answer = answer.strip.downcase
answer = "n" if answer.to_s.empty?
end
if answer == "n"
raise Errors::PluginMissingLocalError,
plugins: needs_install.sort.join(", ")
end
end
needs_install.each do |name|
pconfig = Util::HashWithIndifferentAccess.new(config_plugins[name])
ui.info(I18n.t("vagrant.commands.plugin.installing", name: name))
options = {sources: Vagrant::Bundler::DEFAULT_GEM_SOURCES.dup, env_local: true}
options[:sources] = pconfig[:sources] if pconfig[:sources]
options[:require] = pconfig[:entry_point] if pconfig[:entry_point]
options[:version] = pconfig[:version] if pconfig[:version]
spec = Plugin::Manager.instance.install_plugin(name, options)
ui.info(I18n.t("vagrant.commands.plugin.installed",
name: spec.name, version: spec.version.to_s))
end
ui.info("\n")
# Force halt after installation and require command to be run again. This
# will proper load any new locally installed plugins which are now available.
ui.warn(I18n.t("vagrant.plugins.local.install_rerun_command"))
exit(-1)
end
Vagrant::Plugin::Manager.instance.local_file.installed_plugins
end | [
"def",
"process_configured_plugins",
"return",
"if",
"!",
"Vagrant",
".",
"plugins_enabled?",
"errors",
"=",
"vagrantfile",
".",
"config",
".",
"vagrant",
".",
"validate",
"(",
"nil",
")",
"if",
"!",
"errors",
"[",
"\"vagrant\"",
"]",
".",
"empty?",
"raise",
... | Check for any local plugins defined within the Vagrantfile. If
found, validate they are available. If they are not available,
request to install them, or raise an exception
@return [Hash] plugin list for loading | [
"Check",
"for",
"any",
"local",
"plugins",
"defined",
"within",
"the",
"Vagrantfile",
".",
"If",
"found",
"validate",
"they",
"are",
"available",
".",
"If",
"they",
"are",
"not",
"available",
"request",
"to",
"install",
"them",
"or",
"raise",
"an",
"exceptio... | c22a145c59790c098f95d50141d9afb48e1ef55f | https://github.com/hashicorp/vagrant/blob/c22a145c59790c098f95d50141d9afb48e1ef55f/lib/vagrant/environment.rb#L930-L984 | train | Process the configured plugins | [
30522,
13366,
2832,
1035,
26928,
1035,
13354,
7076,
2709,
2065,
999,
12436,
18980,
1012,
13354,
7076,
1035,
9124,
1029,
10697,
1027,
12436,
18980,
8873,
2571,
1012,
9530,
8873,
2290,
1012,
12436,
18980,
1012,
9398,
3686,
1006,
9152,
2140,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.delete_regex_entity_model_with_http_info | def delete_regex_entity_model_with_http_info(app_id, version_id, regex_entity_id, custom_headers:nil)
delete_regex_entity_model_async(app_id, version_id, regex_entity_id, custom_headers:custom_headers).value!
end | ruby | def delete_regex_entity_model_with_http_info(app_id, version_id, regex_entity_id, custom_headers:nil)
delete_regex_entity_model_async(app_id, version_id, regex_entity_id, custom_headers:custom_headers).value!
end | [
"def",
"delete_regex_entity_model_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"regex_entity_id",
",",
"custom_headers",
":",
"nil",
")",
"delete_regex_entity_model_async",
"(",
"app_id",
",",
"version_id",
",",
"regex_entity_id",
",",
"custom_headers",
":custo... | Deletes a regular expression entity from a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param regex_entity_id The regular expression entity extractor 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. | [
"Deletes",
"a",
"regular",
"expression",
"entity",
"from",
"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#L8399-L8401 | train | Deletes the specified regular expression entity model. | [
30522,
13366,
3972,
12870,
1035,
19723,
10288,
1035,
9178,
1035,
2944,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
19723,
10288,
1035,
9178,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
91... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-i18n/i18n | lib/i18n.rb | I18n.Base.exists? | def exists?(key, _locale = nil, locale: _locale)
locale ||= config.locale
raise Disabled.new('exists?') if locale == false
raise I18n::ArgumentError if key.is_a?(String) && key.empty?
config.backend.exists?(locale, key)
end | ruby | def exists?(key, _locale = nil, locale: _locale)
locale ||= config.locale
raise Disabled.new('exists?') if locale == false
raise I18n::ArgumentError if key.is_a?(String) && key.empty?
config.backend.exists?(locale, key)
end | [
"def",
"exists?",
"(",
"key",
",",
"_locale",
"=",
"nil",
",",
"locale",
":",
"_locale",
")",
"locale",
"||=",
"config",
".",
"locale",
"raise",
"Disabled",
".",
"new",
"(",
"'exists?'",
")",
"if",
"locale",
"==",
"false",
"raise",
"I18n",
"::",
"Argum... | Returns true if a translation exists for a given key, otherwise returns false. | [
"Returns",
"true",
"if",
"a",
"translation",
"exists",
"for",
"a",
"given",
"key",
"otherwise",
"returns",
"false",
"."
] | 0c5dab494d9b043e00662d8e789229c33045c024 | https://github.com/ruby-i18n/i18n/blob/0c5dab494d9b043e00662d8e789229c33045c024/lib/i18n.rb#L210-L215 | train | Returns true if the key exists in the given locale. | [
30522,
13366,
6526,
1029,
30524,
2063,
1064,
1064,
1027,
9530,
8873,
2290,
1012,
2334,
2063,
5333,
9776,
1012,
2047,
1006,
1005,
6526,
1029,
1005,
1007,
2065,
2334,
2063,
1027,
1027,
6270,
5333,
1045,
15136,
2078,
1024,
1024,
6685,
2121,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/virtual_network_gateway_connections.rb | Azure::Network::Mgmt::V2018_07_01.VirtualNetworkGatewayConnections.begin_reset_shared_key_with_http_info | def begin_reset_shared_key_with_http_info(resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers:nil)
begin_reset_shared_key_async(resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers:custom_headers).value!
end | ruby | def begin_reset_shared_key_with_http_info(resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers:nil)
begin_reset_shared_key_async(resource_group_name, virtual_network_gateway_connection_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_reset_shared_key_with_http_info",
"(",
"resource_group_name",
",",
"virtual_network_gateway_connection_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_reset_shared_key_async",
"(",
"resource_group_name",
",",
"virtual_network_gateway_connectio... | The VirtualNetworkGatewayConnectionResetSharedKey operation resets the
virtual network gateway connection shared key for passed virtual network
gateway connection in the specified resource group through Network resource
provider.
@param resource_group_name [String] The name of the resource group.
@param virtual_network_gateway_connection_name [String] The virtual network
gateway connection reset shared key Name.
@param parameters [ConnectionResetSharedKey] Parameters supplied to the begin
reset virtual network gateway connection shared key 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",
"VirtualNetworkGatewayConnectionResetSharedKey",
"operation",
"resets",
"the",
"virtual",
"network",
"gateway",
"connection",
"shared",
"key",
"for",
"passed",
"virtual",
"network",
"gateway",
"connection",
"in",
"the",
"specified",
"resource",
"group",
"through",
... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/virtual_network_gateway_connections.rb#L1035-L1037 | train | Resets the virtual network gateway connection shared key. | [
30522,
13366,
4088,
1035,
25141,
1035,
4207,
1035,
3145,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7484,
1035,
2897,
1035,
11909,
1035,
4434,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
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... |
fastlane/fastlane | fastlane_core/lib/fastlane_core/configuration/configuration.rb | FastlaneCore.Configuration.set | def set(key, value)
UI.crash!("Key '#{key}' must be a symbol. Example :#{key}.") unless key.kind_of?(Symbol)
option = option_for_key(key)
unless option
UI.user_error!("Could not find option '#{key}' in the list of available options: #{@available_options.collect(&:key).join(', ')}")
end
option.verify!(value)
@values[key] = value
true
end | ruby | def set(key, value)
UI.crash!("Key '#{key}' must be a symbol. Example :#{key}.") unless key.kind_of?(Symbol)
option = option_for_key(key)
unless option
UI.user_error!("Could not find option '#{key}' in the list of available options: #{@available_options.collect(&:key).join(', ')}")
end
option.verify!(value)
@values[key] = value
true
end | [
"def",
"set",
"(",
"key",
",",
"value",
")",
"UI",
".",
"crash!",
"(",
"\"Key '#{key}' must be a symbol. Example :#{key}.\"",
")",
"unless",
"key",
".",
"kind_of?",
"(",
"Symbol",
")",
"option",
"=",
"option_for_key",
"(",
"key",
")",
"unless",
"option",
"UI",... | rubocop:enable Metrics/PerceivedComplexity
Overwrites or sets a new value for a given key
@param key [Symbol] Must be a symbol | [
"rubocop",
":",
"enable",
"Metrics",
"/",
"PerceivedComplexity",
"Overwrites",
"or",
"sets",
"a",
"new",
"value",
"for",
"a",
"given",
"key"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/fastlane_core/lib/fastlane_core/configuration/configuration.rb#L266-L278 | train | Set the value of a key. | [
30522,
13366,
2275,
1006,
3145,
1010,
3643,
1007,
21318,
1012,
5823,
999,
1006,
1000,
3145,
1005,
1001,
1063,
3145,
1065,
1005,
2442,
2022,
1037,
6454,
1012,
2742,
1024,
1001,
1063,
3145,
1065,
1012,
1000,
1007,
4983,
3145,
1012,
2785,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb | Azure::KeyVault::V2016_10_01.KeyVaultClient.get_certificate_issuer | def get_certificate_issuer(vault_base_url, issuer_name, custom_headers:nil)
response = get_certificate_issuer_async(vault_base_url, issuer_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_certificate_issuer(vault_base_url, issuer_name, custom_headers:nil)
response = get_certificate_issuer_async(vault_base_url, issuer_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_certificate_issuer",
"(",
"vault_base_url",
",",
"issuer_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_certificate_issuer_async",
"(",
"vault_base_url",
",",
"issuer_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
... | Lists the specified certificate issuer.
The GetCertificateIssuer operation returns the specified certificate issuer
resources in the specified key vault. This operation requires the
certificates/manageissuers/getissuers permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param issuer_name [String] The name of the issuer.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [IssuerBundle] operation results. | [
"Lists",
"the",
"specified",
"certificate",
"issuer",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb#L4941-L4944 | train | Gets the certificate issuer. | [
30522,
13366,
2131,
1035,
8196,
1035,
3277,
2099,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
3277,
2099,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
8196,
1035,
3277,
2099,
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... |
libgit2/rugged | lib/rugged/repository.rb | Rugged.Repository.checkout | def checkout(target, options = {})
options[:strategy] ||= :safe
options.delete(:paths)
return checkout_head(options) if target == "HEAD"
if target.kind_of?(Rugged::Branch)
branch = target
else
branch = branches[target]
end
if branch
self.checkout_tree(branch.target, options)
if branch.remote?
references.create("HEAD", branch.target_id, force: true)
else
references.create("HEAD", branch.canonical_name, force: true)
end
else
commit = Commit.lookup(self, self.rev_parse_oid(target))
references.create("HEAD", commit.oid, force: true)
self.checkout_tree(commit, options)
end
end | ruby | def checkout(target, options = {})
options[:strategy] ||= :safe
options.delete(:paths)
return checkout_head(options) if target == "HEAD"
if target.kind_of?(Rugged::Branch)
branch = target
else
branch = branches[target]
end
if branch
self.checkout_tree(branch.target, options)
if branch.remote?
references.create("HEAD", branch.target_id, force: true)
else
references.create("HEAD", branch.canonical_name, force: true)
end
else
commit = Commit.lookup(self, self.rev_parse_oid(target))
references.create("HEAD", commit.oid, force: true)
self.checkout_tree(commit, options)
end
end | [
"def",
"checkout",
"(",
"target",
",",
"options",
"=",
"{",
"}",
")",
"options",
"[",
":strategy",
"]",
"||=",
":safe",
"options",
".",
"delete",
"(",
":paths",
")",
"return",
"checkout_head",
"(",
"options",
")",
"if",
"target",
"==",
"\"HEAD\"",
"if",
... | Checkout the specified branch, reference or commit.
target - A revparse spec for the branch, reference or commit to check out.
options - Options passed to #checkout_tree. | [
"Checkout",
"the",
"specified",
"branch",
"reference",
"or",
"commit",
"."
] | 33873e5df2bd38501814182ff79609ed4bd88012 | https://github.com/libgit2/rugged/blob/33873e5df2bd38501814182ff79609ed4bd88012/lib/rugged/repository.rb#L29-L54 | train | Checkout the tree of the given target. | [
30522,
13366,
4638,
5833,
1006,
4539,
1010,
7047,
1027,
1063,
1065,
1007,
7047,
1031,
1024,
5656,
1033,
1064,
1064,
1027,
1024,
3647,
7047,
1012,
3972,
12870,
1006,
1024,
10425,
1007,
2709,
4638,
5833,
1035,
2132,
1006,
7047,
1007,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/server/thread_pool_server.rb | Thrift.ThreadPoolServer.serve | def serve
@server_transport.listen
begin
loop do
@thread_q.push(:token)
Thread.new do
begin
loop do
client = @server_transport.accept
trans = @transport_factory.get_transport(client)
prot = @protocol_factory.get_protocol(trans)
begin
loop do
@processor.process(prot, prot)
end
rescue Thrift::TransportException, Thrift::ProtocolException => e
ensure
trans.close
end
end
rescue => e
@exception_q.push(e)
ensure
@thread_q.pop # thread died!
end
end
end
ensure
@server_transport.close
end
end | ruby | def serve
@server_transport.listen
begin
loop do
@thread_q.push(:token)
Thread.new do
begin
loop do
client = @server_transport.accept
trans = @transport_factory.get_transport(client)
prot = @protocol_factory.get_protocol(trans)
begin
loop do
@processor.process(prot, prot)
end
rescue Thrift::TransportException, Thrift::ProtocolException => e
ensure
trans.close
end
end
rescue => e
@exception_q.push(e)
ensure
@thread_q.pop # thread died!
end
end
end
ensure
@server_transport.close
end
end | [
"def",
"serve",
"@server_transport",
".",
"listen",
"begin",
"loop",
"do",
"@thread_q",
".",
"push",
"(",
":token",
")",
"Thread",
".",
"new",
"do",
"begin",
"loop",
"do",
"client",
"=",
"@server_transport",
".",
"accept",
"trans",
"=",
"@transport_factory",
... | exceptions that happen in worker threads simply cause that thread
to die and another to be spawned in its place. | [
"exceptions",
"that",
"happen",
"in",
"worker",
"threads",
"simply",
"cause",
"that",
"thread",
"to",
"die",
"and",
"another",
"to",
"be",
"spawned",
"in",
"its",
"place",
"."
] | 27d8387c49a49fcf193893f834e9766ae0b051c1 | https://github.com/apache/thrift/blob/27d8387c49a49fcf193893f834e9766ae0b051c1/lib/rb/lib/thrift/server/thread_pool_server.rb#L42-L73 | train | Start the server | [
30522,
13366,
3710,
1030,
8241,
1035,
3665,
1012,
4952,
4088,
7077,
2079,
1030,
11689,
1035,
1053,
1012,
5245,
1006,
1024,
19204,
1007,
11689,
1012,
2047,
2079,
4088,
7077,
2079,
7396,
1027,
1030,
8241,
1035,
3665,
1012,
5138,
9099,
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... |
daddyz/phonelib | lib/phonelib/phone_analyzer_helper.rb | Phonelib.PhoneAnalyzerHelper.sanitize_fixed_mobile | def sanitize_fixed_mobile(types)
fixed_mobile = [Core::FIXED_LINE, Core::MOBILE]
[:possible, :valid].each do |key|
if (fixed_mobile - types[key]).empty?
types[key] = types[key] - fixed_mobile + [Core::FIXED_OR_MOBILE]
end
end
types
end | ruby | def sanitize_fixed_mobile(types)
fixed_mobile = [Core::FIXED_LINE, Core::MOBILE]
[:possible, :valid].each do |key|
if (fixed_mobile - types[key]).empty?
types[key] = types[key] - fixed_mobile + [Core::FIXED_OR_MOBILE]
end
end
types
end | [
"def",
"sanitize_fixed_mobile",
"(",
"types",
")",
"fixed_mobile",
"=",
"[",
"Core",
"::",
"FIXED_LINE",
",",
"Core",
"::",
"MOBILE",
"]",
"[",
":possible",
",",
":valid",
"]",
".",
"each",
"do",
"|",
"key",
"|",
"if",
"(",
"fixed_mobile",
"-",
"types",
... | checks if types has both :mobile and :fixed_line and replaces it with
:fixed_or_mobile in case both present | [
"checks",
"if",
"types",
"has",
"both",
":",
"mobile",
"and",
":",
"fixed_line",
"and",
"replaces",
"it",
"with",
":",
"fixed_or_mobile",
"in",
"case",
"both",
"present"
] | aa0023eab7c896b71275bf342bc7f49735cbdbbf | https://github.com/daddyz/phonelib/blob/aa0023eab7c896b71275bf342bc7f49735cbdbbf/lib/phonelib/phone_analyzer_helper.rb#L145-L153 | train | sanitize fixed mobile types | [
30522,
13366,
2624,
25090,
4371,
1035,
4964,
1035,
4684,
1006,
4127,
1007,
4964,
1035,
4684,
1027,
1031,
4563,
1024,
1024,
4964,
1035,
2240,
1010,
4563,
1024,
1024,
4684,
1033,
1031,
1024,
2825,
1010,
1024,
9398,
1033,
1012,
2169,
2079,
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... |
middleman/middleman | middleman-cli/lib/middleman-cli/build.rb | Middleman::Cli.Build.build | def build
root = ENV['MM_ROOT'] || Dir.pwd
raise Thor::Error, 'Error: Could not find a Middleman project config, perhaps you are in the wrong folder?' unless File.exist?(File.join(root, 'config.rb'))
require 'middleman-core'
require 'middleman-core/logger'
require 'middleman-core/builder'
require 'fileutils'
verbose = options['verbose'] ? 0 : 1
instrument = options['instrument']
builder = nil
cli_options = options
::Middleman::Logger.singleton(verbose, instrument)
::Middleman::Util.instrument 'builder.setup' do
missing_and_changed = !options['only_changed'] && options['missing_and_changed']
should_track_dependencies = options['only_changed'] || missing_and_changed || options['track_dependencies']
data_collection_depth = options['data_collection_depth']
@app = ::Middleman::Application.new do
config[:mode] = :build
config[:show_exceptions] = false
config[:cli_options] = cli_options.each_with_object({}) do |(k, v), sum|
sum[k] = v
end
config[:track_data_access] = should_track_dependencies
config[:data_collection_depth] = data_collection_depth
end
builder = Middleman::Builder.new(@app,
glob: options['glob'],
dry_run: options['dry_run'],
clean: options['clean'],
parallel: options['parallel'],
only_changed: options['only_changed'],
missing_and_changed: missing_and_changed,
track_dependencies: should_track_dependencies,
visualize_graph: options['visualize_graph'])
builder.thor = self
builder.on_build_event(&method(:on_event))
end
::Middleman::Util.instrument 'builder.run' do
if builder.run!
clean_directories! if options['clean']
puts 'Project built successfully.'
else
msg = 'There were errors during this build'
msg << ', re-run with `middleman build --verbose` to see the full exception.' unless options['verbose']
shell.say msg, :red
exit(1)
end
end
end | ruby | def build
root = ENV['MM_ROOT'] || Dir.pwd
raise Thor::Error, 'Error: Could not find a Middleman project config, perhaps you are in the wrong folder?' unless File.exist?(File.join(root, 'config.rb'))
require 'middleman-core'
require 'middleman-core/logger'
require 'middleman-core/builder'
require 'fileutils'
verbose = options['verbose'] ? 0 : 1
instrument = options['instrument']
builder = nil
cli_options = options
::Middleman::Logger.singleton(verbose, instrument)
::Middleman::Util.instrument 'builder.setup' do
missing_and_changed = !options['only_changed'] && options['missing_and_changed']
should_track_dependencies = options['only_changed'] || missing_and_changed || options['track_dependencies']
data_collection_depth = options['data_collection_depth']
@app = ::Middleman::Application.new do
config[:mode] = :build
config[:show_exceptions] = false
config[:cli_options] = cli_options.each_with_object({}) do |(k, v), sum|
sum[k] = v
end
config[:track_data_access] = should_track_dependencies
config[:data_collection_depth] = data_collection_depth
end
builder = Middleman::Builder.new(@app,
glob: options['glob'],
dry_run: options['dry_run'],
clean: options['clean'],
parallel: options['parallel'],
only_changed: options['only_changed'],
missing_and_changed: missing_and_changed,
track_dependencies: should_track_dependencies,
visualize_graph: options['visualize_graph'])
builder.thor = self
builder.on_build_event(&method(:on_event))
end
::Middleman::Util.instrument 'builder.run' do
if builder.run!
clean_directories! if options['clean']
puts 'Project built successfully.'
else
msg = 'There were errors during this build'
msg << ', re-run with `middleman build --verbose` to see the full exception.' unless options['verbose']
shell.say msg, :red
exit(1)
end
end
end | [
"def",
"build",
"root",
"=",
"ENV",
"[",
"'MM_ROOT'",
"]",
"||",
"Dir",
".",
"pwd",
"raise",
"Thor",
"::",
"Error",
",",
"'Error: Could not find a Middleman project config, perhaps you are in the wrong folder?'",
"unless",
"File",
".",
"exist?",
"(",
"File",
".",
"j... | Core build Thor command
@return [void] | [
"Core",
"build",
"Thor",
"command"
] | a0dd9f78094813162895511e8516e0c5507cee50 | https://github.com/middleman/middleman/blob/a0dd9f78094813162895511e8516e0c5507cee50/middleman-cli/lib/middleman-cli/build.rb#L72-L130 | train | Build the Middleman project | [
30522,
13366,
3857,
7117,
1027,
4372,
2615,
1031,
1005,
3461,
1035,
7117,
1005,
1033,
1064,
1064,
16101,
1012,
1052,
21724,
5333,
15321,
1024,
1024,
7561,
1010,
1005,
7561,
1024,
2071,
2025,
2424,
1037,
2690,
2386,
2622,
9530,
8873,
2290,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rmosolgo/graphql-ruby | lib/graphql/schema.rb | GraphQL.Schema.as_json | def as_json(only: nil, except: nil, context: {})
execute(Introspection::INTROSPECTION_QUERY, only: only, except: except, context: context).to_h
end | ruby | def as_json(only: nil, except: nil, context: {})
execute(Introspection::INTROSPECTION_QUERY, only: only, except: except, context: context).to_h
end | [
"def",
"as_json",
"(",
"only",
":",
"nil",
",",
"except",
":",
"nil",
",",
"context",
":",
"{",
"}",
")",
"execute",
"(",
"Introspection",
"::",
"INTROSPECTION_QUERY",
",",
"only",
":",
"only",
",",
"except",
":",
"except",
",",
"context",
":",
"contex... | Return the Hash response of {Introspection::INTROSPECTION_QUERY}.
@param context [Hash]
@param only [<#call(member, ctx)>]
@param except [<#call(member, ctx)>]
@return [Hash] GraphQL result | [
"Return",
"the",
"Hash",
"response",
"of",
"{",
"Introspection",
"::",
"INTROSPECTION_QUERY",
"}",
"."
] | d5be13a816f220b9efbabeaa69a3e56fedf311f5 | https://github.com/rmosolgo/graphql-ruby/blob/d5be13a816f220b9efbabeaa69a3e56fedf311f5/lib/graphql/schema.rb#L673-L675 | train | Returns the array of H
objects as a JSON string. | [
30522,
13366,
2004,
1035,
1046,
3385,
1006,
2069,
1024,
9152,
2140,
1010,
3272,
1024,
9152,
2140,
1010,
6123,
1024,
1063,
1065,
1007,
15389,
1006,
17174,
13102,
18491,
1024,
1024,
17174,
13102,
18491,
1035,
23032,
1010,
2069,
1024,
2069,
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... |
watir/watir | lib/watir/capabilities.rb | Watir.Capabilities.process_browser_options | def process_browser_options
browser_options = @options.delete(:options) || {}
case @selenium_browser
when :chrome
if @options.key?(:args) || @options.key?(:switches)
browser_options ||= {}
browser_options[:args] = (@options.delete(:args) || @options.delete(:switches)).dup
end
if @options.delete(:headless)
browser_options ||= {}
browser_options[:args] ||= []
browser_options[:args] += ['--headless', '--disable-gpu']
end
@selenium_opts[:options] = browser_options if browser_options.is_a? Selenium::WebDriver::Chrome::Options
@selenium_opts[:options] ||= Selenium::WebDriver::Chrome::Options.new(browser_options)
when :firefox
profile = @options.delete(:profile)
if browser_options.is_a? Selenium::WebDriver::Firefox::Options
@selenium_opts[:options] = browser_options
if profile
msg = 'Initializing Browser with both :profile and :option', ':profile as a key inside :option'
Watir.logger.deprecate msg, ids: [:firefox_profile]
end
end
if @options.delete(:headless)
browser_options ||= {}
browser_options[:args] ||= []
browser_options[:args] += ['--headless']
end
@selenium_opts[:options] ||= Selenium::WebDriver::Firefox::Options.new(browser_options)
@selenium_opts[:options].profile = profile if profile
when :safari
Selenium::WebDriver::Safari.technology_preview! if @options.delete(:technology_preview)
when :remote
if @browser == :chrome && @options.delete(:headless)
args = @options.delete(:args) || @options.delete(:switches) || []
@options['chromeOptions'] = {'args' => args + ['--headless', '--disable-gpu']}
end
if @browser == :firefox && @options.delete(:headless)
args = @options.delete(:args) || @options.delete(:switches) || []
@options[Selenium::WebDriver::Firefox::Options::KEY] = {'args' => args + ['--headless']}
end
if @browser == :safari && @options.delete(:technology_preview)
@options['safari.options'] = {'technologyPreview' => true}
end
when :ie
if @options.key?(:args)
browser_options ||= {}
browser_options[:args] = @options.delete(:args).dup
end
unless browser_options.is_a? Selenium::WebDriver::IE::Options
ie_caps = browser_options.select { |k| Selenium::WebDriver::IE::Options::CAPABILITIES.include?(k) }
browser_options = Selenium::WebDriver::IE::Options.new(browser_options)
ie_caps.each { |k, v| browser_options.add_option(k, v) }
end
@selenium_opts[:options] = browser_options
end
end | ruby | def process_browser_options
browser_options = @options.delete(:options) || {}
case @selenium_browser
when :chrome
if @options.key?(:args) || @options.key?(:switches)
browser_options ||= {}
browser_options[:args] = (@options.delete(:args) || @options.delete(:switches)).dup
end
if @options.delete(:headless)
browser_options ||= {}
browser_options[:args] ||= []
browser_options[:args] += ['--headless', '--disable-gpu']
end
@selenium_opts[:options] = browser_options if browser_options.is_a? Selenium::WebDriver::Chrome::Options
@selenium_opts[:options] ||= Selenium::WebDriver::Chrome::Options.new(browser_options)
when :firefox
profile = @options.delete(:profile)
if browser_options.is_a? Selenium::WebDriver::Firefox::Options
@selenium_opts[:options] = browser_options
if profile
msg = 'Initializing Browser with both :profile and :option', ':profile as a key inside :option'
Watir.logger.deprecate msg, ids: [:firefox_profile]
end
end
if @options.delete(:headless)
browser_options ||= {}
browser_options[:args] ||= []
browser_options[:args] += ['--headless']
end
@selenium_opts[:options] ||= Selenium::WebDriver::Firefox::Options.new(browser_options)
@selenium_opts[:options].profile = profile if profile
when :safari
Selenium::WebDriver::Safari.technology_preview! if @options.delete(:technology_preview)
when :remote
if @browser == :chrome && @options.delete(:headless)
args = @options.delete(:args) || @options.delete(:switches) || []
@options['chromeOptions'] = {'args' => args + ['--headless', '--disable-gpu']}
end
if @browser == :firefox && @options.delete(:headless)
args = @options.delete(:args) || @options.delete(:switches) || []
@options[Selenium::WebDriver::Firefox::Options::KEY] = {'args' => args + ['--headless']}
end
if @browser == :safari && @options.delete(:technology_preview)
@options['safari.options'] = {'technologyPreview' => true}
end
when :ie
if @options.key?(:args)
browser_options ||= {}
browser_options[:args] = @options.delete(:args).dup
end
unless browser_options.is_a? Selenium::WebDriver::IE::Options
ie_caps = browser_options.select { |k| Selenium::WebDriver::IE::Options::CAPABILITIES.include?(k) }
browser_options = Selenium::WebDriver::IE::Options.new(browser_options)
ie_caps.each { |k, v| browser_options.add_option(k, v) }
end
@selenium_opts[:options] = browser_options
end
end | [
"def",
"process_browser_options",
"browser_options",
"=",
"@options",
".",
"delete",
"(",
":options",
")",
"||",
"{",
"}",
"case",
"@selenium_browser",
"when",
":chrome",
"if",
"@options",
".",
"key?",
"(",
":args",
")",
"||",
"@options",
".",
"key?",
"(",
"... | TODO: - this will get addressed with Capabilities Update
rubocop:disable Metrics/AbcSize
rubocop:disable Metrics/MethodLength
rubocop:disable Metrics/PerceivedComplexity:
rubocop:disable Metrics/CyclomaticComplexity:: | [
"TODO",
":",
"-",
"this",
"will",
"get",
"addressed",
"with",
"Capabilities",
"Update",
"rubocop",
":",
"disable",
"Metrics",
"/",
"AbcSize",
"rubocop",
":",
"disable",
"Metrics",
"/",
"MethodLength",
"rubocop",
":",
"disable",
"Metrics",
"/",
"PerceivedComplexi... | 2d8db09811c6221ae401b85b2f61f5fa66e463a3 | https://github.com/watir/watir/blob/2d8db09811c6221ae401b85b2f61f5fa66e463a3/lib/watir/capabilities.rb#L70-L128 | train | Process the browser options | [
30522,
13366,
2832,
1035,
16602,
1035,
7047,
16602,
1035,
7047,
1027,
1030,
7047,
1012,
3972,
12870,
1006,
1024,
7047,
1007,
1064,
1064,
1063,
1065,
2553,
1030,
7367,
7770,
5007,
1035,
16602,
2043,
1024,
18546,
2065,
1030,
7047,
1012,
3145,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sinatra/sinatra | lib/sinatra/base.rb | Sinatra.Base.dispatch! | def dispatch!
# Avoid passing frozen string in force_encoding
@params.merge!(@request.params).each do |key, val|
next unless val.respond_to?(:force_encoding)
val = val.dup if val.frozen?
@params[key] = force_encoding(val)
end
invoke do
static! if settings.static? && (request.get? || request.head?)
filter! :before
route!
end
rescue ::Exception => boom
invoke { handle_exception!(boom) }
ensure
begin
filter! :after unless env['sinatra.static_file']
rescue ::Exception => boom
invoke { handle_exception!(boom) } unless @env['sinatra.error']
end
end | ruby | def dispatch!
# Avoid passing frozen string in force_encoding
@params.merge!(@request.params).each do |key, val|
next unless val.respond_to?(:force_encoding)
val = val.dup if val.frozen?
@params[key] = force_encoding(val)
end
invoke do
static! if settings.static? && (request.get? || request.head?)
filter! :before
route!
end
rescue ::Exception => boom
invoke { handle_exception!(boom) }
ensure
begin
filter! :after unless env['sinatra.static_file']
rescue ::Exception => boom
invoke { handle_exception!(boom) } unless @env['sinatra.error']
end
end | [
"def",
"dispatch!",
"# Avoid passing frozen string in force_encoding",
"@params",
".",
"merge!",
"(",
"@request",
".",
"params",
")",
".",
"each",
"do",
"|",
"key",
",",
"val",
"|",
"next",
"unless",
"val",
".",
"respond_to?",
"(",
":force_encoding",
")",
"val",... | Dispatch a request with error handling. | [
"Dispatch",
"a",
"request",
"with",
"error",
"handling",
"."
] | 1aa64f9858edc3f93cc8d46e26f724c1ae103b1c | https://github.com/sinatra/sinatra/blob/1aa64f9858edc3f93cc8d46e26f724c1ae103b1c/lib/sinatra/base.rb#L1091-L1112 | train | Dispatches the request to the controller. | [
30522,
13366,
18365,
999,
1001,
4468,
4458,
7708,
5164,
1999,
2486,
1035,
17181,
1030,
11498,
5244,
1012,
13590,
999,
1006,
1030,
5227,
1012,
11498,
5244,
1007,
1012,
2169,
2079,
1064,
3145,
1010,
11748,
1064,
2279,
4983,
11748,
1012,
6869,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/webhook.rb | Trello.Webhook.update! | def update!
client.put("/webhooks/#{id}", {
description: description,
idModel: id_model,
callbackURL: callback_url,
active: active
})
end | ruby | def update!
client.put("/webhooks/#{id}", {
description: description,
idModel: id_model,
callbackURL: callback_url,
active: active
})
end | [
"def",
"update!",
"client",
".",
"put",
"(",
"\"/webhooks/#{id}\"",
",",
"{",
"description",
":",
"description",
",",
"idModel",
":",
"id_model",
",",
"callbackURL",
":",
"callback_url",
",",
"active",
":",
"active",
"}",
")",
"end"
] | Update the webhook.
@raise [Trello::Error] if the Webhook could not be saved.
@return [String] the JSON representation of the updated webhook. | [
"Update",
"the",
"webhook",
"."
] | ad79c9d8152ad5395b3b61c43170908f1912bfb2 | https://github.com/jeremytregunna/ruby-trello/blob/ad79c9d8152ad5395b3b61c43170908f1912bfb2/lib/trello/webhook.rb#L80-L87 | train | Update the current object | [
30522,
13366,
10651,
999,
7396,
1012,
2404,
1006,
1000,
1013,
4773,
6806,
6559,
2015,
1013,
1001,
1063,
8909,
1065,
1000,
1010,
1063,
6412,
1024,
6412,
1010,
8909,
5302,
9247,
1024,
8909,
1035,
2944,
1010,
2655,
5963,
3126,
2140,
1024,
26... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/pops/loaders.rb | Puppet::Pops.Loaders.find_loader | def find_loader(module_name)
if module_name.nil? || EMPTY_STRING == module_name
# Use the public environment loader
public_environment_loader
else
# TODO : Later check if definition is private, and then add it to private_loader_for_module
#
loader = public_loader_for_module(module_name)
if loader.nil?
raise Puppet::ParseError, _("Internal Error: did not find public loader for module: '%{module_name}'") % { module_name: module_name }
end
loader
end
end | ruby | def find_loader(module_name)
if module_name.nil? || EMPTY_STRING == module_name
# Use the public environment loader
public_environment_loader
else
# TODO : Later check if definition is private, and then add it to private_loader_for_module
#
loader = public_loader_for_module(module_name)
if loader.nil?
raise Puppet::ParseError, _("Internal Error: did not find public loader for module: '%{module_name}'") % { module_name: module_name }
end
loader
end
end | [
"def",
"find_loader",
"(",
"module_name",
")",
"if",
"module_name",
".",
"nil?",
"||",
"EMPTY_STRING",
"==",
"module_name",
"# Use the public environment loader",
"public_environment_loader",
"else",
"# TODO : Later check if definition is private, and then add it to private_loader_fo... | Finds the appropriate loader for the given `module_name`, or for the environment in case `module_name`
is `nil` or empty.
@param module_name [String,nil] the name of the module
@return [Loader::Loader] the found loader
@raise [Puppet::ParseError] if no loader can be found
@api private | [
"Finds",
"the",
"appropriate",
"loader",
"for",
"the",
"given",
"module_name",
"or",
"for",
"the",
"environment",
"in",
"case",
"module_name",
"is",
"nil",
"or",
"empty",
"."
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/pops/loaders.rb#L200-L213 | train | Find the loader for a module | [
30522,
13366,
2424,
1035,
7170,
2121,
1006,
11336,
1035,
2171,
1007,
2065,
11336,
1035,
2171,
1012,
9152,
2140,
1029,
1064,
1064,
4064,
1035,
5164,
1027,
1027,
11336,
1035,
2171,
1001,
2224,
1996,
2270,
4044,
7170,
2121,
2270,
1035,
4044,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
decidim/decidim | decidim-core/lib/decidim/stats_registry.rb | Decidim.StatsRegistry.register | def register(name, options = {}, &block)
stat = @stats.detect { |s| s[:name] == name }
raise StandardError, "Stats '#{name}' is already registered." if stat.present?
options[:primary] ||= false
options[:priority] ||= LOW_PRIORITY
@stats.push(name: name,
primary: options[:primary],
priority: options[:priority],
tag: options[:tag],
block: block)
end | ruby | def register(name, options = {}, &block)
stat = @stats.detect { |s| s[:name] == name }
raise StandardError, "Stats '#{name}' is already registered." if stat.present?
options[:primary] ||= false
options[:priority] ||= LOW_PRIORITY
@stats.push(name: name,
primary: options[:primary],
priority: options[:priority],
tag: options[:tag],
block: block)
end | [
"def",
"register",
"(",
"name",
",",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"stat",
"=",
"@stats",
".",
"detect",
"{",
"|",
"s",
"|",
"s",
"[",
":name",
"]",
"==",
"name",
"}",
"raise",
"StandardError",
",",
"\"Stats '#{name}' is already reg... | Public: Initializes the object with an optional stats array
stats - An array of Hashes to represent a stat object
Public: Register a stat
name - The name of the stat
options - A hash of options
* primary: Whether the stat is primary or not.
* priority: The priority of the stat used for render issues.
block - A block that receive the components to filter out the stat. | [
"Public",
":",
"Initializes",
"the",
"object",
"with",
"an",
"optional",
"stats",
"array"
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/lib/decidim/stats_registry.rb#L26-L38 | train | Register a new stats object | [
30522,
13366,
4236,
1006,
2171,
1010,
7047,
1027,
1063,
1065,
1010,
1004,
3796,
1007,
28093,
1027,
1030,
26319,
1012,
11487,
1063,
1064,
1055,
1064,
1055,
1031,
1024,
2171,
1033,
1027,
1027,
2171,
1065,
5333,
3115,
2121,
29165,
1010,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/route_filter_rules.rb | Azure::Network::Mgmt::V2018_07_01.RouteFilterRules.update | def update(resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers:nil)
response = update_async(resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def update(resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers:nil)
response = update_async(resource_group_name, route_filter_name, rule_name, route_filter_rule_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"update",
"(",
"resource_group_name",
",",
"route_filter_name",
",",
"rule_name",
",",
"route_filter_rule_parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"update_async",
"(",
"resource_group_name",
",",
"route_filter_name",
",",
"rule_name",... | Updates a route in the specified route filter.
@param resource_group_name [String] The name of the resource group.
@param route_filter_name [String] The name of the route filter.
@param rule_name [String] The name of the route filter rule.
@param route_filter_rule_parameters [PatchRouteFilterRule] Parameters
supplied to the update route filter rule operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [RouteFilterRule] operation results. | [
"Updates",
"a",
"route",
"in",
"the",
"specified",
"route",
"filter",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/route_filter_rules.rb#L221-L224 | train | Updates a route filter rule. | [
30522,
13366,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2799,
1035,
11307,
1035,
2171,
1010,
3627,
1035,
2171,
1010,
2799,
1035,
11307,
1035,
3627,
1035,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
10651... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
meew0/discordrb | lib/discordrb/bot.rb | Discordrb.Bot.find_emoji | def find_emoji(name)
LOGGER.out("Resolving emoji #{name}")
emoji.find { |element| element.name == name }
end | ruby | def find_emoji(name)
LOGGER.out("Resolving emoji #{name}")
emoji.find { |element| element.name == name }
end | [
"def",
"find_emoji",
"(",
"name",
")",
"LOGGER",
".",
"out",
"(",
"\"Resolving emoji #{name}\"",
")",
"emoji",
".",
"find",
"{",
"|",
"element",
"|",
"element",
".",
"name",
"==",
"name",
"}",
"end"
] | Finds an emoji by its name.
@param name [String] The emoji name that should be resolved.
@return [GlobalEmoji, nil] the emoji identified by the name, or `nil` if it couldn't be found. | [
"Finds",
"an",
"emoji",
"by",
"its",
"name",
"."
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/bot.rb#L189-L192 | train | Finds an emoji by name | [
30522,
13366,
2424,
1035,
7861,
29147,
2072,
1006,
2171,
1007,
8833,
4590,
1012,
2041,
1006,
1000,
29304,
7861,
29147,
2072,
1001,
1063,
2171,
1065,
1000,
1007,
7861,
29147,
2072,
1012,
2424,
1063,
1064,
5783,
1064,
5783,
1012,
2171,
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... |
randym/axlsx | lib/axlsx/workbook/worksheet/cell.rb | Axlsx.Cell.clean_value | def clean_value
if (type == :string || type == :text) && !Axlsx::trust_input
Axlsx::sanitize(::CGI.escapeHTML(@value.to_s))
else
@value.to_s
end
end | ruby | def clean_value
if (type == :string || type == :text) && !Axlsx::trust_input
Axlsx::sanitize(::CGI.escapeHTML(@value.to_s))
else
@value.to_s
end
end | [
"def",
"clean_value",
"if",
"(",
"type",
"==",
":string",
"||",
"type",
"==",
":text",
")",
"&&",
"!",
"Axlsx",
"::",
"trust_input",
"Axlsx",
"::",
"sanitize",
"(",
"::",
"CGI",
".",
"escapeHTML",
"(",
"@value",
".",
"to_s",
")",
")",
"else",
"@value",... | Returns the sanatized value
TODO find a better way to do this as it accounts for 30% of
processing time in benchmarking... | [
"Returns",
"the",
"sanatized",
"value",
"TODO",
"find",
"a",
"better",
"way",
"to",
"do",
"this",
"as",
"it",
"accounts",
"for",
"30%",
"of",
"processing",
"time",
"in",
"benchmarking",
"..."
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/worksheet/cell.rb#L373-L379 | train | clean value
| [
30522,
13366,
4550,
1035,
30524,
1027,
1027,
1024,
5164,
1064,
1064,
2828,
1027,
1027,
1024,
3793,
1007,
1004,
1004,
999,
22260,
4877,
2595,
1024,
1024,
3404,
1035,
7953,
22260,
4877,
2595,
1024,
1024,
2624,
25090,
4371,
1006,
1024,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
projectcypress/health-data-standards | lib/hqmf-parser/2.0/data_criteria_helpers/dc_definition_from_template_or_type_extract.rb | HQMF2.DataCriteriaTypeAndDefinitionExtraction.extract_definition_from_template_id | def extract_definition_from_template_id
found = false
@template_ids.each do |template_id|
defs = HQMF::DataCriteria.definition_for_template_id(template_id, 'r2')
if defs
@definition = defs['definition']
@status = defs['status'].length > 0 ? defs['status'] : nil
found ||= true
else
found ||= handle_known_template_id(template_id)
end
end
found
end | ruby | def extract_definition_from_template_id
found = false
@template_ids.each do |template_id|
defs = HQMF::DataCriteria.definition_for_template_id(template_id, 'r2')
if defs
@definition = defs['definition']
@status = defs['status'].length > 0 ? defs['status'] : nil
found ||= true
else
found ||= handle_known_template_id(template_id)
end
end
found
end | [
"def",
"extract_definition_from_template_id",
"found",
"=",
"false",
"@template_ids",
".",
"each",
"do",
"|",
"template_id",
"|",
"defs",
"=",
"HQMF",
"::",
"DataCriteria",
".",
"definition_for_template_id",
"(",
"template_id",
",",
"'r2'",
")",
"if",
"defs",
"@de... | Given a template id, derive (if available) the definition for the template.
The definitions are stored in hqmf-model/data_criteria.json. | [
"Given",
"a",
"template",
"id",
"derive",
"(",
"if",
"available",
")",
"the",
"definition",
"for",
"the",
"template",
".",
"The",
"definitions",
"are",
"stored",
"in",
"hqmf",
"-",
"model",
"/",
"data_criteria",
".",
"json",
"."
] | 252d4f0927c513eacde6b9ea41b76faa1423c34b | https://github.com/projectcypress/health-data-standards/blob/252d4f0927c513eacde6b9ea41b76faa1423c34b/lib/hqmf-parser/2.0/data_criteria_helpers/dc_definition_from_template_or_type_extract.rb#L18-L33 | train | Extract the definition from the template_ids | [
30522,
13366,
14817,
1035,
6210,
1035,
2013,
1035,
23561,
1035,
8909,
2179,
1027,
6270,
1030,
23561,
1035,
8909,
2015,
1012,
2169,
2079,
1064,
23561,
1035,
8909,
1064,
13366,
2015,
1027,
16260,
2213,
2546,
1024,
1024,
2951,
26775,
21646,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cypriss/mutations | lib/mutations/errors.rb | Mutations.ErrorHash.symbolic | def symbolic
HashWithIndifferentAccess.new.tap do |hash|
each do |k, v|
hash[k] = v.symbolic
end
end
end | ruby | def symbolic
HashWithIndifferentAccess.new.tap do |hash|
each do |k, v|
hash[k] = v.symbolic
end
end
end | [
"def",
"symbolic",
"HashWithIndifferentAccess",
".",
"new",
".",
"tap",
"do",
"|",
"hash",
"|",
"each",
"do",
"|",
"k",
",",
"v",
"|",
"hash",
"[",
"k",
"]",
"=",
"v",
".",
"symbolic",
"end",
"end",
"end"
] | Returns a nested HashWithIndifferentAccess where the values are symbols. Eg:
{
email: :matches,
name: :too_weird,
adddress: {
city: :not_found,
state: :in
}
} | [
"Returns",
"a",
"nested",
"HashWithIndifferentAccess",
"where",
"the",
"values",
"are",
"symbols",
".",
"Eg",
":",
"{",
"email",
":",
":",
"matches",
"name",
":",
":",
"too_weird",
"adddress",
":",
"{",
"city",
":",
":",
"not_found",
"state",
":",
":",
"... | c9948325648d0ea85420963829d1a4d6b4f17bd9 | https://github.com/cypriss/mutations/blob/c9948325648d0ea85420963829d1a4d6b4f17bd9/lib/mutations/errors.rb#L116-L122 | train | Return the symbolic version of the object. | [
30522,
13366,
12613,
23325,
24415,
22254,
13355,
7869,
12380,
9468,
7971,
1012,
2047,
1012,
11112,
2079,
1064,
23325,
1064,
2169,
2079,
1064,
1047,
1010,
1058,
1064,
23325,
1031,
1047,
1033,
1027,
1058,
1012,
12613,
2203,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.