repo stringclasses 237 values | path stringlengths 11 168 | func_name stringlengths 10 147 | original_string stringlengths 79 124k | language stringclasses 1 value | code stringlengths 79 124k | code_tokens listlengths 16 45.3k | docstring stringlengths 4 23.5k | docstring_tokens listlengths 1 452 | sha stringclasses 237 values | url stringlengths 95 268 | partition stringclasses 1 value | summary stringlengths 8 229 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sds/overcommit | lib/overcommit/message_processor.rb | Overcommit.MessageProcessor.basic_status_and_output | def basic_status_and_output(messages)
status =
if messages.any? { |message| message.type == :error }
:fail
elsif messages.any? { |message| message.type == :warning }
:warn
else
:pass
end
output = ''
if messages.any?
output += messages.join("\n") + "\n"
end
[status, output]
end | ruby | def basic_status_and_output(messages)
status =
if messages.any? { |message| message.type == :error }
:fail
elsif messages.any? { |message| message.type == :warning }
:warn
else
:pass
end
output = ''
if messages.any?
output += messages.join("\n") + "\n"
end
[status, output]
end | [
"def",
"basic_status_and_output",
"(",
"messages",
")",
"status",
"=",
"if",
"messages",
".",
"any?",
"{",
"|",
"message",
"|",
"message",
".",
"type",
"==",
":error",
"}",
":fail",
"elsif",
"messages",
".",
"any?",
"{",
"|",
"message",
"|",
"message",
"... | Returns status and output for messages assuming no special treatment of
messages occurring on unmodified lines. | [
"Returns",
"status",
"and",
"output",
"for",
"messages",
"assuming",
"no",
"special",
"treatment",
"of",
"messages",
"occurring",
"on",
"unmodified",
"lines",
"."
] | 35d60adb41da942178b789560968e3ad030b0ac7 | https://github.com/sds/overcommit/blob/35d60adb41da942178b789560968e3ad030b0ac7/lib/overcommit/message_processor.rb#L101-L117 | train | Returns the status and output of the messages | [
30522,
13366,
3937,
1035,
3570,
1035,
1998,
1035,
6434,
1006,
7696,
1007,
3570,
1027,
2065,
7696,
1012,
2151,
1029,
1063,
1064,
4471,
1064,
4471,
1012,
2828,
1027,
1027,
1024,
7561,
1065,
1024,
8246,
3449,
5332,
2546,
7696,
1012,
2151,
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... |
lostisland/faraday | lib/faraday/options.rb | Faraday.Options.merge! | def merge!(other)
other.each do |key, other_value|
self_value = send(key)
sub_options = self.class.options_for(key)
new_value = if self_value && sub_options && other_value
self_value.merge(other_value)
else
other_value
end
send("#{key}=", new_value) unless new_value.nil?
end
self
end | ruby | def merge!(other)
other.each do |key, other_value|
self_value = send(key)
sub_options = self.class.options_for(key)
new_value = if self_value && sub_options && other_value
self_value.merge(other_value)
else
other_value
end
send("#{key}=", new_value) unless new_value.nil?
end
self
end | [
"def",
"merge!",
"(",
"other",
")",
"other",
".",
"each",
"do",
"|",
"key",
",",
"other_value",
"|",
"self_value",
"=",
"send",
"(",
"key",
")",
"sub_options",
"=",
"self",
".",
"class",
".",
"options_for",
"(",
"key",
")",
"new_value",
"=",
"if",
"s... | Public | [
"Public"
] | 3abe9d1eea4bdf61cdf7b76ff9f1ae7e09482e70 | https://github.com/lostisland/faraday/blob/3abe9d1eea4bdf61cdf7b76ff9f1ae7e09482e70/lib/faraday/options.rb#L51-L63 | train | Merge the attributes of this object with the other object. | [
30522,
13366,
13590,
999,
1006,
2060,
1007,
2060,
1012,
2169,
2079,
1064,
3145,
1010,
2060,
1035,
3643,
1064,
2969,
1035,
3643,
1027,
4604,
1006,
3145,
1007,
4942,
1035,
7047,
1027,
2969,
1012,
2465,
1012,
7047,
1035,
2005,
1006,
3145,
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_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/open_id_connect_provider.rb | Azure::ApiManagement::Mgmt::V2018_01_01.OpenIdConnectProvider.get_with_http_info | def get_with_http_info(resource_group_name, service_name, opid, custom_headers:nil)
get_async(resource_group_name, service_name, opid, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, service_name, opid, custom_headers:nil)
get_async(resource_group_name, service_name, opid, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"service_name",
",",
"opid",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"service_name",
",",
"opid",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!"... | Gets specific OpenID Connect Provider.
@param resource_group_name [String] The name of the resource group.
@param service_name [String] The name of the API Management service.
@param opid [String] Identifier of the OpenID Connect 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. | [
"Gets",
"specific",
"OpenID",
"Connect",
"Provider",
"."
] | 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/open_id_connect_provider.rb#L268-L270 | train | Gets the specified Advisor Specifications. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
6728,
3593,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2017-10-01-preview/generated/azure_mgmt_sql/elastic_pools.rb | Azure::SQL::Mgmt::V2017_10_01_preview.ElasticPools.list_by_server_with_http_info | def list_by_server_with_http_info(resource_group_name, server_name, skip:nil, custom_headers:nil)
list_by_server_async(resource_group_name, server_name, skip:skip, custom_headers:custom_headers).value!
end | ruby | def list_by_server_with_http_info(resource_group_name, server_name, skip:nil, custom_headers:nil)
list_by_server_async(resource_group_name, server_name, skip:skip, custom_headers:custom_headers).value!
end | [
"def",
"list_by_server_with_http_info",
"(",
"resource_group_name",
",",
"server_name",
",",
"skip",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"list_by_server_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"skip",
":",
"skip",
",",
"custom_he... | Gets all elastic pools in a server.
@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 skip [Integer] The number of elements in the collection to skip.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"all",
"elastic",
"pools",
"in",
"a",
"server",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2017-10-01-preview/generated/azure_mgmt_sql/elastic_pools.rb#L58-L60 | train | Gets the list of all the segmentation of the server. | [
30522,
13366,
2862,
1035,
2011,
1035,
8241,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
13558,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2862,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
scenic-views/scenic | lib/scenic/statements.rb | Scenic.Statements.create_view | def create_view(name, version: nil, sql_definition: nil, materialized: false)
if version.present? && sql_definition.present?
raise(
ArgumentError,
"sql_definition and version cannot both be set",
)
end
if version.blank? && sql_definition.blank?
version = 1
end
sql_definition ||= definition(name, version)
if materialized
Scenic.database.create_materialized_view(
name,
sql_definition,
no_data: no_data(materialized),
)
else
Scenic.database.create_view(name, sql_definition)
end
end | ruby | def create_view(name, version: nil, sql_definition: nil, materialized: false)
if version.present? && sql_definition.present?
raise(
ArgumentError,
"sql_definition and version cannot both be set",
)
end
if version.blank? && sql_definition.blank?
version = 1
end
sql_definition ||= definition(name, version)
if materialized
Scenic.database.create_materialized_view(
name,
sql_definition,
no_data: no_data(materialized),
)
else
Scenic.database.create_view(name, sql_definition)
end
end | [
"def",
"create_view",
"(",
"name",
",",
"version",
":",
"nil",
",",
"sql_definition",
":",
"nil",
",",
"materialized",
":",
"false",
")",
"if",
"version",
".",
"present?",
"&&",
"sql_definition",
".",
"present?",
"raise",
"(",
"ArgumentError",
",",
"\"sql_de... | Create a new database view.
@param name [String, Symbol] The name of the database view.
@param version [Fixnum] The version number of the view, used to find the
definition file in `db/views`. This defaults to `1` if not provided.
@param sql_definition [String] The SQL query for the view schema. An error
will be raised if `sql_definition` and `version` are both set,
as they are mutually exclusive.
@param materialized [Boolean, Hash] Set to true to create a materialized
view. Set to { no_data: true } to create materialized view without
loading data. Defaults to false.
@return The database response from executing the create statement.
@example Create from `db/views/searches_v02.sql`
create_view(:searches, version: 2)
@example Create from provided SQL string
create_view(:active_users, sql_definition: <<-SQL)
SELECT * FROM users WHERE users.active = 't'
SQL | [
"Create",
"a",
"new",
"database",
"view",
"."
] | cc6adbde2bded9c895c41025d371c4c0f34c9253 | https://github.com/scenic-views/scenic/blob/cc6adbde2bded9c895c41025d371c4c0f34c9253/lib/scenic/statements.rb#L25-L48 | train | Creates a view in the database. | [
30522,
13366,
3443,
1035,
3193,
1006,
2171,
1010,
2544,
1024,
9152,
2140,
1010,
29296,
1035,
6210,
1024,
9152,
2140,
1010,
27075,
1024,
6270,
1007,
2065,
2544,
1012,
2556,
1029,
1004,
1004,
29296,
1035,
6210,
1012,
2556,
1029,
5333,
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... |
square/connect-ruby-sdk | lib/square_connect/models/break_type.rb | SquareConnect.BreakType.break_name= | def break_name=(break_name)
if break_name.nil?
fail ArgumentError, "break_name cannot be nil"
end
if break_name.to_s.length < 1
fail ArgumentError, "invalid value for 'break_name', the character length must be great than or equal to 1."
end
@break_name = break_name
end | ruby | def break_name=(break_name)
if break_name.nil?
fail ArgumentError, "break_name cannot be nil"
end
if break_name.to_s.length < 1
fail ArgumentError, "invalid value for 'break_name', the character length must be great than or equal to 1."
end
@break_name = break_name
end | [
"def",
"break_name",
"=",
"(",
"break_name",
")",
"if",
"break_name",
".",
"nil?",
"fail",
"ArgumentError",
",",
"\"break_name cannot be nil\"",
"end",
"if",
"break_name",
".",
"to_s",
".",
"length",
"<",
"1",
"fail",
"ArgumentError",
",",
"\"invalid value for 'br... | Custom attribute writer method with validation
@param [Object] break_name Value to be assigned | [
"Custom",
"attribute",
"writer",
"method",
"with",
"validation"
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/models/break_type.rb#L190-L200 | train | Set the break_name of the current page. | [
30522,
13366,
3338,
1035,
2171,
1027,
1006,
3338,
1035,
2171,
1007,
2065,
3338,
1035,
2171,
1012,
9152,
2140,
1029,
8246,
6685,
2121,
29165,
1010,
1000,
3338,
1035,
2171,
3685,
2022,
9152,
2140,
1000,
2203,
2065,
3338,
1035,
2171,
1012,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/hardware_component_groups.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.HardwareComponentGroups.begin_change_controller_power_state | def begin_change_controller_power_state(device_name, hardware_component_group_name, parameters, resource_group_name, manager_name, custom_headers:nil)
response = begin_change_controller_power_state_async(device_name, hardware_component_group_name, parameters, resource_group_name, manager_name, custom_headers:custom_headers).value!
nil
end | ruby | def begin_change_controller_power_state(device_name, hardware_component_group_name, parameters, resource_group_name, manager_name, custom_headers:nil)
response = begin_change_controller_power_state_async(device_name, hardware_component_group_name, parameters, resource_group_name, manager_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_change_controller_power_state",
"(",
"device_name",
",",
"hardware_component_group_name",
",",
"parameters",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_change_controller_power_state_async",
"(... | Changes the power state of the controller.
@param device_name [String] The device name
@param hardware_component_group_name [String] The hardware component group
name.
@param parameters [ControllerPowerStateChangeRequest] The controller power
state change request.
@param resource_group_name [String] The resource group name
@param manager_name [String] The manager name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Changes",
"the",
"power",
"state",
"of",
"the",
"controller",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/hardware_component_groups.rb#L184-L187 | train | Change controller power state of the hardware component group. | [
30522,
13366,
4088,
1035,
2689,
1035,
11486,
1035,
2373,
1035,
2110,
1006,
5080,
1035,
2171,
1010,
8051,
1035,
6922,
1035,
2177,
1035,
2171,
1010,
11709,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
30524,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_datalake_analytics/lib/2016-11-01/generated/azure_mgmt_datalake_analytics/firewall_rules.rb | Azure::DataLakeAnalytics::Mgmt::V2016_11_01.FirewallRules.list_by_account | def list_by_account(resource_group_name, account_name, custom_headers:nil)
first_page = list_by_account_as_lazy(resource_group_name, account_name, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_by_account(resource_group_name, account_name, custom_headers:nil)
first_page = list_by_account_as_lazy(resource_group_name, account_name, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_by_account",
"(",
"resource_group_name",
",",
"account_name",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_by_account_as_lazy",
"(",
"resource_group_name",
",",
"account_name",
",",
"custom_headers",
":custom_headers",
")",
"first_page",
... | Lists the Data Lake Analytics firewall rules within the specified Data Lake
Analytics account.
@param resource_group_name [String] The name of the Azure resource group.
@param account_name [String] The name of the Data Lake Analytics account.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<FirewallRule>] operation results. | [
"Lists",
"the",
"Data",
"Lake",
"Analytics",
"firewall",
"rules",
"within",
"the",
"specified",
"Data",
"Lake",
"Analytics",
"account",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_datalake_analytics/lib/2016-11-01/generated/azure_mgmt_datalake_analytics/firewall_rules.rb#L35-L38 | train | Gets all the segmentation terms of the specified virtual machine. | [
30522,
13366,
2862,
1035,
2011,
1035,
4070,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2862,
1035,
30524,
2034,
1035,
3931,
1012,
2131,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/route_filters.rb | Azure::Network::Mgmt::V2018_07_01.RouteFilters.begin_create_or_update | def begin_create_or_update(resource_group_name, route_filter_name, route_filter_parameters, custom_headers:nil)
response = begin_create_or_update_async(resource_group_name, route_filter_name, route_filter_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_create_or_update(resource_group_name, route_filter_name, route_filter_parameters, custom_headers:nil)
response = begin_create_or_update_async(resource_group_name, route_filter_name, route_filter_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_create_or_update",
"(",
"resource_group_name",
",",
"route_filter_name",
",",
"route_filter_parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"route_filter_name",
",",
"route_... | Creates or updates a route filter in a specified resource group.
@param resource_group_name [String] The name of the resource group.
@param route_filter_name [String] The name of the route filter.
@param route_filter_parameters [RouteFilter] Parameters supplied to the
create or update route filter operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [RouteFilter] operation results. | [
"Creates",
"or",
"updates",
"a",
"route",
"filter",
"in",
"a",
"specified",
"resource",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/route_filters.rb#L517-L520 | train | Creates or updates a route filter. | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2799,
1035,
11307,
1035,
2171,
1010,
2799,
1035,
11307,
1035,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
decidim/decidim | decidim-core/app/models/decidim/user_base_entity.rb | Decidim.UserBaseEntity.following | def following
@following ||= begin
followings = following_follows.pluck(:decidim_followable_type, :decidim_followable_id)
grouped_followings = followings.each_with_object({}) do |(type, following_id), all|
all[type] ||= []
all[type] << following_id
all
end
grouped_followings.flat_map do |type, ids|
type.constantize.where(id: ids)
end
end
end | ruby | def following
@following ||= begin
followings = following_follows.pluck(:decidim_followable_type, :decidim_followable_id)
grouped_followings = followings.each_with_object({}) do |(type, following_id), all|
all[type] ||= []
all[type] << following_id
all
end
grouped_followings.flat_map do |type, ids|
type.constantize.where(id: ids)
end
end
end | [
"def",
"following",
"@following",
"||=",
"begin",
"followings",
"=",
"following_follows",
".",
"pluck",
"(",
":decidim_followable_type",
",",
":decidim_followable_id",
")",
"grouped_followings",
"=",
"followings",
".",
"each_with_object",
"(",
"{",
"}",
")",
"do",
"... | Public: Returns a collection with all the entities this user is following.
This can't be done as with a `has_many :following, through: :following_follows`
since it's a polymorphic relation and Rails doesn't know how to load it. With
this implementation we only query the database once for each kind of following.
Returns an Array of Decidim::Followable | [
"Public",
":",
"Returns",
"a",
"collection",
"with",
"all",
"the",
"entities",
"this",
"user",
"is",
"following",
"."
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/app/models/decidim/user_base_entity.rb#L31-L44 | train | Returns the list of the following elements of the decision. | [
30522,
13366,
2206,
1030,
2206,
1064,
1064,
1027,
4088,
2206,
2015,
1027,
2206,
1035,
4076,
1012,
20228,
12722,
1006,
1024,
11703,
28173,
2213,
1035,
3582,
3085,
1035,
2828,
1010,
1024,
11703,
28173,
2213,
1035,
3582,
3085,
1035,
8909,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_key_vault/lib/2018-02-14/generated/azure_mgmt_key_vault/vaults.rb | Azure::KeyVault::Mgmt::V2018_02_14.Vaults.purge_deleted_async | def purge_deleted_async(vault_name, location, custom_headers:nil)
# Send request
promise = begin_purge_deleted_async(vault_name, location, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | ruby | def purge_deleted_async(vault_name, location, custom_headers:nil)
# Send request
promise = begin_purge_deleted_async(vault_name, location, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | [
"def",
"purge_deleted_async",
"(",
"vault_name",
",",
"location",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_purge_deleted_async",
"(",
"vault_name",
",",
"location",
",",
"custom_headers",
":custom_headers",
")",
"promise",
"=",
... | @param vault_name [String] The name of the soft-deleted vault.
@param location [String] The location of the soft-deleted vault.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"vault_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"soft",
"-",
"deleted",
"vault",
".",
"@param",
"location",
"[",
"String",
"]",
"The",
"location",
"of",
"the",
"soft",
"-",
"deleted",
"vault",
".",
"@param",
"custom_headers",
"[",
... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_key_vault/lib/2018-02-14/generated/azure_mgmt_key_vault/vaults.rb#L882-L896 | train | Purges deleted resources from the specified vault. | [
30522,
13366,
24694,
1035,
17159,
1035,
2004,
6038,
2278,
1006,
11632,
1035,
2171,
1010,
3295,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,
4088,
1035,
24694,
1035,
17159,
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... |
restforce/restforce | lib/restforce/middleware/authentication.rb | Restforce.Middleware::Authentication.authenticate! | def authenticate!
response = connection.post '/services/oauth2/token' do |req|
req.body = encode_www_form(params)
end
if response.status >= 500
raise Restforce::ServerError, error_message(response)
elsif response.status != 200
raise Restforce::AuthenticationError, error_message(response)
end
@options[:instance_url] = response.body['instance_url']
@options[:oauth_token] = response.body['access_token']
@options[:authentication_callback]&.call(response.body)
response.body
end | ruby | def authenticate!
response = connection.post '/services/oauth2/token' do |req|
req.body = encode_www_form(params)
end
if response.status >= 500
raise Restforce::ServerError, error_message(response)
elsif response.status != 200
raise Restforce::AuthenticationError, error_message(response)
end
@options[:instance_url] = response.body['instance_url']
@options[:oauth_token] = response.body['access_token']
@options[:authentication_callback]&.call(response.body)
response.body
end | [
"def",
"authenticate!",
"response",
"=",
"connection",
".",
"post",
"'/services/oauth2/token'",
"do",
"|",
"req",
"|",
"req",
".",
"body",
"=",
"encode_www_form",
"(",
"params",
")",
"end",
"if",
"response",
".",
"status",
">=",
"500",
"raise",
"Restforce",
... | Internal: Performs the authentication and returns the response body. | [
"Internal",
":",
"Performs",
"the",
"authentication",
"and",
"returns",
"the",
"response",
"body",
"."
] | 74cbc9c745320dbea5117e2e3cc8d54d66db6562 | https://github.com/restforce/restforce/blob/74cbc9c745320dbea5117e2e3cc8d54d66db6562/lib/restforce/middleware/authentication.rb#L22-L39 | train | Authenticate with the current user | [
30522,
13366,
14469,
3686,
999,
3433,
1027,
4434,
1012,
2695,
1005,
1013,
2578,
1013,
1051,
4887,
2705,
2475,
1013,
19204,
1005,
2079,
1064,
2128,
4160,
1064,
2128,
4160,
1012,
2303,
1027,
4372,
16044,
1035,
7479,
1035,
2433,
1006,
11498,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
samvera/hyrax | app/presenters/hyrax/admin_set_options_presenter.rb | Hyrax.AdminSetOptionsPresenter.attributes_for | def attributes_for(permission_template:)
{}.tap do |attrs|
attrs['data-sharing'] = sharing?(permission_template: permission_template)
# Either add "no-delay" (if immediate release) or a specific release date, but not both.
if permission_template.release_no_delay?
attrs['data-release-no-delay'] = true
elsif permission_template.release_date.present?
attrs['data-release-date'] = permission_template.release_date
end
attrs['data-release-before-date'] = true if permission_template.release_before_date?
attrs['data-visibility'] = permission_template.visibility if permission_template.visibility.present?
end
end | ruby | def attributes_for(permission_template:)
{}.tap do |attrs|
attrs['data-sharing'] = sharing?(permission_template: permission_template)
# Either add "no-delay" (if immediate release) or a specific release date, but not both.
if permission_template.release_no_delay?
attrs['data-release-no-delay'] = true
elsif permission_template.release_date.present?
attrs['data-release-date'] = permission_template.release_date
end
attrs['data-release-before-date'] = true if permission_template.release_before_date?
attrs['data-visibility'] = permission_template.visibility if permission_template.visibility.present?
end
end | [
"def",
"attributes_for",
"(",
"permission_template",
":",
")",
"{",
"}",
".",
"tap",
"do",
"|",
"attrs",
"|",
"attrs",
"[",
"'data-sharing'",
"]",
"=",
"sharing?",
"(",
"permission_template",
":",
"permission_template",
")",
"# Either add \"no-delay\" (if immediate ... | all PermissionTemplate release & visibility data attributes (if not blank or false) | [
"all",
"PermissionTemplate",
"release",
"&",
"visibility",
"data",
"attributes",
"(",
"if",
"not",
"blank",
"or",
"false",
")"
] | e2b4f56e829a53b1f11296324736e9d5b8c9ee5f | https://github.com/samvera/hyrax/blob/e2b4f56e829a53b1f11296324736e9d5b8c9ee5f/app/presenters/hyrax/admin_set_options_presenter.rb#L30-L42 | train | Returns the attributes for the given permission template. | [
30522,
13366,
12332,
1035,
2005,
1006,
6656,
1035,
23561,
1024,
1007,
1063,
1065,
1012,
11112,
2079,
1064,
2012,
16344,
2015,
1064,
2012,
16344,
2015,
1031,
1005,
2951,
1011,
6631,
1005,
1033,
1027,
6631,
1029,
1006,
6656,
1035,
23561,
1024... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/express_route_connections.rb | Azure::Network::Mgmt::V2018_08_01.ExpressRouteConnections.delete | def delete(resource_group_name, express_route_gateway_name, connection_name, custom_headers:nil)
response = delete_async(resource_group_name, express_route_gateway_name, connection_name, custom_headers:custom_headers).value!
nil
end | ruby | def delete(resource_group_name, express_route_gateway_name, connection_name, custom_headers:nil)
response = delete_async(resource_group_name, express_route_gateway_name, connection_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"delete",
"(",
"resource_group_name",
",",
"express_route_gateway_name",
",",
"connection_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_async",
"(",
"resource_group_name",
",",
"express_route_gateway_name",
",",
"connection_name",
",",
"... | Deletes a connection to a ExpressRoute circuit.
@param resource_group_name [String] The name of the resource group.
@param express_route_gateway_name [String] The name of the ExpressRoute
gateway.
@param connection_name [String] The name of the connection subresource.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Deletes",
"a",
"connection",
"to",
"a",
"ExpressRoute",
"circuit",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/express_route_connections.rb#L184-L187 | train | Deletes a ExpressRoute gateway connection. | [
30522,
13366,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4671,
1035,
2799,
1035,
11909,
1035,
2171,
1010,
4434,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
1035,
2004,
6038,
2278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/api/v1_items_api.rb | SquareConnect.V1ItemsApi.delete_modifier_option | def delete_modifier_option(location_id, modifier_list_id, modifier_option_id, opts = {})
data, _status_code, _headers = delete_modifier_option_with_http_info(location_id, modifier_list_id, modifier_option_id, opts)
return data
end | ruby | def delete_modifier_option(location_id, modifier_list_id, modifier_option_id, opts = {})
data, _status_code, _headers = delete_modifier_option_with_http_info(location_id, modifier_list_id, modifier_option_id, opts)
return data
end | [
"def",
"delete_modifier_option",
"(",
"location_id",
",",
"modifier_list_id",
",",
"modifier_option_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"delete_modifier_option_with_http_info",
"(",
"location_id",
",",
"modifier_lis... | DeleteModifierOption
Deletes an existing item modifier option from a modifier list. *Note**: DeleteModifierOption returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteModifierOptionRequest` object as documented below.
@param location_id The ID of the item's associated location.
@param modifier_list_id The ID of the modifier list to delete.
@param modifier_option_id The ID of the modifier list to edit.
@param [Hash] opts the optional parameters
@return [V1ModifierOption] | [
"DeleteModifierOption",
"Deletes",
"an",
"existing",
"item",
"modifier",
"option",
"from",
"a",
"modifier",
"list",
".",
"*",
"Note",
"**",
":",
"DeleteModifierOption",
"returns",
"nothing",
"on",
"success",
"but",
"Connect",
"SDKs",
"map",
"the",
"empty",
"resp... | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/v1_items_api.rb#L991-L994 | train | Delete a modifier option | [
30522,
13366,
3972,
12870,
1035,
16913,
18095,
1035,
5724,
1006,
3295,
1035,
8909,
1010,
16913,
18095,
1035,
2862,
1035,
8909,
1010,
16913,
18095,
1035,
5724,
1035,
8909,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
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... |
wearefine/fae | app/controllers/concerns/fae/cloneable.rb | Fae.Cloneable.update_cloneable_associations | def update_cloneable_associations
associations_for_cloning.each do |association|
type = @klass.reflect_on_association(association)
through_record = type.through_reflection
if through_record.present?
clone_join_relationships(through_record.plural_name)
else
clone_has_one_relationship(association,type) if type.macro == :has_one
clone_has_many_relationships(association) if type.macro == :has_many
end
end
end | ruby | def update_cloneable_associations
associations_for_cloning.each do |association|
type = @klass.reflect_on_association(association)
through_record = type.through_reflection
if through_record.present?
clone_join_relationships(through_record.plural_name)
else
clone_has_one_relationship(association,type) if type.macro == :has_one
clone_has_many_relationships(association) if type.macro == :has_many
end
end
end | [
"def",
"update_cloneable_associations",
"associations_for_cloning",
".",
"each",
"do",
"|",
"association",
"|",
"type",
"=",
"@klass",
".",
"reflect_on_association",
"(",
"association",
")",
"through_record",
"=",
"type",
".",
"through_reflection",
"if",
"through_record... | set cloneable attributes and associations | [
"set",
"cloneable",
"attributes",
"and",
"associations"
] | 645d6b66945aeff54e27af6a95c4f8a1f7a67d39 | https://github.com/wearefine/fae/blob/645d6b66945aeff54e27af6a95c4f8a1f7a67d39/app/controllers/concerns/fae/cloneable.rb#L45-L57 | train | Clones the cloneable associations | [
30522,
13366,
10651,
1035,
17598,
3085,
1035,
8924,
8924,
1035,
2005,
1035,
18856,
13369,
1012,
2169,
2079,
1064,
2523,
1064,
2828,
1027,
1030,
1047,
27102,
1012,
8339,
1035,
2006,
1035,
2523,
1006,
2523,
1007,
2083,
1035,
2501,
1027,
2828,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/sprockets | lib/sprockets/transformers.rb | Sprockets.Transformers.resolve_transform_type | def resolve_transform_type(type, accept)
find_best_mime_type_match(accept || '*/*', [type].compact + config[:transformers][type].keys)
end | ruby | def resolve_transform_type(type, accept)
find_best_mime_type_match(accept || '*/*', [type].compact + config[:transformers][type].keys)
end | [
"def",
"resolve_transform_type",
"(",
"type",
",",
"accept",
")",
"find_best_mime_type_match",
"(",
"accept",
"||",
"'*/*'",
",",
"[",
"type",
"]",
".",
"compact",
"+",
"config",
"[",
":transformers",
"]",
"[",
"type",
"]",
".",
"keys",
")",
"end"
] | Internal: Resolve target mime type that the source type should be
transformed to.
type - String from mime type
accept - String accept type list (default: '*/*')
Examples
resolve_transform_type('text/plain', 'text/plain')
# => 'text/plain'
resolve_transform_type('image/svg+xml', 'image/png, image/*')
# => 'image/png'
resolve_transform_type('text/css', 'image/png')
# => nil
Returns String mime type or nil is no type satisfied the accept value. | [
"Internal",
":",
"Resolve",
"target",
"mime",
"type",
"that",
"the",
"source",
"type",
"should",
"be",
"transformed",
"to",
"."
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/transformers.rb#L83-L85 | train | Find the best mime type match for the given type | [
30522,
13366,
10663,
1035,
10938,
1035,
2828,
1006,
2828,
1010,
5138,
1007,
2424,
1035,
2190,
1035,
2771,
4168,
1035,
2828,
1035,
2674,
1006,
5138,
1064,
1064,
1005,
1008,
1013,
1008,
1005,
1010,
1031,
2828,
1033,
1012,
9233,
1009,
9530,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alexreisner/geocoder | lib/geocoder/query.rb | Geocoder.Query.lookup | def lookup
if !options[:street_address] and (options[:ip_address] or ip_address?)
name = options[:ip_lookup] || Configuration.ip_lookup || Geocoder::Lookup.ip_services.first
else
name = options[:lookup] || Configuration.lookup || Geocoder::Lookup.street_services.first
end
Lookup.get(name)
end | ruby | def lookup
if !options[:street_address] and (options[:ip_address] or ip_address?)
name = options[:ip_lookup] || Configuration.ip_lookup || Geocoder::Lookup.ip_services.first
else
name = options[:lookup] || Configuration.lookup || Geocoder::Lookup.street_services.first
end
Lookup.get(name)
end | [
"def",
"lookup",
"if",
"!",
"options",
"[",
":street_address",
"]",
"and",
"(",
"options",
"[",
":ip_address",
"]",
"or",
"ip_address?",
")",
"name",
"=",
"options",
"[",
":ip_lookup",
"]",
"||",
"Configuration",
".",
"ip_lookup",
"||",
"Geocoder",
"::",
"... | Get a Lookup object (which communicates with the remote geocoding API)
appropriate to the Query text. | [
"Get",
"a",
"Lookup",
"object",
"(",
"which",
"communicates",
"with",
"the",
"remote",
"geocoding",
"API",
")",
"appropriate",
"to",
"the",
"Query",
"text",
"."
] | e087dc2759264ee6f307b926bb2de4ec2406859e | https://github.com/alexreisner/geocoder/blob/e087dc2759264ee6f307b926bb2de4ec2406859e/lib/geocoder/query.rb#L34-L41 | train | Returns the index of the object that corresponds to the current object. | [
30522,
13366,
2298,
6279,
2065,
999,
7047,
1031,
1024,
2395,
1035,
4769,
1033,
1998,
1006,
7047,
1031,
1024,
12997,
1035,
4769,
1033,
2030,
12997,
1035,
4769,
1029,
1007,
2171,
1027,
7047,
1031,
1024,
12997,
1035,
2298,
6279,
1033,
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_event_grid/lib/2019-02-01-preview/generated/azure_mgmt_event_grid/topics.rb | Azure::EventGrid::Mgmt::V2019_02_01_preview.Topics.list_event_types | def list_event_types(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers:nil)
response = list_event_types_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_event_types(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers:nil)
response = list_event_types_async(resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_event_types",
"(",
"resource_group_name",
",",
"provider_namespace",
",",
"resource_type_name",
",",
"resource_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_event_types_async",
"(",
"resource_group_name",
",",
"provider_namespace",
","... | List topic event types
List event types for a topic
@param resource_group_name [String] The name of the resource group within the
user's subscription.
@param provider_namespace [String] Namespace of the provider of the topic
@param resource_type_name [String] Name of the topic type
@param resource_name [String] Name of the topic
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [EventTypesListResult] operation results. | [
"List",
"topic",
"event",
"types"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_event_grid/lib/2019-02-01-preview/generated/azure_mgmt_event_grid/topics.rb#L695-L698 | train | Gets the list of all the event types in a resource group. | [
30522,
13366,
2862,
1035,
2724,
1035,
4127,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
10802,
1035,
3415,
15327,
1010,
7692,
1035,
2828,
1035,
2171,
1010,
7692,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_event_hub/lib/2017-04-01/generated/azure_mgmt_event_hub/namespaces.rb | Azure::EventHub::Mgmt::V2017_04_01.Namespaces.get_messaging_plan | def get_messaging_plan(resource_group_name, namespace_name, custom_headers:nil)
response = get_messaging_plan_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_messaging_plan(resource_group_name, namespace_name, custom_headers:nil)
response = get_messaging_plan_async(resource_group_name, namespace_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_messaging_plan",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_messaging_plan_async",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"v... | Gets messaging plan for specified 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 [MessagingPlan] operation results. | [
"Gets",
"messaging",
"plan",
"for",
"specified",
"namespace",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_event_hub/lib/2017-04-01/generated/azure_mgmt_event_hub/namespaces.rb#L633-L636 | train | Gets the messaging plan for a namespace. | [
30522,
13366,
2131,
1035,
24732,
1035,
2933,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3415,
15327,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
24732,
1035,
2933,
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_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb | Azure::Compute::Mgmt::V2016_04_30_preview.VirtualMachineScaleSets.begin_update_instances_with_http_info | def begin_update_instances_with_http_info(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers:nil)
begin_update_instances_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers:custom_headers).value!
end | ruby | def begin_update_instances_with_http_info(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers:nil)
begin_update_instances_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers:custom_headers).value!
end | [
"def",
"begin_update_instances_with_http_info",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"vm_instance_ids",
",",
"custom_headers",
":",
"nil",
")",
"begin_update_instances_async",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"vm_instance_ids",
... | Upgrades one or more virtual machines to the latest SKU set in the VM scale
set model.
@param resource_group_name [String] The name of the resource group.
@param vm_scale_set_name [String] The name of the VM scale set.
@param vm_instance_ids [VirtualMachineScaleSetVMInstanceRequiredIDs] A list
of virtual machine instance IDs from the VM scale set.
@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. | [
"Upgrades",
"one",
"or",
"more",
"virtual",
"machines",
"to",
"the",
"latest",
"SKU",
"set",
"in",
"the",
"VM",
"scale",
"set",
"model",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2016-04-30-preview/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb#L1711-L1713 | train | Updates a set of virtual machines in a VM scale set. | [
30522,
13366,
4088,
1035,
10651,
1035,
12107,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
4094,
1035,
2275,
1035,
2171,
1010,
1058,
2213,
1035,
6013,
1035,
8909,
2015,
1010,
7661,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
DataDog/dogstatsd-ruby | lib/datadog/statsd.rb | Datadog.Statsd.time | def time(stat, opts=EMPTY_OPTIONS)
opts = {:sample_rate => opts} if opts.is_a? Numeric
start = (PROCESS_TIME_SUPPORTED ? Process.clock_gettime(Process::CLOCK_MONOTONIC) : Time.now.to_f)
return yield
ensure
finished = (PROCESS_TIME_SUPPORTED ? Process.clock_gettime(Process::CLOCK_MONOTONIC) : Time.now.to_f)
timing(stat, ((finished - start) * 1000).round, opts)
end | ruby | def time(stat, opts=EMPTY_OPTIONS)
opts = {:sample_rate => opts} if opts.is_a? Numeric
start = (PROCESS_TIME_SUPPORTED ? Process.clock_gettime(Process::CLOCK_MONOTONIC) : Time.now.to_f)
return yield
ensure
finished = (PROCESS_TIME_SUPPORTED ? Process.clock_gettime(Process::CLOCK_MONOTONIC) : Time.now.to_f)
timing(stat, ((finished - start) * 1000).round, opts)
end | [
"def",
"time",
"(",
"stat",
",",
"opts",
"=",
"EMPTY_OPTIONS",
")",
"opts",
"=",
"{",
":sample_rate",
"=>",
"opts",
"}",
"if",
"opts",
".",
"is_a?",
"Numeric",
"start",
"=",
"(",
"PROCESS_TIME_SUPPORTED",
"?",
"Process",
".",
"clock_gettime",
"(",
"Process... | Reports execution time of the provided block using {#timing}.
If the block fails, the stat is still reported, then the error
is reraised
@param [String] stat stat name
@param [Hash] opts the options to create the metric with
@option opts [Numeric] :sample_rate sample rate, 1 for always
@option opts [Array<String>] :tags An array of tags
@yield The operation to be timed
@see #timing
@example Report the time (in ms) taken to activate an account
$statsd.time('account.activate') { @account.activate! } | [
"Reports",
"execution",
"time",
"of",
"the",
"provided",
"block",
"using",
"{",
"#timing",
"}",
"."
] | 0ea2a4d011958ad0d092654cae950e64b6475077 | https://github.com/DataDog/dogstatsd-ruby/blob/0ea2a4d011958ad0d092654cae950e64b6475077/lib/datadog/statsd.rb#L356-L363 | train | Time a block of the given stat | [
30522,
13366,
2051,
1006,
28093,
1010,
23569,
2015,
1027,
4064,
1035,
7047,
1007,
23569,
2015,
1027,
1063,
1024,
7099,
1035,
3446,
1027,
1028,
23569,
2015,
1065,
2065,
23569,
2015,
1012,
2003,
1035,
1037,
1029,
16371,
25531,
2707,
1027,
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... |
activeadmin/activeadmin | lib/active_admin/application.rb | ActiveAdmin.Application.register | def register(resource, options = {}, &block)
ns = options.fetch(:namespace) { default_namespace }
namespace(ns).register resource, options, &block
end | ruby | def register(resource, options = {}, &block)
ns = options.fetch(:namespace) { default_namespace }
namespace(ns).register resource, options, &block
end | [
"def",
"register",
"(",
"resource",
",",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"ns",
"=",
"options",
".",
"fetch",
"(",
":namespace",
")",
"{",
"default_namespace",
"}",
"namespace",
"(",
"ns",
")",
".",
"register",
"resource",
",",
"option... | Registers a brand new configuration for the given resource. | [
"Registers",
"a",
"brand",
"new",
"configuration",
"for",
"the",
"given",
"resource",
"."
] | 0759c8dcf97865748c9344459162ac3c7e65a6cd | https://github.com/activeadmin/activeadmin/blob/0759c8dcf97865748c9344459162ac3c7e65a6cd/lib/active_admin/application.rb#L63-L66 | train | Register a resource with the given namespace. | [
30522,
13366,
4236,
1006,
7692,
1010,
7047,
1027,
1063,
1065,
1010,
1004,
3796,
1007,
24978,
1027,
7047,
1012,
18584,
1006,
1024,
3415,
15327,
1007,
1063,
12398,
1035,
3415,
15327,
1065,
3415,
15327,
1006,
24978,
1007,
1012,
4236,
7692,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/models/v1_merchant.rb | SquareConnect.V1Merchant.account_type= | def account_type=(account_type)
validator = EnumAttributeValidator.new('String', ["LOCATION", "BUSINESS"])
unless validator.valid?(account_type)
fail ArgumentError, "invalid value for 'account_type', must be one of #{validator.allowable_values}."
end
@account_type = account_type
end | ruby | def account_type=(account_type)
validator = EnumAttributeValidator.new('String', ["LOCATION", "BUSINESS"])
unless validator.valid?(account_type)
fail ArgumentError, "invalid value for 'account_type', must be one of #{validator.allowable_values}."
end
@account_type = account_type
end | [
"def",
"account_type",
"=",
"(",
"account_type",
")",
"validator",
"=",
"EnumAttributeValidator",
".",
"new",
"(",
"'String'",
",",
"[",
"\"LOCATION\"",
",",
"\"BUSINESS\"",
"]",
")",
"unless",
"validator",
".",
"valid?",
"(",
"account_type",
")",
"fail",
"Arg... | Custom attribute writer method checking allowed values (enum).
@param [Object] account_type Object to be assigned | [
"Custom",
"attribute",
"writer",
"method",
"checking",
"allowed",
"values",
"(",
"enum",
")",
"."
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/models/v1_merchant.rb#L215-L221 | train | Sets the account_type of the resource. | [
30522,
13366,
4070,
1035,
2828,
1027,
1006,
4070,
1035,
2828,
1007,
9398,
8844,
1027,
4372,
12248,
4779,
3089,
8569,
2618,
10175,
8524,
4263,
1012,
2047,
1006,
1005,
5164,
1005,
1010,
1031,
1000,
3295,
1000,
1010,
1000,
2449,
1000,
1033,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ruby-git/ruby-git | lib/git/lib.rb | Git.Lib.describe | def describe(committish=nil, opts={})
arr_opts = []
arr_opts << '--all' if opts[:all]
arr_opts << '--tags' if opts[:tags]
arr_opts << '--contains' if opts[:contains]
arr_opts << '--debug' if opts[:debug]
arr_opts << '--long' if opts[:long]
arr_opts << '--always' if opts[:always]
arr_opts << '--exact-match' if opts[:exact_match] || opts[:"exact-match"]
arr_opts << '--dirty' if opts['dirty'] == true
arr_opts << "--dirty=#{opts['dirty']}" if opts['dirty'].is_a?(String)
arr_opts << "--abbrev=#{opts['abbrev']}" if opts[:abbrev]
arr_opts << "--candidates=#{opts['candidates']}" if opts[:candidates]
arr_opts << "--match=#{opts['match']}" if opts[:match]
arr_opts << committish if committish
return command('describe', arr_opts)
end | ruby | def describe(committish=nil, opts={})
arr_opts = []
arr_opts << '--all' if opts[:all]
arr_opts << '--tags' if opts[:tags]
arr_opts << '--contains' if opts[:contains]
arr_opts << '--debug' if opts[:debug]
arr_opts << '--long' if opts[:long]
arr_opts << '--always' if opts[:always]
arr_opts << '--exact-match' if opts[:exact_match] || opts[:"exact-match"]
arr_opts << '--dirty' if opts['dirty'] == true
arr_opts << "--dirty=#{opts['dirty']}" if opts['dirty'].is_a?(String)
arr_opts << "--abbrev=#{opts['abbrev']}" if opts[:abbrev]
arr_opts << "--candidates=#{opts['candidates']}" if opts[:candidates]
arr_opts << "--match=#{opts['match']}" if opts[:match]
arr_opts << committish if committish
return command('describe', arr_opts)
end | [
"def",
"describe",
"(",
"committish",
"=",
"nil",
",",
"opts",
"=",
"{",
"}",
")",
"arr_opts",
"=",
"[",
"]",
"arr_opts",
"<<",
"'--all'",
"if",
"opts",
"[",
":all",
"]",
"arr_opts",
"<<",
"'--tags'",
"if",
"opts",
"[",
":tags",
"]",
"arr_opts",
"<<"... | tries to clone the given repo
returns {:repository} (if bare)
{:working_directory} otherwise
accepts options:
:bare:: no working directory
:branch:: name of branch to track (rather than 'master')
:depth:: the number of commits back to pull
:origin:: name of remote (same as remote)
:path:: directory where the repo will be cloned
:remote:: name of remote (rather than 'origin')
:recursive:: after the clone is created, initialize all submodules within, using their default settings.
TODO - make this work with SSH password or auth_key
READ COMMANDS
Returns most recent tag that is reachable from a commit
accepts options:
:all
:tags
:contains
:debug
:exact_match
:dirty
:abbrev
:candidates
:long
:always
:math
@param [String|NilClass] committish target commit sha or object name
@param [{Symbol=>Object}] opts the given options
@return [String] the tag name | [
"tries",
"to",
"clone",
"the",
"given",
"repo"
] | 9bd4407c56068e1604f14a1b6c0c5a84868e6378 | https://github.com/ruby-git/ruby-git/blob/9bd4407c56068e1604f14a1b6c0c5a84868e6378/lib/git/lib.rb#L105-L126 | train | Describe the specified terms. | [
30522,
13366,
6235,
1006,
10797,
24788,
1027,
9152,
2140,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
12098,
2099,
1035,
23569,
2015,
1027,
1031,
1033,
12098,
2099,
1035,
23569,
2015,
1026,
1026,
1005,
1011,
1011,
2035,
1005,
2065,
23569,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_datalake_analytics/lib/2016-11-01/generated/azure_mgmt_datalake_analytics/data_lake_store_accounts.rb | Azure::DataLakeAnalytics::Mgmt::V2016_11_01.DataLakeStoreAccounts.delete_with_http_info | def delete_with_http_info(resource_group_name, account_name, data_lake_store_account_name, custom_headers:nil)
delete_async(resource_group_name, account_name, data_lake_store_account_name, custom_headers:custom_headers).value!
end | ruby | def delete_with_http_info(resource_group_name, account_name, data_lake_store_account_name, custom_headers:nil)
delete_async(resource_group_name, account_name, data_lake_store_account_name, custom_headers:custom_headers).value!
end | [
"def",
"delete_with_http_info",
"(",
"resource_group_name",
",",
"account_name",
",",
"data_lake_store_account_name",
",",
"custom_headers",
":",
"nil",
")",
"delete_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"data_lake_store_account_name",
",",
"custom_h... | Updates the Data Lake Analytics account specified to remove the specified
Data Lake Store account.
@param resource_group_name [String] The name of the Azure resource group.
@param account_name [String] The name of the Data Lake Analytics account.
@param data_lake_store_account_name [String] The name of the Data Lake Store
account to remove
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Updates",
"the",
"Data",
"Lake",
"Analytics",
"account",
"specified",
"to",
"remove",
"the",
"specified",
"Data",
"Lake",
"Store",
"account",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_datalake_analytics/lib/2016-11-01/generated/azure_mgmt_datalake_analytics/data_lake_store_accounts.rb#L402-L404 | train | Deletes the specified data lake store account. | [
30522,
13366,
3972,
12870,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
2951,
1035,
2697,
1035,
3573,
1035,
4070,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | 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_compose_deployment_status_with_http_info | def get_compose_deployment_status_with_http_info(deployment_name, timeout:60, custom_headers:nil)
get_compose_deployment_status_async(deployment_name, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def get_compose_deployment_status_with_http_info(deployment_name, timeout:60, custom_headers:nil)
get_compose_deployment_status_async(deployment_name, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"get_compose_deployment_status_with_http_info",
"(",
"deployment_name",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"get_compose_deployment_status_async",
"(",
"deployment_name",
",",
"timeout",
":",
"timeout",
",",
"custom_headers",
":custom... | Gets information about a Service Fabric compose deployment.
Returns the status of the compose deployment that was created or in the
process of being created in the Service Fabric cluster and whose name matches
the one specified as the parameter. The response includes the name, status
and other details about the deployment.
@param deployment_name [String] The identity of the deployment.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"information",
"about",
"a",
"Service",
"Fabric",
"compose",
"deployment",
"."
] | 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#L17850-L17852 | train | Gets the status of a Compose Deployment. | [
30522,
13366,
2131,
1035,
17202,
30524,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
17202,
1035,
10813,
1035,
3570,
1035,
2004,
6038,
2278,
1006,
10813,
1035,
2171,
1010,
2051,
5833,
1024,
2051,
5833,
1010,
7661,
1035,
20346,
2015,
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... |
braintree/braintree_ruby | lib/braintree/transaction_line_item_gateway.rb | Braintree.TransactionLineItemGateway.find_all | def find_all(transaction_id)
raise ArgumentError, "transaction_id cannot be blank" if transaction_id.nil? || transaction_id.strip.to_s == ""
response = @config.http.get("#{@config.base_merchant_path}/transactions/#{transaction_id}/line_items")
response[:line_items].map do |line_item_params|
TransactionLineItem._new(@gateway, line_item_params)
end
rescue NotFoundError
raise NotFoundError, "transaction with id #{transaction_id.inspect} not found"
end | ruby | def find_all(transaction_id)
raise ArgumentError, "transaction_id cannot be blank" if transaction_id.nil? || transaction_id.strip.to_s == ""
response = @config.http.get("#{@config.base_merchant_path}/transactions/#{transaction_id}/line_items")
response[:line_items].map do |line_item_params|
TransactionLineItem._new(@gateway, line_item_params)
end
rescue NotFoundError
raise NotFoundError, "transaction with id #{transaction_id.inspect} not found"
end | [
"def",
"find_all",
"(",
"transaction_id",
")",
"raise",
"ArgumentError",
",",
"\"transaction_id cannot be blank\"",
"if",
"transaction_id",
".",
"nil?",
"||",
"transaction_id",
".",
"strip",
".",
"to_s",
"==",
"\"\"",
"response",
"=",
"@config",
".",
"http",
".",
... | :nodoc: | [
":",
"nodoc",
":"
] | 6e56c7099ea55bcdc4073cbea60b2688cef69663 | https://github.com/braintree/braintree_ruby/blob/6e56c7099ea55bcdc4073cbea60b2688cef69663/lib/braintree/transaction_line_item_gateway.rb#L9-L17 | train | Find all line items for a transaction | [
30522,
13366,
2424,
1035,
2035,
1006,
12598,
1035,
8909,
1007,
5333,
6685,
2121,
29165,
1010,
1000,
12598,
1035,
8909,
3685,
2022,
8744,
1000,
2065,
12598,
1035,
8909,
1012,
9152,
2140,
1029,
1064,
1064,
12598,
1035,
8909,
1012,
6167,
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... |
daddyz/phonelib | lib/phonelib/phone_analyzer_helper.rb | Phonelib.PhoneAnalyzerHelper.types_for_check | def types_for_check(data)
exclude_list = PhoneAnalyzer::NOT_FOR_CHECK
exclude_list += Phonelib::Core::SHORT_CODES unless Phonelib.parse_special
Core::TYPES_DESC.keys - exclude_list + fixed_and_mobile_keys(data)
end | ruby | def types_for_check(data)
exclude_list = PhoneAnalyzer::NOT_FOR_CHECK
exclude_list += Phonelib::Core::SHORT_CODES unless Phonelib.parse_special
Core::TYPES_DESC.keys - exclude_list + fixed_and_mobile_keys(data)
end | [
"def",
"types_for_check",
"(",
"data",
")",
"exclude_list",
"=",
"PhoneAnalyzer",
"::",
"NOT_FOR_CHECK",
"exclude_list",
"+=",
"Phonelib",
"::",
"Core",
"::",
"SHORT_CODES",
"unless",
"Phonelib",
".",
"parse_special",
"Core",
"::",
"TYPES_DESC",
".",
"keys",
"-",
... | returns array of phone types for check for current country data
==== Attributes
* +data+ - country data hash | [
"returns",
"array",
"of",
"phone",
"types",
"for",
"check",
"for",
"current",
"country",
"data"
] | aa0023eab7c896b71275bf342bc7f49735cbdbbf | https://github.com/daddyz/phonelib/blob/aa0023eab7c896b71275bf342bc7f49735cbdbbf/lib/phonelib/phone_analyzer_helper.rb#L160-L164 | train | Returns the types that should be checked for the check. | [
30522,
13366,
4127,
1035,
2005,
1035,
4638,
1006,
2951,
1007,
23329,
1035,
2862,
1027,
3042,
27953,
2100,
6290,
1024,
1024,
2025,
1035,
2005,
1035,
4638,
23329,
1035,
2862,
1009,
1027,
3042,
29521,
1024,
1024,
4563,
1024,
1024,
2460,
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.explicit_content_filter= | def explicit_content_filter=(filter_level)
filter_level = FILTER_LEVELS[filter_level] if filter_level.is_a?(Symbol)
update_server_data(explicit_content_filter: filter_level)
end | ruby | def explicit_content_filter=(filter_level)
filter_level = FILTER_LEVELS[filter_level] if filter_level.is_a?(Symbol)
update_server_data(explicit_content_filter: filter_level)
end | [
"def",
"explicit_content_filter",
"=",
"(",
"filter_level",
")",
"filter_level",
"=",
"FILTER_LEVELS",
"[",
"filter_level",
"]",
"if",
"filter_level",
".",
"is_a?",
"(",
"Symbol",
")",
"update_server_data",
"(",
"explicit_content_filter",
":",
"filter_level",
")",
"... | Sets the server content filter.
@param filter_level [Integer, Symbol] The content filter from 0-2 or Symbol (see {FILTER_LEVELS}) | [
"Sets",
"the",
"server",
"content",
"filter",
"."
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/data/server.rb#L716-L720 | train | Update the server data with the specified explicit content filter. | [
30522,
13366,
13216,
1035,
4180,
1035,
11307,
1027,
1006,
11307,
1035,
2504,
1007,
11307,
1035,
2504,
1027,
11307,
1035,
3798,
1031,
11307,
1035,
2504,
1033,
2065,
11307,
1035,
2504,
1012,
2003,
1035,
1037,
1029,
1006,
6454,
1007,
10651,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb | Azure::SQL::Mgmt::V2015_05_01_preview.SyncGroups.list_sync_database_ids_as_lazy | def list_sync_database_ids_as_lazy(location_name, custom_headers:nil)
response = list_sync_database_ids_async(location_name, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_sync_database_ids_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_sync_database_ids_as_lazy(location_name, custom_headers:nil)
response = list_sync_database_ids_async(location_name, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_sync_database_ids_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_sync_database_ids_as_lazy",
"(",
"location_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_sync_database_ids_async",
"(",
"location_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"unless",
"response",
".",
"nil?",... | Gets a collection of sync database ids.
@param location_name [String] The name of the region where the resource is
located.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [SyncDatabaseIdListResult] which provide lazy access to pages of the
response. | [
"Gets",
"a",
"collection",
"of",
"sync",
"database",
"ids",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb#L1777-L1786 | train | Gets a list of all the sync database IDs. | [
30522,
13366,
2862,
1035,
26351,
1035,
7809,
1035,
8909,
2015,
1035,
2004,
1035,
13971,
1006,
3295,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
26351,
1035,
7809,
1035,
8909,
2015,
1035,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_compute/lib/2018-09-30/generated/azure_mgmt_compute/disks.rb | Azure::Compute::Mgmt::V2018_09_30.Disks.begin_update_with_http_info | def begin_update_with_http_info(resource_group_name, disk_name, disk, custom_headers:nil)
begin_update_async(resource_group_name, disk_name, disk, custom_headers:custom_headers).value!
end | ruby | def begin_update_with_http_info(resource_group_name, disk_name, disk, custom_headers:nil)
begin_update_async(resource_group_name, disk_name, disk, custom_headers:custom_headers).value!
end | [
"def",
"begin_update_with_http_info",
"(",
"resource_group_name",
",",
"disk_name",
",",
"disk",
",",
"custom_headers",
":",
"nil",
")",
"begin_update_async",
"(",
"resource_group_name",
",",
"disk_name",
",",
"disk",
",",
"custom_headers",
":custom_headers",
")",
"."... | Updates (patches) a disk.
@param resource_group_name [String] The name of the resource group.
@param disk_name [String] The name of the managed disk that is being created.
The name can't be changed after the disk is created. Supported characters for
the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters.
@param disk [DiskUpdate] Disk object supplied in the body of the Patch disk
operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Updates",
"(",
"patches",
")",
"a",
"disk",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2018-09-30/generated/azure_mgmt_compute/disks.rb#L683-L685 | train | Updates a disk in a resource group. | [
30522,
13366,
4088,
1035,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
9785,
1035,
2171,
1010,
9785,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
1035,
10651,
1035,
2004,
6038,
2278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mongodb/mongoid | lib/mongoid/atomic.rb | Mongoid.Atomic.atomic_pulls | def atomic_pulls
pulls = {}
delayed_atomic_pulls.each_pair do |_, docs|
path = nil
ids = docs.map do |doc|
path ||= doc.flag_as_destroyed
doc._id
end
pulls[path] = { "_id" => { "$in" => ids }} and path = nil
end
pulls
end | ruby | def atomic_pulls
pulls = {}
delayed_atomic_pulls.each_pair do |_, docs|
path = nil
ids = docs.map do |doc|
path ||= doc.flag_as_destroyed
doc._id
end
pulls[path] = { "_id" => { "$in" => ids }} and path = nil
end
pulls
end | [
"def",
"atomic_pulls",
"pulls",
"=",
"{",
"}",
"delayed_atomic_pulls",
".",
"each_pair",
"do",
"|",
"_",
",",
"docs",
"|",
"path",
"=",
"nil",
"ids",
"=",
"docs",
".",
"map",
"do",
"|",
"doc",
"|",
"path",
"||=",
"doc",
".",
"flag_as_destroyed",
"doc",... | Get all the attributes that need to be pulled.
@example Get the pulls.
person.atomic_pulls
@return [ Array<Hash> ] The $pullAll operations.
@since 2.2.0 | [
"Get",
"all",
"the",
"attributes",
"that",
"need",
"to",
"be",
"pulled",
"."
] | 56976e32610f4c2450882b0bfe14da099f0703f4 | https://github.com/mongodb/mongoid/blob/56976e32610f4c2450882b0bfe14da099f0703f4/lib/mongoid/atomic.rb#L204-L215 | train | Returns a hash of all the pulls that have been delayed. | [
30522,
13366,
9593,
1035,
8005,
8005,
1027,
1063,
1065,
8394,
1035,
9593,
1035,
8005,
1012,
2169,
1035,
3940,
2079,
1064,
1035,
1010,
9986,
2015,
1064,
4130,
1027,
9152,
2140,
8909,
2015,
1027,
9986,
2015,
1012,
4949,
2079,
1064,
9986,
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... |
cloudfoundry/bosh | src/bosh_common/lib/common/exec.rb | Bosh.Exec.sh | def sh(command, options={})
opts = options.dup
# can only yield if we don't raise errors
opts[:on_error] = :return if opts[:yield] == :on_false
output = %x{#{command}}
result = Result.new(command, output, $?.exitstatus)
if result.failed?
unless opts[:on_error] == :return
raise Error.new(result.exit_status, command, output)
end
yield result if block_given? && opts[:yield] == :on_false
else
yield result if block_given?
end
result
rescue Errno::ENOENT => e
msg = "command not found: #{command}"
raise Error.new(nil, command) unless opts[:on_error] == :return
result = Result.new(command, msg, -1, true)
yield result if block_given? && opts[:yield] == :on_false
result
end | ruby | def sh(command, options={})
opts = options.dup
# can only yield if we don't raise errors
opts[:on_error] = :return if opts[:yield] == :on_false
output = %x{#{command}}
result = Result.new(command, output, $?.exitstatus)
if result.failed?
unless opts[:on_error] == :return
raise Error.new(result.exit_status, command, output)
end
yield result if block_given? && opts[:yield] == :on_false
else
yield result if block_given?
end
result
rescue Errno::ENOENT => e
msg = "command not found: #{command}"
raise Error.new(nil, command) unless opts[:on_error] == :return
result = Result.new(command, msg, -1, true)
yield result if block_given? && opts[:yield] == :on_false
result
end | [
"def",
"sh",
"(",
"command",
",",
"options",
"=",
"{",
"}",
")",
"opts",
"=",
"options",
".",
"dup",
"# can only yield if we don't raise errors",
"opts",
"[",
":on_error",
"]",
"=",
":return",
"if",
"opts",
"[",
":yield",
"]",
"==",
":on_false",
"output",
... | Execute commands in a way that forces you to deal with failures and
helps you to simplify testing. The module can be included which will
add sh both as an instance and a class method.
A sample way to mock the execution of "ls /":
it "should be possible to mock the result of a command execution" do
cmd = "ls /"
result = Bosh::Exec::Result.new(cmd, "bin etc var", "", 0)
Bosh::Exec.should_receive(:sh).with(cmd).and_return(result)
result = Bosh::Exec.sh(cmd)
result.success?.should be(true)
end
@note As commands are executed using %x{...} you need to append 2>&1 to
redirect stderr or it will be output to the stderr of the process
invoking the sh method
@param [String] command shell command to execute
@param [Hash] options
@option options [Symbol] :on_error if set to :return failing commands
return [Bosh::Exec::Result] instead of raising [Bosh::Exec::Error]
@option options [Symbol] :yield if set to :on_false it will execute
the block when the command fails, else it will execute the block
only when the command succeeds. Implies :on_error = :return
@yield [Bosh::Exec::Result] command result
@return [Bosh::Exec::Result] command result
@raise [Bosh::Exec::Error] raised when the command isn't found or
the command exits with a non zero status
@example by default execute block only when command succeeds and raise
error on failure
sh("command") do |result|
...
end
@example don't raise error if the command fails
result = sh("command", :on_error => :return)
@example execute block only when command fails (which implies
:on_error => :return)
sh("command", :yield => :on_false) do |result|
...
end | [
"Execute",
"commands",
"in",
"a",
"way",
"that",
"forces",
"you",
"to",
"deal",
"with",
"failures",
"and",
"helps",
"you",
"to",
"simplify",
"testing",
".",
"The",
"module",
"can",
"be",
"included",
"which",
"will",
"add",
"sh",
"both",
"as",
"an",
"inst... | 2eaa7100879ddd20cd909cd698514746195e28b7 | https://github.com/cloudfoundry/bosh/blob/2eaa7100879ddd20cd909cd698514746195e28b7/src/bosh_common/lib/common/exec.rb#L50-L78 | train | Execute a command in the current process. | [
30522,
13366,
14021,
1006,
3094,
1010,
7047,
1027,
1063,
1065,
1007,
23569,
2015,
1027,
7047,
1012,
4241,
2361,
1001,
2064,
2069,
10750,
2065,
2057,
2123,
1005,
1056,
5333,
10697,
23569,
2015,
1031,
1024,
2006,
1035,
7561,
1033,
1027,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-iam/lib/aws-sdk-iam/user.rb | Aws::IAM.User.create | def create(options = {})
options = options.merge(user_name: @name)
resp = @client.create_user(options)
User.new(
name: options[:user_name],
data: resp.data.user,
client: @client
)
end | ruby | def create(options = {})
options = options.merge(user_name: @name)
resp = @client.create_user(options)
User.new(
name: options[:user_name],
data: resp.data.user,
client: @client
)
end | [
"def",
"create",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"user_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"create_user",
"(",
"options",
")",
"User",
".",
"new",
"(",
"name",
":",
"options",
"[",
... | @example Request syntax with placeholder values
user = user.create({
path: "pathType",
permissions_boundary: "arnType",
tags: [
{
key: "tagKeyType", # required
value: "tagValueType", # required
},
],
})
@param [Hash] options ({})
@option options [String] :path
The path for the user name. For more information about paths, see [IAM
Identifiers][1] in the *IAM User Guide*.
This parameter is optional. If it is not included, it defaults to a
slash (/).
This parameter allows (through its [regex pattern][2]) a string of
characters consisting of either a forward slash (/) by itself or a
string that must begin and end with forward slashes. In addition, it
can contain any ASCII character from the ! (\\u0021) through the DEL
character (\\u007F), including most punctuation characters, digits,
and upper and lowercased letters.
[1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html
[2]: http://wikipedia.org/wiki/regex
@option options [String] :permissions_boundary
The ARN of the policy that is used to set the permissions boundary for
the user.
@option options [Array<Types::Tag>] :tags
A list of tags that you want to attach to the newly created user. Each
tag consists of a key name and an associated value. For more
information about tagging, see [Tagging IAM Identities][1] in the *IAM
User Guide*.
<note markdown="1"> If any one of the tags is invalid or if you exceed the allowed number
of tags per user, then the entire request fails and the user is not
created.
</note>
[1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html
@return [User] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-iam/lib/aws-sdk-iam/user.rb#L394-L402 | train | Create a user | [
30522,
13366,
3443,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
5310,
1035,
2171,
1024,
1030,
2171,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
3443,
1035,
5310,
1006,
7047,
1007,
5310,
1012,
2047,
1006,
2171,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jekyll/jekyll | lib/jekyll/log_adapter.rb | Jekyll.LogAdapter.write | def write(level_of_message, topic, message = nil, &block)
return false unless write_message?(level_of_message)
writer.public_send(level_of_message, message(topic, message, &block))
end | ruby | def write(level_of_message, topic, message = nil, &block)
return false unless write_message?(level_of_message)
writer.public_send(level_of_message, message(topic, message, &block))
end | [
"def",
"write",
"(",
"level_of_message",
",",
"topic",
",",
"message",
"=",
"nil",
",",
"&",
"block",
")",
"return",
"false",
"unless",
"write_message?",
"(",
"level_of_message",
")",
"writer",
".",
"public_send",
"(",
"level_of_message",
",",
"message",
"(",
... | Internal: Log a message.
level_of_message - the Symbol level of message, one of :debug, :info, :warn, :error
topic - the String topic or full message
message - the String message (optional)
block - a block containing the message (optional)
Returns false if the message was not written, otherwise returns the value of calling
the appropriate writer method, e.g. writer.info. | [
"Internal",
":",
"Log",
"a",
"message",
"."
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/log_adapter.rb#L145-L149 | train | Write a message to the log | [
30522,
13366,
4339,
1006,
2504,
1035,
1997,
1035,
4471,
1010,
8476,
1010,
4471,
1027,
9152,
2140,
1010,
1004,
3796,
1007,
2709,
6270,
4983,
4339,
1035,
4471,
1029,
1006,
2504,
1035,
1997,
1035,
4471,
1007,
3213,
1012,
2270,
1035,
4604,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
puppetlabs/puppet | lib/puppet/util.rb | Puppet.Util.path_to_uri | def path_to_uri(path)
return unless path
params = { :scheme => 'file' }
if Puppet::Util::Platform.windows?
path = path.gsub(/\\/, '/')
if unc = /^\/\/([^\/]+)(\/.+)/.match(path)
params[:host] = unc[1]
path = unc[2]
elsif path =~ /^[a-z]:\//i
path = '/' + path
end
end
# have to split *after* any relevant escaping
params[:path], params[:query] = uri_encode(path).split('?')
search_for_fragment = params[:query] ? :query : :path
if params[search_for_fragment].include?('#')
params[search_for_fragment], _, params[:fragment] = params[search_for_fragment].rpartition('#')
end
begin
URI::Generic.build(params)
rescue => detail
raise Puppet::Error, _("Failed to convert '%{path}' to URI: %{detail}") % { path: path, detail: detail }, detail.backtrace
end
end | ruby | def path_to_uri(path)
return unless path
params = { :scheme => 'file' }
if Puppet::Util::Platform.windows?
path = path.gsub(/\\/, '/')
if unc = /^\/\/([^\/]+)(\/.+)/.match(path)
params[:host] = unc[1]
path = unc[2]
elsif path =~ /^[a-z]:\//i
path = '/' + path
end
end
# have to split *after* any relevant escaping
params[:path], params[:query] = uri_encode(path).split('?')
search_for_fragment = params[:query] ? :query : :path
if params[search_for_fragment].include?('#')
params[search_for_fragment], _, params[:fragment] = params[search_for_fragment].rpartition('#')
end
begin
URI::Generic.build(params)
rescue => detail
raise Puppet::Error, _("Failed to convert '%{path}' to URI: %{detail}") % { path: path, detail: detail }, detail.backtrace
end
end | [
"def",
"path_to_uri",
"(",
"path",
")",
"return",
"unless",
"path",
"params",
"=",
"{",
":scheme",
"=>",
"'file'",
"}",
"if",
"Puppet",
"::",
"Util",
"::",
"Platform",
".",
"windows?",
"path",
"=",
"path",
".",
"gsub",
"(",
"/",
"\\\\",
"/",
",",
"'/... | Convert a path to a file URI | [
"Convert",
"a",
"path",
"to",
"a",
"file",
"URI"
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/util.rb#L319-L347 | train | Convert a path to a URI | [
30522,
13366,
4130,
1035,
2000,
1035,
24471,
2072,
1006,
4130,
1007,
2709,
4983,
4130,
11498,
5244,
1027,
1063,
1024,
5679,
1027,
1028,
1005,
5371,
1005,
1065,
2065,
13997,
1024,
1024,
21183,
4014,
1024,
1024,
4132,
1012,
3645,
1029,
4130,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.filter | def filter(conditions)
filtered_stats = @stats.select do |stat|
selected = true
conditions.each do |condition, value|
selected = false if stat[condition] != value
end
selected
end
StatsRegistry.new(filtered_stats)
end | ruby | def filter(conditions)
filtered_stats = @stats.select do |stat|
selected = true
conditions.each do |condition, value|
selected = false if stat[condition] != value
end
selected
end
StatsRegistry.new(filtered_stats)
end | [
"def",
"filter",
"(",
"conditions",
")",
"filtered_stats",
"=",
"@stats",
".",
"select",
"do",
"|",
"stat",
"|",
"selected",
"=",
"true",
"conditions",
".",
"each",
"do",
"|",
"condition",
",",
"value",
"|",
"selected",
"=",
"false",
"if",
"stat",
"[",
... | Public: Creates a new registry with the filtered stats
conditions - A hash of conditions
* primary: Whether the stat is primary or not.
* priority: The priority of the stat used for render issues.
Returns a new StatsRegistry with the filtered stats | [
"Public",
":",
"Creates",
"a",
"new",
"registry",
"with",
"the",
"filtered",
"stats"
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/lib/decidim/stats_registry.rb#L76-L85 | train | Filter the stats by the given conditions | [
30522,
13366,
11307,
1006,
3785,
1007,
21839,
1035,
26319,
1027,
1030,
26319,
1012,
7276,
2079,
1064,
28093,
1064,
3479,
1027,
2995,
3785,
1012,
2169,
2079,
1064,
4650,
1010,
3643,
1064,
3479,
1027,
6270,
2065,
28093,
1031,
4650,
1033,
999,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.update_backup_policy_with_http_info | def update_backup_policy_with_http_info(backup_policy_description, backup_policy_name, timeout:60, custom_headers:nil)
update_backup_policy_async(backup_policy_description, backup_policy_name, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def update_backup_policy_with_http_info(backup_policy_description, backup_policy_name, timeout:60, custom_headers:nil)
update_backup_policy_async(backup_policy_description, backup_policy_name, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"update_backup_policy_with_http_info",
"(",
"backup_policy_description",
",",
"backup_policy_name",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"update_backup_policy_async",
"(",
"backup_policy_description",
",",
"backup_policy_name",
",",
"tim... | Updates the backup policy.
Updates the backup policy identified by {backupPolicyName}
@param backup_policy_description [BackupPolicyDescription] Describes the
backup policy.
@param backup_policy_name [String] The name of the backup policy.
@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. | [
"Updates",
"the",
"backup",
"policy",
"."
] | 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#L22861-L22863 | train | Updates the backup policy. | [
30522,
13366,
10651,
1035,
10200,
1035,
3343,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10200,
1035,
3343,
1035,
6412,
1010,
10200,
1035,
3343,
1035,
2171,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
3052... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_scheduler/lib/2016-03-01/generated/azure_mgmt_scheduler/jobs.rb | Azure::Scheduler::Mgmt::V2016_03_01.Jobs.run | def run(resource_group_name, job_collection_name, job_name, custom_headers:nil)
response = run_async(resource_group_name, job_collection_name, job_name, custom_headers:custom_headers).value!
nil
end | ruby | def run(resource_group_name, job_collection_name, job_name, custom_headers:nil)
response = run_async(resource_group_name, job_collection_name, job_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"run",
"(",
"resource_group_name",
",",
"job_collection_name",
",",
"job_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"run_async",
"(",
"resource_group_name",
",",
"job_collection_name",
",",
"job_name",
",",
"custom_headers",
":custom_header... | Runs a job.
@param resource_group_name [String] The resource group name.
@param job_collection_name [String] The job collection name.
@param job_name [String] The job name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Runs",
"a",
"job",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_scheduler/lib/2016-03-01/generated/azure_mgmt_scheduler/jobs.rb#L439-L442 | train | Runs a job in a job collection. | [
30522,
13366,
2448,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3105,
1035,
3074,
1035,
2171,
1010,
3105,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2448,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-ec2/lib/aws-sdk-ec2/vpc.rb | Aws::EC2.Vpc.modify_attribute | def modify_attribute(options = {})
options = options.merge(vpc_id: @id)
resp = @client.modify_vpc_attribute(options)
resp.data
end | ruby | def modify_attribute(options = {})
options = options.merge(vpc_id: @id)
resp = @client.modify_vpc_attribute(options)
resp.data
end | [
"def",
"modify_attribute",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"vpc_id",
":",
"@id",
")",
"resp",
"=",
"@client",
".",
"modify_vpc_attribute",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
vpc.modify_attribute({
enable_dns_hostnames: {
value: false,
},
enable_dns_support: {
value: false,
},
})
@param [Hash] options ({})
@option options [Types::AttributeBooleanValue] :enable_dns_hostnames
Indicates whether the instances launched in the VPC get DNS hostnames.
If enabled, instances in the VPC get DNS hostnames; otherwise, they do
not.
You cannot modify the DNS resolution and DNS hostnames attributes in
the same request. Use separate requests for each attribute. You can
only enable DNS hostnames if you've enabled DNS support.
@option options [Types::AttributeBooleanValue] :enable_dns_support
Indicates whether the DNS resolution is supported for the VPC. If
enabled, queries to the Amazon provided DNS server at the
169.254.169.253 IP address, or the reserved IP address at the base of
the VPC network range "plus two" succeed. If disabled, the Amazon
provided DNS service in the VPC that resolves public DNS hostnames to
IP addresses is not enabled.
You cannot modify the DNS resolution and DNS hostnames attributes in
the same request. Use separate requests for each attribute.
@return [EmptyStructure] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/vpc.rb#L647-L651 | train | Modify the attributes of a VPC | [
30522,
13366,
19933,
1035,
17961,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
21210,
2278,
1035,
8909,
1024,
1030,
8909,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
19933,
1035,
21210,
2278,
1035,
17961,
1006,
70... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | deliver/lib/deliver/upload_metadata.rb | Deliver.UploadMetadata.assign_defaults | def assign_defaults(options)
# Normalizes languages keys from symbols to strings
normalize_language_keys(options)
# Build a complete list of the required languages
enabled_languages = detect_languages(options)
# Get all languages used in existing settings
(LOCALISED_VERSION_VALUES + LOCALISED_APP_VALUES).each do |key|
current = options[key]
next unless current && current.kind_of?(Hash)
current.each do |language, value|
enabled_languages << language unless enabled_languages.include?(language)
end
end
# Check folder list (an empty folder signifies a language is required)
ignore_validation = options[:ignore_language_directory_validation]
Loader.language_folders(options[:metadata_path], ignore_validation).each do |lang_folder|
next unless File.directory?(lang_folder) # We don't want to read txt as they are non localised
language = File.basename(lang_folder)
enabled_languages << language unless enabled_languages.include?(language)
end
return unless enabled_languages.include?("default")
UI.message("Detected languages: " + enabled_languages.to_s)
(LOCALISED_VERSION_VALUES + LOCALISED_APP_VALUES).each do |key|
current = options[key]
next unless current && current.kind_of?(Hash)
default = current["default"]
next if default.nil?
enabled_languages.each do |language|
value = current[language]
next unless value.nil?
current[language] = default
end
current.delete("default")
end
end | ruby | def assign_defaults(options)
# Normalizes languages keys from symbols to strings
normalize_language_keys(options)
# Build a complete list of the required languages
enabled_languages = detect_languages(options)
# Get all languages used in existing settings
(LOCALISED_VERSION_VALUES + LOCALISED_APP_VALUES).each do |key|
current = options[key]
next unless current && current.kind_of?(Hash)
current.each do |language, value|
enabled_languages << language unless enabled_languages.include?(language)
end
end
# Check folder list (an empty folder signifies a language is required)
ignore_validation = options[:ignore_language_directory_validation]
Loader.language_folders(options[:metadata_path], ignore_validation).each do |lang_folder|
next unless File.directory?(lang_folder) # We don't want to read txt as they are non localised
language = File.basename(lang_folder)
enabled_languages << language unless enabled_languages.include?(language)
end
return unless enabled_languages.include?("default")
UI.message("Detected languages: " + enabled_languages.to_s)
(LOCALISED_VERSION_VALUES + LOCALISED_APP_VALUES).each do |key|
current = options[key]
next unless current && current.kind_of?(Hash)
default = current["default"]
next if default.nil?
enabled_languages.each do |language|
value = current[language]
next unless value.nil?
current[language] = default
end
current.delete("default")
end
end | [
"def",
"assign_defaults",
"(",
"options",
")",
"# Normalizes languages keys from symbols to strings",
"normalize_language_keys",
"(",
"options",
")",
"# Build a complete list of the required languages",
"enabled_languages",
"=",
"detect_languages",
"(",
"options",
")",
"# Get all l... | rubocop:enable Metrics/PerceivedComplexity
If the user is using the 'default' language, then assign values where they are needed | [
"rubocop",
":",
"enable",
"Metrics",
"/",
"PerceivedComplexity",
"If",
"the",
"user",
"is",
"using",
"the",
"default",
"language",
"then",
"assign",
"values",
"where",
"they",
"are",
"needed"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/deliver/lib/deliver/upload_metadata.rb#L174-L216 | train | Assign default values to the current settings | [
30522,
13366,
23911,
1035,
12398,
2015,
1006,
7047,
1007,
1001,
3671,
10057,
4155,
6309,
2013,
9255,
2000,
7817,
3671,
4697,
1035,
2653,
1035,
6309,
1006,
7047,
1007,
1001,
3857,
1037,
3143,
2862,
1997,
1996,
3223,
4155,
9124,
1035,
4155,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kmuto/review | lib/epubmaker/epubcommon.rb | EPUBMaker.EPUBCommon.cover | def cover(type = nil)
@body_ext = type.nil? ? '' : %Q( epub:type="#{type}")
if @producer.config['coverimage']
file = @producer.coverimage
raise "coverimage #{@producer.config['coverimage']} not found. Abort." unless file
@body = <<-EOT
<div id="cover-image" class="cover-image">
<img src="#{file}" alt="#{CGI.escapeHTML(@producer.config.name_of('title'))}" class="max"/>
</div>
EOT
else
@body = <<-EOT
<h1 class="cover-title">#{CGI.escapeHTML(@producer.config.name_of('title'))}</h1>
EOT
if @producer.config['subtitle']
@body << <<-EOT
<h2 class="cover-subtitle">#{CGI.escapeHTML(@producer.config.name_of('subtitle'))}</h2>
EOT
end
end
@title = CGI.escapeHTML(@producer.config.name_of('title'))
@language = @producer.config['language']
@stylesheets = @producer.config['stylesheet']
tmplfile = if @producer.config['htmlversion'].to_i == 5
File.expand_path('./html/layout-html5.html.erb', ReVIEW::Template::TEMPLATE_DIR)
else
File.expand_path('./html/layout-xhtml1.html.erb', ReVIEW::Template::TEMPLATE_DIR)
end
tmpl = ReVIEW::Template.load(tmplfile)
tmpl.result(binding)
end | ruby | def cover(type = nil)
@body_ext = type.nil? ? '' : %Q( epub:type="#{type}")
if @producer.config['coverimage']
file = @producer.coverimage
raise "coverimage #{@producer.config['coverimage']} not found. Abort." unless file
@body = <<-EOT
<div id="cover-image" class="cover-image">
<img src="#{file}" alt="#{CGI.escapeHTML(@producer.config.name_of('title'))}" class="max"/>
</div>
EOT
else
@body = <<-EOT
<h1 class="cover-title">#{CGI.escapeHTML(@producer.config.name_of('title'))}</h1>
EOT
if @producer.config['subtitle']
@body << <<-EOT
<h2 class="cover-subtitle">#{CGI.escapeHTML(@producer.config.name_of('subtitle'))}</h2>
EOT
end
end
@title = CGI.escapeHTML(@producer.config.name_of('title'))
@language = @producer.config['language']
@stylesheets = @producer.config['stylesheet']
tmplfile = if @producer.config['htmlversion'].to_i == 5
File.expand_path('./html/layout-html5.html.erb', ReVIEW::Template::TEMPLATE_DIR)
else
File.expand_path('./html/layout-xhtml1.html.erb', ReVIEW::Template::TEMPLATE_DIR)
end
tmpl = ReVIEW::Template.load(tmplfile)
tmpl.result(binding)
end | [
"def",
"cover",
"(",
"type",
"=",
"nil",
")",
"@body_ext",
"=",
"type",
".",
"nil?",
"?",
"''",
":",
"%Q( epub:type=\"#{type}\")",
"if",
"@producer",
".",
"config",
"[",
"'coverimage'",
"]",
"file",
"=",
"@producer",
".",
"coverimage",
"raise",
"\"coverimage... | Return cover content. | [
"Return",
"cover",
"content",
"."
] | 77d1273e671663f05db2992281fd891b776badf0 | https://github.com/kmuto/review/blob/77d1273e671663f05db2992281fd891b776badf0/lib/epubmaker/epubcommon.rb#L126-L158 | train | Create a cover image | [
30522,
13366,
3104,
1006,
2828,
1027,
9152,
2140,
1007,
1030,
2303,
1035,
4654,
2102,
1027,
2828,
1012,
9152,
2140,
1029,
1029,
1005,
1005,
1024,
1003,
1053,
1006,
4958,
12083,
1024,
2828,
1027,
1000,
1001,
1063,
2828,
1065,
1000,
1007,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_face/lib/1.0/generated/azure_cognitiveservices_face/large_person_group_person.rb | Azure::CognitiveServices::Face::V1_0.LargePersonGroupPerson.list | def list(large_person_group_id, start:nil, top:nil, custom_headers:nil)
response = list_async(large_person_group_id, start:start, top:top, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list(large_person_group_id, start:nil, top:nil, custom_headers:nil)
response = list_async(large_person_group_id, start:start, top:top, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list",
"(",
"large_person_group_id",
",",
"start",
":",
"nil",
",",
"top",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_async",
"(",
"large_person_group_id",
",",
"start",
":",
"start",
",",
"top",
":",
"top",
",",
"... | List all persons in a large person group, and retrieve person information
(including personId, name, userData and persistedFaceIds of registered faces
of the person).
@param large_person_group_id [String] Id referencing a particular large
person group.
@param start [String] Starting person id to return (used to list a range of
persons).
@param top [Integer] Number of persons to return starting with the person id
indicated by the 'start' parameter.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array] operation results. | [
"List",
"all",
"persons",
"in",
"a",
"large",
"person",
"group",
"and",
"retrieve",
"person",
"information",
"(",
"including",
"personId",
"name",
"userData",
"and",
"persistedFaceIds",
"of",
"registered",
"faces",
"of",
"the",
"person",
")",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_face/lib/1.0/generated/azure_cognitiveservices_face/large_person_group_person.rb#L152-L155 | train | Gets the list of all the large person groups. | [
30522,
13366,
2862,
1006,
2312,
1035,
2711,
1035,
2177,
1035,
8909,
1010,
2707,
1024,
9152,
2140,
1010,
2327,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2004,
6038,
2278,
1006,
2312,
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... |
randym/axlsx | lib/axlsx/workbook/worksheet/comment.rb | Axlsx.Comment.to_xml_string | def to_xml_string(str = "")
author = @comments.authors[author_index]
str << ('<comment ref="' << ref << '" authorId="' << author_index.to_s << '">')
str << '<text>'
unless author.to_s == ""
str << '<r><rPr><b/><color indexed="81"/></rPr>'
str << ("<t>" << ::CGI.escapeHTML(author.to_s) << ":\n</t></r>")
end
str << '<r>'
str << '<rPr><color indexed="81"/></rPr>'
str << ('<t>' << ::CGI.escapeHTML(text) << '</t></r></text>')
str << '</comment>'
end | ruby | def to_xml_string(str = "")
author = @comments.authors[author_index]
str << ('<comment ref="' << ref << '" authorId="' << author_index.to_s << '">')
str << '<text>'
unless author.to_s == ""
str << '<r><rPr><b/><color indexed="81"/></rPr>'
str << ("<t>" << ::CGI.escapeHTML(author.to_s) << ":\n</t></r>")
end
str << '<r>'
str << '<rPr><color indexed="81"/></rPr>'
str << ('<t>' << ::CGI.escapeHTML(text) << '</t></r></text>')
str << '</comment>'
end | [
"def",
"to_xml_string",
"(",
"str",
"=",
"\"\"",
")",
"author",
"=",
"@comments",
".",
"authors",
"[",
"author_index",
"]",
"str",
"<<",
"(",
"'<comment ref=\"'",
"<<",
"ref",
"<<",
"'\" authorId=\"'",
"<<",
"author_index",
".",
"to_s",
"<<",
"'\">'",
")",
... | serialize the object
@param [String] str
@return [String] | [
"serialize",
"the",
"object"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/worksheet/comment.rb#L63-L75 | train | Returns the xml string for this comment. | [
30522,
13366,
2000,
1035,
20950,
1035,
5164,
1006,
2358,
2099,
1027,
1000,
1000,
1007,
3166,
1027,
1030,
7928,
1012,
6048,
1031,
3166,
1035,
5950,
1033,
2358,
2099,
1026,
1026,
1006,
1005,
1026,
7615,
25416,
1027,
1000,
1005,
1026,
1026,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/api.rb | Github.API.set | def set(option, value=(not_set=true), ignore_setter=false, &block)
raise ArgumentError, 'value not set' if block and !not_set
return self if !not_set and value.nil?
if not_set
set_options option
return self
end
if respond_to?("#{option}=") and not ignore_setter
return __send__("#{option}=", value)
end
define_accessors option, value
self
end | ruby | def set(option, value=(not_set=true), ignore_setter=false, &block)
raise ArgumentError, 'value not set' if block and !not_set
return self if !not_set and value.nil?
if not_set
set_options option
return self
end
if respond_to?("#{option}=") and not ignore_setter
return __send__("#{option}=", value)
end
define_accessors option, value
self
end | [
"def",
"set",
"(",
"option",
",",
"value",
"=",
"(",
"not_set",
"=",
"true",
")",
",",
"ignore_setter",
"=",
"false",
",",
"&",
"block",
")",
"raise",
"ArgumentError",
",",
"'value not set'",
"if",
"block",
"and",
"!",
"not_set",
"return",
"self",
"if",
... | Set a configuration option for a given namespace
@param [String] option
@param [Object] value
@param [Boolean] ignore_setter
@return [self]
@api public | [
"Set",
"a",
"configuration",
"option",
"for",
"a",
"given",
"namespace"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/api.rb#L294-L309 | train | Set the value of an option. | [
30522,
13366,
2275,
1006,
5724,
1010,
3643,
1027,
1006,
2025,
1035,
2275,
1027,
2995,
1007,
1010,
8568,
1035,
2275,
3334,
1027,
6270,
1010,
1004,
3796,
1007,
5333,
6685,
2121,
29165,
1010,
1005,
3643,
2025,
2275,
1005,
2065,
3796,
1998,
9... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
haml/haml | lib/haml/helpers.rb | Haml.Helpers.preserve | def preserve(input = nil, &block)
return preserve(capture_haml(&block)) if block
s = input.to_s.chomp("\n")
s.gsub!(/\n/, '
')
s.delete!("\r")
s
end | ruby | def preserve(input = nil, &block)
return preserve(capture_haml(&block)) if block
s = input.to_s.chomp("\n")
s.gsub!(/\n/, '
')
s.delete!("\r")
s
end | [
"def",
"preserve",
"(",
"input",
"=",
"nil",
",",
"&",
"block",
")",
"return",
"preserve",
"(",
"capture_haml",
"(",
"block",
")",
")",
"if",
"block",
"s",
"=",
"input",
".",
"to_s",
".",
"chomp",
"(",
"\"\\n\"",
")",
"s",
".",
"gsub!",
"(",
"/",
... | Takes any string, finds all the newlines, and converts them to
HTML entities so they'll render correctly in
whitespace-sensitive tags without screwing up the indentation.
@overload preserve(input)
Escapes newlines within a string.
@param input [String] The string within which to escape all newlines
@overload preserve
Escapes newlines within a block of Haml code.
@yield The block within which to escape newlines | [
"Takes",
"any",
"string",
"finds",
"all",
"the",
"newlines",
"and",
"converts",
"them",
"to",
"HTML",
"entities",
"so",
"they",
"ll",
"render",
"correctly",
"in",
"whitespace",
"-",
"sensitive",
"tags",
"without",
"screwing",
"up",
"the",
"indentation",
"."
] | 9aa0fbe4a91b999978927be569d2ad0cd39076f1 | https://github.com/haml/haml/blob/9aa0fbe4a91b999978927be569d2ad0cd39076f1/lib/haml/helpers.rb#L132-L138 | train | Preserve the input | [
30522,
13366,
7969,
1006,
7953,
1027,
9152,
2140,
1010,
1004,
3796,
1007,
2709,
7969,
1006,
5425,
1035,
10654,
2140,
1006,
1004,
3796,
1007,
1007,
2065,
3796,
1055,
1027,
7953,
1012,
2000,
1035,
1055,
1012,
16480,
8737,
1006,
1000,
1032,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/site.rb | Jekyll.Site.in_dest_dir | def in_dest_dir(*paths)
paths.reduce(dest) do |base, path|
Jekyll.sanitized_path(base, path)
end
end | ruby | def in_dest_dir(*paths)
paths.reduce(dest) do |base, path|
Jekyll.sanitized_path(base, path)
end
end | [
"def",
"in_dest_dir",
"(",
"*",
"paths",
")",
"paths",
".",
"reduce",
"(",
"dest",
")",
"do",
"|",
"base",
",",
"path",
"|",
"Jekyll",
".",
"sanitized_path",
"(",
"base",
",",
"path",
")",
"end",
"end"
] | Public: Prefix a given path with the destination directory.
paths - (optional) path elements to a file or directory within the
destination directory
Returns a path which is prefixed with the destination directory. | [
"Public",
":",
"Prefix",
"a",
"given",
"path",
"with",
"the",
"destination",
"directory",
"."
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/site.rb#L404-L408 | train | Returns the path to the file in the destination directory | [
30522,
13366,
1999,
1035,
4078,
2102,
1035,
16101,
1006,
1008,
10425,
1007,
10425,
1012,
5547,
1006,
4078,
2102,
1007,
2079,
1064,
2918,
1010,
4130,
1064,
15333,
4801,
3363,
1012,
2624,
25090,
5422,
1035,
4130,
1006,
2918,
1010,
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... |
mongodb/mongo-ruby-driver | lib/mongo/retryable.rb | Mongo.Retryable.read_with_retry | def read_with_retry(session = nil, server_selector = nil, &block)
if session.nil? && server_selector.nil?
# Older versions of Mongoid call read_with_retry without arguments.
# This is already not correct in a MongoDB 3.6+ environment with
# sessions. For compatibility we emulate the legacy driver behavior
# here but upgrading Mongoid is strongly recommended.
unless $_mongo_read_with_retry_warned
$_mongo_read_with_retry_warned = true
Logger.logger.warn("Legacy read_with_retry invocation - please update the application and/or its dependencies")
end
# Since we don't have a session, we cannot use the modern read retries.
# And we need to select a server but we don't have a server selector.
# Use PrimaryPreferred which will work as long as there is a data
# bearing node in the cluster; the block may select a different server
# which is fine.
server_selector = ServerSelector.get(mode: :primary_preferred)
legacy_read_with_retry(nil, server_selector, &block)
elsif session && session.retry_reads?
modern_read_with_retry(session, server_selector, &block)
elsif client.max_read_retries > 0
legacy_read_with_retry(session, server_selector, &block)
else
server = select_server(cluster, server_selector)
yield server
end
end | ruby | def read_with_retry(session = nil, server_selector = nil, &block)
if session.nil? && server_selector.nil?
# Older versions of Mongoid call read_with_retry without arguments.
# This is already not correct in a MongoDB 3.6+ environment with
# sessions. For compatibility we emulate the legacy driver behavior
# here but upgrading Mongoid is strongly recommended.
unless $_mongo_read_with_retry_warned
$_mongo_read_with_retry_warned = true
Logger.logger.warn("Legacy read_with_retry invocation - please update the application and/or its dependencies")
end
# Since we don't have a session, we cannot use the modern read retries.
# And we need to select a server but we don't have a server selector.
# Use PrimaryPreferred which will work as long as there is a data
# bearing node in the cluster; the block may select a different server
# which is fine.
server_selector = ServerSelector.get(mode: :primary_preferred)
legacy_read_with_retry(nil, server_selector, &block)
elsif session && session.retry_reads?
modern_read_with_retry(session, server_selector, &block)
elsif client.max_read_retries > 0
legacy_read_with_retry(session, server_selector, &block)
else
server = select_server(cluster, server_selector)
yield server
end
end | [
"def",
"read_with_retry",
"(",
"session",
"=",
"nil",
",",
"server_selector",
"=",
"nil",
",",
"&",
"block",
")",
"if",
"session",
".",
"nil?",
"&&",
"server_selector",
".",
"nil?",
"# Older versions of Mongoid call read_with_retry without arguments.",
"# This is alread... | Execute a read operation with retrying.
This method performs server selection for the specified server selector
and yields to the provided block, which should execute the initial
query operation and return its result. The block will be passed the
server selected for the operation. If the block raises an exception,
and this exception corresponds to a read retryable error, and read
retries are enabled for the client, this method will perform server
selection again and yield to the block again (with potentially a
different server). If the block returns successfully, the result
of the block is returned.
If modern retry reads are on (which is the default), the initial read
operation will be retried once. If legacy retry reads are on, the
initial read operation will be retried zero or more times depending
on the :max_read_retries client setting, the default for which is 1.
To disable read retries, turn off modern read retries by setting
retry_reads: false and set :max_read_retries to 0 on the client.
@api private
@example Execute the read.
read_with_retry(session, server_selector) do |server|
...
end
@param [ Mongo::Session ] session The session that the operation is being
run on.
@param [ Mongo::ServerSelector::Selectable ] server_selector Server
selector for the operation.
@param [ Proc ] block The block to execute.
@return [ Result ] The result of the operation. | [
"Execute",
"a",
"read",
"operation",
"with",
"retrying",
"."
] | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/retryable.rb#L99-L124 | train | This method is used to read a single record from the database. | [
30522,
13366,
3191,
1035,
2007,
1035,
2128,
11129,
1006,
5219,
1027,
9152,
2140,
1010,
8241,
1035,
27000,
1027,
9152,
2140,
1010,
1004,
3796,
1007,
2065,
5219,
1012,
9152,
2140,
1029,
1004,
1004,
8241,
1035,
27000,
1012,
9152,
2140,
1029,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/api/v1_items_api.rb | SquareConnect.V1ItemsApi.delete_category | def delete_category(location_id, category_id, opts = {})
data, _status_code, _headers = delete_category_with_http_info(location_id, category_id, opts)
return data
end | ruby | def delete_category(location_id, category_id, opts = {})
data, _status_code, _headers = delete_category_with_http_info(location_id, category_id, opts)
return data
end | [
"def",
"delete_category",
"(",
"location_id",
",",
"category_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"delete_category_with_http_info",
"(",
"location_id",
",",
"category_id",
",",
"opts",
")",
"return",
"data",
... | DeleteCategory
Deletes an existing item category. *Note**: DeleteCategory returns nothing on success but Connect SDKs map the empty response to an empty `V1DeleteCategoryRequest` object as documented below.
@param location_id The ID of the item's associated location.
@param category_id The ID of the category to delete.
@param [Hash] opts the optional parameters
@return [V1Category] | [
"DeleteCategory",
"Deletes",
"an",
"existing",
"item",
"category",
".",
"*",
"Note",
"**",
":",
"DeleteCategory",
"returns",
"nothing",
"on",
"success",
"but",
"Connect",
"SDKs",
"map",
"the",
"empty",
"response",
"to",
"an",
"empty",
"V1DeleteCategoryRequest",
... | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/v1_items_api.rb#L695-L698 | train | Delete a category | [
30522,
13366,
3972,
12870,
1035,
4696,
1006,
3295,
1035,
8909,
1010,
4696,
1035,
8909,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
3972,
12870,
1035,
4696,
1035,
2007,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster.rb | Aws::RDS.DBCluster.modify | def modify(options = {})
options = options.merge(db_cluster_identifier: @id)
resp = @client.modify_db_cluster(options)
DBCluster.new(
id: resp.data.db_cluster.db_cluster_identifier,
data: resp.data.db_cluster,
client: @client
)
end | ruby | def modify(options = {})
options = options.merge(db_cluster_identifier: @id)
resp = @client.modify_db_cluster(options)
DBCluster.new(
id: resp.data.db_cluster.db_cluster_identifier,
data: resp.data.db_cluster,
client: @client
)
end | [
"def",
"modify",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"db_cluster_identifier",
":",
"@id",
")",
"resp",
"=",
"@client",
".",
"modify_db_cluster",
"(",
"options",
")",
"DBCluster",
".",
"new",
"(",
"id",
":",
... | @example Request syntax with placeholder values
dbcluster = db_cluster.modify({
new_db_cluster_identifier: "String",
apply_immediately: false,
backup_retention_period: 1,
db_cluster_parameter_group_name: "String",
vpc_security_group_ids: ["String"],
port: 1,
master_user_password: "String",
option_group_name: "String",
preferred_backup_window: "String",
preferred_maintenance_window: "String",
enable_iam_database_authentication: false,
backtrack_window: 1,
cloudwatch_logs_export_configuration: {
enable_log_types: ["String"],
disable_log_types: ["String"],
},
engine_version: "String",
scaling_configuration: {
min_capacity: 1,
max_capacity: 1,
auto_pause: false,
seconds_until_auto_pause: 1,
timeout_action: "String",
},
deletion_protection: false,
enable_http_endpoint: false,
copy_tags_to_snapshot: false,
})
@param [Hash] options ({})
@option options [String] :new_db_cluster_identifier
The new DB cluster identifier for the DB cluster when renaming a DB
cluster. This value is stored as a lowercase string.
Constraints:
* Must contain from 1 to 63 letters, numbers, or hyphens
* The first character must be a letter
* Can't end with a hyphen or contain two consecutive hyphens
Example: `my-cluster2`
@option options [Boolean] :apply_immediately
A value that specifies whether the modifications in this request and
any pending modifications are asynchronously applied as soon as
possible, regardless of the `PreferredMaintenanceWindow` setting for
the DB cluster. If this parameter is set to `false`, changes to the DB
cluster are applied during the next maintenance window.
The `ApplyImmediately` parameter only affects the
`EnableIAMDatabaseAuthentication`, `MasterUserPassword`, and
`NewDBClusterIdentifier` values. If you set the `ApplyImmediately`
parameter value to false, then changes to the
`EnableIAMDatabaseAuthentication`, `MasterUserPassword`, and
`NewDBClusterIdentifier` values are applied during the next
maintenance window. All other changes are applied immediately,
regardless of the value of the `ApplyImmediately` parameter.
Default: `false`
@option options [Integer] :backup_retention_period
The number of days for which automated backups are retained. You must
specify a minimum value of 1.
Default: 1
Constraints:
* Must be a value from 1 to 35
^
@option options [String] :db_cluster_parameter_group_name
The name of the DB cluster parameter group to use for the DB cluster.
@option options [Array<String>] :vpc_security_group_ids
A list of VPC security groups that the DB cluster will belong to.
@option options [Integer] :port
The port number on which the DB cluster accepts connections.
Constraints: Value must be `1150-65535`
Default: The same port as the original DB cluster.
@option options [String] :master_user_password
The new password for the master database user. This password can
contain any printable ASCII character except "/", """, or "@".
Constraints: Must contain from 8 to 41 characters.
@option options [String] :option_group_name
A value that indicates that the DB cluster should be associated with
the specified option group. Changing this parameter doesn't result in
an outage except in the following case, and the change is applied
during the next maintenance window unless the `ApplyImmediately`
parameter is set to `true` for this request. If the parameter change
results in an option group that enables OEM, this change can cause a
brief (sub-second) period during which new connections are rejected
but existing connections are not interrupted.
Permanent options can't be removed from an option group. The option
group can't be removed from a DB cluster once it is associated with a
DB cluster.
@option options [String] :preferred_backup_window
The daily time range during which automated backups are created if
automated backups are enabled, using the `BackupRetentionPeriod`
parameter.
The default is a 30-minute window selected at random from an 8-hour
block of time for each AWS Region. To see the time blocks available,
see [ Adjusting the Preferred DB Cluster Maintenance Window][1] in the
*Amazon Aurora User Guide.*
Constraints:
* Must be in the format `hh24:mi-hh24:mi`.
* Must be in Universal Coordinated Time (UTC).
* Must not conflict with the preferred maintenance window.
* Must be at least 30 minutes.
[1]: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_UpgradeDBInstance.Maintenance.html#AdjustingTheMaintenanceWindow.Aurora
@option options [String] :preferred_maintenance_window
The weekly time range during which system maintenance can occur, in
Universal Coordinated Time (UTC).
Format: `ddd:hh24:mi-ddd:hh24:mi`
The default is a 30-minute window selected at random from an 8-hour
block of time for each AWS Region, occurring on a random day of the
week. To see the time blocks available, see [ Adjusting the Preferred
DB Cluster Maintenance Window][1] in the *Amazon Aurora User Guide.*
Valid Days: Mon, Tue, Wed, Thu, Fri, Sat, Sun.
Constraints: Minimum 30-minute window.
[1]: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_UpgradeDBInstance.Maintenance.html#AdjustingTheMaintenanceWindow.Aurora
@option options [Boolean] :enable_iam_database_authentication
True to enable mapping of AWS Identity and Access Management (IAM)
accounts to database accounts, and otherwise false.
Default: `false`
@option options [Integer] :backtrack_window
The target backtrack window, in seconds. To disable backtracking, set
this value to 0.
Default: 0
Constraints:
* If specified, this value must be set to a number from 0 to 259,200
(72 hours).
^
@option options [Types::CloudwatchLogsExportConfiguration] :cloudwatch_logs_export_configuration
The configuration setting for the log types to be enabled for export
to CloudWatch Logs for a specific DB cluster.
@option options [String] :engine_version
The version number of the database engine to which you want to
upgrade. Changing this parameter results in an outage. The change is
applied during the next maintenance window unless the ApplyImmediately
parameter is set to true.
For a list of valid engine versions, see CreateDBCluster, or call
DescribeDBEngineVersions.
@option options [Types::ScalingConfiguration] :scaling_configuration
The scaling properties of the DB cluster. You can only modify scaling
properties for DB clusters in `serverless` DB engine mode.
@option options [Boolean] :deletion_protection
Indicates if the DB cluster has deletion protection enabled. The
database can't be deleted when this value is set to true.
@option options [Boolean] :enable_http_endpoint
<note markdown="1"> HTTP endpoint functionality is in beta for Aurora Serverless and is
subject to change.
</note>
A value that indicates whether to enable the HTTP endpoint for an
Aurora Serverless DB cluster. By default, the HTTP endpoint is
disabled.
When enabled, the HTTP endpoint provides a connectionless web service
API for running SQL queries on the Aurora Serverless DB cluster. You
can also query your database from inside the RDS console with the
query editor.
For more information about Aurora Serverless, see [Using Amazon Aurora
Serverless][1] in the *Amazon Aurora User Guide*.
[1]: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless.html
@option options [Boolean] :copy_tags_to_snapshot
True to copy all tags from the DB cluster to snapshots of the DB
cluster, and otherwise false. The default is false.
@return [DBCluster] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-rds/lib/aws-sdk-rds/db_cluster.rb#L1143-L1151 | train | Modify the DB cluster | [
30522,
13366,
19933,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
16962,
1035,
9324,
1035,
8909,
4765,
18095,
1024,
1030,
8909,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
19933,
1035,
16962,
1035,
9324,
1006,
704... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hanami/hanami | lib/hanami/middleware_stack.rb | Hanami.MiddlewareStack.use | def use(middleware, *args, &blk)
stack.push [middleware, args, blk]
stack.uniq!
end | ruby | def use(middleware, *args, &blk)
stack.push [middleware, args, blk]
stack.uniq!
end | [
"def",
"use",
"(",
"middleware",
",",
"*",
"args",
",",
"&",
"blk",
")",
"stack",
".",
"push",
"[",
"middleware",
",",
"args",
",",
"blk",
"]",
"stack",
".",
"uniq!",
"end"
] | Append a middleware to the stack.
@param middleware [Object] a Rack middleware
@param args [Array] optional arguments to pass to the Rack middleware
@param blk [Proc] an optional block to pass to the Rack middleware
@return [Array] the middleware that was added
@since 0.2.0
@see Hanami::MiddlewareStack#prepend
@example
# apps/web/application.rb
module Web
class Application < Hanami::Application
configure do
# ...
use MyRackMiddleware, foo: 'bar'
end
end
end | [
"Append",
"a",
"middleware",
"to",
"the",
"stack",
"."
] | 8c6e5147e92ef869b25379448572da3698eacfdc | https://github.com/hanami/hanami/blob/8c6e5147e92ef869b25379448572da3698eacfdc/lib/hanami/middleware_stack.rb#L77-L80 | train | Use a middleware. | [
30522,
13366,
2224,
1006,
2690,
8059,
1010,
1008,
12098,
5620,
1010,
1004,
1038,
13687,
1007,
9991,
1012,
5245,
1031,
2690,
8059,
1010,
12098,
5620,
1010,
1038,
13687,
1033,
9991,
1012,
4895,
18515,
999,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/disaster_recovery_configurations.rb | Azure::SQL::Mgmt::V2014_04_01.DisasterRecoveryConfigurations.failover_allow_data_loss | def failover_allow_data_loss(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
response = failover_allow_data_loss_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:custom_headers).value!
nil
end | ruby | def failover_allow_data_loss(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:nil)
response = failover_allow_data_loss_async(resource_group_name, server_name, disaster_recovery_configuration_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"failover_allow_data_loss",
"(",
"resource_group_name",
",",
"server_name",
",",
"disaster_recovery_configuration_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"failover_allow_data_loss_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"d... | Fails over from the current primary server to this server. This operation
might result in data loss.
@param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param server_name [String] The name of the server.
@param disaster_recovery_configuration_name [String] The name of the disaster
recovery configuration to failover forcefully.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Fails",
"over",
"from",
"the",
"current",
"primary",
"server",
"to",
"this",
"server",
".",
"This",
"operation",
"might",
"result",
"in",
"data",
"loss",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2014-04-01/generated/azure_mgmt_sql/disaster_recovery_configurations.rb#L385-L388 | train | Allow data loss of a managed cluster. | [
30522,
13366,
8246,
7840,
1035,
3499,
1035,
2951,
1035,
3279,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
7071,
1035,
7233,
1035,
9563,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
CocoaPods/Xcodeproj | lib/xcodeproj/project.rb | Xcodeproj.Project.generate_available_uuid_list | def generate_available_uuid_list(count = 100)
new_uuids = (0..count).map { SecureRandom.hex(12).upcase }
uniques = (new_uuids - (@generated_uuids + uuids))
@generated_uuids += uniques
@available_uuids += uniques
end | ruby | def generate_available_uuid_list(count = 100)
new_uuids = (0..count).map { SecureRandom.hex(12).upcase }
uniques = (new_uuids - (@generated_uuids + uuids))
@generated_uuids += uniques
@available_uuids += uniques
end | [
"def",
"generate_available_uuid_list",
"(",
"count",
"=",
"100",
")",
"new_uuids",
"=",
"(",
"0",
"..",
"count",
")",
".",
"map",
"{",
"SecureRandom",
".",
"hex",
"(",
"12",
")",
".",
"upcase",
"}",
"uniques",
"=",
"(",
"new_uuids",
"-",
"(",
"@generat... | Pre-generates the given number of UUIDs. Useful for optimizing
performance when the rough number of objects that will be created is
known in advance.
@param [Integer] count
the number of UUIDs that should be generated.
@note This method might generated a minor number of uniques UUIDs than
the given count, because some might be duplicated a thus will be
discarded.
@return [void] | [
"Pre",
"-",
"generates",
"the",
"given",
"number",
"of",
"UUIDs",
".",
"Useful",
"for",
"optimizing",
"performance",
"when",
"the",
"rough",
"number",
"of",
"objects",
"that",
"will",
"be",
"created",
"is",
"known",
"in",
"advance",
"."
] | 3be1684437a6f8e69c7836ad4c85a2b78663272f | https://github.com/CocoaPods/Xcodeproj/blob/3be1684437a6f8e69c7836ad4c85a2b78663272f/lib/xcodeproj/project.rb#L479-L484 | train | Generate a list of unique UUIDs | [
30522,
13366,
9699,
1035,
2800,
1035,
1057,
21272,
1035,
2862,
1006,
4175,
1027,
2531,
1007,
2047,
1035,
1057,
21272,
2015,
1027,
1006,
1014,
1012,
1012,
4175,
1007,
1012,
4949,
1063,
5851,
13033,
5358,
1012,
2002,
2595,
1006,
2260,
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... |
appium/ruby_lib | lib/appium_lib/driver.rb | Appium.Driver.start_driver | def start_driver(http_client_ops =
{ http_client: ::Appium::Http::Default.new, open_timeout: 999_999, read_timeout: 999_999 })
@core.quit_driver
# If automationName is set only in server side, then the following automation_name should be nil before
# starting driver.
automation_name = @core.automation_name
@driver = @core.start_driver(server_url: server_url, http_client_ops: http_client_ops)
@http_client = @core.http_client
# if automation_name was nil before start_driver, then re-extend driver specific methods
# to be able to extend correctly.
extend_for(device: @core.device, automation_name: @core.automation_name) if automation_name.nil?
@appium_server_status = appium_server_version
@driver
end | ruby | def start_driver(http_client_ops =
{ http_client: ::Appium::Http::Default.new, open_timeout: 999_999, read_timeout: 999_999 })
@core.quit_driver
# If automationName is set only in server side, then the following automation_name should be nil before
# starting driver.
automation_name = @core.automation_name
@driver = @core.start_driver(server_url: server_url, http_client_ops: http_client_ops)
@http_client = @core.http_client
# if automation_name was nil before start_driver, then re-extend driver specific methods
# to be able to extend correctly.
extend_for(device: @core.device, automation_name: @core.automation_name) if automation_name.nil?
@appium_server_status = appium_server_version
@driver
end | [
"def",
"start_driver",
"(",
"http_client_ops",
"=",
"{",
"http_client",
":",
"::",
"Appium",
"::",
"Http",
"::",
"Default",
".",
"new",
",",
"open_timeout",
":",
"999_999",
",",
"read_timeout",
":",
"999_999",
"}",
")",
"@core",
".",
"quit_driver",
"# If aut... | Creates a new global driver and quits the old one if it exists.
You can customise http_client as the following
Read http://www.rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Device to understand more what the driver
can call instance methods.
@example
require 'rubygems'
require 'appium_lib'
# platformName takes a string or a symbol.
# Start iOS driver
opts = {
caps: {
platformName: :ios,
app: '/path/to/MyiOS.app'
},
appium_lib: {
wait_timeout: 30
}
}
appium_driver = Appium::Driver.new(opts) #=> return an Appium::Driver instance
appium_driver.start_driver #=> return an Appium::Core::Base::Driver
@option http_client_ops [Hash] :http_client Custom HTTP Client
@option http_client_ops [Hash] :open_timeout Custom open timeout for http client.
@option http_client_ops [Hash] :read_timeout Custom read timeout for http client.
@return [Selenium::WebDriver] the new global driver | [
"Creates",
"a",
"new",
"global",
"driver",
"and",
"quits",
"the",
"old",
"one",
"if",
"it",
"exists",
".",
"You",
"can",
"customise",
"http_client",
"as",
"the",
"following"
] | 1f5898400dd1928bfe42ddd5f842d1f8738f2f76 | https://github.com/appium/ruby_lib/blob/1f5898400dd1928bfe42ddd5f842d1f8738f2f76/lib/appium_lib/driver.rb#L540-L558 | train | Start the driver | [
30522,
13366,
2707,
1035,
4062,
1006,
8299,
1035,
7396,
1035,
23092,
1027,
1063,
8299,
1035,
7396,
1024,
1024,
1024,
10439,
5007,
1024,
1024,
8299,
1024,
1024,
12398,
1012,
2047,
1010,
2330,
1035,
2051,
5833,
1024,
25897,
1035,
25897,
1010,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/route_filter_rules.rb | Azure::Network::Mgmt::V2018_07_01.RouteFilterRules.begin_delete | def begin_delete(resource_group_name, route_filter_name, rule_name, custom_headers:nil)
response = begin_delete_async(resource_group_name, route_filter_name, rule_name, custom_headers:custom_headers).value!
nil
end | ruby | def begin_delete(resource_group_name, route_filter_name, rule_name, custom_headers:nil)
response = begin_delete_async(resource_group_name, route_filter_name, rule_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_delete",
"(",
"resource_group_name",
",",
"route_filter_name",
",",
"rule_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_delete_async",
"(",
"resource_group_name",
",",
"route_filter_name",
",",
"rule_name",
",",
"custom_headers",
... | Deletes the specified rule from a 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 rule.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Deletes",
"the",
"specified",
"rule",
"from",
"a",
"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#L358-L361 | train | Deletes a route filter rule. | [
30522,
13366,
4088,
1035,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2799,
1035,
11307,
1035,
2171,
1010,
3627,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
3972,
12870,
1035,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_customer_insights/lib/2017-01-01/generated/azure_mgmt_customer_insights/interactions.rb | Azure::CustomerInsights::Mgmt::V2017_01_01.Interactions.suggest_relationship_links_with_http_info | def suggest_relationship_links_with_http_info(resource_group_name, hub_name, interaction_name, custom_headers:nil)
suggest_relationship_links_async(resource_group_name, hub_name, interaction_name, custom_headers:custom_headers).value!
end | ruby | def suggest_relationship_links_with_http_info(resource_group_name, hub_name, interaction_name, custom_headers:nil)
suggest_relationship_links_async(resource_group_name, hub_name, interaction_name, custom_headers:custom_headers).value!
end | [
"def",
"suggest_relationship_links_with_http_info",
"(",
"resource_group_name",
",",
"hub_name",
",",
"interaction_name",
",",
"custom_headers",
":",
"nil",
")",
"suggest_relationship_links_async",
"(",
"resource_group_name",
",",
"hub_name",
",",
"interaction_name",
",",
"... | Suggests relationships to create relationship links.
@param resource_group_name [String] The name of the resource group.
@param hub_name [String] The name of the hub.
@param interaction_name [String] The name of the interaction.
@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. | [
"Suggests",
"relationships",
"to",
"create",
"relationship",
"links",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_customer_insights/lib/2017-01-01/generated/azure_mgmt_customer_insights/interactions.rb#L302-L304 | train | Suggest relationship links for a hub. | [
30522,
13366,
6592,
1035,
3276,
1035,
6971,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
9594,
1035,
2171,
1010,
8290,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
6592,
1035,
3276,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb | Azure::CognitiveServices::ComputerVision::V2_0.ComputerVisionClient.analyze_image_with_http_info | def analyze_image_with_http_info(url, visual_features:nil, details:nil, language:nil, custom_headers:nil)
analyze_image_async(url, visual_features:visual_features, details:details, language:language, custom_headers:custom_headers).value!
end | ruby | def analyze_image_with_http_info(url, visual_features:nil, details:nil, language:nil, custom_headers:nil)
analyze_image_async(url, visual_features:visual_features, details:details, language:language, custom_headers:custom_headers).value!
end | [
"def",
"analyze_image_with_http_info",
"(",
"url",
",",
"visual_features",
":",
"nil",
",",
"details",
":",
"nil",
",",
"language",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"analyze_image_async",
"(",
"url",
",",
"visual_features",
":visual_features",
... | This operation extracts a rich set of visual features based on the image
content.
Two input methods are supported -- (1) Uploading an image or (2) specifying
an image URL. Within your request, there is an optional parameter to allow
you to choose which features to return. By default, image categories are
returned in the response.
A successful response will be returned in JSON. If the request failed, the
response will contain an error code and a message to help understand what
went wrong.
@param url [String] Publicly reachable URL of an image.
@param visual_features [Array<VisualFeatureTypes>] A string indicating what
visual feature types to return. Multiple values should be comma-separated.
Valid visual feature types include: Categories - categorizes image content
according to a taxonomy defined in documentation. Tags - tags the image with
a detailed list of words related to the image content. Description -
describes the image content with a complete English sentence. Faces - detects
if faces are present. If present, generate coordinates, gender and age.
ImageType - detects if image is clipart or a line drawing. Color - determines
the accent color, dominant color, and whether an image is black&white. Adult
- detects if the image is pornographic in nature (depicts nudity or a sex
act). Sexually suggestive content is also detected. Objects - detects
various objects within an image, including the approximate location. The
Objects argument is only available in English. Brands - detects various
brands within an image, including the approximate location. The Brands
argument is only available in English.
@param details [Array<Details>] A string indicating which domain-specific
details to return. Multiple values should be comma-separated. Valid visual
feature types include: Celebrities - identifies celebrities if detected in
the image, Landmarks - identifies notable landmarks in the image.
@param language [Enum] The desired language for output generation. If this
parameter is not specified, the default value is "en".Supported
languages:en - English, Default. es - Spanish, ja - Japanese, pt -
Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es',
'ja', 'pt', 'zh'
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"This",
"operation",
"extracts",
"a",
"rich",
"set",
"of",
"visual",
"features",
"based",
"on",
"the",
"image",
"content",
".",
"Two",
"input",
"methods",
"are",
"supported",
"--",
"(",
"1",
")",
"Uploading",
"an",
"image",
"or",
"(",
"2",
")",
"specifyi... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb#L202-L204 | train | Analyze an image. | [
30522,
13366,
17908,
1035,
3746,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
24471,
2140,
1010,
5107,
1035,
2838,
1024,
9152,
2140,
1010,
4751,
1024,
9152,
2140,
1010,
2653,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_resources/lib/2016-02-01/generated/azure_mgmt_resources/resources.rb | Azure::Resources::Mgmt::V2016_02_01.Resources.begin_move_resources | def begin_move_resources(source_resource_group_name, parameters, custom_headers:nil)
response = begin_move_resources_async(source_resource_group_name, parameters, custom_headers:custom_headers).value!
nil
end | ruby | def begin_move_resources(source_resource_group_name, parameters, custom_headers:nil)
response = begin_move_resources_async(source_resource_group_name, parameters, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_move_resources",
"(",
"source_resource_group_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_move_resources_async",
"(",
"source_resource_group_name",
",",
"parameters",
",",
"custom_headers",
":custom_headers",
")",
... | Move resources from one resource group to another. The resources being moved
should all be in the same resource group.
@param source_resource_group_name [String] Source resource group name.
@param parameters [ResourcesMoveInfo] move resources' parameters.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Move",
"resources",
"from",
"one",
"resource",
"group",
"to",
"another",
".",
"The",
"resources",
"being",
"moved",
"should",
"all",
"be",
"in",
"the",
"same",
"resource",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_resources/lib/2016-02-01/generated/azure_mgmt_resources/resources.rb#L682-L685 | train | Moves the resources of the source resource group to the target resource group. | [
30522,
13366,
4088,
1035,
2693,
1035,
4219,
1006,
3120,
1035,
7692,
1035,
2177,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
2693,
1035,
4219,
1035,
2004,
6038,
2278,
1006,
3120,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/vagrantfile.rb | Vagrant.Vagrantfile.machine_config | def machine_config(name, provider, boxes, data_path=nil)
keys = @keys.dup
sub_machine = @config.vm.defined_vms[name]
if !sub_machine
raise Errors::MachineNotFound,
name: name, provider: provider
end
provider_plugin = nil
provider_cls = nil
provider_options = {}
box_formats = nil
if provider != nil
provider_plugin = Vagrant.plugin("2").manager.providers[provider]
if !provider_plugin
providers = Vagrant.plugin("2").manager.providers.to_hash.keys
if providers
providers_str = providers.join(', ')
else
providers_str = "N/A"
end
if providers.include? provider.downcase
raise Errors::ProviderNotFoundSuggestion,
machine: name, provider: provider,
suggestion: provider.downcase, providers: providers_str
end
raise Errors::ProviderNotFound,
machine: name, provider: provider, providers: providers_str
end
provider_cls = provider_plugin[0]
provider_options = provider_plugin[1]
box_formats = provider_options[:box_format] || provider
# Test if the provider is usable or not
begin
provider_cls.usable?(true)
rescue Errors::VagrantError => e
raise Errors::ProviderNotUsable,
machine: name.to_s,
provider: provider.to_s,
message: e.to_s
end
end
# Add the sub-machine configuration to the loader and keys
vm_config_key = "#{object_id}_machine_#{name}"
@loader.set(vm_config_key, sub_machine.config_procs)
keys << vm_config_key
# Load once so that we can get the proper box value
config, config_warnings, config_errors = @loader.load(keys)
# Track the original box so we know if we changed
box = nil
initial_box = original_box = config.vm.box
initial_version = original_version = config.vm.box_version
# Check if this machine has a local box metadata file
# describing the existing guest. If so, load it and
# set the box name and version to allow the actual
# box in use to be discovered.
if data_path
meta_file = data_path.join("box_meta")
if meta_file.file?
box_meta = JSON.parse(meta_file.read)
config.vm.box = box_meta["name"]
config.vm.box_version = box_meta["version"]
end
end
# The proc below loads the box and provider overrides. This is
# in a proc because it may have to recurse if the provider override
# changes the box.
load_box_proc = lambda do
local_keys = keys.dup
# Load the box Vagrantfile, if there is one
if config.vm.box && boxes
box = boxes.find(config.vm.box, box_formats, config.vm.box_version)
if box
box_vagrantfile = find_vagrantfile(box.directory)
if box_vagrantfile && !config.vm.ignore_box_vagrantfile
box_config_key =
"#{boxes.object_id}_#{box.name}_#{box.provider}".to_sym
@loader.set(box_config_key, box_vagrantfile)
local_keys.unshift(box_config_key)
config, config_warnings, config_errors = @loader.load(local_keys)
elsif box_vagrantfile && config.vm.ignore_box_vagrantfile
@logger.warn("Ignoring #{box.name} provided Vagrantfile inside box")
end
end
end
# Load provider overrides
provider_overrides = config.vm.get_provider_overrides(provider)
if !provider_overrides.empty?
config_key =
"#{object_id}_vm_#{name}_#{config.vm.box}_#{provider}".to_sym
@loader.set(config_key, provider_overrides)
local_keys << config_key
config, config_warnings, config_errors = @loader.load(local_keys)
end
# If the box changed, then we need to reload
if original_box != config.vm.box || original_version != config.vm.box_version
# TODO: infinite loop protection?
original_box = config.vm.box
original_version = config.vm.box_version
load_box_proc.call
end
end
# Load the box and provider overrides
load_box_proc.call
# NOTE: In cases where the box_meta file contains stale information
# and the reference box no longer exists, fall back to initial
# configuration and attempt to load that
if box.nil?
@logger.warn("Failed to locate #{config.vm.box} with version #{config.vm.box_version}")
@logger.warn("Performing lookup with inital values #{initial_box} with version #{initial_version}")
config.vm.box = original_box = initial_box
config.vm.box_version = original_box = initial_version
load_box_proc.call
end
# Ensure box attributes are set to original values in
# case they were modified by the local box metadata
config.vm.box = original_box
config.vm.box_version = original_version
return {
box: box,
provider_cls: provider_cls,
provider_options: provider_options.dup,
config: config,
config_warnings: config_warnings,
config_errors: config_errors,
}
end | ruby | def machine_config(name, provider, boxes, data_path=nil)
keys = @keys.dup
sub_machine = @config.vm.defined_vms[name]
if !sub_machine
raise Errors::MachineNotFound,
name: name, provider: provider
end
provider_plugin = nil
provider_cls = nil
provider_options = {}
box_formats = nil
if provider != nil
provider_plugin = Vagrant.plugin("2").manager.providers[provider]
if !provider_plugin
providers = Vagrant.plugin("2").manager.providers.to_hash.keys
if providers
providers_str = providers.join(', ')
else
providers_str = "N/A"
end
if providers.include? provider.downcase
raise Errors::ProviderNotFoundSuggestion,
machine: name, provider: provider,
suggestion: provider.downcase, providers: providers_str
end
raise Errors::ProviderNotFound,
machine: name, provider: provider, providers: providers_str
end
provider_cls = provider_plugin[0]
provider_options = provider_plugin[1]
box_formats = provider_options[:box_format] || provider
# Test if the provider is usable or not
begin
provider_cls.usable?(true)
rescue Errors::VagrantError => e
raise Errors::ProviderNotUsable,
machine: name.to_s,
provider: provider.to_s,
message: e.to_s
end
end
# Add the sub-machine configuration to the loader and keys
vm_config_key = "#{object_id}_machine_#{name}"
@loader.set(vm_config_key, sub_machine.config_procs)
keys << vm_config_key
# Load once so that we can get the proper box value
config, config_warnings, config_errors = @loader.load(keys)
# Track the original box so we know if we changed
box = nil
initial_box = original_box = config.vm.box
initial_version = original_version = config.vm.box_version
# Check if this machine has a local box metadata file
# describing the existing guest. If so, load it and
# set the box name and version to allow the actual
# box in use to be discovered.
if data_path
meta_file = data_path.join("box_meta")
if meta_file.file?
box_meta = JSON.parse(meta_file.read)
config.vm.box = box_meta["name"]
config.vm.box_version = box_meta["version"]
end
end
# The proc below loads the box and provider overrides. This is
# in a proc because it may have to recurse if the provider override
# changes the box.
load_box_proc = lambda do
local_keys = keys.dup
# Load the box Vagrantfile, if there is one
if config.vm.box && boxes
box = boxes.find(config.vm.box, box_formats, config.vm.box_version)
if box
box_vagrantfile = find_vagrantfile(box.directory)
if box_vagrantfile && !config.vm.ignore_box_vagrantfile
box_config_key =
"#{boxes.object_id}_#{box.name}_#{box.provider}".to_sym
@loader.set(box_config_key, box_vagrantfile)
local_keys.unshift(box_config_key)
config, config_warnings, config_errors = @loader.load(local_keys)
elsif box_vagrantfile && config.vm.ignore_box_vagrantfile
@logger.warn("Ignoring #{box.name} provided Vagrantfile inside box")
end
end
end
# Load provider overrides
provider_overrides = config.vm.get_provider_overrides(provider)
if !provider_overrides.empty?
config_key =
"#{object_id}_vm_#{name}_#{config.vm.box}_#{provider}".to_sym
@loader.set(config_key, provider_overrides)
local_keys << config_key
config, config_warnings, config_errors = @loader.load(local_keys)
end
# If the box changed, then we need to reload
if original_box != config.vm.box || original_version != config.vm.box_version
# TODO: infinite loop protection?
original_box = config.vm.box
original_version = config.vm.box_version
load_box_proc.call
end
end
# Load the box and provider overrides
load_box_proc.call
# NOTE: In cases where the box_meta file contains stale information
# and the reference box no longer exists, fall back to initial
# configuration and attempt to load that
if box.nil?
@logger.warn("Failed to locate #{config.vm.box} with version #{config.vm.box_version}")
@logger.warn("Performing lookup with inital values #{initial_box} with version #{initial_version}")
config.vm.box = original_box = initial_box
config.vm.box_version = original_box = initial_version
load_box_proc.call
end
# Ensure box attributes are set to original values in
# case they were modified by the local box metadata
config.vm.box = original_box
config.vm.box_version = original_version
return {
box: box,
provider_cls: provider_cls,
provider_options: provider_options.dup,
config: config,
config_warnings: config_warnings,
config_errors: config_errors,
}
end | [
"def",
"machine_config",
"(",
"name",
",",
"provider",
",",
"boxes",
",",
"data_path",
"=",
"nil",
")",
"keys",
"=",
"@keys",
".",
"dup",
"sub_machine",
"=",
"@config",
".",
"vm",
".",
"defined_vms",
"[",
"name",
"]",
"if",
"!",
"sub_machine",
"raise",
... | Returns the configuration for a single machine.
When loading a box Vagrantfile, it will be prepended to the
key order specified when initializing this class. Sub-machine
and provider-specific overrides are appended at the end. The
actual order is:
- box
- keys specified for #initialize
- sub-machine
- provider
The return value is a hash with the following keys (symbols)
and values:
- box: the {Box} backing the machine
- config: the actual configuration
- config_errors: list of errors, if any
- config_warnings: list of warnings, if any
- provider_cls: class of the provider backing the machine
- provider_options: options for the provider
@param [Symbol] name Name of the machine.
@param [Symbol] provider The provider the machine should
be backed by (required for provider overrides).
@param [BoxCollection] boxes BoxCollection to look up the
box Vagrantfile.
@param [Pathname] data_path Machine data path
@return [Hash<Symbol, Object>] Various configuration parameters for a
machine. See the main documentation body for more info. | [
"Returns",
"the",
"configuration",
"for",
"a",
"single",
"machine",
"."
] | c22a145c59790c098f95d50141d9afb48e1ef55f | https://github.com/hashicorp/vagrant/blob/c22a145c59790c098f95d50141d9afb48e1ef55f/lib/vagrant/vagrantfile.rb#L115-L259 | train | Get the machine configuration for the given machine name. | [
30522,
13366,
3698,
1035,
9530,
8873,
2290,
1006,
2171,
1010,
10802,
1010,
8378,
1010,
2951,
1035,
4130,
1027,
9152,
2140,
1007,
6309,
1027,
1030,
6309,
1012,
4241,
2361,
30524,
5244,
1031,
2171,
1033,
2065,
999,
4942,
1035,
3698,
5333,
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... |
randym/axlsx | lib/axlsx/workbook/worksheet/worksheet.rb | Axlsx.Worksheet.add_row | def add_row(values=[], options={})
row = Row.new(self, values, options)
update_column_info row, options.delete(:widths)
yield row if block_given?
row
end | ruby | def add_row(values=[], options={})
row = Row.new(self, values, options)
update_column_info row, options.delete(:widths)
yield row if block_given?
row
end | [
"def",
"add_row",
"(",
"values",
"=",
"[",
"]",
",",
"options",
"=",
"{",
"}",
")",
"row",
"=",
"Row",
".",
"new",
"(",
"self",
",",
"values",
",",
"options",
")",
"update_column_info",
"row",
",",
"options",
".",
"delete",
"(",
":widths",
")",
"yi... | Adds a row to the worksheet and updates auto fit data.
@example - put a vanilla row in your spreadsheet
ws.add_row [1, 'fish on my pl', '8']
@example - specify a fixed width for a column in your spreadsheet
# The first column will ignore the content of this cell when calculating column autowidth.
# The second column will include this text in calculating the columns autowidth
# The third cell will set a fixed with of 80 for the column.
# If you need to un-fix a column width, use :auto. That will recalculate the column width based on all content in the column
ws.add_row ['I wish', 'for a fish', 'on my fish wish dish'], :widths=>[:ignore, :auto, 80]
@example - specify a fixed height for a row
ws.add_row ['I wish', 'for a fish', 'on my fish wish dish'], :height => 40
@example - create and use a style for all cells in the row
blue = ws.styles.add_style :color => "#00FF00"
ws.add_row [1, 2, 3], :style=>blue
@example - only style some cells
blue = ws.styles.add_style :color => "#00FF00"
red = ws.styles.add_style :color => "#FF0000"
big = ws.styles.add_style :sz => 40
ws.add_row ["red fish", "blue fish", "one fish", "two fish"], :style=>[red, blue, nil, big] # the last nil is optional
@example - force the second cell to be a float value
ws.add_row [3, 4, 5], :types => [nil, :float]
@example - use << alias
ws << [3, 4, 5], :types => [nil, :float]
@see Worksheet#column_widths
@return [Row]
@option options [Array] values
@option options [Array, Symbol] types
@option options [Array, Integer] style
@option options [Array] widths each member of the widths array will affect how auto_fit behavies.
@option options [Float] height the row's height (in points) | [
"Adds",
"a",
"row",
"to",
"the",
"worksheet",
"and",
"updates",
"auto",
"fit",
"data",
".",
"@example",
"-",
"put",
"a",
"vanilla",
"row",
"in",
"your",
"spreadsheet",
"ws",
".",
"add_row",
"[",
"1",
"fish",
"on",
"my",
"pl",
"8",
"]"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/worksheet/worksheet.rb#L400-L405 | train | Add a row to the table | [
30522,
13366,
5587,
1035,
5216,
1006,
5300,
1027,
1031,
1033,
1010,
7047,
1027,
1063,
1065,
1007,
5216,
1027,
5216,
1012,
2047,
1006,
2969,
1010,
5300,
1010,
7047,
1007,
10651,
1035,
5930,
1035,
18558,
5216,
1010,
7047,
1012,
3972,
12870,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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_with_http_info | def list_recommended_rules_for_web_app_with_http_info(resource_group_name, site_name, featured:nil, filter:nil, custom_headers:nil)
list_recommended_rules_for_web_app_async(resource_group_name, site_name, featured:featured, filter:filter, custom_headers:custom_headers).value!
end | ruby | def list_recommended_rules_for_web_app_with_http_info(resource_group_name, site_name, featured:nil, filter:nil, custom_headers:nil)
list_recommended_rules_for_web_app_async(resource_group_name, site_name, featured:featured, filter:filter, custom_headers:custom_headers).value!
end | [
"def",
"list_recommended_rules_for_web_app_with_http_info",
"(",
"resource_group_name",
",",
"site_name",
",",
"featured",
":",
"nil",
",",
"filter",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"list_recommended_rules_for_web_app_async",
"(",
"resource_group_name",
... | Get all recommendations for an app.
Get all recommendations for an app.
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param site_name [String] Name of the app.
@param featured [Boolean] Specify <code>true</code> to return only the most
critical recommendations. The default is <code>false</code>, which returns
all recommendations.
@param filter [String] Return only channels specified in the filter. Filter
is specified by using OData syntax. Example: $filter=channel eq 'Api' or
channel eq 'Notification'
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Get",
"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#L473-L475 | train | Gets the list of recommended rules for the specified web app. | [
30522,
13366,
2862,
1035,
6749,
1035,
3513,
1035,
2005,
1035,
4773,
1035,
10439,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2609,
1035,
2171,
1010,
2956,
1024,
9152,
2140,
1010,
11307,
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... |
decidim/decidim | decidim-core/lib/decidim/filter_form_builder.rb | Decidim.FilterFormBuilder.collection_radio_buttons | def collection_radio_buttons(method, collection, value_method, label_method, options = {}, html_options = {})
fieldset_wrapper options[:legend_title] do
super(method, collection, value_method, label_method, options, html_options) do |builder|
if block_given?
yield builder
else
builder.label { builder.radio_button + builder.text }
end
end
end
end | ruby | def collection_radio_buttons(method, collection, value_method, label_method, options = {}, html_options = {})
fieldset_wrapper options[:legend_title] do
super(method, collection, value_method, label_method, options, html_options) do |builder|
if block_given?
yield builder
else
builder.label { builder.radio_button + builder.text }
end
end
end
end | [
"def",
"collection_radio_buttons",
"(",
"method",
",",
"collection",
",",
"value_method",
",",
"label_method",
",",
"options",
"=",
"{",
"}",
",",
"html_options",
"=",
"{",
"}",
")",
"fieldset_wrapper",
"options",
"[",
":legend_title",
"]",
"do",
"super",
"(",... | Wrap the radio buttons collection in a custom fieldset.
It also renders the inputs inside its labels. | [
"Wrap",
"the",
"radio",
"buttons",
"collection",
"in",
"a",
"custom",
"fieldset",
".",
"It",
"also",
"renders",
"the",
"inputs",
"inside",
"its",
"labels",
"."
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/lib/decidim/filter_form_builder.rb#L10-L20 | train | Returns a radio buttons for a collection | [
30522,
13366,
3074,
1035,
2557,
1035,
11287,
1006,
4118,
1010,
3074,
1010,
3643,
1035,
4118,
1010,
3830,
1035,
4118,
1010,
7047,
1027,
1063,
1065,
1010,
16129,
1035,
7047,
1027,
1063,
1065,
1007,
4249,
3388,
1035,
10236,
4842,
7047,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
tongueroo/jets | lib/jets/rack_server.rb | Jets.RackServer.serve | def serve
# Note, looks like stopping jets server with Ctrl-C sends the TERM signal
# down to the sub bin/rackup command cleans up the child process fine.
Bundler.with_clean_env do
args = ''
# only forward the host option, port is always 9292 for simplicity
if @options[:host]
args << " --host #{@options[:host]}"
else
args << " --host 127.0.0.1" # using the default localhost is not starting up https://stackoverflow.com/questions/4356646/address-family-not-supported-by-protocol-family
end
command = "cd #{rack_project} && bin/rackup#{args}" # leads to the same wrapper rack scripts
puts "=> #{command}".color(:green)
system(command)
end
end | ruby | def serve
# Note, looks like stopping jets server with Ctrl-C sends the TERM signal
# down to the sub bin/rackup command cleans up the child process fine.
Bundler.with_clean_env do
args = ''
# only forward the host option, port is always 9292 for simplicity
if @options[:host]
args << " --host #{@options[:host]}"
else
args << " --host 127.0.0.1" # using the default localhost is not starting up https://stackoverflow.com/questions/4356646/address-family-not-supported-by-protocol-family
end
command = "cd #{rack_project} && bin/rackup#{args}" # leads to the same wrapper rack scripts
puts "=> #{command}".color(:green)
system(command)
end
end | [
"def",
"serve",
"# Note, looks like stopping jets server with Ctrl-C sends the TERM signal",
"# down to the sub bin/rackup command cleans up the child process fine.",
"Bundler",
".",
"with_clean_env",
"do",
"args",
"=",
"''",
"# only forward the host option, port is always 9292 for simplicity"... | Runs in the child process | [
"Runs",
"in",
"the",
"child",
"process"
] | 46943a519224067e58aa3e2d5656e3ca083150f9 | https://github.com/tongueroo/jets/blob/46943a519224067e58aa3e2d5656e3ca083150f9/lib/jets/rack_server.rb#L34-L51 | train | This method is called by the server to serve the result of the server. | [
30522,
13366,
3710,
1001,
3602,
1010,
3504,
2066,
7458,
9924,
8241,
2007,
14931,
12190,
1011,
1039,
10255,
1996,
2744,
4742,
1001,
2091,
2000,
1996,
4942,
8026,
1013,
14513,
6279,
3094,
4550,
2015,
2039,
1996,
2775,
2832,
2986,
1012,
14012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_explicit_list_item_with_http_info | def get_explicit_list_item_with_http_info(app_id, version_id, entity_id, item_id, custom_headers:nil)
get_explicit_list_item_async(app_id, version_id, entity_id, item_id, custom_headers:custom_headers).value!
end | ruby | def get_explicit_list_item_with_http_info(app_id, version_id, entity_id, item_id, custom_headers:nil)
get_explicit_list_item_async(app_id, version_id, entity_id, item_id, custom_headers:custom_headers).value!
end | [
"def",
"get_explicit_list_item_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"item_id",
",",
"custom_headers",
":",
"nil",
")",
"get_explicit_list_item_async",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"item_id",
",",
"cust... | Get the explicit (exception) list of the pattern.any entity in a version of
the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param entity_id The Pattern.Any entity Id.
@param item_id [Integer] The explicit list item Id.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Get",
"the",
"explicit",
"(",
"exception",
")",
"list",
"of",
"the",
"pattern",
".",
"any",
"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#L11297-L11299 | train | Gets the specified list item. | [
30522,
13366,
2131,
1035,
13216,
1035,
2862,
1035,
8875,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
9178,
1035,
8909,
1010,
8875,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/workflow_run_action_repetitions.rb | Azure::Logic::Mgmt::V2016_06_01.WorkflowRunActionRepetitions.list_expression_traces_with_http_info | def list_expression_traces_with_http_info(resource_group_name, workflow_name, run_name, action_name, repetition_name, custom_headers:nil)
list_expression_traces_async(resource_group_name, workflow_name, run_name, action_name, repetition_name, custom_headers:custom_headers).value!
end | ruby | def list_expression_traces_with_http_info(resource_group_name, workflow_name, run_name, action_name, repetition_name, custom_headers:nil)
list_expression_traces_async(resource_group_name, workflow_name, run_name, action_name, repetition_name, custom_headers:custom_headers).value!
end | [
"def",
"list_expression_traces_with_http_info",
"(",
"resource_group_name",
",",
"workflow_name",
",",
"run_name",
",",
"action_name",
",",
"repetition_name",
",",
"custom_headers",
":",
"nil",
")",
"list_expression_traces_async",
"(",
"resource_group_name",
",",
"workflow_... | Lists a workflow run expression trace.
@param resource_group_name [String] The resource group name.
@param workflow_name [String] The workflow name.
@param run_name [String] The workflow run name.
@param action_name [String] The workflow action name.
@param repetition_name [String] The workflow repetition.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Lists",
"a",
"workflow",
"run",
"expression",
"trace",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/workflow_run_action_repetitions.rb#L259-L261 | train | Gets the expression traces for a workflow run. | [
30522,
13366,
2862,
1035,
3670,
1035,
10279,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2147,
12314,
1035,
2171,
1010,
2448,
1035,
2171,
1010,
2895,
1035,
2171,
1010,
23318,
1035,
2171,
1010,
7661,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/jobs.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.Jobs.begin_cancel | def begin_cancel(device_name, job_name, resource_group_name, manager_name, custom_headers:nil)
response = begin_cancel_async(device_name, job_name, resource_group_name, manager_name, custom_headers:custom_headers).value!
nil
end | ruby | def begin_cancel(device_name, job_name, resource_group_name, manager_name, custom_headers:nil)
response = begin_cancel_async(device_name, job_name, resource_group_name, manager_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_cancel",
"(",
"device_name",
",",
"job_name",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_cancel_async",
"(",
"device_name",
",",
"job_name",
",",
"resource_group_name",
",",
"manager... | Cancels a job on the device.
@param device_name [String] The device name
@param job_name [String] The jobName.
@param resource_group_name [String] The resource group name
@param manager_name [String] The manager name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Cancels",
"a",
"job",
"on",
"the",
"device",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/jobs.rb#L385-L388 | train | Cancels a job. | [
30522,
13366,
4088,
1035,
17542,
1006,
5080,
1035,
2171,
1010,
3105,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
17542,
1035,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2017-03-30/generated/azure_mgmt_network/public_ipaddresses.rb | Azure::Network::Mgmt::V2017_03_30.PublicIPAddresses.get_virtual_machine_scale_set_public_ipaddress_with_http_info | def get_virtual_machine_scale_set_public_ipaddress_with_http_info(resource_group_name, virtual_machine_scale_set_name, virtualmachine_index, network_interface_name, ip_configuration_name, public_ip_address_name, expand:nil, custom_headers:nil)
get_virtual_machine_scale_set_public_ipaddress_async(resource_group_name, virtual_machine_scale_set_name, virtualmachine_index, network_interface_name, ip_configuration_name, public_ip_address_name, expand:expand, custom_headers:custom_headers).value!
end | ruby | def get_virtual_machine_scale_set_public_ipaddress_with_http_info(resource_group_name, virtual_machine_scale_set_name, virtualmachine_index, network_interface_name, ip_configuration_name, public_ip_address_name, expand:nil, custom_headers:nil)
get_virtual_machine_scale_set_public_ipaddress_async(resource_group_name, virtual_machine_scale_set_name, virtualmachine_index, network_interface_name, ip_configuration_name, public_ip_address_name, expand:expand, custom_headers:custom_headers).value!
end | [
"def",
"get_virtual_machine_scale_set_public_ipaddress_with_http_info",
"(",
"resource_group_name",
",",
"virtual_machine_scale_set_name",
",",
"virtualmachine_index",
",",
"network_interface_name",
",",
"ip_configuration_name",
",",
"public_ip_address_name",
",",
"expand",
":",
"n... | Get the specified public IP address in a virtual machine scale set.
@param resource_group_name [String] The name of the resource group.
@param virtual_machine_scale_set_name [String] The name of the virtual
machine scale set.
@param virtualmachine_index [String] The virtual machine index.
@param network_interface_name [String] The name of the network interface.
@param ip_configuration_name [String] The name of the IP configuration.
@param public_ip_address_name [String] The name of the public IP Address.
@param expand [String] Expands referenced resources.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Get",
"the",
"specified",
"public",
"IP",
"address",
"in",
"a",
"virtual",
"machine",
"scale",
"set",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2017-03-30/generated/azure_mgmt_network/public_ipaddresses.rb#L272-L274 | train | Gets the specified public IP address of the specified virtual machine. | [
30522,
13366,
2131,
1035,
7484,
1035,
3698,
1035,
4094,
1035,
2275,
1035,
2270,
1035,
25249,
16200,
4757,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7484,
1035,
3698,
1035,
4094,
1035,
2275,
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_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.start_cluster_configuration_upgrade_with_http_info | def start_cluster_configuration_upgrade_with_http_info(cluster_configuration_upgrade_description, timeout:60, custom_headers:nil)
start_cluster_configuration_upgrade_async(cluster_configuration_upgrade_description, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def start_cluster_configuration_upgrade_with_http_info(cluster_configuration_upgrade_description, timeout:60, custom_headers:nil)
start_cluster_configuration_upgrade_async(cluster_configuration_upgrade_description, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"start_cluster_configuration_upgrade_with_http_info",
"(",
"cluster_configuration_upgrade_description",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"start_cluster_configuration_upgrade_async",
"(",
"cluster_configuration_upgrade_description",
",",
"tim... | Start upgrading the configuration of a Service Fabric standalone cluster.
Validate the supplied configuration upgrade parameters and start upgrading
the cluster configuration if the parameters are valid.
@param cluster_configuration_upgrade_description
[ClusterConfigurationUpgradeDescription] Parameters for a standalone cluster
configuration upgrade.
@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. | [
"Start",
"upgrading",
"the",
"configuration",
"of",
"a",
"Service",
"Fabric",
"standalone",
"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#L2911-L2913 | train | Starts the upgrade of the specified cluster configuration. | [
30522,
13366,
2707,
1035,
9324,
1035,
9563,
1035,
12200,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
9324,
1035,
9563,
1035,
12200,
1035,
6412,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2707,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | snapshot/lib/snapshot/simulator_launchers/simulator_launcher_xcode_8.rb | Snapshot.SimulatorLauncherXcode8.run_for_device_and_language | def run_for_device_and_language(language, locale, device, launch_arguments, retries = 0)
return launch_one_at_a_time(language, locale, device, launch_arguments)
rescue => ex
UI.error(ex.to_s) # show the reason for failure to the user, but still maybe retry
if retries < launcher_config.number_of_retries
UI.important("Tests failed, re-trying #{retries + 1} out of #{launcher_config.number_of_retries + 1} times")
run_for_device_and_language(language, locale, device, launch_arguments, retries + 1)
else
UI.error("Backtrace:\n\t#{ex.backtrace.join("\n\t")}") if FastlaneCore::Globals.verbose?
self.collected_errors << ex
raise ex if launcher_config.stop_after_first_error
return false # for the results
end
end | ruby | def run_for_device_and_language(language, locale, device, launch_arguments, retries = 0)
return launch_one_at_a_time(language, locale, device, launch_arguments)
rescue => ex
UI.error(ex.to_s) # show the reason for failure to the user, but still maybe retry
if retries < launcher_config.number_of_retries
UI.important("Tests failed, re-trying #{retries + 1} out of #{launcher_config.number_of_retries + 1} times")
run_for_device_and_language(language, locale, device, launch_arguments, retries + 1)
else
UI.error("Backtrace:\n\t#{ex.backtrace.join("\n\t")}") if FastlaneCore::Globals.verbose?
self.collected_errors << ex
raise ex if launcher_config.stop_after_first_error
return false # for the results
end
end | [
"def",
"run_for_device_and_language",
"(",
"language",
",",
"locale",
",",
"device",
",",
"launch_arguments",
",",
"retries",
"=",
"0",
")",
"return",
"launch_one_at_a_time",
"(",
"language",
",",
"locale",
",",
"device",
",",
"launch_arguments",
")",
"rescue",
... | This is its own method so that it can re-try if the tests fail randomly
@return true/false depending on if the tests succeeded | [
"This",
"is",
"its",
"own",
"method",
"so",
"that",
"it",
"can",
"re",
"-",
"try",
"if",
"the",
"tests",
"fail",
"randomly"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/snapshot/lib/snapshot/simulator_launchers/simulator_launcher_xcode_8.rb#L34-L48 | train | Runs the launch_one_at_a_time method | [
30522,
13366,
2448,
1035,
2005,
1035,
5080,
1035,
1998,
1035,
2653,
1006,
2653,
1010,
2334,
2063,
1010,
5080,
1010,
4888,
1035,
9918,
1010,
2128,
21011,
1027,
1014,
1007,
2709,
4888,
1035,
2028,
1035,
2012,
1035,
30524,
1035,
9530,
8873,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hashicorp/vault-ruby | lib/vault/api/auth.rb | Vault.Authenticate.app_id | def app_id(app_id, user_id, options = {})
payload = { app_id: app_id, user_id: user_id }.merge(options)
json = client.post("/v1/auth/app-id/login", JSON.fast_generate(payload))
secret = Secret.decode(json)
client.token = secret.auth.client_token
return secret
end | ruby | def app_id(app_id, user_id, options = {})
payload = { app_id: app_id, user_id: user_id }.merge(options)
json = client.post("/v1/auth/app-id/login", JSON.fast_generate(payload))
secret = Secret.decode(json)
client.token = secret.auth.client_token
return secret
end | [
"def",
"app_id",
"(",
"app_id",
",",
"user_id",
",",
"options",
"=",
"{",
"}",
")",
"payload",
"=",
"{",
"app_id",
":",
"app_id",
",",
"user_id",
":",
"user_id",
"}",
".",
"merge",
"(",
"options",
")",
"json",
"=",
"client",
".",
"post",
"(",
"\"/v... | Authenticate via the "app-id" authentication method. If authentication is
successful, the resulting token will be stored on the client and used for
future requests.
@example
Vault.auth.app_id(
"aeece56e-3f9b-40c3-8f85-781d3e9a8f68",
"3b87be76-95cf-493a-a61b-7d5fc70870ad",
) #=> #<Vault::Secret lease_id="">
@example with a custom mount point
Vault.auth.app_id(
"aeece56e-3f9b-40c3-8f85-781d3e9a8f68",
"3b87be76-95cf-493a-a61b-7d5fc70870ad",
mount: "new-app-id",
)
@param [String] app_id
@param [String] user_id
@param [Hash] options
additional options to pass to the authentication call, such as a custom
mount point
@return [Secret] | [
"Authenticate",
"via",
"the",
"app",
"-",
"id",
"authentication",
"method",
".",
"If",
"authentication",
"is",
"successful",
"the",
"resulting",
"token",
"will",
"be",
"stored",
"on",
"the",
"client",
"and",
"used",
"for",
"future",
"requests",
"."
] | 02f0532a802ba1a2a0d8703a4585dab76eb9d864 | https://github.com/hashicorp/vault-ruby/blob/02f0532a802ba1a2a0d8703a4585dab76eb9d864/lib/vault/api/auth.rb#L69-L75 | train | Create an app - id for a user | [
30522,
13366,
10439,
1035,
8909,
1006,
10439,
1035,
8909,
1010,
5310,
1035,
8909,
1010,
7047,
1027,
1063,
1065,
1007,
18093,
1027,
1063,
10439,
1035,
8909,
1024,
10439,
1035,
8909,
1010,
5310,
1035,
8909,
1024,
5310,
1035,
8909,
1065,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/haml-lint | lib/haml_lint/reporter/disabled_config_reporter.rb | HamlLint.Reporter::DisabledConfigReporter.config_file_contents | def config_file_contents
output = []
output << HEADING
output << 'linters:' if linters_with_lints.any?
linters_with_lints.each do |linter, files|
output << generate_config_for_linter(linter, files)
end
output.join("\n\n")
end | ruby | def config_file_contents
output = []
output << HEADING
output << 'linters:' if linters_with_lints.any?
linters_with_lints.each do |linter, files|
output << generate_config_for_linter(linter, files)
end
output.join("\n\n")
end | [
"def",
"config_file_contents",
"output",
"=",
"[",
"]",
"output",
"<<",
"HEADING",
"output",
"<<",
"'linters:'",
"if",
"linters_with_lints",
".",
"any?",
"linters_with_lints",
".",
"each",
"do",
"|",
"linter",
",",
"files",
"|",
"output",
"<<",
"generate_config_... | The contents of the generated configuration file based on captured lint.
@return [String] a Yaml-formatted configuration file's contents | [
"The",
"contents",
"of",
"the",
"generated",
"configuration",
"file",
"based",
"on",
"captured",
"lint",
"."
] | 024c773667e54cf88db938c2b368977005d70ee8 | https://github.com/sds/haml-lint/blob/024c773667e54cf88db938c2b368977005d70ee8/lib/haml_lint/reporter/disabled_config_reporter.rb#L87-L95 | train | Generate the config file contents for the current project. | [
30522,
13366,
9530,
8873,
2290,
1035,
5371,
1035,
8417,
6434,
1027,
1031,
1033,
6434,
1026,
1026,
5825,
6434,
1026,
1026,
1005,
11409,
7747,
1024,
1005,
2065,
11409,
7747,
1035,
2007,
1035,
11409,
3215,
1012,
2151,
1029,
11409,
7747,
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_monitor/lib/2017-04-01/generated/azure_mgmt_monitor/activity_log_alerts.rb | Azure::Monitor::Mgmt::V2017_04_01.ActivityLogAlerts.delete | def delete(resource_group_name, activity_log_alert_name, custom_headers:nil)
response = delete_async(resource_group_name, activity_log_alert_name, custom_headers:custom_headers).value!
nil
end | ruby | def delete(resource_group_name, activity_log_alert_name, custom_headers:nil)
response = delete_async(resource_group_name, activity_log_alert_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"delete",
"(",
"resource_group_name",
",",
"activity_log_alert_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_async",
"(",
"resource_group_name",
",",
"activity_log_alert_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!"... | Delete an activity log alert.
@param resource_group_name [String] The name of the resource group.
@param activity_log_alert_name [String] The name of the activity log alert.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Delete",
"an",
"activity",
"log",
"alert",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_monitor/lib/2017-04-01/generated/azure_mgmt_monitor/activity_log_alerts.rb#L241-L244 | train | Deletes an activity log alert. | [
30522,
13366,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4023,
1035,
8833,
1035,
9499,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
1035,
2004,
6038,
2278,
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... |
meew0/discordrb | lib/discordrb/data/server.rb | Discordrb.Server.edit_emoji | def edit_emoji(emoji, name: nil, roles: nil, reason: nil)
emoji = @emoji[emoji.resolve_id]
data = JSON.parse(API::Server.edit_emoji(@bot.token, @id, emoji.resolve_id, name || emoji.name, (roles || emoji.roles).map(&:resolve_id), reason))
new_emoji = Emoji.new(data)
@emoji[new_emoji.id] = new_emoji
end | ruby | def edit_emoji(emoji, name: nil, roles: nil, reason: nil)
emoji = @emoji[emoji.resolve_id]
data = JSON.parse(API::Server.edit_emoji(@bot.token, @id, emoji.resolve_id, name || emoji.name, (roles || emoji.roles).map(&:resolve_id), reason))
new_emoji = Emoji.new(data)
@emoji[new_emoji.id] = new_emoji
end | [
"def",
"edit_emoji",
"(",
"emoji",
",",
"name",
":",
"nil",
",",
"roles",
":",
"nil",
",",
"reason",
":",
"nil",
")",
"emoji",
"=",
"@emoji",
"[",
"emoji",
".",
"resolve_id",
"]",
"data",
"=",
"JSON",
".",
"parse",
"(",
"API",
"::",
"Server",
".",
... | Changes the name and/or role whitelist of an emoji on this server.
@param emoji [Emoji, Integer, String] The emoji or emoji ID to edit.
@param name [String] The new name for the emoji.
@param roles [Array<Role, Integer, String>] A new array of roles, or role IDs, to whitelist.
@param reason [String] The reason for the editing of this emoji.
@return [Emoji] The edited emoji. | [
"Changes",
"the",
"name",
"and",
"/",
"or",
"role",
"whitelist",
"of",
"an",
"emoji",
"on",
"this",
"server",
"."
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/data/server.rb#L533-L538 | train | Edit an emoji | [
30522,
13366,
10086,
1035,
7861,
29147,
2072,
1006,
7861,
29147,
2072,
1010,
2171,
1024,
9152,
2140,
1010,
4395,
1024,
9152,
2140,
1010,
3114,
1024,
9152,
2140,
1007,
7861,
29147,
2072,
1027,
1030,
7861,
29147,
2072,
1031,
7861,
29147,
2072... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/sprockets | lib/sprockets/context.rb | Sprockets.Context.base64_asset_data_uri | def base64_asset_data_uri(asset)
data = Rack::Utils.escape(EncodingUtils.base64(asset.source))
"data:#{asset.content_type};base64,#{data}"
end | ruby | def base64_asset_data_uri(asset)
data = Rack::Utils.escape(EncodingUtils.base64(asset.source))
"data:#{asset.content_type};base64,#{data}"
end | [
"def",
"base64_asset_data_uri",
"(",
"asset",
")",
"data",
"=",
"Rack",
"::",
"Utils",
".",
"escape",
"(",
"EncodingUtils",
".",
"base64",
"(",
"asset",
".",
"source",
")",
")",
"\"data:#{asset.content_type};base64,#{data}\"",
"end"
] | Returns a Base64-encoded data URI. | [
"Returns",
"a",
"Base64",
"-",
"encoded",
"data",
"URI",
"."
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/context.rb#L271-L274 | train | Returns the base64 encoded data URI for the given asset | [
30522,
13366,
2918,
21084,
1035,
11412,
1035,
2951,
1035,
24471,
2072,
1006,
11412,
1007,
2951,
1027,
14513,
1024,
1024,
21183,
12146,
1012,
4019,
1006,
17181,
21823,
4877,
1012,
2918,
21084,
1006,
11412,
1012,
3120,
1007,
1007,
1000,
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... |
sporkmonger/addressable | lib/addressable/template.rb | Addressable.Template.expand | def expand(mapping, processor=nil, normalize_values=true)
result = self.pattern.dup
mapping = normalize_keys(mapping)
result.gsub!( EXPRESSION ) do |capture|
transform_capture(mapping, capture, processor, normalize_values)
end
return Addressable::URI.parse(result)
end | ruby | def expand(mapping, processor=nil, normalize_values=true)
result = self.pattern.dup
mapping = normalize_keys(mapping)
result.gsub!( EXPRESSION ) do |capture|
transform_capture(mapping, capture, processor, normalize_values)
end
return Addressable::URI.parse(result)
end | [
"def",
"expand",
"(",
"mapping",
",",
"processor",
"=",
"nil",
",",
"normalize_values",
"=",
"true",
")",
"result",
"=",
"self",
".",
"pattern",
".",
"dup",
"mapping",
"=",
"normalize_keys",
"(",
"mapping",
")",
"result",
".",
"gsub!",
"(",
"EXPRESSION",
... | Expands a URI template into a full URI.
@param [Hash] mapping The mapping that corresponds to the pattern.
@param [#validate, #transform] processor
An optional processor object may be supplied.
@param [Boolean] normalize_values
Optional flag to enable/disable unicode normalization. Default: true
The object should respond to either the <tt>validate</tt> or
<tt>transform</tt> messages or both. Both the <tt>validate</tt> and
<tt>transform</tt> methods should take two parameters: <tt>name</tt> and
<tt>value</tt>. The <tt>validate</tt> method should return <tt>true</tt>
or <tt>false</tt>; <tt>true</tt> if the value of the variable is valid,
<tt>false</tt> otherwise. An <tt>InvalidTemplateValueError</tt>
exception will be raised if the value is invalid. The <tt>transform</tt>
method should return the transformed variable value as a <tt>String</tt>.
If a <tt>transform</tt> method is used, the value will not be percent
encoded automatically. Unicode normalization will be performed both
before and after sending the value to the transform method.
@return [Addressable::URI] The expanded URI template.
@example
class ExampleProcessor
def self.validate(name, value)
return !!(value =~ /^[\w ]+$/) if name == "query"
return true
end
def self.transform(name, value)
return value.gsub(/ /, "+") if name == "query"
return value
end
end
Addressable::Template.new(
"http://example.com/search/{query}/"
).expand(
{"query" => "an example search query"},
ExampleProcessor
).to_str
#=> "http://example.com/search/an+example+search+query/"
Addressable::Template.new(
"http://example.com/search/{query}/"
).expand(
{"query" => "an example search query"}
).to_str
#=> "http://example.com/search/an%20example%20search%20query/"
Addressable::Template.new(
"http://example.com/search/{query}/"
).expand(
{"query" => "bogus!"},
ExampleProcessor
).to_str
#=> Addressable::Template::InvalidTemplateValueError | [
"Expands",
"a",
"URI",
"template",
"into",
"a",
"full",
"URI",
"."
] | 5894c95a7768435cb46d1355954611dbd194832e | https://github.com/sporkmonger/addressable/blob/5894c95a7768435cb46d1355954611dbd194832e/lib/addressable/template.rb#L592-L599 | train | Expand the given mapping | [
30522,
13366,
7818,
1006,
12375,
1010,
13151,
1027,
9152,
2140,
1010,
3671,
4697,
1035,
5300,
1027,
2995,
1007,
2765,
1027,
2969,
1012,
5418,
1012,
4241,
2361,
12375,
1027,
3671,
4697,
1035,
6309,
1006,
12375,
1007,
2765,
1012,
28177,
12083... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
meew0/discordrb | lib/discordrb/gateway.rb | Discordrb.Gateway.send_status_update | def send_status_update(status, since, game, afk)
data = {
status: status,
since: since,
game: game,
afk: afk
}
send_packet(Opcodes::PRESENCE, data)
end | ruby | def send_status_update(status, since, game, afk)
data = {
status: status,
since: since,
game: game,
afk: afk
}
send_packet(Opcodes::PRESENCE, data)
end | [
"def",
"send_status_update",
"(",
"status",
",",
"since",
",",
"game",
",",
"afk",
")",
"data",
"=",
"{",
"status",
":",
"status",
",",
"since",
":",
"since",
",",
"game",
":",
"game",
",",
"afk",
":",
"afk",
"}",
"send_packet",
"(",
"Opcodes",
"::",... | Sends a status update packet (op 3). This sets the bot user's status (online/idle/...) and game playing/streaming.
@param status [String] The status that should be set (`online`, `idle`, `dnd`, `invisible`).
@param since [Integer] The unix timestamp in milliseconds when the status was set. Should only be provided when
`afk` is true.
@param game [Hash<Symbol => Object>, nil] `nil` if no game should be played, or a hash of `:game => "name"` if a
game should be played. The hash can also contain additional attributes for streaming statuses.
@param afk [true, false] Whether the status was set due to inactivity on the user's part. | [
"Sends",
"a",
"status",
"update",
"packet",
"(",
"op",
"3",
")",
".",
"This",
"sets",
"the",
"bot",
"user",
"s",
"status",
"(",
"online",
"/",
"idle",
"/",
"...",
")",
"and",
"game",
"playing",
"/",
"streaming",
"."
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/gateway.rb#L318-L327 | train | Send a status update packet to the server | [
30522,
13366,
4604,
1035,
3570,
1035,
10651,
1006,
3570,
1010,
2144,
1010,
2208,
1010,
21358,
2243,
1007,
2951,
1027,
1063,
3570,
1024,
3570,
1010,
2144,
1024,
2144,
1010,
2208,
1024,
2208,
1010,
21358,
2243,
1024,
21358,
2243,
1065,
4604,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/virtual_network_gateways.rb | Azure::Network::Mgmt::V2018_07_01.VirtualNetworkGateways.begin_set_vpnclient_ipsec_parameters_with_http_info | def begin_set_vpnclient_ipsec_parameters_with_http_info(resource_group_name, virtual_network_gateway_name, vpnclient_ipsec_params, custom_headers:nil)
begin_set_vpnclient_ipsec_parameters_async(resource_group_name, virtual_network_gateway_name, vpnclient_ipsec_params, custom_headers:custom_headers).value!
end | ruby | def begin_set_vpnclient_ipsec_parameters_with_http_info(resource_group_name, virtual_network_gateway_name, vpnclient_ipsec_params, custom_headers:nil)
begin_set_vpnclient_ipsec_parameters_async(resource_group_name, virtual_network_gateway_name, vpnclient_ipsec_params, custom_headers:custom_headers).value!
end | [
"def",
"begin_set_vpnclient_ipsec_parameters_with_http_info",
"(",
"resource_group_name",
",",
"virtual_network_gateway_name",
",",
"vpnclient_ipsec_params",
",",
"custom_headers",
":",
"nil",
")",
"begin_set_vpnclient_ipsec_parameters_async",
"(",
"resource_group_name",
",",
"virt... | The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy
for P2S client of virtual network gateway in the specified resource group
through Network resource provider.
@param resource_group_name [String] The name of the resource group.
@param virtual_network_gateway_name [String] The name of the virtual network
gateway.
@param vpnclient_ipsec_params [VpnClientIPsecParameters] Parameters supplied
to the Begin Set vpnclient ipsec parameters of Virtual Network Gateway P2S
client 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",
"Set",
"VpnclientIpsecParameters",
"operation",
"sets",
"the",
"vpnclient",
"ipsec",
"policy",
"for",
"P2S",
"client",
"of",
"virtual",
"network",
"gateway",
"in",
"the",
"specified",
"resource",
"group",
"through",
"Network",
"resource",
"provider",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/virtual_network_gateways.rb#L2150-L2152 | train | Set vpnclient ipsec parameters. | [
30522,
13366,
4088,
1035,
2275,
1035,
21210,
12273,
8751,
3372,
1035,
12997,
3366,
2278,
1035,
11709,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7484,
1035,
2897,
1035,
11909,
1035,
2171,
1010,
21210,
122... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_redis/lib/2017-02-01/generated/azure_mgmt_redis/redis.rb | Azure::Redis::Mgmt::V2017_02_01.Redis.begin_import_data_with_http_info | def begin_import_data_with_http_info(resource_group_name, name, parameters, custom_headers:nil)
begin_import_data_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
end | ruby | def begin_import_data_with_http_info(resource_group_name, name, parameters, custom_headers:nil)
begin_import_data_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_import_data_with_http_info",
"(",
"resource_group_name",
",",
"name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_import_data_async",
"(",
"resource_group_name",
",",
"name",
",",
"parameters",
",",
"custom_headers",
":custom_headers",
... | Import data into Redis cache.
@param resource_group_name [String] The name of the resource group.
@param name [String] The name of the Redis cache.
@param parameters [ImportRDBParameters] Parameters for Redis import
operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Import",
"data",
"into",
"Redis",
"cache",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_redis/lib/2017-02-01/generated/azure_mgmt_redis/redis.rb#L1104-L1106 | train | Import a data set into a collection of documents. | [
30522,
13366,
4088,
1035,
12324,
1035,
2951,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
1035,
12324,
1035,
2951,
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... |
rubocop-hq/rubocop | lib/rubocop/target_finder.rb | RuboCop.TargetFinder.find_files | def find_files(base_dir, flags)
wanted_toplevel_dirs = toplevel_dirs(base_dir, flags) -
excluded_dirs(base_dir)
wanted_toplevel_dirs.map! { |dir| dir << '/**/*' }
pattern = if wanted_toplevel_dirs.empty?
# We need this special case to avoid creating the pattern
# /**/* which searches the entire file system.
["#{base_dir}/**/*"]
else
# Search the non-excluded top directories, but also add files
# on the top level, which would otherwise not be found.
wanted_toplevel_dirs.unshift("#{base_dir}/*")
end
Dir.glob(pattern, flags).select { |path| FileTest.file?(path) }
end | ruby | def find_files(base_dir, flags)
wanted_toplevel_dirs = toplevel_dirs(base_dir, flags) -
excluded_dirs(base_dir)
wanted_toplevel_dirs.map! { |dir| dir << '/**/*' }
pattern = if wanted_toplevel_dirs.empty?
# We need this special case to avoid creating the pattern
# /**/* which searches the entire file system.
["#{base_dir}/**/*"]
else
# Search the non-excluded top directories, but also add files
# on the top level, which would otherwise not be found.
wanted_toplevel_dirs.unshift("#{base_dir}/*")
end
Dir.glob(pattern, flags).select { |path| FileTest.file?(path) }
end | [
"def",
"find_files",
"(",
"base_dir",
",",
"flags",
")",
"wanted_toplevel_dirs",
"=",
"toplevel_dirs",
"(",
"base_dir",
",",
"flags",
")",
"-",
"excluded_dirs",
"(",
"base_dir",
")",
"wanted_toplevel_dirs",
".",
"map!",
"{",
"|",
"dir",
"|",
"dir",
"<<",
"'/... | Search for files recursively starting at the given base directory using
the given flags that determine how the match is made. Excluded files will
be removed later by the caller, but as an optimization find_files removes
the top level directories that are excluded in configuration in the
normal way (dir/**/*). | [
"Search",
"for",
"files",
"recursively",
"starting",
"at",
"the",
"given",
"base",
"directory",
"using",
"the",
"given",
"flags",
"that",
"determine",
"how",
"the",
"match",
"is",
"made",
".",
"Excluded",
"files",
"will",
"be",
"removed",
"later",
"by",
"the... | 2a4f4f0fdac4e1bb25891fc312af2ea60c6aa2f0 | https://github.com/rubocop-hq/rubocop/blob/2a4f4f0fdac4e1bb25891fc312af2ea60c6aa2f0/lib/rubocop/target_finder.rb#L86-L101 | train | Find all files in the given base directory. | [
30522,
13366,
2424,
1035,
6764,
1006,
2918,
1035,
16101,
1010,
9245,
1007,
2359,
1035,
2327,
20414,
2884,
1035,
16101,
2015,
1027,
2327,
20414,
2884,
1035,
16101,
2015,
1006,
2918,
1035,
16101,
1010,
9245,
1007,
1011,
12421,
1035,
16101,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
gollum/gollum | lib/gollum/helpers.rb | Precious.Helpers.extract_path | def extract_path(file_path)
return nil if file_path.nil?
last_slash = file_path.rindex("/")
if last_slash
file_path[0, last_slash]
end
end | ruby | def extract_path(file_path)
return nil if file_path.nil?
last_slash = file_path.rindex("/")
if last_slash
file_path[0, last_slash]
end
end | [
"def",
"extract_path",
"(",
"file_path",
")",
"return",
"nil",
"if",
"file_path",
".",
"nil?",
"last_slash",
"=",
"file_path",
".",
"rindex",
"(",
"\"/\"",
")",
"if",
"last_slash",
"file_path",
"[",
"0",
",",
"last_slash",
"]",
"end",
"end"
] | Extract the path string that Gollum::Wiki expects | [
"Extract",
"the",
"path",
"string",
"that",
"Gollum",
"::",
"Wiki",
"expects"
] | f44367c31baac5c154888a9e09b2833fa62e1c61 | https://github.com/gollum/gollum/blob/f44367c31baac5c154888a9e09b2833fa62e1c61/lib/gollum/helpers.rb#L10-L16 | train | Extract the path from a file path | [
30522,
13366,
14817,
1035,
4130,
1006,
5371,
1035,
4130,
1007,
2709,
9152,
2140,
2065,
5371,
1035,
4130,
1012,
9152,
2140,
1029,
2197,
1035,
18296,
1027,
5371,
1035,
4130,
1012,
15544,
13629,
2595,
1006,
1000,
1013,
1000,
1007,
2065,
2197,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/network_interface_tap_configurations.rb | Azure::Network::Mgmt::V2019_02_01.NetworkInterfaceTapConfigurations.get_with_http_info | def get_with_http_info(resource_group_name, network_interface_name, tap_configuration_name, custom_headers:nil)
get_async(resource_group_name, network_interface_name, tap_configuration_name, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, network_interface_name, tap_configuration_name, custom_headers:nil)
get_async(resource_group_name, network_interface_name, tap_configuration_name, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"network_interface_name",
",",
"tap_configuration_name",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"network_interface_name",
",",
"tap_configuration_name",
",",
"custom... | Get the specified tap configuration on a network interface.
@param resource_group_name [String] The name of the resource group.
@param network_interface_name [String] The name of the network interface.
@param tap_configuration_name [String] The name of the tap configuration.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Get",
"the",
"specified",
"tap",
"configuration",
"on",
"a",
"network",
"interface",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/network_interface_tap_configurations.rb#L91-L93 | train | Gets the specified network interface tap configuration. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2897,
1035,
8278,
1035,
2171,
1010,
11112,
1035,
9563,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
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... |
randym/axlsx | lib/axlsx/workbook/worksheet/sheet_data.rb | Axlsx.SheetData.to_xml_string | def to_xml_string(str = '')
str << '<sheetData>'
worksheet.rows.each_with_index do |row, index|
row.to_xml_string(index, str)
end
str << '</sheetData>'
end | ruby | def to_xml_string(str = '')
str << '<sheetData>'
worksheet.rows.each_with_index do |row, index|
row.to_xml_string(index, str)
end
str << '</sheetData>'
end | [
"def",
"to_xml_string",
"(",
"str",
"=",
"''",
")",
"str",
"<<",
"'<sheetData>'",
"worksheet",
".",
"rows",
".",
"each_with_index",
"do",
"|",
"row",
",",
"index",
"|",
"row",
".",
"to_xml_string",
"(",
"index",
",",
"str",
")",
"end",
"str",
"<<",
"'<... | Serialize the sheet data
@param [String] str the string this objects serializaton will be concacted to.
@return [String] | [
"Serialize",
"the",
"sheet",
"data"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/worksheet/sheet_data.rb#L18-L24 | train | Convert the worksheet to XML string. | [
30522,
13366,
2000,
1035,
20950,
1035,
5164,
1006,
2358,
2099,
1027,
1005,
1005,
1007,
2358,
2099,
1026,
1026,
1005,
1026,
7123,
2850,
2696,
1028,
1005,
2573,
21030,
2102,
1012,
10281,
1012,
2169,
1035,
2007,
1035,
5950,
2079,
1064,
5216,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/api/v1_items_api.rb | SquareConnect.V1ItemsApi.apply_modifier_list | def apply_modifier_list(location_id, modifier_list_id, item_id, opts = {})
data, _status_code, _headers = apply_modifier_list_with_http_info(location_id, modifier_list_id, item_id, opts)
return data
end | ruby | def apply_modifier_list(location_id, modifier_list_id, item_id, opts = {})
data, _status_code, _headers = apply_modifier_list_with_http_info(location_id, modifier_list_id, item_id, opts)
return data
end | [
"def",
"apply_modifier_list",
"(",
"location_id",
",",
"modifier_list_id",
",",
"item_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"apply_modifier_list_with_http_info",
"(",
"location_id",
",",
"modifier_list_id",
",",
"... | ApplyModifierList
Associates a modifier list with an item, meaning modifier options from the list can be applied to the item.
@param location_id The ID of the item's associated location.
@param modifier_list_id The ID of the modifier list to apply.
@param item_id The ID of the item to add the modifier list to.
@param [Hash] opts the optional parameters
@return [V1Item] | [
"ApplyModifierList",
"Associates",
"a",
"modifier",
"list",
"with",
"an",
"item",
"meaning",
"modifier",
"options",
"from",
"the",
"list",
"can",
"be",
"applied",
"to",
"the",
"item",
"."
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/v1_items_api.rb#L153-L156 | train | Apply a modifier list to an item | [
30522,
13366,
6611,
1035,
16913,
18095,
1035,
2862,
1006,
3295,
1035,
8909,
1010,
16913,
18095,
1035,
2862,
1035,
8909,
1010,
8875,
1035,
8909,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cerebris/jsonapi-resources | lib/jsonapi/basic_resource.rb | JSONAPI.BasicResource._save | def _save(validation_context = nil)
unless @model.valid?(validation_context)
fail JSONAPI::Exceptions::ValidationErrors.new(self)
end
if defined? @model.save
saved = @model.save(validate: false)
unless saved
if @model.errors.present?
fail JSONAPI::Exceptions::ValidationErrors.new(self)
else
fail JSONAPI::Exceptions::SaveFailed.new
end
end
else
saved = true
end
@model.reload if @reload_needed
@reload_needed = false
@save_needed = !saved
:completed
end | ruby | def _save(validation_context = nil)
unless @model.valid?(validation_context)
fail JSONAPI::Exceptions::ValidationErrors.new(self)
end
if defined? @model.save
saved = @model.save(validate: false)
unless saved
if @model.errors.present?
fail JSONAPI::Exceptions::ValidationErrors.new(self)
else
fail JSONAPI::Exceptions::SaveFailed.new
end
end
else
saved = true
end
@model.reload if @reload_needed
@reload_needed = false
@save_needed = !saved
:completed
end | [
"def",
"_save",
"(",
"validation_context",
"=",
"nil",
")",
"unless",
"@model",
".",
"valid?",
"(",
"validation_context",
")",
"fail",
"JSONAPI",
"::",
"Exceptions",
"::",
"ValidationErrors",
".",
"new",
"(",
"self",
")",
"end",
"if",
"defined?",
"@model",
"... | Override this on a resource to return a different result code. Any
value other than :completed will result in operations returning
`:accepted`
For example to return `:accepted` if your model does not immediately
save resources to the database you could override `_save` as follows:
```
def _save
super
return :accepted
end
``` | [
"Override",
"this",
"on",
"a",
"resource",
"to",
"return",
"a",
"different",
"result",
"code",
".",
"Any",
"value",
"other",
"than",
":",
"completed",
"will",
"result",
"in",
"operations",
"returning",
":",
"accepted"
] | 1ac6bba777e364eaa36706f888792b99b63d8d1a | https://github.com/cerebris/jsonapi-resources/blob/1ac6bba777e364eaa36706f888792b99b63d8d1a/lib/jsonapi/basic_resource.rb#L195-L219 | train | Save the model to the database. | [
30522,
13366,
1035,
3828,
1006,
27354,
1035,
6123,
1027,
9152,
2140,
1007,
4983,
1030,
2944,
1012,
9398,
1029,
1006,
27354,
1035,
6123,
1007,
8246,
1046,
3385,
9331,
2072,
1024,
1024,
11790,
1024,
1024,
27354,
2121,
29165,
2015,
1012,
2047,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb | Azure::Web::Mgmt::V2018_02_01.AppServiceEnvironments.list_multi_role_pool_instance_metrics_with_http_info | def list_multi_role_pool_instance_metrics_with_http_info(resource_group_name, name, instance, details:nil, custom_headers:nil)
list_multi_role_pool_instance_metrics_async(resource_group_name, name, instance, details:details, custom_headers:custom_headers).value!
end | ruby | def list_multi_role_pool_instance_metrics_with_http_info(resource_group_name, name, instance, details:nil, custom_headers:nil)
list_multi_role_pool_instance_metrics_async(resource_group_name, name, instance, details:details, custom_headers:custom_headers).value!
end | [
"def",
"list_multi_role_pool_instance_metrics_with_http_info",
"(",
"resource_group_name",
",",
"name",
",",
"instance",
",",
"details",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"list_multi_role_pool_instance_metrics_async",
"(",
"resource_group_name",
",",
"name... | Get metrics for a specific instance of a multi-role pool of an App Service
Environment.
Get metrics for a specific instance of a multi-role pool of an App Service
Environment.
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param name [String] Name of the App Service Environment.
@param instance [String] Name of the instance in the multi-role pool.
@param details [Boolean] Specify <code>true</code> to include instance
details. The default is <code>false</code>.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Get",
"metrics",
"for",
"a",
"specific",
"instance",
"of",
"a",
"multi",
"-",
"role",
"pool",
"of",
"an",
"App",
"Service",
"Environment",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb#L1826-L1828 | train | Gets metrics for a multi - role pool instance. | [
30522,
13366,
2862,
1035,
4800,
1035,
2535,
1035,
4770,
1035,
6013,
1035,
12046,
2015,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
6013,
1010,
4751,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sensu/sensu | lib/sensu/daemon.rb | Sensu.Daemon.setup_redis | def setup_redis
@logger.debug("connecting to redis", :settings => @settings[:redis])
Redis.logger = @logger
Redis.connect(@settings[:redis]) do |connection|
@redis = connection
@redis.on_error do |error|
@logger.error("redis connection error", :error => error.to_s)
end
@redis.before_reconnect do
unless testing?
@logger.warn("reconnecting to redis")
pause
end
end
@redis.after_reconnect do
@logger.info("reconnected to redis")
resume
end
yield(@redis) if block_given?
end
end | ruby | def setup_redis
@logger.debug("connecting to redis", :settings => @settings[:redis])
Redis.logger = @logger
Redis.connect(@settings[:redis]) do |connection|
@redis = connection
@redis.on_error do |error|
@logger.error("redis connection error", :error => error.to_s)
end
@redis.before_reconnect do
unless testing?
@logger.warn("reconnecting to redis")
pause
end
end
@redis.after_reconnect do
@logger.info("reconnected to redis")
resume
end
yield(@redis) if block_given?
end
end | [
"def",
"setup_redis",
"@logger",
".",
"debug",
"(",
"\"connecting to redis\"",
",",
":settings",
"=>",
"@settings",
"[",
":redis",
"]",
")",
"Redis",
".",
"logger",
"=",
"@logger",
"Redis",
".",
"connect",
"(",
"@settings",
"[",
":redis",
"]",
")",
"do",
"... | Set up the Redis connection. Sensu uses Redis as a data store,
to store the client registry, current events, etc. The Sensu
service will stop gracefully in the event of a Redis error, and
pause/resume in the event of connectivity issues. This method
creates the Redis instance variable: `@redis`.
https://github.com/sensu/sensu-redis
@yield [Object] passes initialized and connected Redis
connection object to the callback/block. | [
"Set",
"up",
"the",
"Redis",
"connection",
".",
"Sensu",
"uses",
"Redis",
"as",
"a",
"data",
"store",
"to",
"store",
"the",
"client",
"registry",
"current",
"events",
"etc",
".",
"The",
"Sensu",
"service",
"will",
"stop",
"gracefully",
"in",
"the",
"event"... | 51319e4b58c8d9986f101ad71ff729aa3e51e951 | https://github.com/sensu/sensu/blob/51319e4b58c8d9986f101ad71ff729aa3e51e951/lib/sensu/daemon.rb#L323-L343 | train | setup redis connection | [
30522,
13366,
16437,
1035,
2417,
2483,
1030,
8833,
4590,
1012,
2139,
8569,
2290,
1006,
1000,
7176,
2000,
2417,
2483,
1000,
1010,
1024,
10906,
1027,
1028,
1030,
10906,
1031,
1024,
2417,
2483,
1033,
1007,
2417,
2483,
1012,
8833,
4590,
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_scheduler/lib/2016-03-01/generated/azure_mgmt_scheduler/jobs.rb | Azure::Scheduler::Mgmt::V2016_03_01.Jobs.patch | def patch(resource_group_name, job_collection_name, job_name, job, custom_headers:nil)
response = patch_async(resource_group_name, job_collection_name, job_name, job, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def patch(resource_group_name, job_collection_name, job_name, job, custom_headers:nil)
response = patch_async(resource_group_name, job_collection_name, job_name, job, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"patch",
"(",
"resource_group_name",
",",
"job_collection_name",
",",
"job_name",
",",
"job",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"patch_async",
"(",
"resource_group_name",
",",
"job_collection_name",
",",
"job_name",
",",
"job",
",",
... | Patches an existing job.
@param resource_group_name [String] The resource group name.
@param job_collection_name [String] The job collection name.
@param job_name [String] The job name.
@param job [JobDefinition] The job definition.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [JobDefinition] operation results. | [
"Patches",
"an",
"existing",
"job",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_scheduler/lib/2016-03-01/generated/azure_mgmt_scheduler/jobs.rb#L249-L252 | train | Patch a job in a job collection. | [
30522,
13366,
8983,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3105,
1035,
3074,
1035,
2171,
1010,
3105,
1035,
2171,
1010,
3105,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
8983,
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... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.3.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_3_0_9.ServiceFabricClientAPIs.get_service | def get_service(application_resource_name, service_resource_name, custom_headers:nil)
response = get_service_async(application_resource_name, service_resource_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_service(application_resource_name, service_resource_name, custom_headers:nil)
response = get_service_async(application_resource_name, service_resource_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_service",
"(",
"application_resource_name",
",",
"service_resource_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_service_async",
"(",
"application_resource_name",
",",
"service_resource_name",
",",
"custom_headers",
":custom_headers",
")",... | Gets the description of the specified service in an application resource.
Gets the description of the service resource.
@param application_resource_name [String] Service Fabric application resource
name.
@param service_resource_name [String] Service Fabric service resource name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ServiceResourceDescription] operation results. | [
"Gets",
"the",
"description",
"of",
"the",
"specified",
"service",
"in",
"an",
"application",
"resource",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.3.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L29729-L29732 | train | Gets the specified service. | [
30522,
13366,
2131,
1035,
2326,
1006,
4646,
1035,
7692,
1035,
2171,
1010,
2326,
1035,
7692,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
2326,
1035,
2004,
6038,
2278,
1006,
4646,
1035,
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... |
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_deleted_keys_with_http_info | def get_deleted_keys_with_http_info(vault_base_url, maxresults:nil, custom_headers:nil)
get_deleted_keys_async(vault_base_url, maxresults:maxresults, custom_headers:custom_headers).value!
end | ruby | def get_deleted_keys_with_http_info(vault_base_url, maxresults:nil, custom_headers:nil)
get_deleted_keys_async(vault_base_url, maxresults:maxresults, custom_headers:custom_headers).value!
end | [
"def",
"get_deleted_keys_with_http_info",
"(",
"vault_base_url",
",",
"maxresults",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"get_deleted_keys_async",
"(",
"vault_base_url",
",",
"maxresults",
":",
"maxresults",
",",
"custom_headers",
":custom_headers",
")",
... | Lists the deleted keys in the specified vault.
Retrieves a list of the keys in the Key Vault as JSON Web Key structures that
contain the public part of a deleted key. This operation includes
deletion-specific information. The Get Deleted Keys operation is applicable
for vaults enabled for soft-delete. While the operation can be invoked on any
vault, it will return an error if invoked on a non soft-delete enabled vault.
This operation requires the keys/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 [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Lists",
"the",
"deleted",
"keys",
"in",
"the",
"specified",
"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#L2247-L2249 | train | Gets the deleted keys for the specified vault. | [
30522,
13366,
2131,
1035,
17159,
1035,
6309,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
4098,
6072,
11314,
2015,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | sigh/lib/sigh/runner.rb | Sigh.Runner.download_profile | def download_profile(profile)
UI.important("Downloading provisioning profile...")
profile_name ||= "#{profile_type.pretty_type}_#{Sigh.config[:app_identifier]}"
if Sigh.config[:platform].to_s == 'tvos'
profile_name += "_tvos"
end
if Sigh.config[:platform].to_s == 'macos'
profile_name += '.provisionprofile'
else
profile_name += '.mobileprovision'
end
tmp_path = Dir.mktmpdir("profile_download")
output_path = File.join(tmp_path, profile_name)
File.open(output_path, "wb") do |f|
f.write(profile.download)
end
UI.success("Successfully downloaded provisioning profile...")
return output_path
end | ruby | def download_profile(profile)
UI.important("Downloading provisioning profile...")
profile_name ||= "#{profile_type.pretty_type}_#{Sigh.config[:app_identifier]}"
if Sigh.config[:platform].to_s == 'tvos'
profile_name += "_tvos"
end
if Sigh.config[:platform].to_s == 'macos'
profile_name += '.provisionprofile'
else
profile_name += '.mobileprovision'
end
tmp_path = Dir.mktmpdir("profile_download")
output_path = File.join(tmp_path, profile_name)
File.open(output_path, "wb") do |f|
f.write(profile.download)
end
UI.success("Successfully downloaded provisioning profile...")
return output_path
end | [
"def",
"download_profile",
"(",
"profile",
")",
"UI",
".",
"important",
"(",
"\"Downloading provisioning profile...\"",
")",
"profile_name",
"||=",
"\"#{profile_type.pretty_type}_#{Sigh.config[:app_identifier]}\"",
"if",
"Sigh",
".",
"config",
"[",
":platform",
"]",
".",
... | Downloads and stores the provisioning profile | [
"Downloads",
"and",
"stores",
"the",
"provisioning",
"profile"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/sigh/lib/sigh/runner.rb#L240-L262 | train | Download the profile | [
30522,
13366,
8816,
1035,
6337,
1006,
6337,
1007,
21318,
1012,
2590,
1006,
1000,
8816,
2075,
9347,
2075,
6337,
1012,
1012,
1012,
1000,
1007,
6337,
1035,
2171,
1064,
1064,
1027,
1000,
1001,
1063,
6337,
1035,
2828,
1012,
3492,
1035,
2828,
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... |
square/connect-ruby-sdk | lib/square_connect/api_client.rb | SquareConnect.ApiClient.update_params_for_auth! | def update_params_for_auth!(header_params, query_params, auth_names)
Array(auth_names).each do |auth_name|
auth_setting = @config.auth_settings[auth_name]
next unless auth_setting
case auth_setting[:in]
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
else fail ArgumentError, 'Authentication token must be in `query` of `header`'
end
end
end | ruby | def update_params_for_auth!(header_params, query_params, auth_names)
Array(auth_names).each do |auth_name|
auth_setting = @config.auth_settings[auth_name]
next unless auth_setting
case auth_setting[:in]
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
else fail ArgumentError, 'Authentication token must be in `query` of `header`'
end
end
end | [
"def",
"update_params_for_auth!",
"(",
"header_params",
",",
"query_params",
",",
"auth_names",
")",
"Array",
"(",
"auth_names",
")",
".",
"each",
"do",
"|",
"auth_name",
"|",
"auth_setting",
"=",
"@config",
".",
"auth_settings",
"[",
"auth_name",
"]",
"next",
... | Update hearder and query params based on authentication settings.
@param [Hash] header_params Header parameters
@param [Hash] query_params Query parameters
@param [String] auth_names Authentication scheme name | [
"Update",
"hearder",
"and",
"query",
"params",
"based",
"on",
"authentication",
"settings",
"."
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api_client.rb#L299-L309 | train | Update the header_params and query_params with the auth_settings | [
30522,
13366,
10651,
1035,
11498,
5244,
1035,
2005,
1035,
8740,
2705,
999,
1006,
20346,
1035,
11498,
5244,
1010,
23032,
1035,
11498,
5244,
1010,
8740,
2705,
1035,
3415,
1007,
9140,
1006,
8740,
2705,
1035,
3415,
1007,
1012,
2169,
2079,
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 | runtime/ms_rest_azure/lib/ms_rest_azure/azure_service_client.rb | MsRestAzure.AzureServiceClient.check_for_status_code_failure | def check_for_status_code_failure(azure_response)
fail MsRest::ValidationError, 'Azure response cannot be nil' if azure_response.nil?
fail MsRest::ValidationError, 'Azure response cannot have empty response object' if azure_response.response.nil?
fail MsRest::ValidationError, 'Azure response cannot have empty request object' if azure_response.request.nil?
status_code = azure_response.response.status
http_method = azure_response.request.method
fail AzureOperationError, "Unexpected polling status code from long running operation #{status_code}" unless status_code === 200 || status_code === 202 ||
(status_code === 201 && http_method === :put) ||
(status_code === 204 && (http_method === :delete || http_method === :post))
end | ruby | def check_for_status_code_failure(azure_response)
fail MsRest::ValidationError, 'Azure response cannot be nil' if azure_response.nil?
fail MsRest::ValidationError, 'Azure response cannot have empty response object' if azure_response.response.nil?
fail MsRest::ValidationError, 'Azure response cannot have empty request object' if azure_response.request.nil?
status_code = azure_response.response.status
http_method = azure_response.request.method
fail AzureOperationError, "Unexpected polling status code from long running operation #{status_code}" unless status_code === 200 || status_code === 202 ||
(status_code === 201 && http_method === :put) ||
(status_code === 204 && (http_method === :delete || http_method === :post))
end | [
"def",
"check_for_status_code_failure",
"(",
"azure_response",
")",
"fail",
"MsRest",
"::",
"ValidationError",
",",
"'Azure response cannot be nil'",
"if",
"azure_response",
".",
"nil?",
"fail",
"MsRest",
"::",
"ValidationError",
",",
"'Azure response cannot have empty respon... | Verifies for unexpected polling status code
@param azure_response [MsRestAzure::AzureOperationResponse] response from Azure service. | [
"Verifies",
"for",
"unexpected",
"polling",
"status",
"code"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/runtime/ms_rest_azure/lib/ms_rest_azure/azure_service_client.rb#L122-L133 | train | Check for status code failure | [
30522,
13366,
4638,
1035,
2005,
1035,
3570,
1035,
3642,
1035,
4945,
1006,
24296,
1035,
3433,
1007,
8246,
5796,
28533,
1024,
1024,
27354,
2121,
29165,
1010,
1005,
24296,
3433,
3685,
2022,
9152,
2140,
1005,
2065,
24296,
1035,
3433,
1012,
9152... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_service_bus/lib/2017-04-01/generated/azure_mgmt_service_bus/rules.rb | Azure::ServiceBus::Mgmt::V2017_04_01.Rules.list_by_subscriptions | def list_by_subscriptions(resource_group_name, namespace_name, topic_name, subscription_name, skip:nil, top:nil, custom_headers:nil)
first_page = list_by_subscriptions_as_lazy(resource_group_name, namespace_name, topic_name, subscription_name, skip:skip, top:top, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list_by_subscriptions(resource_group_name, namespace_name, topic_name, subscription_name, skip:nil, top:nil, custom_headers:nil)
first_page = list_by_subscriptions_as_lazy(resource_group_name, namespace_name, topic_name, subscription_name, skip:skip, top:top, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list_by_subscriptions",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"topic_name",
",",
"subscription_name",
",",
"skip",
":",
"nil",
",",
"top",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_by_subscriptions_as_lazy... | List all the rules within given topic-subscription
@param resource_group_name [String] Name of the Resource group within the
Azure subscription.
@param namespace_name [String] The namespace name
@param topic_name [String] The topic name.
@param subscription_name [String] The subscription name.
@param skip [Integer] Skip is only used if a previous operation returned a
partial result. If a previous response contains a nextLink element, the value
of the nextLink element will include a skip parameter that specifies a
starting point to use for subsequent calls.
@param top [Integer] May be used to limit the number of results to the most
recent N usageDetails.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<Rule>] operation results. | [
"List",
"all",
"the",
"rules",
"within",
"given",
"topic",
"-",
"subscription"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_service_bus/lib/2017-04-01/generated/azure_mgmt_service_bus/rules.rb#L43-L46 | train | Gets all the items in a subscription. | [
30522,
13366,
2862,
1035,
2011,
1035,
15002,
2015,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3415,
15327,
1035,
2171,
1010,
8476,
1035,
2171,
1010,
15002,
1035,
2171,
1010,
13558,
1024,
9152,
2140,
1010,
2327,
1024,
9152,
2140,
1010,
7661,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_container_instance/lib/2018-09-01/generated/azure_mgmt_container_instance/container_operations.rb | Azure::ContainerInstance::Mgmt::V2018_09_01.ContainerOperations.execute_command | def execute_command(resource_group_name, container_group_name, container_name, container_exec_request, custom_headers:nil)
response = execute_command_async(resource_group_name, container_group_name, container_name, container_exec_request, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def execute_command(resource_group_name, container_group_name, container_name, container_exec_request, custom_headers:nil)
response = execute_command_async(resource_group_name, container_group_name, container_name, container_exec_request, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"execute_command",
"(",
"resource_group_name",
",",
"container_group_name",
",",
"container_name",
",",
"container_exec_request",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"execute_command_async",
"(",
"resource_group_name",
",",
"container_group_name"... | Executes a command in a specific container instance.
Executes a command for a specific container instance in a specified resource
group and container group.
@param resource_group_name [String] The name of the resource group.
@param container_group_name [String] The name of the container group.
@param container_name [String] The name of the container instance.
@param container_exec_request [ContainerExecRequest] The request for the exec
command.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ContainerExecResponse] operation results. | [
"Executes",
"a",
"command",
"in",
"a",
"specific",
"container",
"instance",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_instance/lib/2018-09-01/generated/azure_mgmt_container_instance/container_operations.rb#L154-L157 | train | Execute a command on a container. | [
30522,
13366,
15389,
1035,
3094,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
11661,
1035,
2177,
1035,
2171,
1010,
11661,
1035,
2171,
1010,
11661,
1035,
4654,
8586,
1035,
5227,
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... |
mongodb/mongoid | lib/mongoid/findable.rb | Mongoid.Findable.find_by! | def find_by!(attrs = {})
result = where(attrs).find_first
raise(Errors::DocumentNotFound.new(self, attrs)) unless result
yield(result) if result && block_given?
result
end | ruby | def find_by!(attrs = {})
result = where(attrs).find_first
raise(Errors::DocumentNotFound.new(self, attrs)) unless result
yield(result) if result && block_given?
result
end | [
"def",
"find_by!",
"(",
"attrs",
"=",
"{",
"}",
")",
"result",
"=",
"where",
"(",
"attrs",
")",
".",
"find_first",
"raise",
"(",
"Errors",
"::",
"DocumentNotFound",
".",
"new",
"(",
"self",
",",
"attrs",
")",
")",
"unless",
"result",
"yield",
"(",
"r... | Find the first +Document+ given the conditions, or raises
Mongoid::Errors::DocumentNotFound
@example Find the document by attribute other than id
Person.find_by(:username => "superuser")
@param [ Hash ] attrs The attributes to check.
@raise [ Errors::DocumentNotFound ] If no document found.
@return [ Document ] A matching document. | [
"Find",
"the",
"first",
"+",
"Document",
"+",
"given",
"the",
"conditions",
"or",
"raises",
"Mongoid",
"::",
"Errors",
"::",
"DocumentNotFound"
] | 56976e32610f4c2450882b0bfe14da099f0703f4 | https://github.com/mongodb/mongoid/blob/56976e32610f4c2450882b0bfe14da099f0703f4/lib/mongoid/findable.rb#L135-L140 | train | Find the first document matching the given attributes. | [
30522,
13366,
2424,
1035,
2011,
999,
1006,
2012,
16344,
2015,
1027,
1063,
1065,
1007,
2765,
1027,
2073,
1006,
2012,
16344,
2015,
1007,
1012,
2424,
1035,
2034,
5333,
1006,
10697,
1024,
1024,
6254,
17048,
14876,
8630,
1012,
2047,
1006,
2969,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
troessner/reek | lib/reek/context_builder.rb | Reek.ContextBuilder.process_send | def process_send(exp, _parent)
process(exp)
case current_context
when Context::ModuleContext
handle_send_for_modules exp
when Context::MethodContext
handle_send_for_methods exp
end
end | ruby | def process_send(exp, _parent)
process(exp)
case current_context
when Context::ModuleContext
handle_send_for_modules exp
when Context::MethodContext
handle_send_for_methods exp
end
end | [
"def",
"process_send",
"(",
"exp",
",",
"_parent",
")",
"process",
"(",
"exp",
")",
"case",
"current_context",
"when",
"Context",
"::",
"ModuleContext",
"handle_send_for_modules",
"exp",
"when",
"Context",
"::",
"MethodContext",
"handle_send_for_methods",
"exp",
"en... | Handles `send` nodes a.k.a. method calls.
An input example that would trigger this method would be:
call_me()
Besides checking if it's a visibility modifier or an attribute writer
we also record to what the method call is referring to
which we later use for smell detectors like FeatureEnvy. | [
"Handles",
"send",
"nodes",
"a",
".",
"k",
".",
"a",
".",
"method",
"calls",
"."
] | 8c6b5c0c6228a6981ab48543457889f9ea984054 | https://github.com/troessner/reek/blob/8c6b5c0c6228a6981ab48543457889f9ea984054/lib/reek/context_builder.rb#L155-L163 | train | process send | [
30522,
13366,
2832,
1035,
4604,
1006,
4654,
2361,
1010,
1035,
6687,
1007,
2832,
1006,
4654,
2361,
1007,
2553,
2783,
1035,
6123,
2043,
6123,
1024,
1024,
11336,
8663,
18209,
5047,
1035,
4604,
1035,
2005,
1035,
14184,
4654,
2361,
2043,
6123,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_container_registry/lib/2017-06-01-preview/generated/azure_mgmt_container_registry/registries.rb | Azure::ContainerRegistry::Mgmt::V2017_06_01_preview.Registries.begin_create_with_http_info | def begin_create_with_http_info(resource_group_name, registry_name, registry, custom_headers:nil)
begin_create_async(resource_group_name, registry_name, registry, custom_headers:custom_headers).value!
end | ruby | def begin_create_with_http_info(resource_group_name, registry_name, registry, custom_headers:nil)
begin_create_async(resource_group_name, registry_name, registry, custom_headers:custom_headers).value!
end | [
"def",
"begin_create_with_http_info",
"(",
"resource_group_name",
",",
"registry_name",
",",
"registry",
",",
"custom_headers",
":",
"nil",
")",
"begin_create_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"registry",
",",
"custom_headers",
":custom_header... | Creates a container registry with the specified parameters.
@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 registry [Registry] The parameters for creating a container registry.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Creates",
"a",
"container",
"registry",
"with",
"the",
"specified",
"parameters",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_registry/lib/2017-06-01-preview/generated/azure_mgmt_container_registry/registries.rb#L878-L880 | train | Creates a new elastic search specification. | [
30522,
13366,
4088,
1035,
3443,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
15584,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
1035,
3443,
1035,
2004,
6038,
2278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
grpc/grpc | src/ruby/lib/grpc/generic/bidi_call.rb | GRPC.BidiCall.write_loop | def write_loop(requests, is_client: true, set_output_stream_done: nil)
GRPC.logger.debug('bidi-write-loop: starting')
count = 0
requests.each do |req|
GRPC.logger.debug("bidi-write-loop: #{count}")
count += 1
payload = @marshal.call(req)
# Fails if status already received
begin
@req_view.send_initial_metadata unless @req_view.nil?
@call.run_batch(SEND_MESSAGE => payload)
rescue GRPC::Core::CallError => e
# This is almost definitely caused by a status arriving while still
# writing. Don't re-throw the error
GRPC.logger.warn('bidi-write-loop: ended with error')
GRPC.logger.warn(e)
break
end
end
GRPC.logger.debug("bidi-write-loop: #{count} writes done")
if is_client
GRPC.logger.debug("bidi-write-loop: client sent #{count}, waiting")
begin
@call.run_batch(SEND_CLOSE_FROM_CLIENT => nil)
rescue GRPC::Core::CallError => e
GRPC.logger.warn('bidi-write-loop: send close failed')
GRPC.logger.warn(e)
end
GRPC.logger.debug('bidi-write-loop: done')
end
GRPC.logger.debug('bidi-write-loop: finished')
rescue StandardError => e
GRPC.logger.warn('bidi-write-loop: failed')
GRPC.logger.warn(e)
if is_client
@call.cancel_with_status(GRPC::Core::StatusCodes::UNKNOWN,
"GRPC bidi call error: #{e.inspect}")
else
raise e
end
ensure
set_output_stream_done.call if is_client
end | ruby | def write_loop(requests, is_client: true, set_output_stream_done: nil)
GRPC.logger.debug('bidi-write-loop: starting')
count = 0
requests.each do |req|
GRPC.logger.debug("bidi-write-loop: #{count}")
count += 1
payload = @marshal.call(req)
# Fails if status already received
begin
@req_view.send_initial_metadata unless @req_view.nil?
@call.run_batch(SEND_MESSAGE => payload)
rescue GRPC::Core::CallError => e
# This is almost definitely caused by a status arriving while still
# writing. Don't re-throw the error
GRPC.logger.warn('bidi-write-loop: ended with error')
GRPC.logger.warn(e)
break
end
end
GRPC.logger.debug("bidi-write-loop: #{count} writes done")
if is_client
GRPC.logger.debug("bidi-write-loop: client sent #{count}, waiting")
begin
@call.run_batch(SEND_CLOSE_FROM_CLIENT => nil)
rescue GRPC::Core::CallError => e
GRPC.logger.warn('bidi-write-loop: send close failed')
GRPC.logger.warn(e)
end
GRPC.logger.debug('bidi-write-loop: done')
end
GRPC.logger.debug('bidi-write-loop: finished')
rescue StandardError => e
GRPC.logger.warn('bidi-write-loop: failed')
GRPC.logger.warn(e)
if is_client
@call.cancel_with_status(GRPC::Core::StatusCodes::UNKNOWN,
"GRPC bidi call error: #{e.inspect}")
else
raise e
end
ensure
set_output_stream_done.call if is_client
end | [
"def",
"write_loop",
"(",
"requests",
",",
"is_client",
":",
"true",
",",
"set_output_stream_done",
":",
"nil",
")",
"GRPC",
".",
"logger",
".",
"debug",
"(",
"'bidi-write-loop: starting'",
")",
"count",
"=",
"0",
"requests",
".",
"each",
"do",
"|",
"req",
... | set_output_stream_done is relevant on client-side | [
"set_output_stream_done",
"is",
"relevant",
"on",
"client",
"-",
"side"
] | f3937f0e55227a4ef3a23f895d3b204a947610f8 | https://github.com/grpc/grpc/blob/f3937f0e55227a4ef3a23f895d3b204a947610f8/src/ruby/lib/grpc/generic/bidi_call.rb#L142-L184 | train | Write a batch of requests to the server. | [
30522,
13366,
4339,
1035,
7077,
1006,
11186,
1010,
2003,
30524,
2139,
8569,
2290,
1006,
1005,
7226,
2072,
1011,
4339,
1011,
7077,
1024,
3225,
1005,
1007,
4175,
1027,
1014,
11186,
1012,
2169,
2079,
1064,
2128,
4160,
1064,
24665,
15042,
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... |
mikel/mail | lib/mail/utilities.rb | Mail.Utilities.underscoreize | def underscoreize( str )
str.to_s.downcase.tr(Constants::HYPHEN, Constants::UNDERSCORE)
end | ruby | def underscoreize( str )
str.to_s.downcase.tr(Constants::HYPHEN, Constants::UNDERSCORE)
end | [
"def",
"underscoreize",
"(",
"str",
")",
"str",
".",
"to_s",
".",
"downcase",
".",
"tr",
"(",
"Constants",
"::",
"HYPHEN",
",",
"Constants",
"::",
"UNDERSCORE",
")",
"end"
] | Swaps out all hyphens (-) for underscores (_) good for stringing to symbols
a field name.
Example:
string = :resent_from_field
underscoreize ( string ) #=> 'resent_from_field' | [
"Swaps",
"out",
"all",
"hyphens",
"(",
"-",
")",
"for",
"underscores",
"(",
"_",
")",
"good",
"for",
"stringing",
"to",
"symbols",
"a",
"field",
"name",
"."
] | fb53fb369eb2bf0494ac70675970c90cdcc3f495 | https://github.com/mikel/mail/blob/fb53fb369eb2bf0494ac70675970c90cdcc3f495/lib/mail/utilities.rb#L221-L223 | train | Convert the given string to underscored. | [
30522,
13366,
2104,
9363,
2890,
4697,
1006,
2358,
2099,
1007,
2358,
2099,
1012,
2000,
1035,
1055,
1012,
2091,
18382,
1012,
19817,
1006,
5377,
2015,
1024,
1024,
1044,
22571,
10222,
1010,
5377,
2015,
1024,
1024,
2104,
9363,
2890,
1007,
2203,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.