repo stringclasses 235 values | path stringlengths 11 168 | func_name stringlengths 12 143 | original_string stringlengths 83 6.91k | language stringclasses 1 value | code stringlengths 83 6.91k | code_tokens listlengths 15 1.01k | docstring stringlengths 5 25.7k | docstring_tokens listlengths 1 427 | sha stringclasses 235 values | url stringlengths 99 268 | partition stringclasses 1 value | summary stringlengths 7 202 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
meew0/discordrb | lib/discordrb/bot.rb | Discordrb.Bot.send_temporary_message | def send_temporary_message(channel, content, timeout, tts = false, embed = nil)
Thread.new do
Thread.current[:discordrb_name] = "#{@current_thread}-temp-msg"
message = send_message(channel, content, tts, embed)
sleep(timeout)
message.delete
end
nil
end | ruby | def send_temporary_message(channel, content, timeout, tts = false, embed = nil)
Thread.new do
Thread.current[:discordrb_name] = "#{@current_thread}-temp-msg"
message = send_message(channel, content, tts, embed)
sleep(timeout)
message.delete
end
nil
end | [
"def",
"send_temporary_message",
"(",
"channel",
",",
"content",
",",
"timeout",
",",
"tts",
"=",
"false",
",",
"embed",
"=",
"nil",
")",
"Thread",
".",
"new",
"do",
"Thread",
".",
"current",
"[",
":discordrb_name",
"]",
"=",
"\"#{@current_thread}-temp-msg\"",... | Sends a text message to a channel given its ID and the message's content,
then deletes it after the specified timeout in seconds.
@param channel [Channel, Integer, #resolve_id] The channel to send something to.
@param content [String] The text that should be sent as a message. It is limited to 2000 characters (Discord imposed).
@param timeout [Float] The amount of time in seconds after which the message sent will be deleted.
@param tts [true, false] Whether or not this message should be sent using Discord text-to-speech.
@param embed [Hash, Discordrb::Webhooks::Embed, nil] The rich embed to append to this message. | [
"Sends",
"a",
"text",
"message",
"to",
"a",
"channel",
"given",
"its",
"ID",
"and",
"the",
"message",
"s",
"content",
"then",
"deletes",
"it",
"after",
"the",
"specified",
"timeout",
"in",
"seconds",
"."
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/bot.rb#L381-L391 | train | Send a temporary message to a channel | [
30522,
13366,
4604,
1035,
5741,
1035,
4471,
1006,
3149,
1010,
4180,
1010,
2051,
5833,
1010,
23746,
2015,
1027,
6270,
1010,
7861,
8270,
1027,
9152,
2140,
1007,
11689,
1012,
2047,
2079,
11689,
1012,
2783,
1031,
1024,
12532,
4103,
15185,
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... |
doorkeeper-gem/doorkeeper | lib/doorkeeper/models/access_token_mixin.rb | Doorkeeper.AccessTokenMixin.as_json | def as_json(_options = {})
{
resource_owner_id: resource_owner_id,
scope: scopes,
expires_in: expires_in_seconds,
application: { uid: application.try(:uid) },
created_at: created_at.to_i,
}
end | ruby | def as_json(_options = {})
{
resource_owner_id: resource_owner_id,
scope: scopes,
expires_in: expires_in_seconds,
application: { uid: application.try(:uid) },
created_at: created_at.to_i,
}
end | [
"def",
"as_json",
"(",
"_options",
"=",
"{",
"}",
")",
"{",
"resource_owner_id",
":",
"resource_owner_id",
",",
"scope",
":",
"scopes",
",",
"expires_in",
":",
"expires_in_seconds",
",",
"application",
":",
"{",
"uid",
":",
"application",
".",
"try",
"(",
... | JSON representation of the Access Token instance.
@return [Hash] hash with token data | [
"JSON",
"representation",
"of",
"the",
"Access",
"Token",
"instance",
"."
] | f1be81891c3d54a42928c1b9e03c5d6833b8af87 | https://github.com/doorkeeper-gem/doorkeeper/blob/f1be81891c3d54a42928c1b9e03c5d6833b8af87/lib/doorkeeper/models/access_token_mixin.rb#L205-L213 | train | Returns a JSON representation of the object. | [
30522,
13366,
2004,
1035,
1046,
3385,
1006,
1035,
7047,
1027,
1063,
1065,
1007,
1063,
7692,
1035,
3954,
1035,
8909,
1024,
7692,
1035,
3954,
1035,
8909,
1010,
9531,
1024,
9531,
2015,
1010,
4654,
20781,
2015,
1035,
1999,
1024,
4654,
20781,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
awesome-print/awesome_print | lib/awesome_print/ext/ripple.rb | AwesomePrint.Ripple.cast_with_ripple | def cast_with_ripple(object, type)
cast = cast_without_ripple(object, type)
return cast if !defined?(::Ripple)
if object.is_a?(::Ripple::AttributeMethods) # Module used to access attributes across documents and embedded documents
cast = :ripple_document_instance
elsif object.is_a?(::Ripple::Properties) # Used to access property metadata on Ripple classes
cast = :ripple_document_class
end
cast
end | ruby | def cast_with_ripple(object, type)
cast = cast_without_ripple(object, type)
return cast if !defined?(::Ripple)
if object.is_a?(::Ripple::AttributeMethods) # Module used to access attributes across documents and embedded documents
cast = :ripple_document_instance
elsif object.is_a?(::Ripple::Properties) # Used to access property metadata on Ripple classes
cast = :ripple_document_class
end
cast
end | [
"def",
"cast_with_ripple",
"(",
"object",
",",
"type",
")",
"cast",
"=",
"cast_without_ripple",
"(",
"object",
",",
"type",
")",
"return",
"cast",
"if",
"!",
"defined?",
"(",
"::",
"Ripple",
")",
"if",
"object",
".",
"is_a?",
"(",
"::",
"Ripple",
"::",
... | Add Ripple class names to the dispatcher pipeline.
------------------------------------------------------------------------------ | [
"Add",
"Ripple",
"class",
"names",
"to",
"the",
"dispatcher",
"pipeline",
".",
"------------------------------------------------------------------------------"
] | 4564fd74721562cbef2443f7d97109bf9192343d | https://github.com/awesome-print/awesome_print/blob/4564fd74721562cbef2443f7d97109bf9192343d/lib/awesome_print/ext/ripple.rb#L16-L26 | train | Casts a document to the specified type. | [
30522,
13366,
3459,
1035,
2007,
1035,
24644,
1006,
4874,
1010,
2828,
1007,
3459,
1027,
3459,
1035,
2302,
1035,
24644,
1006,
4874,
1010,
2828,
1007,
2709,
3459,
2065,
999,
4225,
1029,
1006,
1024,
1024,
24644,
1007,
2065,
4874,
30524,
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_api_management/lib/2017-03-01/generated/azure_mgmt_api_management/api_issue.rb | Azure::ApiManagement::Mgmt::V2017_03_01.ApiIssue.head | def head(resource_group_name, service_name, api_id, issue_id, custom_headers:nil)
response = head_async(resource_group_name, service_name, api_id, issue_id, custom_headers:custom_headers).value!
nil
end | ruby | def head(resource_group_name, service_name, api_id, issue_id, custom_headers:nil)
response = head_async(resource_group_name, service_name, api_id, issue_id, custom_headers:custom_headers).value!
nil
end | [
"def",
"head",
"(",
"resource_group_name",
",",
"service_name",
",",
"api_id",
",",
"issue_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"head_async",
"(",
"resource_group_name",
",",
"service_name",
",",
"api_id",
",",
"issue_id",
",",
"custom_h... | Gets the entity state (Etag) version of the Issue for an API specified by its
identifier.
@param resource_group_name [String] The name of the resource group.
@param service_name [String] The name of the API Management service.
@param api_id [String] API identifier. Must be unique in the current API
Management service instance.
@param issue_id [String] Issue identifier. Must be unique in the current API
Management service instance.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Gets",
"the",
"entity",
"state",
"(",
"Etag",
")",
"version",
"of",
"the",
"Issue",
"for",
"an",
"API",
"specified",
"by",
"its",
"identifier",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2017-03-01/generated/azure_mgmt_api_management/api_issue.rb#L38-L41 | train | Gets the list of all the documents in an API. | [
30522,
13366,
2132,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
17928,
1035,
8909,
1010,
3277,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2132,
1035,
2004,
6038,
2278,
1006,
7692,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.resolve_service | def resolve_service(service_id, partition_key_type:nil, partition_key_value:nil, previous_rsp_version:nil, timeout:60, custom_headers:nil)
response = resolve_service_async(service_id, partition_key_type:partition_key_type, partition_key_value:partition_key_value, previous_rsp_version:previous_rsp_version, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def resolve_service(service_id, partition_key_type:nil, partition_key_value:nil, previous_rsp_version:nil, timeout:60, custom_headers:nil)
response = resolve_service_async(service_id, partition_key_type:partition_key_type, partition_key_value:partition_key_value, previous_rsp_version:previous_rsp_version, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"resolve_service",
"(",
"service_id",
",",
"partition_key_type",
":",
"nil",
",",
"partition_key_value",
":",
"nil",
",",
"previous_rsp_version",
":",
"nil",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"resolve_serv... | Resolve a Service Fabric partition.
Resolve a Service Fabric service partition to get the endpoints of the
service replicas.
@param service_id [String] The identity of the service. This is typically the
full name of the service without the 'fabric:' URI scheme.
Starting from version 6.0, hierarchical names are delimited with the "~"
character.
For example, if the service name is "fabric:/myapp/app1/svc1", the service
identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
versions.
@param partition_key_type [Integer] Key type for the partition. This
parameter is required if the partition scheme for the service is Int64Range
or Named. The possible values are following.
- None (1) - Indicates that the PartitionKeyValue parameter is not specified.
This is valid for the partitions with partitioning scheme as Singleton. This
is the default value. The value is 1.
- Int64Range (2) - Indicates that the PartitionKeyValue parameter is an int64
partition key. This is valid for the partitions with partitioning scheme as
Int64Range. The value is 2.
- Named (3) - Indicates that the PartitionKeyValue parameter is a name of the
partition. This is valid for the partitions with partitioning scheme as
Named. The value is 3.
@param partition_key_value [String] Partition key. This is required if the
partition scheme for the service is Int64Range or Named.
@param previous_rsp_version [String] The value in the Version field of the
response that was received previously. This is required if the user knows
that the result that was got previously is stale.
@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 [ResolvedServicePartition] operation results. | [
"Resolve",
"a",
"Service",
"Fabric",
"partition",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L11669-L11672 | train | Resolve a service to a specific language. | [
30522,
13366,
10663,
1035,
2326,
1006,
2326,
1035,
8909,
1010,
13571,
1035,
3145,
1035,
2828,
1024,
9152,
2140,
1010,
13571,
1035,
3145,
1035,
3643,
1024,
9152,
2140,
1010,
3025,
1035,
12667,
2361,
1035,
2544,
1024,
9152,
2140,
1010,
2051,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hashicorp/vagrant | lib/vagrant/machine_index.rb | Vagrant.MachineIndex.unlocked_reload | def unlocked_reload
return if !@index_file.file?
data = nil
begin
data = JSON.load(@index_file.read)
rescue JSON::ParserError
raise Errors::CorruptMachineIndex, path: @index_file.to_s
end
if data
if !data["version"] || data["version"].to_i != 1
raise Errors::CorruptMachineIndex, path: @index_file.to_s
end
@machines = data["machines"] || {}
end
end | ruby | def unlocked_reload
return if !@index_file.file?
data = nil
begin
data = JSON.load(@index_file.read)
rescue JSON::ParserError
raise Errors::CorruptMachineIndex, path: @index_file.to_s
end
if data
if !data["version"] || data["version"].to_i != 1
raise Errors::CorruptMachineIndex, path: @index_file.to_s
end
@machines = data["machines"] || {}
end
end | [
"def",
"unlocked_reload",
"return",
"if",
"!",
"@index_file",
".",
"file?",
"data",
"=",
"nil",
"begin",
"data",
"=",
"JSON",
".",
"load",
"(",
"@index_file",
".",
"read",
")",
"rescue",
"JSON",
"::",
"ParserError",
"raise",
"Errors",
"::",
"CorruptMachineIn... | This will reload the data without locking the index. It is assumed
the caller with lock the index outside of this call.
@param [File] f | [
"This",
"will",
"reload",
"the",
"data",
"without",
"locking",
"the",
"index",
".",
"It",
"is",
"assumed",
"the",
"caller",
"with",
"lock",
"the",
"index",
"outside",
"of",
"this",
"call",
"."
] | c22a145c59790c098f95d50141d9afb48e1ef55f | https://github.com/hashicorp/vagrant/blob/c22a145c59790c098f95d50141d9afb48e1ef55f/lib/vagrant/machine_index.rb#L288-L305 | train | Reload the index file | [
30522,
13366,
14058,
1035,
2128,
11066,
2709,
2065,
999,
1030,
5950,
1035,
5371,
1012,
5371,
1029,
2951,
1027,
9152,
2140,
4088,
2951,
1027,
1046,
3385,
1012,
7170,
1006,
1030,
5950,
1035,
5371,
1012,
3191,
1007,
5343,
1046,
3385,
1024,
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... |
rails/rails | actionpack/lib/action_dispatch/middleware/remote_ip.rb | ActionDispatch.RemoteIp.call | def call(env)
req = ActionDispatch::Request.new env
req.remote_ip = GetIp.new(req, check_ip, proxies)
@app.call(req.env)
end | ruby | def call(env)
req = ActionDispatch::Request.new env
req.remote_ip = GetIp.new(req, check_ip, proxies)
@app.call(req.env)
end | [
"def",
"call",
"(",
"env",
")",
"req",
"=",
"ActionDispatch",
"::",
"Request",
".",
"new",
"env",
"req",
".",
"remote_ip",
"=",
"GetIp",
".",
"new",
"(",
"req",
",",
"check_ip",
",",
"proxies",
")",
"@app",
".",
"call",
"(",
"req",
".",
"env",
")",... | Create a new +RemoteIp+ middleware instance.
The +ip_spoofing_check+ option is on by default. When on, an exception
is raised if it looks like the client is trying to lie about its own IP
address. It makes sense to turn off this check on sites aimed at non-IP
clients (like WAP devices), or behind proxies that set headers in an
incorrect or confusing way (like AWS ELB).
The +custom_proxies+ argument can take an Array of string, IPAddr, or
Regexp objects which will be used instead of +TRUSTED_PROXIES+. If a
single string, IPAddr, or Regexp object is provided, it will be used in
addition to +TRUSTED_PROXIES+. Any proxy setup will put the value you
want in the middle (or at the beginning) of the X-Forwarded-For list,
with your proxy servers after it. If your proxies aren't removed, pass
them in via the +custom_proxies+ parameter. That way, the middleware will
ignore those IP addresses, and return the one that you want.
Since the IP address may not be needed, we store the object here
without calculating the IP to keep from slowing down the majority of
requests. For those requests that do need to know the IP, the
GetIp#calculate_ip method will calculate the memoized client IP address. | [
"Create",
"a",
"new",
"+",
"RemoteIp",
"+",
"middleware",
"instance",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/actionpack/lib/action_dispatch/middleware/remote_ip.rb#L78-L82 | train | Call the app | [
30522,
13366,
2655,
1006,
4372,
2615,
1007,
2128,
4160,
1027,
2895,
10521,
4502,
10649,
1024,
1024,
5227,
1012,
2047,
4372,
2615,
2128,
4160,
1012,
6556,
1035,
12997,
1027,
2131,
11514,
1012,
2047,
1006,
2128,
4160,
1010,
4638,
1035,
12997,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.write_with_retry | def write_with_retry(session, write_concern, ending_transaction = false, &block)
if ending_transaction && !session
raise ArgumentError, 'Cannot end a transaction without a session'
end
unless ending_transaction || retry_write_allowed?(session, write_concern)
return legacy_write_with_retry(nil, session, &block)
end
# If we are here, session is not nil. A session being nil would have
# failed retry_write_allowed? check.
server = cluster.next_primary
unless ending_transaction || server.retry_writes?
return legacy_write_with_retry(server, session, &block)
end
begin
txn_num = session.in_transaction? ? session.txn_num : session.next_txn_num
yield(server, txn_num, false)
rescue Error::SocketError, Error::SocketTimeoutError => e
if session.in_transaction? && !ending_transaction
raise
end
retry_write(e, txn_num, &block)
rescue Error::OperationFailure => e
if (session.in_transaction? && !ending_transaction) || !e.write_retryable?
raise
end
retry_write(e, txn_num, &block)
end
end | ruby | def write_with_retry(session, write_concern, ending_transaction = false, &block)
if ending_transaction && !session
raise ArgumentError, 'Cannot end a transaction without a session'
end
unless ending_transaction || retry_write_allowed?(session, write_concern)
return legacy_write_with_retry(nil, session, &block)
end
# If we are here, session is not nil. A session being nil would have
# failed retry_write_allowed? check.
server = cluster.next_primary
unless ending_transaction || server.retry_writes?
return legacy_write_with_retry(server, session, &block)
end
begin
txn_num = session.in_transaction? ? session.txn_num : session.next_txn_num
yield(server, txn_num, false)
rescue Error::SocketError, Error::SocketTimeoutError => e
if session.in_transaction? && !ending_transaction
raise
end
retry_write(e, txn_num, &block)
rescue Error::OperationFailure => e
if (session.in_transaction? && !ending_transaction) || !e.write_retryable?
raise
end
retry_write(e, txn_num, &block)
end
end | [
"def",
"write_with_retry",
"(",
"session",
",",
"write_concern",
",",
"ending_transaction",
"=",
"false",
",",
"&",
"block",
")",
"if",
"ending_transaction",
"&&",
"!",
"session",
"raise",
"ArgumentError",
",",
"'Cannot end a transaction without a session'",
"end",
"u... | Implements write retrying functionality by yielding to the passed
block one or more times.
If the session is provided (hence, the deployment supports sessions),
and modern retry writes are enabled on the client, the modern retry
logic is invoked. Otherwise the legacy retry logic is invoked.
If ending_transaction parameter is true, indicating that a transaction
is being committed or aborted, the operation is executed exactly once.
Note that, since transactions require sessions, this method will raise
ArgumentError if ending_transaction is true and session is nil.
@api private
@example Execute the write.
write_with_retry do
...
end
@note This only retries operations on not master failures, since it is
the only case we can be sure a partial write did not already occur.
@param [ nil | Session ] session Optional session to use with the operation.
@param [ nil | Hash | WriteConcern::Base ] write_concern The write concern.
@param [ true | false ] ending_transaction True if the write operation is abortTransaction or
commitTransaction, false otherwise.
@param [ Proc ] block The block to execute.
@yieldparam [ Server ] server The server to which the write should be sent.
@yieldparam [ Integer ] txn_num Transaction number (NOT the ACID kind).
@return [ Result ] The result of the operation.
@since 2.1.0 | [
"Implements",
"write",
"retrying",
"functionality",
"by",
"yielding",
"to",
"the",
"passed",
"block",
"one",
"or",
"more",
"times",
"."
] | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/retryable.rb#L191-L223 | train | Calls the given block with the next primary cluster. | [
30522,
13366,
4339,
1035,
2007,
1035,
2128,
11129,
1006,
5219,
1010,
4339,
1035,
5142,
1010,
4566,
1035,
12598,
1027,
6270,
1010,
1004,
3796,
1007,
2065,
4566,
1035,
12598,
1004,
1004,
999,
5219,
5333,
6685,
2121,
29165,
1010,
1005,
3685,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/webhooks.rb | Azure::ContainerRegistry::Mgmt::V2017_06_01_preview.Webhooks.get_callback_config_with_http_info | def get_callback_config_with_http_info(resource_group_name, registry_name, webhook_name, custom_headers:nil)
get_callback_config_async(resource_group_name, registry_name, webhook_name, custom_headers:custom_headers).value!
end | ruby | def get_callback_config_with_http_info(resource_group_name, registry_name, webhook_name, custom_headers:nil)
get_callback_config_async(resource_group_name, registry_name, webhook_name, custom_headers:custom_headers).value!
end | [
"def",
"get_callback_config_with_http_info",
"(",
"resource_group_name",
",",
"registry_name",
",",
"webhook_name",
",",
"custom_headers",
":",
"nil",
")",
"get_callback_config_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"webhook_name",
",",
"custom_heade... | Gets the configuration of service URI and custom headers for the webhook.
@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 webhook_name [String] The name of the webhook.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"configuration",
"of",
"service",
"URI",
"and",
"custom",
"headers",
"for",
"the",
"webhook",
"."
] | 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/webhooks.rb#L503-L505 | train | Gets the callback configuration for the specified webhook. | [
30522,
13366,
2131,
1035,
2655,
5963,
1035,
9530,
8873,
2290,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
4773,
6806,
6559,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
tongueroo/ufo | lib/ufo/task.rb | Ufo.Task.adjust_fargate_options | def adjust_fargate_options(options)
task_def = recent_task_definition
return options unless task_def[:network_mode] == "awsvpc"
awsvpc_conf = { subnets: network[:ecs_subnets] }
if task_def[:requires_compatibilities] == ["FARGATE"]
awsvpc_conf[:assign_public_ip] = "ENABLED"
options[:launch_type] = "FARGATE"
end
options[:network_configuration] = { awsvpc_configuration: awsvpc_conf }
options
end | ruby | def adjust_fargate_options(options)
task_def = recent_task_definition
return options unless task_def[:network_mode] == "awsvpc"
awsvpc_conf = { subnets: network[:ecs_subnets] }
if task_def[:requires_compatibilities] == ["FARGATE"]
awsvpc_conf[:assign_public_ip] = "ENABLED"
options[:launch_type] = "FARGATE"
end
options[:network_configuration] = { awsvpc_configuration: awsvpc_conf }
options
end | [
"def",
"adjust_fargate_options",
"(",
"options",
")",
"task_def",
"=",
"recent_task_definition",
"return",
"options",
"unless",
"task_def",
"[",
":network_mode",
"]",
"==",
"\"awsvpc\"",
"awsvpc_conf",
"=",
"{",
"subnets",
":",
"network",
"[",
":ecs_subnets",
"]",
... | adjust network_configuration based on fargate and network mode of awsvpc | [
"adjust",
"network_configuration",
"based",
"on",
"fargate",
"and",
"network",
"mode",
"of",
"awsvpc"
] | 16ac3dad28edcab2693c0e7d89a1971aca65b8f9 | https://github.com/tongueroo/ufo/blob/16ac3dad28edcab2693c0e7d89a1971aca65b8f9/lib/ufo/task.rb#L103-L115 | train | Adjust the FARGATE options for the current task | [
30522,
13366,
14171,
1035,
2521,
5867,
1035,
7047,
1006,
7047,
1007,
4708,
1035,
13366,
1027,
3522,
1035,
4708,
1035,
6210,
2709,
7047,
4983,
4708,
1035,
13366,
1031,
1024,
2897,
1035,
5549,
1033,
1027,
1027,
1000,
22091,
2015,
2615,
15042,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
kpumuk/meta-tags | lib/meta_tags/renderer.rb | MetaTags.Renderer.render | def render(view)
tags = []
render_charset(tags)
render_title(tags)
render_icon(tags)
render_with_normalization(tags, :description)
render_with_normalization(tags, :keywords)
render_refresh(tags)
render_noindex(tags)
render_alternate(tags)
render_open_search(tags)
render_links(tags)
render_hashes(tags)
render_custom(tags)
tags.tap(&:compact!).map! { |tag| tag.render(view) }
view.safe_join tags, MetaTags.config.minify_output ? "" : "\n"
end | ruby | def render(view)
tags = []
render_charset(tags)
render_title(tags)
render_icon(tags)
render_with_normalization(tags, :description)
render_with_normalization(tags, :keywords)
render_refresh(tags)
render_noindex(tags)
render_alternate(tags)
render_open_search(tags)
render_links(tags)
render_hashes(tags)
render_custom(tags)
tags.tap(&:compact!).map! { |tag| tag.render(view) }
view.safe_join tags, MetaTags.config.minify_output ? "" : "\n"
end | [
"def",
"render",
"(",
"view",
")",
"tags",
"=",
"[",
"]",
"render_charset",
"(",
"tags",
")",
"render_title",
"(",
"tags",
")",
"render_icon",
"(",
"tags",
")",
"render_with_normalization",
"(",
"tags",
",",
":description",
")",
"render_with_normalization",
"(... | Initialized a new instance of Renderer.
@param [MetaTagsCollection] meta_tags meta tags object to render.
Renders meta tags on the page.
@param [ActionView::Base] view Rails view object. | [
"Initialized",
"a",
"new",
"instance",
"of",
"Renderer",
"."
] | 03585f95edf96cd17024c5c155ce46ec8bc47232 | https://github.com/kpumuk/meta-tags/blob/03585f95edf96cd17024c5c155ce46ec8bc47232/lib/meta_tags/renderer.rb#L20-L39 | train | Renders the view. | [
30522,
13366,
17552,
1006,
3193,
1007,
22073,
1027,
1031,
1033,
17552,
1035,
25869,
13462,
1006,
22073,
1007,
17552,
1035,
2516,
1006,
22073,
1007,
17552,
1035,
12696,
1006,
22073,
1007,
17552,
1035,
2007,
1035,
3671,
3989,
1006,
22073,
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 | runtime/ms_rest_azure/lib/ms_rest_azure/azure_service_client.rb | MsRestAzure.AzureServiceClient.update_state_from_location_header | def update_state_from_location_header(request, polling_state, custom_deserialization_block, final_state_via = FinalStateVia::DEFAULT)
result = get_async_with_custom_deserialization(request, custom_deserialization_block)
polling_state.update_response(result.response)
polling_state.request = result.request
status_code = result.response.status
http_method = request.method
if status_code === 202
polling_state.status = AsyncOperationStatus::IN_PROGRESS_STATUS
elsif status_code === 200 || (status_code === 201 && http_method === :put) ||
(status_code === 204 && (http_method === :delete || http_method === :post || http_method === :get))
polling_state.status = AsyncOperationStatus::SUCCESS_STATUS
error_data = CloudErrorData.new
error_data.code = polling_state.status
error_data.message = "Long running operation failed with status #{polling_state.status}"
polling_state.error_data = error_data
polling_state.resource = result.body
elsif final_state_via == FinalStateVia::LOCATION && status_code === 404 && http_method === :delete && !polling_state.azure_async_operation_header_link.nil? && !polling_state.location_header_link.nil?
polling_state.status = AsyncOperationStatus::SUCCESS_STATUS
else
fail AzureOperationError, "The response from long running operation does not have a valid status code. Method: #{http_method}, Status Code: #{status_code}"
end
end | ruby | def update_state_from_location_header(request, polling_state, custom_deserialization_block, final_state_via = FinalStateVia::DEFAULT)
result = get_async_with_custom_deserialization(request, custom_deserialization_block)
polling_state.update_response(result.response)
polling_state.request = result.request
status_code = result.response.status
http_method = request.method
if status_code === 202
polling_state.status = AsyncOperationStatus::IN_PROGRESS_STATUS
elsif status_code === 200 || (status_code === 201 && http_method === :put) ||
(status_code === 204 && (http_method === :delete || http_method === :post || http_method === :get))
polling_state.status = AsyncOperationStatus::SUCCESS_STATUS
error_data = CloudErrorData.new
error_data.code = polling_state.status
error_data.message = "Long running operation failed with status #{polling_state.status}"
polling_state.error_data = error_data
polling_state.resource = result.body
elsif final_state_via == FinalStateVia::LOCATION && status_code === 404 && http_method === :delete && !polling_state.azure_async_operation_header_link.nil? && !polling_state.location_header_link.nil?
polling_state.status = AsyncOperationStatus::SUCCESS_STATUS
else
fail AzureOperationError, "The response from long running operation does not have a valid status code. Method: #{http_method}, Status Code: #{status_code}"
end
end | [
"def",
"update_state_from_location_header",
"(",
"request",
",",
"polling_state",
",",
"custom_deserialization_block",
",",
"final_state_via",
"=",
"FinalStateVia",
"::",
"DEFAULT",
")",
"result",
"=",
"get_async_with_custom_deserialization",
"(",
"request",
",",
"custom_de... | Updates polling state based on location header for HTTP requests.
@param request [MsRest::HttpOperationRequest] The url retrieve data from.
@param polling_state [MsRestAzure::PollingState] polling state to update.
@param custom_deserialization_block [Proc] custom deserialization method for parsing response.
@param final_state_via [MsRestAzure::FinalStateVia] Final State via value | [
"Updates",
"polling",
"state",
"based",
"on",
"location",
"header",
"for",
"HTTP",
"requests",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/runtime/ms_rest_azure/lib/ms_rest_azure/azure_service_client.rb#L173-L198 | train | Update polling state from location header | [
30522,
13366,
10651,
1035,
2110,
1035,
2013,
1035,
3295,
1035,
20346,
1006,
5227,
1010,
17888,
1035,
2110,
1010,
7661,
1035,
4078,
11610,
22731,
1035,
3796,
1010,
2345,
1035,
2110,
1035,
3081,
1027,
4399,
12259,
9035,
1024,
1024,
12398,
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... |
danger/danger | spec/fixtures/plugins/example_fully_documented.rb | Danger.DangerProselint.lint_files | def lint_files(files = nil)
# Installs a prose checker if needed
system "pip install --user proselint" unless proselint_installed?
# Check that this is in the user's PATH
if `which proselint`.strip.empty?
fail "proselint is not in the user's PATH, or it failed to install"
end
# Either use files provided, or use the modified + added
markdown_files = files ? Dir.glob(files) : (modified_files + added_files)
markdown_files.select! { |line| line.end_with?(".markdown", ".md") }
# TODO: create the disabled linters JSON in ~/.proselintrc
# using @disable_linter
# Convert paths to proselint results
require 'json'
result_jsons = Hash[markdown_files.uniq.collect { |v| [v, JSON.parse(`proselint #{v} --json`.strip)] }]
proses = result_jsons.select { |path, prose| prose['data']['errors'].count }
# Get some metadata about the local setup
current_branch = env.request_source.pr_json["head"]["ref"]
current_slug = env.ci_source.repo_slug
# We got some error reports back from proselint
if proses.count > 0
message = "### Proselint found issues\n\n"
proses.each do |path, prose|
github_loc = "/#{current_slug}/tree/#{current_branch}/#{path}"
message << "#### [#{path}](#{github_loc})\n\n"
message << "Line | Message | Severity |\n"
message << "| --- | ----- | ----- |\n"
prose["data"]["errors"].each do |error|
message << "#{error['line']} | #{error['message']} | #{error['severity']}\n"
end
end
markdown message
end
end | ruby | def lint_files(files = nil)
# Installs a prose checker if needed
system "pip install --user proselint" unless proselint_installed?
# Check that this is in the user's PATH
if `which proselint`.strip.empty?
fail "proselint is not in the user's PATH, or it failed to install"
end
# Either use files provided, or use the modified + added
markdown_files = files ? Dir.glob(files) : (modified_files + added_files)
markdown_files.select! { |line| line.end_with?(".markdown", ".md") }
# TODO: create the disabled linters JSON in ~/.proselintrc
# using @disable_linter
# Convert paths to proselint results
require 'json'
result_jsons = Hash[markdown_files.uniq.collect { |v| [v, JSON.parse(`proselint #{v} --json`.strip)] }]
proses = result_jsons.select { |path, prose| prose['data']['errors'].count }
# Get some metadata about the local setup
current_branch = env.request_source.pr_json["head"]["ref"]
current_slug = env.ci_source.repo_slug
# We got some error reports back from proselint
if proses.count > 0
message = "### Proselint found issues\n\n"
proses.each do |path, prose|
github_loc = "/#{current_slug}/tree/#{current_branch}/#{path}"
message << "#### [#{path}](#{github_loc})\n\n"
message << "Line | Message | Severity |\n"
message << "| --- | ----- | ----- |\n"
prose["data"]["errors"].each do |error|
message << "#{error['line']} | #{error['message']} | #{error['severity']}\n"
end
end
markdown message
end
end | [
"def",
"lint_files",
"(",
"files",
"=",
"nil",
")",
"# Installs a prose checker if needed",
"system",
"\"pip install --user proselint\"",
"unless",
"proselint_installed?",
"# Check that this is in the user's PATH",
"if",
"`",
"`",
".",
"strip",
".",
"empty?",
"fail",
"\"pro... | Lints the globbed files, which can fail your build if
@param [String] files
A globbed string which should return the files that you want to lint, defaults to nil.
if nil, modified and added files will be used.
@return [void] | [
"Lints",
"the",
"globbed",
"files",
"which",
"can",
"fail",
"your",
"build",
"if"
] | 0d6d09f2d949c287fe75202d947374042b0679f4 | https://github.com/danger/danger/blob/0d6d09f2d949c287fe75202d947374042b0679f4/spec/fixtures/plugins/example_fully_documented.rb#L30-L72 | train | Check if the user has installed proselint and if so it will lint the files | [
30522,
13366,
11409,
2102,
1035,
6764,
1006,
6764,
1027,
9152,
2140,
1007,
1001,
16500,
2015,
1037,
12388,
4638,
2121,
2065,
2734,
2291,
1000,
28315,
16500,
1011,
1011,
5310,
12388,
4115,
2102,
1000,
4983,
12388,
4115,
2102,
1035,
5361,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb | Azure::SQL::Mgmt::V2015_05_01_preview.FailoverGroups.failover_async | def failover_async(resource_group_name, server_name, failover_group_name, custom_headers:nil)
# Send request
promise = begin_failover_async(resource_group_name, server_name, failover_group_name, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::SQL::Mgmt::V2015_05_01_preview::Models::FailoverGroup.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | ruby | def failover_async(resource_group_name, server_name, failover_group_name, custom_headers:nil)
# Send request
promise = begin_failover_async(resource_group_name, server_name, failover_group_name, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::SQL::Mgmt::V2015_05_01_preview::Models::FailoverGroup.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | [
"def",
"failover_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"failover_group_name",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_failover_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"failover_group_name... | @param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param server_name [String] The name of the server containing the failover
group.
@param failover_group_name [String] The name of the failover group.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"resource_group_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"resource",
"group",
"that",
"contains",
"the",
"resource",
".",
"You",
"can",
"obtain",
"this",
"value",
"from",
"the",
"Azure",
"Resource",
"Manager",
"API",
"or",
"the",
"por... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb#L415-L431 | train | Gets the failover group. | [
30522,
13366,
8246,
7840,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
8246,
7840,
1035,
2177,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hashicorp/vault-ruby | lib/vault/api/auth_token.rb | Vault.AuthToken.renew_self | def renew_self(increment = 0, options = {})
headers = extract_headers!(options)
json = client.put("/v1/auth/token/renew-self", JSON.fast_generate(
increment: increment,
), headers)
return Secret.decode(json)
end | ruby | def renew_self(increment = 0, options = {})
headers = extract_headers!(options)
json = client.put("/v1/auth/token/renew-self", JSON.fast_generate(
increment: increment,
), headers)
return Secret.decode(json)
end | [
"def",
"renew_self",
"(",
"increment",
"=",
"0",
",",
"options",
"=",
"{",
"}",
")",
"headers",
"=",
"extract_headers!",
"(",
"options",
")",
"json",
"=",
"client",
".",
"put",
"(",
"\"/v1/auth/token/renew-self\"",
",",
"JSON",
".",
"fast_generate",
"(",
"... | Renews a lease associated with the calling token.
@example
Vault.auth_token.renew_self #=> #<Vault::Secret lease_id="">
@param [Fixnum] increment
@return [Secret] | [
"Renews",
"a",
"lease",
"associated",
"with",
"the",
"calling",
"token",
"."
] | 02f0532a802ba1a2a0d8703a4585dab76eb9d864 | https://github.com/hashicorp/vault-ruby/blob/02f0532a802ba1a2a0d8703a4585dab76eb9d864/lib/vault/api/auth_token.rb#L172-L178 | train | Renews the current token | [
30522,
13366,
20687,
1035,
2969,
1006,
4297,
28578,
4765,
1027,
1014,
1010,
7047,
1027,
1063,
1065,
1007,
20346,
2015,
1027,
14817,
1035,
20346,
2015,
999,
1006,
7047,
1007,
1046,
3385,
1027,
7396,
1012,
2404,
1006,
1000,
1013,
1058,
2487,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | actionpack/lib/action_controller/metal/strong_parameters.rb | ActionController.Parameters.permitted_scalar_filter | def permitted_scalar_filter(params, permitted_key)
permitted_key = permitted_key.to_s
if has_key?(permitted_key) && permitted_scalar?(self[permitted_key])
params[permitted_key] = self[permitted_key]
end
each_key do |key|
next unless key =~ /\(\d+[if]?\)\z/
next unless $~.pre_match == permitted_key
params[key] = self[key] if permitted_scalar?(self[key])
end
end | ruby | def permitted_scalar_filter(params, permitted_key)
permitted_key = permitted_key.to_s
if has_key?(permitted_key) && permitted_scalar?(self[permitted_key])
params[permitted_key] = self[permitted_key]
end
each_key do |key|
next unless key =~ /\(\d+[if]?\)\z/
next unless $~.pre_match == permitted_key
params[key] = self[key] if permitted_scalar?(self[key])
end
end | [
"def",
"permitted_scalar_filter",
"(",
"params",
",",
"permitted_key",
")",
"permitted_key",
"=",
"permitted_key",
".",
"to_s",
"if",
"has_key?",
"(",
"permitted_key",
")",
"&&",
"permitted_scalar?",
"(",
"self",
"[",
"permitted_key",
"]",
")",
"params",
"[",
"p... | Adds existing keys to the params if their values are scalar.
For example:
puts self.keys #=> ["zipcode(90210i)"]
params = {}
permitted_scalar_filter(params, "zipcode")
puts params.keys # => ["zipcode"] | [
"Adds",
"existing",
"keys",
"to",
"the",
"params",
"if",
"their",
"values",
"are",
"scalar",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/actionpack/lib/action_controller/metal/strong_parameters.rb#L933-L946 | train | permitted_scalar_filter | [
30522,
13366,
7936,
1035,
26743,
2099,
1035,
11307,
1006,
11498,
5244,
1010,
7936,
1035,
3145,
1007,
7936,
1035,
3145,
1027,
7936,
1035,
3145,
1012,
2000,
1035,
1055,
2065,
2038,
1035,
3145,
1029,
1006,
7936,
1035,
3145,
1007,
1004,
1004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
twitter/secure_headers | lib/secure_headers/view_helper.rb | SecureHeaders.ViewHelpers.nonced_stylesheet_pack_tag | def nonced_stylesheet_pack_tag(*args, &block)
opts = extract_options(args).merge(nonce: _content_security_policy_nonce(:style))
stylesheet_pack_tag(*args, opts, &block)
end | ruby | def nonced_stylesheet_pack_tag(*args, &block)
opts = extract_options(args).merge(nonce: _content_security_policy_nonce(:style))
stylesheet_pack_tag(*args, opts, &block)
end | [
"def",
"nonced_stylesheet_pack_tag",
"(",
"*",
"args",
",",
"&",
"block",
")",
"opts",
"=",
"extract_options",
"(",
"args",
")",
".",
"merge",
"(",
"nonce",
":",
"_content_security_policy_nonce",
"(",
":style",
")",
")",
"stylesheet_pack_tag",
"(",
"args",
","... | Public: create a stylesheet Webpacker link tag using the content security policy nonce.
Instructs secure_headers to append a nonce to style-src directive.
Returns an html-safe link tag with the nonce attribute. | [
"Public",
":",
"create",
"a",
"stylesheet",
"Webpacker",
"link",
"tag",
"using",
"the",
"content",
"security",
"policy",
"nonce",
".",
"Instructs",
"secure_headers",
"to",
"append",
"a",
"nonce",
"to",
"style",
"-",
"src",
"directive",
"."
] | 543e6712aadae08f1653ed973e6b6204f7eac26a | https://github.com/twitter/secure_headers/blob/543e6712aadae08f1653ed973e6b6204f7eac26a/lib/secure_headers/view_helper.rb#L59-L63 | train | Returns a stylesheet pack tag for the given args. | [
30522,
13366,
2512,
11788,
1035,
6782,
21030,
2102,
1035,
5308,
1035,
6415,
1006,
1008,
12098,
5620,
1010,
1004,
3796,
1007,
23569,
2015,
1027,
14817,
1035,
7047,
1006,
12098,
5620,
1007,
1012,
13590,
1006,
2512,
3401,
1024,
1035,
4180,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
seejohnrun/ice_cube | lib/ice_cube/builders/ical_builder.rb | IceCube.IcalBuilder.to_s | def to_s
arr = []
if freq = @hash.delete('FREQ')
arr << "FREQ=#{freq.join(',')}"
end
arr.concat(@hash.map do |key, value|
if value.is_a?(Array)
"#{key}=#{value.join(',')}"
end
end.compact)
arr.join(';')
end | ruby | def to_s
arr = []
if freq = @hash.delete('FREQ')
arr << "FREQ=#{freq.join(',')}"
end
arr.concat(@hash.map do |key, value|
if value.is_a?(Array)
"#{key}=#{value.join(',')}"
end
end.compact)
arr.join(';')
end | [
"def",
"to_s",
"arr",
"=",
"[",
"]",
"if",
"freq",
"=",
"@hash",
".",
"delete",
"(",
"'FREQ'",
")",
"arr",
"<<",
"\"FREQ=#{freq.join(',')}\"",
"end",
"arr",
".",
"concat",
"(",
"@hash",
".",
"map",
"do",
"|",
"key",
",",
"value",
"|",
"if",
"value",
... | Build for a single rule entry | [
"Build",
"for",
"a",
"single",
"rule",
"entry"
] | fb6c657bdc4f87dfda2bf83f15c5f487b78ccabd | https://github.com/seejohnrun/ice_cube/blob/fb6c657bdc4f87dfda2bf83f15c5f487b78ccabd/lib/ice_cube/builders/ical_builder.rb#L20-L31 | train | Convert the hash to a string | [
30522,
13366,
2000,
1035,
1055,
12098,
2099,
1027,
1031,
1033,
2065,
10424,
2063,
4160,
1027,
1030,
23325,
1012,
3972,
12870,
1006,
1005,
30524,
23325,
1012,
4949,
2079,
1064,
3145,
1010,
3643,
1064,
2065,
3643,
1012,
2003,
1035,
1037,
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... |
mongodb/mongo-ruby-driver | lib/mongo/monitoring.rb | Mongo.Monitoring.started | def started(topic, event)
subscribers_for(topic).each{ |subscriber| subscriber.started(event) }
end | ruby | def started(topic, event)
subscribers_for(topic).each{ |subscriber| subscriber.started(event) }
end | [
"def",
"started",
"(",
"topic",
",",
"event",
")",
"subscribers_for",
"(",
"topic",
")",
".",
"each",
"{",
"|",
"subscriber",
"|",
"subscriber",
".",
"started",
"(",
"event",
")",
"}",
"end"
] | Publish a started event.
@example Publish a started event.
monitoring.started(COMMAND, event)
@param [ String ] topic The event topic.
@param [ Event ] event The event to publish.
@since 2.1.0 | [
"Publish",
"a",
"started",
"event",
"."
] | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/monitoring.rb#L252-L254 | train | Called when a topic has started | [
30522,
13366,
2318,
1006,
8476,
1010,
2724,
1007,
17073,
1035,
2005,
1006,
8476,
1007,
1012,
2169,
1063,
1064,
4942,
29234,
2099,
1064,
4942,
29234,
2099,
1012,
2318,
1006,
2724,
1007,
1065,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.normalize_keys | def normalize_keys(mapping)
return mapping.inject({}) do |accu, pair|
name, value = pair
if Symbol === name
name = name.to_s
elsif name.respond_to?(:to_str)
name = name.to_str
else
raise TypeError,
"Can't convert #{name.class} into String."
end
accu[name] = value
accu
end
end | ruby | def normalize_keys(mapping)
return mapping.inject({}) do |accu, pair|
name, value = pair
if Symbol === name
name = name.to_s
elsif name.respond_to?(:to_str)
name = name.to_str
else
raise TypeError,
"Can't convert #{name.class} into String."
end
accu[name] = value
accu
end
end | [
"def",
"normalize_keys",
"(",
"mapping",
")",
"return",
"mapping",
".",
"inject",
"(",
"{",
"}",
")",
"do",
"|",
"accu",
",",
"pair",
"|",
"name",
",",
"value",
"=",
"pair",
"if",
"Symbol",
"===",
"name",
"name",
"=",
"name",
".",
"to_s",
"elsif",
... | Generates a hash with string keys
@param [Hash] mapping A mapping hash to normalize
@return [Hash]
A hash with stringified keys | [
"Generates",
"a",
"hash",
"with",
"string",
"keys"
] | 5894c95a7768435cb46d1355954611dbd194832e | https://github.com/sporkmonger/addressable/blob/5894c95a7768435cb46d1355954611dbd194832e/lib/addressable/template.rb#L960-L974 | train | Normalize the keys of a hash of keys to a single key. | [
30522,
13366,
3671,
4697,
1035,
6309,
1006,
12375,
1007,
2709,
12375,
1012,
1999,
20614,
1006,
1063,
1065,
1007,
2079,
1064,
16222,
2226,
1010,
3940,
1064,
2171,
1010,
3643,
1027,
3940,
2065,
6454,
1027,
1027,
1027,
2171,
2171,
1027,
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... |
daddyz/phonelib | lib/phonelib/data_importer_helper.rb | Phonelib.DataImporterHelper.fill_prefixes | def fill_prefixes(key, value, prefix, prefixes)
prefixes = {} if prefixes.nil?
if prefix.size == 1
pr = prefix.to_i
prefixes[pr] ||= {}
prefixes[pr][key] = value
else
pr = prefix[0].to_i
prefixes[pr] = fill_prefixes(key, value, prefix[1..-1], prefixes[pr])
end
prefixes
end | ruby | def fill_prefixes(key, value, prefix, prefixes)
prefixes = {} if prefixes.nil?
if prefix.size == 1
pr = prefix.to_i
prefixes[pr] ||= {}
prefixes[pr][key] = value
else
pr = prefix[0].to_i
prefixes[pr] = fill_prefixes(key, value, prefix[1..-1], prefixes[pr])
end
prefixes
end | [
"def",
"fill_prefixes",
"(",
"key",
",",
"value",
",",
"prefix",
",",
"prefixes",
")",
"prefixes",
"=",
"{",
"}",
"if",
"prefixes",
".",
"nil?",
"if",
"prefix",
".",
"size",
"==",
"1",
"pr",
"=",
"prefix",
".",
"to_i",
"prefixes",
"[",
"pr",
"]",
"... | method updates prefixes hash recursively | [
"method",
"updates",
"prefixes",
"hash",
"recursively"
] | aa0023eab7c896b71275bf342bc7f49735cbdbbf | https://github.com/daddyz/phonelib/blob/aa0023eab7c896b71275bf342bc7f49735cbdbbf/lib/phonelib/data_importer_helper.rb#L36-L47 | train | Fill the prefix with the value | [
30522,
13366,
6039,
1035,
17576,
2229,
1006,
3145,
1010,
3643,
1010,
17576,
1010,
17576,
2229,
1007,
17576,
2229,
1027,
1063,
1065,
2065,
17576,
2229,
1012,
9152,
2140,
1029,
2065,
17576,
1012,
2946,
1027,
1027,
1015,
10975,
1027,
17576,
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_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/global_users.rb | Azure::Labservices::Mgmt::V2018_10_15.GlobalUsers.reset_password_async | def reset_password_async(user_name, reset_password_payload, custom_headers:nil)
# Send request
promise = begin_reset_password_async(user_name, reset_password_payload, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | ruby | def reset_password_async(user_name, reset_password_payload, custom_headers:nil)
# Send request
promise = begin_reset_password_async(user_name, reset_password_payload, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | [
"def",
"reset_password_async",
"(",
"user_name",
",",
"reset_password_payload",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_reset_password_async",
"(",
"user_name",
",",
"reset_password_payload",
",",
"custom_headers",
":custom_headers",... | @param user_name [String] The name of the user.
@param reset_password_payload [ResetPasswordPayload] Represents the payload
for resetting passwords.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"user_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"user",
".",
"@param",
"reset_password_payload",
"[",
"ResetPasswordPayload",
"]",
"Represents",
"the",
"payload",
"for",
"resetting",
"passwords",
".",
"@param",
"custom_headers",
"[",
"Hash",... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/global_users.rb#L743-L757 | train | Resets the password of the specified user. | [
30522,
13366,
25141,
1035,
20786,
1035,
2004,
6038,
2278,
1006,
5310,
1035,
2171,
1010,
25141,
1035,
20786,
1035,
18093,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,
4088,
1035,
25141,
1035,
20786,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_customvisiontraining/lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb | Azure::CognitiveServices::Customvisiontraining::V3_0.CustomvisiontrainingClient.query_predictions | def query_predictions(project_id, query, custom_headers:nil)
response = query_predictions_async(project_id, query, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def query_predictions(project_id, query, custom_headers:nil)
response = query_predictions_async(project_id, query, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"query_predictions",
"(",
"project_id",
",",
"query",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"query_predictions_async",
"(",
"project_id",
",",
"query",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",... | Get images that were sent to your prediction endpoint.
@param project_id The project id.
@param query [PredictionQueryToken] Parameters used to query the predictions.
Limited to combining 2 tags.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [PredictionQueryResult] operation results. | [
"Get",
"images",
"that",
"were",
"sent",
"to",
"your",
"prediction",
"endpoint",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_customvisiontraining/lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb#L2331-L2334 | train | Query predictions for a given project. | [
30522,
13366,
23032,
1035,
20932,
1006,
2622,
1035,
8909,
1010,
23032,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
23032,
1035,
20932,
1035,
2004,
6038,
2278,
1006,
2622,
1035,
8909,
1010,
23032,
1010,
7661,
1035,
203... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rmagick/rmagick | examples/histogram.rb | Magick.Image.histogram | def histogram(fg = 'white', bg = 'black')
red = Array.new(HISTOGRAM_COLS, 0)
green = Array.new(HISTOGRAM_COLS, 0)
blue = Array.new(HISTOGRAM_COLS, 0)
alpha = Array.new(HISTOGRAM_COLS, 0)
int = Array.new(HISTOGRAM_COLS, 0)
rows.times do |row|
pixels = get_pixels(0, row, columns, 1)
pixels.each do |pixel|
red[pixel.red & MAX_QUANTUM] += 1
green[pixel.green & MAX_QUANTUM] += 1
blue[pixel.blue & MAX_QUANTUM] += 1
# Only count opacity channel if some pixels are not opaque.
alpha[pixel.opacity & MAX_QUANTUM] += 1 unless opaque?
v = pixel_intensity(pixel)
int[v] += 1
end
end
# Scale to chart size. When computing the scale, add some "air" between
# the max frequency and the top of the histogram. This makes a prettier chart.
# The RGBA and intensity histograms are all drawn to the same scale.
max = [red.max, green.max, blue.max, alpha.max, int.max].max
scale = HISTOGRAM_ROWS / (max * AIR_FACTOR)
charts = ImageList.new
# Add the thumbnail.
thumb = copy
thumb['Label'] = File.basename(filename)
charts << thumb
# Compute the channel and intensity histograms.
channel_hists = channel_histograms(red, green, blue, int, scale, fg, bg)
# Add the red, green, and blue histograms to the list
charts << channel_hists.shift
charts << channel_hists.shift
charts << channel_hists.shift
# Add Alpha channel or image stats
charts << if !opaque?
alpha_hist(alpha, scale, fg, bg)
else
info_text(fg, bg)
end
# Add the RGB histogram
charts << channel_hists.shift
# Add the intensity histogram.
charts << intensity_hist(channel_hists.shift)
# Add the color frequency histogram.
charts << color_hist(fg, bg)
# Make a montage.
histogram = charts.montage do
self.background_color = bg
self.stroke = 'transparent'
self.fill = fg
self.border_width = 1
self.tile = '4x2'
self.geometry = "#{HISTOGRAM_COLS}x#{HISTOGRAM_ROWS}+10+10"
end
histogram
end | ruby | def histogram(fg = 'white', bg = 'black')
red = Array.new(HISTOGRAM_COLS, 0)
green = Array.new(HISTOGRAM_COLS, 0)
blue = Array.new(HISTOGRAM_COLS, 0)
alpha = Array.new(HISTOGRAM_COLS, 0)
int = Array.new(HISTOGRAM_COLS, 0)
rows.times do |row|
pixels = get_pixels(0, row, columns, 1)
pixels.each do |pixel|
red[pixel.red & MAX_QUANTUM] += 1
green[pixel.green & MAX_QUANTUM] += 1
blue[pixel.blue & MAX_QUANTUM] += 1
# Only count opacity channel if some pixels are not opaque.
alpha[pixel.opacity & MAX_QUANTUM] += 1 unless opaque?
v = pixel_intensity(pixel)
int[v] += 1
end
end
# Scale to chart size. When computing the scale, add some "air" between
# the max frequency and the top of the histogram. This makes a prettier chart.
# The RGBA and intensity histograms are all drawn to the same scale.
max = [red.max, green.max, blue.max, alpha.max, int.max].max
scale = HISTOGRAM_ROWS / (max * AIR_FACTOR)
charts = ImageList.new
# Add the thumbnail.
thumb = copy
thumb['Label'] = File.basename(filename)
charts << thumb
# Compute the channel and intensity histograms.
channel_hists = channel_histograms(red, green, blue, int, scale, fg, bg)
# Add the red, green, and blue histograms to the list
charts << channel_hists.shift
charts << channel_hists.shift
charts << channel_hists.shift
# Add Alpha channel or image stats
charts << if !opaque?
alpha_hist(alpha, scale, fg, bg)
else
info_text(fg, bg)
end
# Add the RGB histogram
charts << channel_hists.shift
# Add the intensity histogram.
charts << intensity_hist(channel_hists.shift)
# Add the color frequency histogram.
charts << color_hist(fg, bg)
# Make a montage.
histogram = charts.montage do
self.background_color = bg
self.stroke = 'transparent'
self.fill = fg
self.border_width = 1
self.tile = '4x2'
self.geometry = "#{HISTOGRAM_COLS}x#{HISTOGRAM_ROWS}+10+10"
end
histogram
end | [
"def",
"histogram",
"(",
"fg",
"=",
"'white'",
",",
"bg",
"=",
"'black'",
")",
"red",
"=",
"Array",
".",
"new",
"(",
"HISTOGRAM_COLS",
",",
"0",
")",
"green",
"=",
"Array",
".",
"new",
"(",
"HISTOGRAM_COLS",
",",
"0",
")",
"blue",
"=",
"Array",
"."... | Create the histogram montage. | [
"Create",
"the",
"histogram",
"montage",
"."
] | ef6688ed9d76bf123c2ea1a483eff8635051adb7 | https://github.com/rmagick/rmagick/blob/ef6688ed9d76bf123c2ea1a483eff8635051adb7/examples/histogram.rb#L197-L267 | train | Returns a histogram of the image. | [
30522,
13366,
2010,
3406,
13113,
1006,
30524,
1006,
2010,
3406,
13113,
1035,
8902,
2015,
1010,
1014,
1007,
2665,
1027,
9140,
1012,
2047,
1006,
2010,
3406,
13113,
1035,
8902,
2015,
1010,
1014,
1007,
2630,
1027,
9140,
1012,
2047,
1006,
2010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_policy_insights/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/remediations.rb | Azure::PolicyInsights::Mgmt::V2018_07_01_preview.Remediations.delete_at_management_group | def delete_at_management_group(management_group_id, remediation_name, custom_headers:nil)
response = delete_at_management_group_async(management_group_id, remediation_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def delete_at_management_group(management_group_id, remediation_name, custom_headers:nil)
response = delete_at_management_group_async(management_group_id, remediation_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"delete_at_management_group",
"(",
"management_group_id",
",",
"remediation_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_at_management_group_async",
"(",
"management_group_id",
",",
"remediation_name",
",",
"custom_headers",
":custom_headers"... | Deletes an existing remediation at management group scope.
@param management_group_id [String] Management group ID.
@param remediation_name [String] The name of the remediation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Remediation] operation results. | [
"Deletes",
"an",
"existing",
"remediation",
"at",
"management",
"group",
"scope",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_policy_insights/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/remediations.rb#L529-L532 | train | Deletes a remediation at management group scope. | [
30522,
13366,
3972,
12870,
1035,
2012,
1035,
2968,
1035,
2177,
1006,
2968,
1035,
2177,
1035,
8909,
1010,
2128,
16969,
3508,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
1035,
2012,
1035,
2968,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/rake | lib/rake/promise.rb | Rake.Promise.work | def work
stat :attempting_lock_on, item_id: object_id
if @mutex.try_lock
stat :has_lock_on, item_id: object_id
chore
stat :releasing_lock_on, item_id: object_id
@mutex.unlock
else
stat :bailed_on, item_id: object_id
end
end | ruby | def work
stat :attempting_lock_on, item_id: object_id
if @mutex.try_lock
stat :has_lock_on, item_id: object_id
chore
stat :releasing_lock_on, item_id: object_id
@mutex.unlock
else
stat :bailed_on, item_id: object_id
end
end | [
"def",
"work",
"stat",
":attempting_lock_on",
",",
"item_id",
":",
"object_id",
"if",
"@mutex",
".",
"try_lock",
"stat",
":has_lock_on",
",",
"item_id",
":",
"object_id",
"chore",
"stat",
":releasing_lock_on",
",",
"item_id",
":",
"object_id",
"@mutex",
".",
"un... | If no one else is working this promise, go ahead and do the chore. | [
"If",
"no",
"one",
"else",
"is",
"working",
"this",
"promise",
"go",
"ahead",
"and",
"do",
"the",
"chore",
"."
] | 1c22b490ee6cb8bd614fa8d0d6145f671466206b | https://github.com/ruby/rake/blob/1c22b490ee6cb8bd614fa8d0d6145f671466206b/lib/rake/promise.rb#L42-L52 | train | Work the object_id_nodelist object_id_n | [
30522,
13366,
2147,
28093,
1024,
7161,
1035,
5843,
1035,
2006,
1010,
8875,
1035,
8909,
1024,
4874,
1035,
8909,
2065,
1030,
20101,
2595,
1012,
3046,
1035,
5843,
28093,
1024,
2038,
1035,
5843,
1035,
2006,
1010,
8875,
1035,
8909,
1024,
4874,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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.regenerate_storage_account_key | def regenerate_storage_account_key(vault_base_url, storage_account_name, key_name, custom_headers:nil)
response = regenerate_storage_account_key_async(vault_base_url, storage_account_name, key_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def regenerate_storage_account_key(vault_base_url, storage_account_name, key_name, custom_headers:nil)
response = regenerate_storage_account_key_async(vault_base_url, storage_account_name, key_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"regenerate_storage_account_key",
"(",
"vault_base_url",
",",
"storage_account_name",
",",
"key_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"regenerate_storage_account_key_async",
"(",
"vault_base_url",
",",
"storage_account_name",
",",
"key_name"... | Regenerates the specified key value for the given storage account. This
operation requires the storage/regeneratekey permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param storage_account_name [String] The name of the storage account.
@param key_name [String] The storage account key name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [StorageBundle] operation results. | [
"Regenerates",
"the",
"specified",
"key",
"value",
"for",
"the",
"given",
"storage",
"account",
".",
"This",
"operation",
"requires",
"the",
"storage",
"/",
"regeneratekey",
"permission",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb#L7558-L7561 | train | Regenerate a storage account key. | [
30522,
13366,
19723,
24454,
3686,
1035,
5527,
1035,
4070,
1035,
3145,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
5527,
1035,
4070,
1035,
2171,
1010,
3145,
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_network/lib/2019-02-01/generated/azure_mgmt_network/nat_gateways.rb | Azure::Network::Mgmt::V2019_02_01.NatGateways.delete | def delete(resource_group_name, nat_gateway_name, custom_headers:nil)
response = delete_async(resource_group_name, nat_gateway_name, custom_headers:custom_headers).value!
nil
end | ruby | def delete(resource_group_name, nat_gateway_name, custom_headers:nil)
response = delete_async(resource_group_name, nat_gateway_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"delete",
"(",
"resource_group_name",
",",
"nat_gateway_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_async",
"(",
"resource_group_name",
",",
"nat_gateway_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"nil",
"... | Deletes the specified nat gateway.
@param resource_group_name [String] The name of the resource group.
@param nat_gateway_name [String] The name of the nat gateway.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Deletes",
"the",
"specified",
"nat",
"gateway",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/nat_gateways.rb#L32-L35 | train | Deletes a nat gateway. | [
30522,
13366,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
14085,
1035,
11909,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
middleman/middleman | middleman-core/lib/middleman-core/rack.rb | Middleman.Rack.send_file | def send_file(resource, env)
file = ::Rack::File.new nil
path = resource.file_descriptor[:full_path]
if !file.respond_to?(:path=)
request = ::Rack::Request.new(env)
response = file.serving(request, path)
else
file.path = path
response = file.serving(env)
end
status = response[0]
response[1]['Content-Encoding'] = 'gzip' if %w[.svgz .gz].include?(resource.ext)
# Do not set Content-Type if status is 1xx, 204, 205 or 304, otherwise
# Rack will throw an error (500)
if !(100..199).cover?(status) && ![204, 205, 304].include?(status)
response[1]['Content-Type'] = resource.content_type || (resource.binary? ? 'application/octet-stream' : 'text/plain')
end
halt response
end | ruby | def send_file(resource, env)
file = ::Rack::File.new nil
path = resource.file_descriptor[:full_path]
if !file.respond_to?(:path=)
request = ::Rack::Request.new(env)
response = file.serving(request, path)
else
file.path = path
response = file.serving(env)
end
status = response[0]
response[1]['Content-Encoding'] = 'gzip' if %w[.svgz .gz].include?(resource.ext)
# Do not set Content-Type if status is 1xx, 204, 205 or 304, otherwise
# Rack will throw an error (500)
if !(100..199).cover?(status) && ![204, 205, 304].include?(status)
response[1]['Content-Type'] = resource.content_type || (resource.binary? ? 'application/octet-stream' : 'text/plain')
end
halt response
end | [
"def",
"send_file",
"(",
"resource",
",",
"env",
")",
"file",
"=",
"::",
"Rack",
"::",
"File",
".",
"new",
"nil",
"path",
"=",
"resource",
".",
"file_descriptor",
"[",
":full_path",
"]",
"if",
"!",
"file",
".",
"respond_to?",
"(",
":path=",
")",
"reque... | Immediately send static file | [
"Immediately",
"send",
"static",
"file"
] | a0dd9f78094813162895511e8516e0c5507cee50 | https://github.com/middleman/middleman/blob/a0dd9f78094813162895511e8516e0c5507cee50/middleman-core/lib/middleman-core/rack.rb#L130-L149 | train | Send a file to the client | [
30522,
13366,
4604,
1035,
5371,
1006,
7692,
1010,
4372,
2615,
1007,
5371,
1027,
1024,
1024,
14513,
1024,
1024,
5371,
1012,
2047,
9152,
2140,
4130,
1027,
7692,
1012,
5371,
1035,
4078,
23235,
2953,
1031,
1024,
2440,
1035,
4130,
1033,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
meew0/discordrb | lib/discordrb/commands/command_bot.rb | Discordrb::Commands.CommandBot.trigger? | def trigger?(message)
if @prefix.is_a? String
standard_prefix_trigger(message.content, @prefix)
elsif @prefix.is_a? Array
@prefix.map { |e| standard_prefix_trigger(message.content, e) }.reduce { |m, e| m || e }
elsif @prefix.respond_to? :call
@prefix.call(message)
end
end | ruby | def trigger?(message)
if @prefix.is_a? String
standard_prefix_trigger(message.content, @prefix)
elsif @prefix.is_a? Array
@prefix.map { |e| standard_prefix_trigger(message.content, e) }.reduce { |m, e| m || e }
elsif @prefix.respond_to? :call
@prefix.call(message)
end
end | [
"def",
"trigger?",
"(",
"message",
")",
"if",
"@prefix",
".",
"is_a?",
"String",
"standard_prefix_trigger",
"(",
"message",
".",
"content",
",",
"@prefix",
")",
"elsif",
"@prefix",
".",
"is_a?",
"Array",
"@prefix",
".",
"map",
"{",
"|",
"e",
"|",
"standard... | Check whether a message should trigger command execution, and if it does, return the raw chain | [
"Check",
"whether",
"a",
"message",
"should",
"trigger",
"command",
"execution",
"and",
"if",
"it",
"does",
"return",
"the",
"raw",
"chain"
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/commands/command_bot.rb#L426-L434 | train | Returns true if the message matches the prefix | [
30522,
13366,
9495,
1029,
1006,
4471,
1007,
2065,
1030,
17576,
1012,
2003,
1035,
1037,
1029,
5164,
3115,
1035,
17576,
1035,
9495,
1006,
4471,
1012,
4180,
1010,
1030,
17576,
1007,
3449,
5332,
2546,
1030,
17576,
1012,
2003,
1035,
1037,
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... |
mongodb/mongoid | lib/mongoid/attributes.rb | Mongoid.Attributes.attribute_present? | def attribute_present?(name)
attribute = read_raw_attribute(name)
!attribute.blank? || attribute == false
rescue ActiveModel::MissingAttributeError
false
end | ruby | def attribute_present?(name)
attribute = read_raw_attribute(name)
!attribute.blank? || attribute == false
rescue ActiveModel::MissingAttributeError
false
end | [
"def",
"attribute_present?",
"(",
"name",
")",
"attribute",
"=",
"read_raw_attribute",
"(",
"name",
")",
"!",
"attribute",
".",
"blank?",
"||",
"attribute",
"==",
"false",
"rescue",
"ActiveModel",
"::",
"MissingAttributeError",
"false",
"end"
] | Determine if an attribute is present.
@example Is the attribute present?
person.attribute_present?("title")
@param [ String, Symbol ] name The name of the attribute.
@return [ true, false ] True if present, false if not.
@since 1.0.0 | [
"Determine",
"if",
"an",
"attribute",
"is",
"present",
"."
] | 56976e32610f4c2450882b0bfe14da099f0703f4 | https://github.com/mongodb/mongoid/blob/56976e32610f4c2450882b0bfe14da099f0703f4/lib/mongoid/attributes.rb#L32-L37 | train | Returns true if the attribute is present. | [
30522,
13366,
17961,
1035,
2556,
1029,
1006,
2171,
1007,
17961,
1027,
3191,
1035,
6315,
1035,
17961,
1006,
2171,
1007,
999,
17961,
1012,
8744,
1029,
1064,
1064,
17961,
1027,
1027,
6270,
5343,
3161,
5302,
9247,
1024,
1024,
4394,
19321,
3089,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
toptal/chewy | lib/chewy/query.rb | Chewy.Query.facets | def facets(params = nil)
raise RemovedFeature, 'removed in elasticsearch 2.0' if Runtime.version >= '2.0'
if params
chain { criteria.update_facets params }
else
_response['facets'] || {}
end
end | ruby | def facets(params = nil)
raise RemovedFeature, 'removed in elasticsearch 2.0' if Runtime.version >= '2.0'
if params
chain { criteria.update_facets params }
else
_response['facets'] || {}
end
end | [
"def",
"facets",
"(",
"params",
"=",
"nil",
")",
"raise",
"RemovedFeature",
",",
"'removed in elasticsearch 2.0'",
"if",
"Runtime",
".",
"version",
">=",
"'2.0'",
"if",
"params",
"chain",
"{",
"criteria",
".",
"update_facets",
"params",
"}",
"else",
"_response",... | Adds facets section to the search request.
All the chained facets a merged and added to the
search request
@example
UsersIndex.facets(tags: {terms: {field: 'tags'}}).facets(ages: {terms: {field: 'age'}})
# => {body: {
query: {...},
facets: {tags: {terms: {field: 'tags'}}, ages: {terms: {field: 'age'}}}
}}
If called parameterless - returns result facets from ES performing request.
Returns empty hash if no facets was requested or resulted. | [
"Adds",
"facets",
"section",
"to",
"the",
"search",
"request",
".",
"All",
"the",
"chained",
"facets",
"a",
"merged",
"and",
"added",
"to",
"the",
"search",
"request"
] | cb1bb3efb1bd8a31e7e31add6072189cb1f4f01b | https://github.com/toptal/chewy/blob/cb1bb3efb1bd8a31e7e31add6072189cb1f4f01b/lib/chewy/query.rb#L370-L377 | train | Update facets | [
30522,
13366,
2227,
3215,
1006,
11498,
5244,
1027,
9152,
2140,
1007,
5333,
3718,
7959,
4017,
5397,
1010,
1005,
3718,
1999,
21274,
17310,
11140,
1016,
1012,
1014,
1005,
2065,
2448,
7292,
1012,
2544,
1028,
1027,
1005,
1016,
1012,
1014,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
zendesk/ruby-kafka | lib/kafka/cluster.rb | Kafka.Cluster.get_transaction_coordinator | def get_transaction_coordinator(transactional_id:)
@logger.debug "Getting transaction coordinator for `#{transactional_id}`"
refresh_metadata_if_necessary!
if transactional_id.nil?
# Get a random_broker
@logger.debug "Transaction ID is not available. Choose a random broker."
return random_broker
else
get_coordinator(Kafka::Protocol::COORDINATOR_TYPE_TRANSACTION, transactional_id)
end
end | ruby | def get_transaction_coordinator(transactional_id:)
@logger.debug "Getting transaction coordinator for `#{transactional_id}`"
refresh_metadata_if_necessary!
if transactional_id.nil?
# Get a random_broker
@logger.debug "Transaction ID is not available. Choose a random broker."
return random_broker
else
get_coordinator(Kafka::Protocol::COORDINATOR_TYPE_TRANSACTION, transactional_id)
end
end | [
"def",
"get_transaction_coordinator",
"(",
"transactional_id",
":",
")",
"@logger",
".",
"debug",
"\"Getting transaction coordinator for `#{transactional_id}`\"",
"refresh_metadata_if_necessary!",
"if",
"transactional_id",
".",
"nil?",
"# Get a random_broker",
"@logger",
".",
"de... | Finds the broker acting as the coordinator of the given transaction.
@param transactional_id: [String]
@return [Broker] the broker that's currently coordinator. | [
"Finds",
"the",
"broker",
"acting",
"as",
"the",
"coordinator",
"of",
"the",
"given",
"transaction",
"."
] | 2a73471b6a607a52dc85c79301ba522acb4566b5 | https://github.com/zendesk/ruby-kafka/blob/2a73471b6a607a52dc85c79301ba522acb4566b5/lib/kafka/cluster.rb#L128-L140 | train | Get the coordinator for a given transaction ID | [
30522,
13366,
2131,
1035,
12598,
1035,
10669,
1006,
12598,
2389,
1035,
8909,
1024,
1007,
1030,
8833,
4590,
1012,
2139,
8569,
2290,
1000,
2893,
12598,
10669,
2005,
1036,
1001,
1063,
12598,
2389,
1035,
8909,
1065,
1036,
1000,
25416,
21898,
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... |
meew0/discordrb | lib/discordrb/webhooks/client.rb | Discordrb::Webhooks.Client.execute | def execute(builder = nil, wait = false)
raise TypeError, 'builder needs to be nil or like a Discordrb::Webhooks::Builder!' unless
builder.respond_to?(:file) && builder.respond_to?(:to_multipart_hash) || builder.respond_to?(:to_json_hash) || builder.nil?
builder ||= Builder.new
yield builder if block_given?
if builder.file
post_multipart(builder, wait)
else
post_json(builder, wait)
end
end | ruby | def execute(builder = nil, wait = false)
raise TypeError, 'builder needs to be nil or like a Discordrb::Webhooks::Builder!' unless
builder.respond_to?(:file) && builder.respond_to?(:to_multipart_hash) || builder.respond_to?(:to_json_hash) || builder.nil?
builder ||= Builder.new
yield builder if block_given?
if builder.file
post_multipart(builder, wait)
else
post_json(builder, wait)
end
end | [
"def",
"execute",
"(",
"builder",
"=",
"nil",
",",
"wait",
"=",
"false",
")",
"raise",
"TypeError",
",",
"'builder needs to be nil or like a Discordrb::Webhooks::Builder!'",
"unless",
"builder",
".",
"respond_to?",
"(",
":file",
")",
"&&",
"builder",
".",
"respond_t... | Create a new webhook
@param url [String] The URL to post messages to.
@param id [Integer] The webhook's ID. Will only be used if `url` is not
set.
@param token [String] The webhook's authorisation token. Will only be used
if `url` is not set.
Executes the webhook this client points to with the given data.
@param builder [Builder, nil] The builder to start out with, or nil if one should be created anew.
@param wait [true, false] Whether Discord should wait for the message to be successfully received by clients, or
whether it should return immediately after sending the message.
@yield [builder] Gives the builder to the block to add additional steps, or to do the entire building process.
@yieldparam builder [Builder] The builder given as a parameter which is used as the initial step to start from.
@example Execute the webhook with an already existing builder
builder = Discordrb::Webhooks::Builder.new # ...
client.execute(builder)
@example Execute the webhook by building a new message
client.execute do |builder|
builder.content = 'Testing'
builder.username = 'discordrb'
builder.add_embed do |embed|
embed.timestamp = Time.now
embed.title = 'Testing'
embed.image = Discordrb::Webhooks::EmbedImage.new(url: 'https://i.imgur.com/PcMltU7.jpg')
end
end
@return [RestClient::Response] the response returned by Discord. | [
"Create",
"a",
"new",
"webhook"
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/webhooks/client.rb#L41-L54 | train | Execute the webhook. | [
30522,
13366,
15389,
1006,
12508,
1027,
9152,
2140,
1010,
3524,
1027,
6270,
1007,
5333,
2828,
2121,
29165,
30524,
12508,
999,
1005,
4983,
12508,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
5371,
1007,
1004,
1004,
12508,
1012,
6869,
1035,
2000... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/models/additional_recipient_receivable_refund.rb | SquareConnect.AdditionalRecipientReceivableRefund.refund_id= | def refund_id=(refund_id)
if refund_id.nil?
fail ArgumentError, "refund_id cannot be nil"
end
if refund_id.to_s.length < 1
fail ArgumentError, "invalid value for 'refund_id', the character length must be great than or equal to 1."
end
@refund_id = refund_id
end | ruby | def refund_id=(refund_id)
if refund_id.nil?
fail ArgumentError, "refund_id cannot be nil"
end
if refund_id.to_s.length < 1
fail ArgumentError, "invalid value for 'refund_id', the character length must be great than or equal to 1."
end
@refund_id = refund_id
end | [
"def",
"refund_id",
"=",
"(",
"refund_id",
")",
"if",
"refund_id",
".",
"nil?",
"fail",
"ArgumentError",
",",
"\"refund_id cannot be nil\"",
"end",
"if",
"refund_id",
".",
"to_s",
".",
"length",
"<",
"1",
"fail",
"ArgumentError",
",",
"\"invalid value for 'refund_... | Custom attribute writer method with validation
@param [Object] refund_id Value to be assigned | [
"Custom",
"attribute",
"writer",
"method",
"with",
"validation"
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/models/additional_recipient_receivable_refund.rb#L180-L190 | train | Set the refund_id of the refund. | [
30522,
13366,
25416,
8630,
1035,
8909,
1027,
1006,
25416,
8630,
1035,
8909,
1007,
2065,
25416,
8630,
1035,
8909,
1012,
9152,
2140,
1029,
8246,
6685,
2121,
29165,
1010,
1000,
25416,
8630,
1035,
8909,
3685,
2022,
9152,
2140,
1000,
2203,
2065,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_container_service/lib/2017-01-31/generated/azure_mgmt_container_service/container_services.rb | Azure::ContainerService::Mgmt::V2017_01_31.ContainerServices.create_or_update_async | def create_or_update_async(resource_group_name, container_service_name, parameters, custom_headers:nil)
# Send request
promise = begin_create_or_update_async(resource_group_name, container_service_name, parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::ContainerService::Mgmt::V2017_01_31::Models::ContainerService.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | ruby | def create_or_update_async(resource_group_name, container_service_name, parameters, custom_headers:nil)
# Send request
promise = begin_create_or_update_async(resource_group_name, container_service_name, parameters, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::ContainerService::Mgmt::V2017_01_31::Models::ContainerService.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | [
"def",
"create_or_update_async",
"(",
"resource_group_name",
",",
"container_service_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"container_service_name",
... | @param resource_group_name [String] The name of the resource group.
@param container_service_name [String] The name of the container service in
the specified subscription and resource group.
@param parameters [ContainerService] Parameters supplied to the Create or
Update a Container Service operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"resource_group_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"resource",
"group",
".",
"@param",
"container_service_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"container",
"service",
"in",
"the",
"specified",
"subscription",
"and"... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_service/lib/2017-01-31/generated/azure_mgmt_container_service/container_services.rb#L153-L169 | train | Creates or updates a container service. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
11661,
1035,
2326,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
roo-rb/roo | lib/roo/open_office.rb | Roo.OpenOffice.read_cells | def read_cells(sheet = default_sheet)
validate_sheet!(sheet)
return if @cells_read[sheet]
sheet_found = false
doc.xpath("//*[local-name()='table']").each do |ws|
next unless sheet == attribute(ws, 'name')
sheet_found = true
col = 1
row = 1
ws.children.each do |table_element|
case table_element.name
when 'table-column'
@style_defaults[sheet] << table_element.attributes['default-cell-style-name']
when 'table-row'
if table_element.attributes['number-rows-repeated']
skip_row = attribute(table_element, 'number-rows-repeated').to_s.to_i
row = row + skip_row - 1
end
table_element.children.each do |cell|
skip_col = attribute(cell, 'number-columns-repeated')
formula = attribute(cell, 'formula')
value_type = attribute(cell, 'value-type')
v = attribute(cell, 'value')
style_name = attribute(cell, 'style-name')
case value_type
when 'string'
str_v = ''
# insert \n if there is more than one paragraph
para_count = 0
cell.children.each do |str|
# begin comments
#=begin
#- <table:table-cell office:value-type="string">
# - <office:annotation office:display="true" draw:style-name="gr1" draw:text-style-name="P1" svg:width="1.1413in" svg:height="0.3902in" svg:x="2.0142in" svg:y="0in" draw:caption-point-x="-0.2402in" draw:caption-point-y="0.5661in">
# <dc:date>2011-09-20T00:00:00</dc:date>
# <text:p text:style-name="P1">Kommentar fuer B4</text:p>
# </office:annotation>
# <text:p>B4 (mit Kommentar)</text:p>
# </table:table-cell>
#=end
if str.name == 'annotation'
str.children.each do |annotation|
next unless annotation.name == 'p'
# @comment ist ein Hash mit Sheet als Key (wie bei @cell)
# innerhalb eines Elements besteht ein Eintrag aus einem
# weiteren Hash mit Key [row,col] und dem eigentlichen
# Kommentartext als Inhalt
@comment[sheet] = Hash.new unless @comment[sheet]
key = [row, col]
@comment[sheet][key] = annotation.text
end
end
# end comments
if str.name == 'p'
v = str.content
str_v += "\n" if para_count > 0
para_count += 1
if str.children.size > 1
str_v += children_to_string(str.children)
else
str.children.each do |child|
str_v += child.content #.text
end
end
str_v.gsub!(/'/, "'") # special case not supported by unescapeHTML
str_v = CGI.unescapeHTML(str_v)
end # == 'p'
end
when 'time'
cell.children.each do |str|
v = str.content if str.name == 'p'
end
when '', nil, 'date', 'percentage', 'float'
#
when 'boolean'
v = attribute(cell, 'boolean-value').to_s
end
if skip_col
if !v.nil? || cell.attributes['date-value']
0.upto(skip_col.to_i - 1) do |i|
set_cell_values(sheet, col, row, i, v, value_type, formula, cell, str_v, style_name)
end
end
col += (skip_col.to_i - 1)
end # if skip
set_cell_values(sheet, col, row, 0, v, value_type, formula, cell, str_v, style_name)
col += 1
end
row += 1
col = 1
end
end
end
doc.xpath("//*[local-name()='automatic-styles']").each do |style|
read_styles(style)
end
fail RangeError unless sheet_found
@cells_read[sheet] = true
@comments_read[sheet] = true
end | ruby | def read_cells(sheet = default_sheet)
validate_sheet!(sheet)
return if @cells_read[sheet]
sheet_found = false
doc.xpath("//*[local-name()='table']").each do |ws|
next unless sheet == attribute(ws, 'name')
sheet_found = true
col = 1
row = 1
ws.children.each do |table_element|
case table_element.name
when 'table-column'
@style_defaults[sheet] << table_element.attributes['default-cell-style-name']
when 'table-row'
if table_element.attributes['number-rows-repeated']
skip_row = attribute(table_element, 'number-rows-repeated').to_s.to_i
row = row + skip_row - 1
end
table_element.children.each do |cell|
skip_col = attribute(cell, 'number-columns-repeated')
formula = attribute(cell, 'formula')
value_type = attribute(cell, 'value-type')
v = attribute(cell, 'value')
style_name = attribute(cell, 'style-name')
case value_type
when 'string'
str_v = ''
# insert \n if there is more than one paragraph
para_count = 0
cell.children.each do |str|
# begin comments
#=begin
#- <table:table-cell office:value-type="string">
# - <office:annotation office:display="true" draw:style-name="gr1" draw:text-style-name="P1" svg:width="1.1413in" svg:height="0.3902in" svg:x="2.0142in" svg:y="0in" draw:caption-point-x="-0.2402in" draw:caption-point-y="0.5661in">
# <dc:date>2011-09-20T00:00:00</dc:date>
# <text:p text:style-name="P1">Kommentar fuer B4</text:p>
# </office:annotation>
# <text:p>B4 (mit Kommentar)</text:p>
# </table:table-cell>
#=end
if str.name == 'annotation'
str.children.each do |annotation|
next unless annotation.name == 'p'
# @comment ist ein Hash mit Sheet als Key (wie bei @cell)
# innerhalb eines Elements besteht ein Eintrag aus einem
# weiteren Hash mit Key [row,col] und dem eigentlichen
# Kommentartext als Inhalt
@comment[sheet] = Hash.new unless @comment[sheet]
key = [row, col]
@comment[sheet][key] = annotation.text
end
end
# end comments
if str.name == 'p'
v = str.content
str_v += "\n" if para_count > 0
para_count += 1
if str.children.size > 1
str_v += children_to_string(str.children)
else
str.children.each do |child|
str_v += child.content #.text
end
end
str_v.gsub!(/'/, "'") # special case not supported by unescapeHTML
str_v = CGI.unescapeHTML(str_v)
end # == 'p'
end
when 'time'
cell.children.each do |str|
v = str.content if str.name == 'p'
end
when '', nil, 'date', 'percentage', 'float'
#
when 'boolean'
v = attribute(cell, 'boolean-value').to_s
end
if skip_col
if !v.nil? || cell.attributes['date-value']
0.upto(skip_col.to_i - 1) do |i|
set_cell_values(sheet, col, row, i, v, value_type, formula, cell, str_v, style_name)
end
end
col += (skip_col.to_i - 1)
end # if skip
set_cell_values(sheet, col, row, 0, v, value_type, formula, cell, str_v, style_name)
col += 1
end
row += 1
col = 1
end
end
end
doc.xpath("//*[local-name()='automatic-styles']").each do |style|
read_styles(style)
end
fail RangeError unless sheet_found
@cells_read[sheet] = true
@comments_read[sheet] = true
end | [
"def",
"read_cells",
"(",
"sheet",
"=",
"default_sheet",
")",
"validate_sheet!",
"(",
"sheet",
")",
"return",
"if",
"@cells_read",
"[",
"sheet",
"]",
"sheet_found",
"=",
"false",
"doc",
".",
"xpath",
"(",
"\"//*[local-name()='table']\"",
")",
".",
"each",
"do"... | read all cells in the selected sheet
--
the following construct means '4 blanks'
some content <text:s text:c="3"/>
++ | [
"read",
"all",
"cells",
"in",
"the",
"selected",
"sheet",
"--",
"the",
"following",
"construct",
"means",
"4",
"blanks",
"some",
"content",
"<text",
":",
"s",
"text",
":",
"c",
"=",
"3",
"/",
">",
"++"
] | 4ec1104f0c3c2a29711c0c907371cd2be12bcc3c | https://github.com/roo-rb/roo/blob/4ec1104f0c3c2a29711c0c907371cd2be12bcc3c/lib/roo/open_office.rb#L454-L557 | train | Read cells from a worksheet | [
30522,
13366,
3191,
1035,
4442,
1006,
7123,
1027,
12398,
1035,
7123,
1007,
9398,
3686,
1035,
7123,
999,
1006,
7123,
1007,
2709,
2065,
1030,
4442,
1035,
3191,
1031,
7123,
1033,
7123,
1035,
2179,
1027,
6270,
9986,
1012,
26726,
8988,
1006,
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... |
rails/rails | activejob/lib/active_job/enqueuing.rb | ActiveJob.Enqueuing.enqueue | def enqueue(options = {})
self.scheduled_at = options[:wait].seconds.from_now.to_f if options[:wait]
self.scheduled_at = options[:wait_until].to_f if options[:wait_until]
self.queue_name = self.class.queue_name_from_part(options[:queue]) if options[:queue]
self.priority = options[:priority].to_i if options[:priority]
successfully_enqueued = false
run_callbacks :enqueue do
if scheduled_at
self.class.queue_adapter.enqueue_at self, scheduled_at
else
self.class.queue_adapter.enqueue self
end
successfully_enqueued = true
end
if successfully_enqueued
self
else
if self.class.return_false_on_aborted_enqueue
false
else
ActiveSupport::Deprecation.warn(
"Rails 6.1 will return false when the enqueuing is aborted. Make sure your code doesn't depend on it" \
" returning the instance of the job and set `config.active_job.return_false_on_aborted_enqueue = true`" \
" to remove the deprecations."
)
self
end
end
end | ruby | def enqueue(options = {})
self.scheduled_at = options[:wait].seconds.from_now.to_f if options[:wait]
self.scheduled_at = options[:wait_until].to_f if options[:wait_until]
self.queue_name = self.class.queue_name_from_part(options[:queue]) if options[:queue]
self.priority = options[:priority].to_i if options[:priority]
successfully_enqueued = false
run_callbacks :enqueue do
if scheduled_at
self.class.queue_adapter.enqueue_at self, scheduled_at
else
self.class.queue_adapter.enqueue self
end
successfully_enqueued = true
end
if successfully_enqueued
self
else
if self.class.return_false_on_aborted_enqueue
false
else
ActiveSupport::Deprecation.warn(
"Rails 6.1 will return false when the enqueuing is aborted. Make sure your code doesn't depend on it" \
" returning the instance of the job and set `config.active_job.return_false_on_aborted_enqueue = true`" \
" to remove the deprecations."
)
self
end
end
end | [
"def",
"enqueue",
"(",
"options",
"=",
"{",
"}",
")",
"self",
".",
"scheduled_at",
"=",
"options",
"[",
":wait",
"]",
".",
"seconds",
".",
"from_now",
".",
"to_f",
"if",
"options",
"[",
":wait",
"]",
"self",
".",
"scheduled_at",
"=",
"options",
"[",
... | Enqueues the job to be performed by the queue adapter.
==== Options
* <tt>:wait</tt> - Enqueues the job with the specified delay
* <tt>:wait_until</tt> - Enqueues the job at the time specified
* <tt>:queue</tt> - Enqueues the job on the specified queue
* <tt>:priority</tt> - Enqueues the job with the specified priority
==== Examples
my_job_instance.enqueue
my_job_instance.enqueue wait: 5.minutes
my_job_instance.enqueue queue: :important
my_job_instance.enqueue wait_until: Date.tomorrow.midnight
my_job_instance.enqueue priority: 10 | [
"Enqueues",
"the",
"job",
"to",
"be",
"performed",
"by",
"the",
"queue",
"adapter",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activejob/lib/active_job/enqueuing.rb#L46-L78 | train | Enqueue a job to the queue | [
30522,
13366,
4372,
4226,
5657,
1006,
7047,
1027,
1063,
1065,
1007,
2969,
1012,
5115,
1035,
2012,
1027,
7047,
1031,
1024,
3524,
1033,
1012,
3823,
1012,
2013,
1035,
2085,
1012,
2000,
1035,
1042,
2065,
7047,
1031,
1024,
3524,
1033,
2969,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_face/lib/1.0/generated/azure_cognitiveservices_face/snapshot_operations.rb | Azure::CognitiveServices::Face::V1_0.SnapshotOperations.update_with_http_info | def update_with_http_info(snapshot_id, apply_scope:nil, user_data:nil, custom_headers:nil)
update_async(snapshot_id, apply_scope:apply_scope, user_data:user_data, custom_headers:custom_headers).value!
end | ruby | def update_with_http_info(snapshot_id, apply_scope:nil, user_data:nil, custom_headers:nil)
update_async(snapshot_id, apply_scope:apply_scope, user_data:user_data, custom_headers:custom_headers).value!
end | [
"def",
"update_with_http_info",
"(",
"snapshot_id",
",",
"apply_scope",
":",
"nil",
",",
"user_data",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"update_async",
"(",
"snapshot_id",
",",
"apply_scope",
":apply_scope",
",",
"user_data",
":user_data",
",",
... | Update the information of a snapshot. Only the source subscription who took
the snapshot can update the snapshot.
@param snapshot_id Id referencing a particular snapshot.
@param apply_scope Array of the target Face subscription ids for the
snapshot, specified by the user who created the snapshot when calling
Snapshot - Take. For each snapshot, only subscriptions included in the
applyScope of Snapshot - Take can apply it.
@param user_data [String] User specified data about the snapshot for any
purpose. Length should not exceed 16KB.
@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. | [
"Update",
"the",
"information",
"of",
"a",
"snapshot",
".",
"Only",
"the",
"source",
"subscription",
"who",
"took",
"the",
"snapshot",
"can",
"update",
"the",
"snapshot",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_face/lib/1.0/generated/azure_cognitiveservices_face/snapshot_operations.rb#L499-L501 | train | Updates a snapshot s segmentation. | [
30522,
13366,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
20057,
12326,
1035,
8909,
1010,
6611,
1035,
9531,
1024,
9152,
2140,
1010,
5310,
1035,
2951,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
10651,
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_automation/lib/2015-10-31/generated/azure_mgmt_automation/connection_operations.rb | Azure::Automation::Mgmt::V2015_10_31.ConnectionOperations.delete_with_http_info | def delete_with_http_info(resource_group_name, automation_account_name, connection_name, custom_headers:nil)
delete_async(resource_group_name, automation_account_name, connection_name, custom_headers:custom_headers).value!
end | ruby | def delete_with_http_info(resource_group_name, automation_account_name, connection_name, custom_headers:nil)
delete_async(resource_group_name, automation_account_name, connection_name, custom_headers:custom_headers).value!
end | [
"def",
"delete_with_http_info",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"connection_name",
",",
"custom_headers",
":",
"nil",
")",
"delete_async",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"connection_name",
",",
"custom_heade... | Delete the connection.
@param resource_group_name [String] Name of an Azure Resource group.
@param automation_account_name [String] The name of the automation account.
@param connection_name [String] The name of connection.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Delete",
"the",
"connection",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/connection_operations.rb#L51-L53 | train | Deletes the specified connection. | [
30522,
13366,
3972,
12870,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
19309,
1035,
4070,
1035,
2171,
1010,
4434,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
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_scheduler/lib/2016-03-01/generated/azure_mgmt_scheduler/job_collections.rb | Azure::Scheduler::Mgmt::V2016_03_01.JobCollections.create_or_update | def create_or_update(resource_group_name, job_collection_name, job_collection, custom_headers:nil)
response = create_or_update_async(resource_group_name, job_collection_name, job_collection, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_or_update(resource_group_name, job_collection_name, job_collection, custom_headers:nil)
response = create_or_update_async(resource_group_name, job_collection_name, job_collection, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_or_update",
"(",
"resource_group_name",
",",
"job_collection_name",
",",
"job_collection",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_or_update_async",
"(",
"resource_group_name",
",",
"job_collection_name",
",",
"job_collection",
",",... | Provisions a new job collection or updates an existing job collection.
@param resource_group_name [String] The resource group name.
@param job_collection_name [String] The job collection name.
@param job_collection [JobCollectionDefinition] The job collection
definition.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [JobCollectionDefinition] operation results. | [
"Provisions",
"a",
"new",
"job",
"collection",
"or",
"updates",
"an",
"existing",
"job",
"collection",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_scheduler/lib/2016-03-01/generated/azure_mgmt_scheduler/job_collections.rb#L300-L303 | train | Creates or updates a job collection. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3105,
1035,
3074,
1035,
2171,
1010,
3105,
1035,
3074,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3443,
1035,
2030,
1035,
10651,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/generator/entry.rb | GitHubChangelogGenerator.Entry.default_sections | def default_sections
[
Section.new(name: "summary", prefix: @options[:summary_prefix], labels: @options[:summary_labels], options: @options, body_only: true),
Section.new(name: "breaking", prefix: @options[:breaking_prefix], labels: @options[:breaking_labels], options: @options),
Section.new(name: "enhancements", prefix: @options[:enhancement_prefix], labels: @options[:enhancement_labels], options: @options),
Section.new(name: "bugs", prefix: @options[:bug_prefix], labels: @options[:bug_labels], options: @options),
Section.new(name: "deprecated", prefix: @options[:deprecated_prefix], labels: @options[:deprecated_labels], options: @options),
Section.new(name: "removed", prefix: @options[:removed_prefix], labels: @options[:removed_labels], options: @options),
Section.new(name: "security", prefix: @options[:security_prefix], labels: @options[:security_labels], options: @options)
]
end | ruby | def default_sections
[
Section.new(name: "summary", prefix: @options[:summary_prefix], labels: @options[:summary_labels], options: @options, body_only: true),
Section.new(name: "breaking", prefix: @options[:breaking_prefix], labels: @options[:breaking_labels], options: @options),
Section.new(name: "enhancements", prefix: @options[:enhancement_prefix], labels: @options[:enhancement_labels], options: @options),
Section.new(name: "bugs", prefix: @options[:bug_prefix], labels: @options[:bug_labels], options: @options),
Section.new(name: "deprecated", prefix: @options[:deprecated_prefix], labels: @options[:deprecated_labels], options: @options),
Section.new(name: "removed", prefix: @options[:removed_prefix], labels: @options[:removed_labels], options: @options),
Section.new(name: "security", prefix: @options[:security_prefix], labels: @options[:security_labels], options: @options)
]
end | [
"def",
"default_sections",
"[",
"Section",
".",
"new",
"(",
"name",
":",
"\"summary\"",
",",
"prefix",
":",
"@options",
"[",
":summary_prefix",
"]",
",",
"labels",
":",
"@options",
"[",
":summary_labels",
"]",
",",
"options",
":",
"@options",
",",
"body_only... | Default sections to used when --configure-sections is not set.
@return [Array] Section objects. | [
"Default",
"sections",
"to",
"used",
"when",
"--",
"configure",
"-",
"sections",
"is",
"not",
"set",
"."
] | f18c64b5cc0d7473b059275b88385ac11ca8b564 | https://github.com/github-changelog-generator/github-changelog-generator/blob/f18c64b5cc0d7473b059275b88385ac11ca8b564/lib/github_changelog_generator/generator/entry.rb#L126-L136 | train | Returns a list of default sections | [
30522,
13366,
12398,
1035,
5433,
1031,
2930,
1012,
2047,
1006,
2171,
1024,
1000,
12654,
1000,
1010,
17576,
1024,
1030,
7047,
1031,
1024,
12654,
1035,
17576,
1033,
1010,
10873,
1024,
1030,
7047,
1031,
1024,
12654,
1035,
10873,
1033,
1010,
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... |
realm/jazzy | lib/jazzy/source_declaration.rb | Jazzy.SourceDeclaration.fully_qualified_name_regexp | def fully_qualified_name_regexp
Regexp.new(namespace_path.map(&:name)
.map { |n| Regexp.escape(n) }
.join('(?:<.*?>)?\.'))
end | ruby | def fully_qualified_name_regexp
Regexp.new(namespace_path.map(&:name)
.map { |n| Regexp.escape(n) }
.join('(?:<.*?>)?\.'))
end | [
"def",
"fully_qualified_name_regexp",
"Regexp",
".",
"new",
"(",
"namespace_path",
".",
"map",
"(",
":name",
")",
".",
"map",
"{",
"|",
"n",
"|",
"Regexp",
".",
"escape",
"(",
"n",
")",
"}",
".",
"join",
"(",
"'(?:<.*?>)?\\.'",
")",
")",
"end"
] | :name doesn't include any generic type params.
This regexp matches any generic type params in parent names. | [
":",
"name",
"doesn",
"t",
"include",
"any",
"generic",
"type",
"params",
".",
"This",
"regexp",
"matches",
"any",
"generic",
"type",
"params",
"in",
"parent",
"names",
"."
] | e8744dbdb78814b237e8d57a82d40953560e9143 | https://github.com/realm/jazzy/blob/e8744dbdb78814b237e8d57a82d40953560e9143/lib/jazzy/source_declaration.rb#L57-L61 | train | Returns a regexp that matches the full qualified name of the namespace. | [
30522,
13366,
3929,
1035,
4591,
1035,
2171,
1035,
19723,
10288,
2361,
19723,
10288,
2361,
1012,
2047,
1006,
3415,
15327,
1035,
4130,
1012,
4949,
1006,
1004,
1024,
2171,
1007,
1012,
4949,
1063,
1064,
1050,
1064,
19723,
10288,
2361,
1012,
401... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.create_category | def create_category(location_id, body, opts = {})
data, _status_code, _headers = create_category_with_http_info(location_id, body, opts)
return data
end | ruby | def create_category(location_id, body, opts = {})
data, _status_code, _headers = create_category_with_http_info(location_id, body, opts)
return data
end | [
"def",
"create_category",
"(",
"location_id",
",",
"body",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"create_category_with_http_info",
"(",
"location_id",
",",
"body",
",",
"opts",
")",
"return",
"data",
"end"
] | CreateCategory
Creates an item category.
@param location_id The ID of the location to create an item for.
@param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
@param [Hash] opts the optional parameters
@return [V1Category] | [
"CreateCategory",
"Creates",
"an",
"item",
"category",
"."
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/v1_items_api.rb#L215-L218 | train | Creates a category | [
30522,
13366,
3443,
1035,
4696,
1006,
3295,
1035,
8909,
1010,
2303,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
3443,
1035,
4696,
1035,
2007,
1035,
8299,
1035,
18558,
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... |
aasm/aasm | lib/aasm/base.rb | AASM.Base.state | def state(*args)
names, options = interpret_state_args(args)
names.each do |name|
@state_machine.add_state(name, klass, options)
aasm_name = @name.to_sym
state = name.to_sym
method_name = namespace? ? "#{namespace}_#{name}" : name
safely_define_method klass, "#{method_name}?", -> do
aasm(aasm_name).current_state == state
end
const_name = namespace? ? "STATE_#{namespace.upcase}_#{name.upcase}" : "STATE_#{name.upcase}"
unless klass.const_defined?(const_name)
klass.const_set(const_name, name)
end
end
end | ruby | def state(*args)
names, options = interpret_state_args(args)
names.each do |name|
@state_machine.add_state(name, klass, options)
aasm_name = @name.to_sym
state = name.to_sym
method_name = namespace? ? "#{namespace}_#{name}" : name
safely_define_method klass, "#{method_name}?", -> do
aasm(aasm_name).current_state == state
end
const_name = namespace? ? "STATE_#{namespace.upcase}_#{name.upcase}" : "STATE_#{name.upcase}"
unless klass.const_defined?(const_name)
klass.const_set(const_name, name)
end
end
end | [
"def",
"state",
"(",
"*",
"args",
")",
"names",
",",
"options",
"=",
"interpret_state_args",
"(",
"args",
")",
"names",
".",
"each",
"do",
"|",
"name",
"|",
"@state_machine",
".",
"add_state",
"(",
"name",
",",
"klass",
",",
"options",
")",
"aasm_name",
... | define a state
args
[0] state
[1] options (or nil)
or
[0] state
[1..] state | [
"define",
"a",
"state",
"args",
"[",
"0",
"]",
"state",
"[",
"1",
"]",
"options",
"(",
"or",
"nil",
")",
"or",
"[",
"0",
"]",
"state",
"[",
"1",
"..",
"]",
"state"
] | 6a1000b489c6b2e205a7b142478a4b4e207c3dbd | https://github.com/aasm/aasm/blob/6a1000b489c6b2e205a7b142478a4b4e207c3dbd/lib/aasm/base.rb#L92-L110 | train | Add a state to the current state machine | [
30522,
13366,
2110,
1006,
1008,
12098,
5620,
1007,
3415,
1010,
7047,
1027,
17841,
1035,
2110,
1035,
12098,
5620,
1006,
12098,
5620,
1007,
3415,
1012,
2169,
30524,
2171,
1010,
1047,
27102,
1010,
7047,
1007,
9779,
6491,
1035,
2171,
1027,
1030... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
awesome-print/awesome_print | lib/awesome_print/colorize.rb | AwesomePrint.Colorize.colorize | def colorize(str, type)
str = CGI.escapeHTML(str) if options[:html]
if options[:plain] || !options[:color][type] || !inspector.colorize?
str
#
# Check if the string color method is defined by awesome_print and accepts
# html parameter or it has been overriden by some gem such as colorize.
#
elsif str.method(options[:color][type]).arity == -1 # Accepts html parameter.
str.send(options[:color][type], options[:html])
else
str = %Q|<kbd style="color:#{options[:color][type]}">#{str}</kbd>| if options[:html]
str.send(options[:color][type])
end
end | ruby | def colorize(str, type)
str = CGI.escapeHTML(str) if options[:html]
if options[:plain] || !options[:color][type] || !inspector.colorize?
str
#
# Check if the string color method is defined by awesome_print and accepts
# html parameter or it has been overriden by some gem such as colorize.
#
elsif str.method(options[:color][type]).arity == -1 # Accepts html parameter.
str.send(options[:color][type], options[:html])
else
str = %Q|<kbd style="color:#{options[:color][type]}">#{str}</kbd>| if options[:html]
str.send(options[:color][type])
end
end | [
"def",
"colorize",
"(",
"str",
",",
"type",
")",
"str",
"=",
"CGI",
".",
"escapeHTML",
"(",
"str",
")",
"if",
"options",
"[",
":html",
"]",
"if",
"options",
"[",
":plain",
"]",
"||",
"!",
"options",
"[",
":color",
"]",
"[",
"type",
"]",
"||",
"!"... | Pick the color and apply it to the given string as necessary.
------------------------------------------------------------------------------ | [
"Pick",
"the",
"color",
"and",
"apply",
"it",
"to",
"the",
"given",
"string",
"as",
"necessary",
".",
"------------------------------------------------------------------------------"
] | 4564fd74721562cbef2443f7d97109bf9192343d | https://github.com/awesome-print/awesome_print/blob/4564fd74721562cbef2443f7d97109bf9192343d/lib/awesome_print/colorize.rb#L8-L22 | train | Returns a string with the colorized string | [
30522,
13366,
3609,
4697,
1006,
2358,
2099,
1010,
2828,
1007,
2358,
2099,
1027,
1039,
5856,
1012,
4019,
11039,
19968,
1006,
2358,
2099,
1007,
2065,
7047,
1031,
1024,
16129,
1033,
2065,
7047,
1031,
1024,
5810,
1033,
1064,
1064,
999,
7047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
tongueroo/ufo | lib/ufo/ship.rb | Ufo.Ship.stop_old_tasks | def stop_old_tasks
# only works when deployment is blocking
return unless @options[:wait]
Thread.new do
stop = Ufo::Stop.new(@service, @options.merge(mute: true))
while true
stop.log "checking for old tasks and waiting for 10 seconds"
stop.run
sleep 10
end
end
end | ruby | def stop_old_tasks
# only works when deployment is blocking
return unless @options[:wait]
Thread.new do
stop = Ufo::Stop.new(@service, @options.merge(mute: true))
while true
stop.log "checking for old tasks and waiting for 10 seconds"
stop.run
sleep 10
end
end
end | [
"def",
"stop_old_tasks",
"# only works when deployment is blocking",
"return",
"unless",
"@options",
"[",
":wait",
"]",
"Thread",
".",
"new",
"do",
"stop",
"=",
"Ufo",
"::",
"Stop",
".",
"new",
"(",
"@service",
",",
"@options",
".",
"merge",
"(",
"mute",
":",
... | Start a thread that will poll for ecs deployments and kill of tasks
in old deployments.
This must be done in a thread because the stack update process is blocking. | [
"Start",
"a",
"thread",
"that",
"will",
"poll",
"for",
"ecs",
"deployments",
"and",
"kill",
"of",
"tasks",
"in",
"old",
"deployments",
".",
"This",
"must",
"be",
"done",
"in",
"a",
"thread",
"because",
"the",
"stack",
"update",
"process",
"is",
"blocking",... | 16ac3dad28edcab2693c0e7d89a1971aca65b8f9 | https://github.com/tongueroo/ufo/blob/16ac3dad28edcab2693c0e7d89a1971aca65b8f9/lib/ufo/ship.rb#L40-L52 | train | stop old tasks | [
30522,
13366,
2644,
1035,
2214,
1035,
8518,
1001,
2069,
2573,
2043,
10813,
2003,
10851,
2709,
4983,
1030,
7047,
1031,
1024,
3524,
1033,
11689,
1012,
2047,
2079,
2644,
1027,
24321,
1024,
1024,
2644,
1012,
2047,
1006,
1030,
2326,
1010,
1030,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_media_services/lib/2018-07-01/generated/azure_mgmt_media_services/streaming_endpoints.rb | Azure::MediaServices::Mgmt::V2018_07_01.StreamingEndpoints.stop | def stop(resource_group_name, account_name, streaming_endpoint_name, custom_headers:nil)
response = stop_async(resource_group_name, account_name, streaming_endpoint_name, custom_headers:custom_headers).value!
nil
end | ruby | def stop(resource_group_name, account_name, streaming_endpoint_name, custom_headers:nil)
response = stop_async(resource_group_name, account_name, streaming_endpoint_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"stop",
"(",
"resource_group_name",
",",
"account_name",
",",
"streaming_endpoint_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"stop_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"streaming_endpoint_name",
",",
"custom_headers",... | Stop StreamingEndpoint
Stops an existing StreamingEndpoint.
@param resource_group_name [String] The name of the resource group within the
Azure subscription.
@param account_name [String] The Media Services account name.
@param streaming_endpoint_name [String] The name of the StreamingEndpoint.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Stop",
"StreamingEndpoint"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_media_services/lib/2018-07-01/generated/azure_mgmt_media_services/streaming_endpoints.rb#L441-L444 | train | Stops the streaming endpoint. | [
30522,
13366,
2644,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
11058,
1035,
2203,
8400,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2644,
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 | data/azure_cognitiveservices_contentmoderator/lib/1.0/generated/azure_cognitiveservices_contentmoderator/list_management_term.rb | Azure::CognitiveServices::ContentModerator::V1_0.ListManagementTerm.get_all_terms_with_http_info | def get_all_terms_with_http_info(list_id, language, offset:nil, limit:nil, custom_headers:nil)
get_all_terms_async(list_id, language, offset:offset, limit:limit, custom_headers:custom_headers).value!
end | ruby | def get_all_terms_with_http_info(list_id, language, offset:nil, limit:nil, custom_headers:nil)
get_all_terms_async(list_id, language, offset:offset, limit:limit, custom_headers:custom_headers).value!
end | [
"def",
"get_all_terms_with_http_info",
"(",
"list_id",
",",
"language",
",",
"offset",
":",
"nil",
",",
"limit",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"get_all_terms_async",
"(",
"list_id",
",",
"language",
",",
"offset",
":",
"offset",
",",
"l... | Gets all terms from the list with list Id equal to the list Id passed.
@param list_id [String] List Id of the image list.
@param language [String] Language of the terms.
@param offset [Integer] The pagination start index.
@param limit [Integer] The max limit.
@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",
"terms",
"from",
"the",
"list",
"with",
"list",
"Id",
"equal",
"to",
"the",
"list",
"Id",
"passed",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_contentmoderator/lib/1.0/generated/azure_cognitiveservices_contentmoderator/list_management_term.rb#L252-L254 | train | Gets all terms of a list. | [
30522,
13366,
2131,
1035,
2035,
1035,
3408,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2862,
1035,
8909,
1010,
2653,
1010,
16396,
1024,
9152,
2140,
1010,
5787,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/gallery_images.rb | Azure::Labservices::Mgmt::V2018_10_15.GalleryImages.delete_with_http_info | def delete_with_http_info(resource_group_name, lab_account_name, gallery_image_name, custom_headers:nil)
delete_async(resource_group_name, lab_account_name, gallery_image_name, custom_headers:custom_headers).value!
end | ruby | def delete_with_http_info(resource_group_name, lab_account_name, gallery_image_name, custom_headers:nil)
delete_async(resource_group_name, lab_account_name, gallery_image_name, custom_headers:custom_headers).value!
end | [
"def",
"delete_with_http_info",
"(",
"resource_group_name",
",",
"lab_account_name",
",",
"gallery_image_name",
",",
"custom_headers",
":",
"nil",
")",
"delete_async",
"(",
"resource_group_name",
",",
"lab_account_name",
",",
"gallery_image_name",
",",
"custom_headers",
"... | Delete gallery image.
@param resource_group_name [String] The name of the resource group.
@param lab_account_name [String] The name of the lab Account.
@param gallery_image_name [String] The name of the gallery Image.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Delete",
"gallery",
"image",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_labservices/lib/2018-10-15/generated/azure_mgmt_labservices/gallery_images.rb#L385-L387 | train | Deletes a gallery image. | [
30522,
13366,
3972,
12870,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
6845,
1035,
4070,
1035,
2171,
1010,
3916,
1035,
3746,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
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_network/lib/2016-12-01/generated/azure_mgmt_network/virtual_network_gateways.rb | Azure::Network::Mgmt::V2016_12_01.VirtualNetworkGateways.begin_create_or_update_with_http_info | def begin_create_or_update_with_http_info(resource_group_name, virtual_network_gateway_name, parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, virtual_network_gateway_name, parameters, custom_headers:custom_headers).value!
end | ruby | def begin_create_or_update_with_http_info(resource_group_name, virtual_network_gateway_name, parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, virtual_network_gateway_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_create_or_update_with_http_info",
"(",
"resource_group_name",
",",
"virtual_network_gateway_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"virtual_network_gateway_name",
",",
"par... | Creates or updates a virtual network gateway in the specified resource group.
@param resource_group_name [String] The name of the resource group.
@param virtual_network_gateway_name [String] The name of the virtual network
gateway.
@param parameters [VirtualNetworkGateway] Parameters supplied to create or
update virtual network gateway 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. | [
"Creates",
"or",
"updates",
"a",
"virtual",
"network",
"gateway",
"in",
"the",
"specified",
"resource",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2016-12-01/generated/azure_mgmt_network/virtual_network_gateways.rb#L632-L634 | train | Creates or updates a virtual network gateway. | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7484,
1035,
2897,
1035,
11909,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_reimage_all | def begin_reimage_all(resource_group_name, vm_scale_set_name, custom_headers:nil)
response = begin_reimage_all_async(resource_group_name, vm_scale_set_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_reimage_all(resource_group_name, vm_scale_set_name, custom_headers:nil)
response = begin_reimage_all_async(resource_group_name, vm_scale_set_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_reimage_all",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_reimage_all_async",
"(",
"resource_group_name",
",",
"vm_scale_set_name",
",",
"custom_headers",
":custom_headers",
")",
".",
... | Reimages all the disks ( including data disks ) in the virtual machines in a
VM scale set. This operation is only supported for managed disks.
@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 custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OperationStatusResponse] operation results. | [
"Reimages",
"all",
"the",
"disks",
"(",
"including",
"data",
"disks",
")",
"in",
"the",
"virtual",
"machines",
"in",
"a",
"VM",
"scale",
"set",
".",
"This",
"operation",
"is",
"only",
"supported",
"for",
"managed",
"disks",
"."
] | 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#L1895-L1898 | train | Reimage all virtual machines in a VM scale set. | [
30522,
13366,
4088,
1035,
24964,
26860,
1035,
2035,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
4094,
1035,
2275,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
24964,
26860,
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_container_registry/lib/2018-02-01-preview/generated/azure_mgmt_container_registry/build_tasks.rb | Azure::ContainerRegistry::Mgmt::V2018_02_01_preview.BuildTasks.create | def create(resource_group_name, registry_name, build_task_name, build_task_create_parameters, custom_headers:nil)
response = create_async(resource_group_name, registry_name, build_task_name, build_task_create_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create(resource_group_name, registry_name, build_task_name, build_task_create_parameters, custom_headers:nil)
response = create_async(resource_group_name, registry_name, build_task_name, build_task_create_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create",
"(",
"resource_group_name",
",",
"registry_name",
",",
"build_task_name",
",",
"build_task_create_parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"build_task_na... | Creates a build task for 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 build_task_name [String] The name of the container registry build
task.
@param build_task_create_parameters [BuildTask] The parameters for creating a
build task.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [BuildTask] operation results. | [
"Creates",
"a",
"build",
"task",
"for",
"a",
"container",
"registry",
"with",
"the",
"specified",
"parameters",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_registry/lib/2018-02-01-preview/generated/azure_mgmt_container_registry/build_tasks.rb#L254-L257 | train | Creates a build task. | [
30522,
13366,
3443,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
3857,
1035,
4708,
1035,
2171,
1010,
3857,
1035,
4708,
1035,
3443,
1035,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3443,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-12-01/generated/azure_mgmt_network/p2s_vpn_gateways.rb | Azure::Network::Mgmt::V2018_12_01.P2sVpnGateways.update_tags | def update_tags(resource_group_name, gateway_name, p2svpn_gateway_parameters, custom_headers:nil)
response = update_tags_async(resource_group_name, gateway_name, p2svpn_gateway_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def update_tags(resource_group_name, gateway_name, p2svpn_gateway_parameters, custom_headers:nil)
response = update_tags_async(resource_group_name, gateway_name, p2svpn_gateway_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"update_tags",
"(",
"resource_group_name",
",",
"gateway_name",
",",
"p2svpn_gateway_parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"update_tags_async",
"(",
"resource_group_name",
",",
"gateway_name",
",",
"p2svpn_gateway_parameters",
",",
... | Updates virtual wan p2s vpn gateway tags.
@param resource_group_name [String] The resource group name of the
P2SVpnGateway.
@param gateway_name [String] The name of the gateway.
@param p2svpn_gateway_parameters [TagsObject] Parameters supplied to update a
virtual wan p2s vpn gateway tags.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [P2SVpnGateway] operation results. | [
"Updates",
"virtual",
"wan",
"p2s",
"vpn",
"gateway",
"tags",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-12-01/generated/azure_mgmt_network/p2s_vpn_gateways.rb#L181-L184 | train | Updates a P2SVpnGateway tags. | [
30522,
13366,
10651,
1035,
22073,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
11909,
1035,
2171,
1010,
1052,
2475,
2015,
2615,
2361,
2078,
1035,
11909,
1035,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
10651,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activesupport/lib/active_support/duration.rb | ActiveSupport.Duration.+ | def +(other)
if Duration === other
parts = @parts.dup
other.parts.each do |(key, value)|
parts[key] += value
end
Duration.new(value + other.value, parts)
else
seconds = @parts[:seconds] + other
Duration.new(value + other, @parts.merge(seconds: seconds))
end
end | ruby | def +(other)
if Duration === other
parts = @parts.dup
other.parts.each do |(key, value)|
parts[key] += value
end
Duration.new(value + other.value, parts)
else
seconds = @parts[:seconds] + other
Duration.new(value + other, @parts.merge(seconds: seconds))
end
end | [
"def",
"+",
"(",
"other",
")",
"if",
"Duration",
"===",
"other",
"parts",
"=",
"@parts",
".",
"dup",
"other",
".",
"parts",
".",
"each",
"do",
"|",
"(",
"key",
",",
"value",
")",
"|",
"parts",
"[",
"key",
"]",
"+=",
"value",
"end",
"Duration",
".... | Compares one Duration with another or a Numeric to this Duration.
Numeric values are treated as seconds.
Adds another Duration or a Numeric to this Duration. Numeric values
are treated as seconds. | [
"Compares",
"one",
"Duration",
"with",
"another",
"or",
"a",
"Numeric",
"to",
"this",
"Duration",
".",
"Numeric",
"values",
"are",
"treated",
"as",
"seconds",
".",
"Adds",
"another",
"Duration",
"or",
"a",
"Numeric",
"to",
"this",
"Duration",
".",
"Numeric",... | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/duration.rb#L238-L249 | train | Add two Duration objects. | [
30522,
13366,
1009,
1006,
2060,
1007,
2065,
9367,
1027,
1027,
1027,
2060,
3033,
1027,
1030,
3033,
1012,
4241,
2361,
2060,
1012,
3033,
1012,
2169,
2079,
1064,
1006,
3145,
1010,
3643,
1007,
1064,
3033,
1031,
3145,
1033,
1009,
1027,
3643,
22... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
piotrmurach/github | lib/github_api/client/repos/releases/assets.rb | Github.Client::Repos::Releases::Assets.edit | def edit(*args)
arguments(args, required: [:owner, :repo, :id]) do
permit VALID_ASSET_PARAM_NAMES
end
patch_request("/repos/#{arguments.owner}/#{arguments.repo}/releases/assets/#{arguments.id}", arguments.params)
end | ruby | def edit(*args)
arguments(args, required: [:owner, :repo, :id]) do
permit VALID_ASSET_PARAM_NAMES
end
patch_request("/repos/#{arguments.owner}/#{arguments.repo}/releases/assets/#{arguments.id}", arguments.params)
end | [
"def",
"edit",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":owner",
",",
":repo",
",",
":id",
"]",
")",
"do",
"permit",
"VALID_ASSET_PARAM_NAMES",
"end",
"patch_request",
"(",
"\"/repos/#{arguments.owner}/#{arguments.repo}/releases... | Edit a release asset
Users with push access to the repository can edit a release asset.
@param [Hash] params
@input params [String] :name
Required. The file name of the asset.
@input params [String] :label
An alternate short description of the asset.
Used in place of the filename.
@example
github = Github.new
github.repos.releases.assets.edit 'owner', 'repo', 'id',
name: "foo-1.0.0-osx.zip",
label: "Mac binary"
@api public | [
"Edit",
"a",
"release",
"asset"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/repos/releases/assets.rb#L114-L120 | train | Edit an asset | [
30522,
13366,
10086,
1006,
1008,
12098,
5620,
1007,
9918,
1006,
12098,
5620,
1010,
3223,
1024,
1031,
1024,
3954,
1010,
1024,
16360,
2080,
1010,
1024,
8909,
1033,
1007,
2079,
9146,
9398,
1035,
11412,
1035,
11498,
2213,
1035,
3415,
2203,
8983... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.list_discounts | def list_discounts(location_id, opts = {})
data, _status_code, _headers = list_discounts_with_http_info(location_id, opts)
return data
end | ruby | def list_discounts(location_id, opts = {})
data, _status_code, _headers = list_discounts_with_http_info(location_id, opts)
return data
end | [
"def",
"list_discounts",
"(",
"location_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"list_discounts_with_http_info",
"(",
"location_id",
",",
"opts",
")",
"return",
"data",
"end"
] | ListDiscounts
Lists all of a location's discounts.
@param location_id The ID of the location to list categories for.
@param [Hash] opts the optional parameters
@return [Array<V1Discount>] | [
"ListDiscounts",
"Lists",
"all",
"of",
"a",
"location",
"s",
"discounts",
"."
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/v1_items_api.rb#L1294-L1297 | train | Returns a list of all the discretized discounts for a location | [
30522,
13366,
2862,
1035,
19575,
2015,
1006,
3295,
1035,
8909,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
2862,
1035,
19575,
2015,
1035,
2007,
1035,
8299,
1035,
18558,
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... |
github/linguist | samples/Ruby/sinatra.rb | Sinatra.Templates.render_ruby | def render_ruby(engine, template, options={}, locals={}, &block)
options, template = template, nil if template.is_a?(Hash)
template = Proc.new { block } if template.nil?
render engine, template, options, locals
end | ruby | def render_ruby(engine, template, options={}, locals={}, &block)
options, template = template, nil if template.is_a?(Hash)
template = Proc.new { block } if template.nil?
render engine, template, options, locals
end | [
"def",
"render_ruby",
"(",
"engine",
",",
"template",
",",
"options",
"=",
"{",
"}",
",",
"locals",
"=",
"{",
"}",
",",
"&",
"block",
")",
"options",
",",
"template",
"=",
"template",
",",
"nil",
"if",
"template",
".",
"is_a?",
"(",
"Hash",
")",
"t... | logic shared between builder and nokogiri | [
"logic",
"shared",
"between",
"builder",
"and",
"nokogiri"
] | 9116c90fcbb82ac03b4b33c58cfbde1fcf745e99 | https://github.com/github/linguist/blob/9116c90fcbb82ac03b4b33c58cfbde1fcf745e99/samples/Ruby/sinatra.rb#L665-L669 | train | Render a Ruby template. | [
30522,
13366,
17552,
1035,
10090,
1006,
3194,
1010,
23561,
1010,
7047,
1027,
1063,
1065,
1010,
10575,
1027,
1063,
1065,
1010,
1004,
3796,
1007,
7047,
1010,
23561,
1027,
23561,
1010,
9152,
2140,
2065,
23561,
1012,
2003,
1035,
1037,
1029,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_cdn/lib/2017-04-02/generated/azure_mgmt_cdn/endpoints.rb | Azure::CDN::Mgmt::V2017_04_02.Endpoints.begin_update_with_http_info | def begin_update_with_http_info(resource_group_name, profile_name, endpoint_name, endpoint_update_properties, custom_headers:nil)
begin_update_async(resource_group_name, profile_name, endpoint_name, endpoint_update_properties, custom_headers:custom_headers).value!
end | ruby | def begin_update_with_http_info(resource_group_name, profile_name, endpoint_name, endpoint_update_properties, custom_headers:nil)
begin_update_async(resource_group_name, profile_name, endpoint_name, endpoint_update_properties, custom_headers:custom_headers).value!
end | [
"def",
"begin_update_with_http_info",
"(",
"resource_group_name",
",",
"profile_name",
",",
"endpoint_name",
",",
"endpoint_update_properties",
",",
"custom_headers",
":",
"nil",
")",
"begin_update_async",
"(",
"resource_group_name",
",",
"profile_name",
",",
"endpoint_name... | Updates an existing CDN endpoint with the specified endpoint name under the
specified subscription, resource group and profile. Only tags and Origin
HostHeader can be updated after creating an endpoint. To update origins, use
the Update Origin operation. To update custom domains, use the Update Custom
Domain operation.
@param resource_group_name [String] Name of the Resource group within the
Azure subscription.
@param profile_name [String] Name of the CDN profile which is unique within
the resource group.
@param endpoint_name [String] Name of the endpoint under the profile which is
unique globally.
@param endpoint_update_properties [EndpointUpdateParameters] Endpoint update
properties
@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",
"an",
"existing",
"CDN",
"endpoint",
"with",
"the",
"specified",
"endpoint",
"name",
"under",
"the",
"specified",
"subscription",
"resource",
"group",
"and",
"profile",
".",
"Only",
"tags",
"and",
"Origin",
"HostHeader",
"can",
"be",
"updated",
"after... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_cdn/lib/2017-04-02/generated/azure_mgmt_cdn/endpoints.rb#L1025-L1027 | train | Updates an existing endpoint. | [
30522,
13366,
4088,
1035,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
6337,
1035,
2171,
1010,
2203,
8400,
1035,
2171,
1010,
2203,
8400,
1035,
10651,
1035,
5144,
1010,
7661,
1035,
20346,
2015,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/virtual_network_taps.rb | Azure::Network::Mgmt::V2019_02_01.VirtualNetworkTaps.delete | def delete(resource_group_name, tap_name, custom_headers:nil)
response = delete_async(resource_group_name, tap_name, custom_headers:custom_headers).value!
nil
end | ruby | def delete(resource_group_name, tap_name, custom_headers:nil)
response = delete_async(resource_group_name, tap_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"delete",
"(",
"resource_group_name",
",",
"tap_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_async",
"(",
"resource_group_name",
",",
"tap_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"nil",
"end"
] | Deletes the specified virtual network tap.
@param resource_group_name [String] The name of the resource group.
@param tap_name [String] The name of the virtual network tap.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Deletes",
"the",
"specified",
"virtual",
"network",
"tap",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/virtual_network_taps.rb#L32-L35 | train | Deletes a Tap. | [
30522,
13366,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
11112,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
11112,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.to_sheet_node_xml_string | def to_sheet_node_xml_string(str='')
add_autofilter_defined_name_to_workbook
str << '<sheet '
serialized_attributes str
str << ('name="' << name << '" ')
str << ('r:id="' << rId << '"></sheet>')
end | ruby | def to_sheet_node_xml_string(str='')
add_autofilter_defined_name_to_workbook
str << '<sheet '
serialized_attributes str
str << ('name="' << name << '" ')
str << ('r:id="' << rId << '"></sheet>')
end | [
"def",
"to_sheet_node_xml_string",
"(",
"str",
"=",
"''",
")",
"add_autofilter_defined_name_to_workbook",
"str",
"<<",
"'<sheet '",
"serialized_attributes",
"str",
"str",
"<<",
"(",
"'name=\"'",
"<<",
"name",
"<<",
"'\" '",
")",
"str",
"<<",
"(",
"'r:id=\"'",
"<<"... | Returns a sheet node serialization for this sheet in the workbook. | [
"Returns",
"a",
"sheet",
"node",
"serialization",
"for",
"this",
"sheet",
"in",
"the",
"workbook",
"."
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/worksheet/worksheet.rb#L552-L558 | train | Convert the worksheet to XML string | [
30522,
13366,
2000,
1035,
7123,
1035,
13045,
1035,
20950,
1035,
5164,
1006,
2358,
2099,
1027,
1005,
1005,
1007,
5587,
1035,
8285,
8873,
21928,
1035,
4225,
1035,
2171,
1035,
2000,
1035,
2147,
8654,
2358,
2099,
1026,
1026,
1005,
1026,
7123,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
oauth-xx/oauth2 | lib/oauth2/client.rb | OAuth2.Client.authorize_url | def authorize_url(params = {})
params = (params || {}).merge(redirection_params)
connection.build_url(options[:authorize_url], params).to_s
end | ruby | def authorize_url(params = {})
params = (params || {}).merge(redirection_params)
connection.build_url(options[:authorize_url], params).to_s
end | [
"def",
"authorize_url",
"(",
"params",
"=",
"{",
"}",
")",
"params",
"=",
"(",
"params",
"||",
"{",
"}",
")",
".",
"merge",
"(",
"redirection_params",
")",
"connection",
".",
"build_url",
"(",
"options",
"[",
":authorize_url",
"]",
",",
"params",
")",
... | The authorize endpoint URL of the OAuth2 provider
@param [Hash] params additional query parameters | [
"The",
"authorize",
"endpoint",
"URL",
"of",
"the",
"OAuth2",
"provider"
] | f08ff9da169136ab133aa2faab0d74a4407deffb | https://github.com/oauth-xx/oauth2/blob/f08ff9da169136ab133aa2faab0d74a4407deffb/lib/oauth2/client.rb#L73-L76 | train | Returns the authorize_url for the current user | [
30522,
13366,
3166,
4697,
1035,
24471,
2140,
1006,
11498,
5244,
1027,
1063,
1065,
1007,
11498,
5244,
1027,
1006,
11498,
5244,
1064,
1064,
1063,
1065,
1007,
1012,
13590,
1006,
2417,
7442,
7542,
1035,
11498,
5244,
1007,
4434,
1012,
3857,
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... |
square/connect-ruby-sdk | lib/square_connect/models/v1_merchant.rb | SquareConnect.V1Merchant.business_type= | def business_type=(business_type)
validator = EnumAttributeValidator.new('String', ["ACCOUNTING", "APPAREL_AND_ACCESSORY_SHOPS", "ART_DEALERS_GALLERIES", "ART_DESIGN_AND_PHOTOGRAPHY", "BAR_CLUB_LOUNGE", "BEAUTY_AND_BARBER_SHOPS", "BOOK_STORES", "BUSINESS_SERVICES", "CATERING", "CHARITABLE_SOCIAL_SERVICE_ORGANIZATIONS", "CHARITIBLE_ORGS", "CLEANING_SERVICES", "COMPUTER_EQUIPMENT_SOFTWARE_MAINTENANCE_REPAIR_SERVICES", "CONSULTANT", "CONTRACTORS", "DELIVERY_SERVICES", "DENTISTRY", "EDUCATION", "FOOD_STORES_CONVENIENCE_STORES_AND_SPECIALTY_MARKETS", "FOOD_TRUCK_CART", "FURNITURE_HOME_AND_OFFICE_EQUIPMENT", "FURNITURE_HOME_GOODS", "HOTELS_AND_LODGING", "INDIVIDUAL_USE", "JEWELRY_AND_WATCHES", "LANDSCAPING_AND_HORTICULTURAL_SERVICES", "LANGUAGE_SCHOOLS", "LEGAL_SERVICES", "MEDICAL_PRACTITIONERS", "MEDICAL_SERVICES_AND_HEALTH_PRACTITIONERS", "MEMBERSHIP_ORGANIZATIONS", "MUSIC_AND_ENTERTAINMENT", "OTHER", "OUTDOOR_MARKETS", "PERSONAL_SERVICES", "POLITICAL_ORGANIZATIONS", "PROFESSIONAL_SERVICES", "REAL_ESTATE", "RECREATION_SERVICES", "REPAIR_SHOPS_AND_RELATED_SERVICES", "RESTAURANTS", "RETAIL_SHOPS", "SCHOOLS_AND_EDUCATIONAL_SERVICES", "SPORTING_GOODS", "TAXICABS_AND_LIMOUSINES", "TICKET_SALES", "TOURISM", "TRAVEL_TOURISM", "VETERINARY_SERVICES", "WEB_DEV_DESIGN"])
unless validator.valid?(business_type)
fail ArgumentError, "invalid value for 'business_type', must be one of #{validator.allowable_values}."
end
@business_type = business_type
end | ruby | def business_type=(business_type)
validator = EnumAttributeValidator.new('String', ["ACCOUNTING", "APPAREL_AND_ACCESSORY_SHOPS", "ART_DEALERS_GALLERIES", "ART_DESIGN_AND_PHOTOGRAPHY", "BAR_CLUB_LOUNGE", "BEAUTY_AND_BARBER_SHOPS", "BOOK_STORES", "BUSINESS_SERVICES", "CATERING", "CHARITABLE_SOCIAL_SERVICE_ORGANIZATIONS", "CHARITIBLE_ORGS", "CLEANING_SERVICES", "COMPUTER_EQUIPMENT_SOFTWARE_MAINTENANCE_REPAIR_SERVICES", "CONSULTANT", "CONTRACTORS", "DELIVERY_SERVICES", "DENTISTRY", "EDUCATION", "FOOD_STORES_CONVENIENCE_STORES_AND_SPECIALTY_MARKETS", "FOOD_TRUCK_CART", "FURNITURE_HOME_AND_OFFICE_EQUIPMENT", "FURNITURE_HOME_GOODS", "HOTELS_AND_LODGING", "INDIVIDUAL_USE", "JEWELRY_AND_WATCHES", "LANDSCAPING_AND_HORTICULTURAL_SERVICES", "LANGUAGE_SCHOOLS", "LEGAL_SERVICES", "MEDICAL_PRACTITIONERS", "MEDICAL_SERVICES_AND_HEALTH_PRACTITIONERS", "MEMBERSHIP_ORGANIZATIONS", "MUSIC_AND_ENTERTAINMENT", "OTHER", "OUTDOOR_MARKETS", "PERSONAL_SERVICES", "POLITICAL_ORGANIZATIONS", "PROFESSIONAL_SERVICES", "REAL_ESTATE", "RECREATION_SERVICES", "REPAIR_SHOPS_AND_RELATED_SERVICES", "RESTAURANTS", "RETAIL_SHOPS", "SCHOOLS_AND_EDUCATIONAL_SERVICES", "SPORTING_GOODS", "TAXICABS_AND_LIMOUSINES", "TICKET_SALES", "TOURISM", "TRAVEL_TOURISM", "VETERINARY_SERVICES", "WEB_DEV_DESIGN"])
unless validator.valid?(business_type)
fail ArgumentError, "invalid value for 'business_type', must be one of #{validator.allowable_values}."
end
@business_type = business_type
end | [
"def",
"business_type",
"=",
"(",
"business_type",
")",
"validator",
"=",
"EnumAttributeValidator",
".",
"new",
"(",
"'String'",
",",
"[",
"\"ACCOUNTING\"",
",",
"\"APPAREL_AND_ACCESSORY_SHOPS\"",
",",
"\"ART_DEALERS_GALLERIES\"",
",",
"\"ART_DESIGN_AND_PHOTOGRAPHY\"",
",... | Custom attribute writer method checking allowed values (enum).
@param [Object] business_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#L225-L231 | train | The business type of the service. | [
30522,
13366,
2449,
1035,
2828,
1027,
1006,
2449,
1035,
2828,
1007,
9398,
8844,
1027,
4372,
12248,
4779,
3089,
8569,
2618,
10175,
8524,
4263,
1012,
2047,
1006,
1005,
5164,
1005,
1010,
1031,
1000,
9529,
1000,
1010,
1000,
26278,
1035,
1998,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.list_hierarchical_entities_with_http_info | def list_hierarchical_entities_with_http_info(app_id, version_id, skip:0, take:100, custom_headers:nil)
list_hierarchical_entities_async(app_id, version_id, skip:skip, take:take, custom_headers:custom_headers).value!
end | ruby | def list_hierarchical_entities_with_http_info(app_id, version_id, skip:0, take:100, custom_headers:nil)
list_hierarchical_entities_async(app_id, version_id, skip:skip, take:take, custom_headers:custom_headers).value!
end | [
"def",
"list_hierarchical_entities_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"skip",
":",
"0",
",",
"take",
":",
"100",
",",
"custom_headers",
":",
"nil",
")",
"list_hierarchical_entities_async",
"(",
"app_id",
",",
"version_id",
",",
"skip",
":",
... | Gets information about all the hierarchical entity models in a version of the
application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param skip [Integer] The number of entries to skip. Default value is 0.
@param take [Integer] The number of entries to return. Maximum page size is
500. Default is 100.
@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",
"all",
"the",
"hierarchical",
"entity",
"models",
"in",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L636-L638 | train | Gets the list of hierarchical entities. | [
30522,
13366,
2862,
1035,
25835,
1035,
11422,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
13558,
1024,
1014,
1010,
2202,
1024,
2531,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2862... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rmagick/rmagick | lib/rmagick_internal.rb | Magick.Image.texture_fill_to_border | def texture_fill_to_border(x, y, texture)
texture_flood_fill(border_color, texture, x, y, FillToBorderMethod)
end | ruby | def texture_fill_to_border(x, y, texture)
texture_flood_fill(border_color, texture, x, y, FillToBorderMethod)
end | [
"def",
"texture_fill_to_border",
"(",
"x",
",",
"y",
",",
"texture",
")",
"texture_flood_fill",
"(",
"border_color",
",",
"texture",
",",
"x",
",",
"y",
",",
"FillToBorderMethod",
")",
"end"
] | Replace neighboring pixels to border color with texture pixels | [
"Replace",
"neighboring",
"pixels",
"to",
"border",
"color",
"with",
"texture",
"pixels"
] | ef6688ed9d76bf123c2ea1a483eff8635051adb7 | https://github.com/rmagick/rmagick/blob/ef6688ed9d76bf123c2ea1a483eff8635051adb7/lib/rmagick_internal.rb#L991-L993 | train | Fill the texture to border | [
30522,
13366,
14902,
1035,
6039,
1035,
2000,
1035,
3675,
1006,
1060,
1010,
1061,
1010,
14902,
1007,
14902,
1035,
7186,
1035,
6039,
1006,
3675,
1035,
3609,
1010,
14902,
1010,
1060,
1010,
1061,
1010,
6039,
3406,
12821,
4063,
11368,
6806,
2094... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | actionview/lib/action_view/record_identifier.rb | ActionView.RecordIdentifier.dom_id | def dom_id(record, prefix = nil)
if record_id = record_key_for_dom_id(record)
"#{dom_class(record, prefix)}#{JOIN}#{record_id}"
else
dom_class(record, prefix || NEW)
end
end | ruby | def dom_id(record, prefix = nil)
if record_id = record_key_for_dom_id(record)
"#{dom_class(record, prefix)}#{JOIN}#{record_id}"
else
dom_class(record, prefix || NEW)
end
end | [
"def",
"dom_id",
"(",
"record",
",",
"prefix",
"=",
"nil",
")",
"if",
"record_id",
"=",
"record_key_for_dom_id",
"(",
"record",
")",
"\"#{dom_class(record, prefix)}#{JOIN}#{record_id}\"",
"else",
"dom_class",
"(",
"record",
",",
"prefix",
"||",
"NEW",
")",
"end",
... | The DOM id convention is to use the singular form of an object or class with the id following an underscore.
If no id is found, prefix with "new_" instead.
dom_id(Post.find(45)) # => "post_45"
dom_id(Post.new) # => "new_post"
If you need to address multiple instances of the same class in the same view, you can prefix the dom_id:
dom_id(Post.find(45), :edit) # => "edit_post_45"
dom_id(Post.new, :custom) # => "custom_post" | [
"The",
"DOM",
"id",
"convention",
"is",
"to",
"use",
"the",
"singular",
"form",
"of",
"an",
"object",
"or",
"class",
"with",
"the",
"id",
"following",
"an",
"underscore",
".",
"If",
"no",
"id",
"is",
"found",
"prefix",
"with",
"new_",
"instead",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/actionview/lib/action_view/record_identifier.rb#L89-L95 | train | Returns the dom_id for the given record. | [
30522,
13366,
14383,
1035,
8909,
1006,
2501,
1010,
17576,
1027,
9152,
2140,
1007,
2065,
2501,
1035,
8909,
1027,
2501,
1035,
3145,
1035,
2005,
1035,
14383,
1035,
8909,
1006,
2501,
1007,
1000,
1001,
1063,
14383,
1035,
2465,
1006,
2501,
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... |
projectcypress/health-data-standards | lib/hqmf-parser/2.0/data_criteria_helpers/dc_post_processing.rb | HQMF2.DataCriteriaPostProcessing.handle_mapping_template | def handle_mapping_template(mapping)
if mapping
if mapping[:valueset_path] && @entry.at_xpath(mapping[:valueset_path])
@code_list_xpath = mapping[:valueset_path]
end
@value = DataCriteriaMethods.parse_value(@entry, mapping[:result_path]) if mapping[:result_path]
end
end | ruby | def handle_mapping_template(mapping)
if mapping
if mapping[:valueset_path] && @entry.at_xpath(mapping[:valueset_path])
@code_list_xpath = mapping[:valueset_path]
end
@value = DataCriteriaMethods.parse_value(@entry, mapping[:result_path]) if mapping[:result_path]
end
end | [
"def",
"handle_mapping_template",
"(",
"mapping",
")",
"if",
"mapping",
"if",
"mapping",
"[",
":valueset_path",
"]",
"&&",
"@entry",
".",
"at_xpath",
"(",
"mapping",
"[",
":valueset_path",
"]",
")",
"@code_list_xpath",
"=",
"mapping",
"[",
":valueset_path",
"]",... | Set the value and code_list_xpath using the template mapping held in the ValueSetHelper class | [
"Set",
"the",
"value",
"and",
"code_list_xpath",
"using",
"the",
"template",
"mapping",
"held",
"in",
"the",
"ValueSetHelper",
"class"
] | 252d4f0927c513eacde6b9ea41b76faa1423c34b | https://github.com/projectcypress/health-data-standards/blob/252d4f0927c513eacde6b9ea41b76faa1423c34b/lib/hqmf-parser/2.0/data_criteria_helpers/dc_post_processing.rb#L41-L48 | train | Handle the mapping template | [
30522,
13366,
5047,
1035,
12375,
1035,
23561,
1006,
12375,
1007,
2065,
12375,
2065,
12375,
1031,
1024,
5300,
3388,
1035,
4130,
1033,
1004,
1004,
1030,
4443,
1012,
2012,
1035,
26726,
8988,
1006,
12375,
1031,
1024,
5300,
3388,
1035,
4130,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sporkmonger/addressable | lib/addressable/uri.rb | Addressable.URI.port= | def port=(new_port)
if new_port != nil && new_port.respond_to?(:to_str)
new_port = Addressable::URI.unencode_component(new_port.to_str)
end
if new_port.respond_to?(:valid_encoding?) && !new_port.valid_encoding?
raise InvalidURIError, "Invalid encoding in port"
end
if new_port != nil && !(new_port.to_s =~ /^\d+$/)
raise InvalidURIError,
"Invalid port number: #{new_port.inspect}"
end
@port = new_port.to_s.to_i
@port = nil if @port == 0
# Reset dependent values
remove_instance_variable(:@authority) if defined?(@authority)
remove_instance_variable(:@normalized_port) if defined?(@normalized_port)
remove_composite_values
# Ensure we haven't created an invalid URI
validate()
end | ruby | def port=(new_port)
if new_port != nil && new_port.respond_to?(:to_str)
new_port = Addressable::URI.unencode_component(new_port.to_str)
end
if new_port.respond_to?(:valid_encoding?) && !new_port.valid_encoding?
raise InvalidURIError, "Invalid encoding in port"
end
if new_port != nil && !(new_port.to_s =~ /^\d+$/)
raise InvalidURIError,
"Invalid port number: #{new_port.inspect}"
end
@port = new_port.to_s.to_i
@port = nil if @port == 0
# Reset dependent values
remove_instance_variable(:@authority) if defined?(@authority)
remove_instance_variable(:@normalized_port) if defined?(@normalized_port)
remove_composite_values
# Ensure we haven't created an invalid URI
validate()
end | [
"def",
"port",
"=",
"(",
"new_port",
")",
"if",
"new_port",
"!=",
"nil",
"&&",
"new_port",
".",
"respond_to?",
"(",
":to_str",
")",
"new_port",
"=",
"Addressable",
"::",
"URI",
".",
"unencode_component",
"(",
"new_port",
".",
"to_str",
")",
"end",
"if",
... | Sets the port component for this URI.
@param [String, Integer, #to_s] new_port The new port component. | [
"Sets",
"the",
"port",
"component",
"for",
"this",
"URI",
"."
] | 5894c95a7768435cb46d1355954611dbd194832e | https://github.com/sporkmonger/addressable/blob/5894c95a7768435cb46d1355954611dbd194832e/lib/addressable/uri.rb#L1381-L1405 | train | Set the port number | [
30522,
13366,
3417,
1027,
1006,
2047,
1035,
3417,
1007,
2065,
2047,
1035,
3417,
999,
1027,
9152,
2140,
1004,
1004,
2047,
1035,
3417,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
2000,
1035,
2358,
2099,
1007,
2047,
1035,
3417,
1027,
4769,
308... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/user.rb | Discordrb.User.send_file | def send_file(file, caption = nil, filename: nil, spoiler: nil)
pm.send_file(file, caption: caption, filename: filename, spoiler: spoiler)
end | ruby | def send_file(file, caption = nil, filename: nil, spoiler: nil)
pm.send_file(file, caption: caption, filename: filename, spoiler: spoiler)
end | [
"def",
"send_file",
"(",
"file",
",",
"caption",
"=",
"nil",
",",
"filename",
":",
"nil",
",",
"spoiler",
":",
"nil",
")",
"pm",
".",
"send_file",
"(",
"file",
",",
"caption",
":",
"caption",
",",
"filename",
":",
"filename",
",",
"spoiler",
":",
"sp... | Send the user a file.
@param file [File] The file to send to the user
@param caption [String] The caption of the file being sent
@param filename [String] Overrides the filename of the uploaded file
@param spoiler [true, false] Whether or not this file should appear as a spoiler.
@return [Message] the message sent to this user.
@example Send a file from disk
user.send_file(File.open('rubytaco.png', 'r')) | [
"Send",
"the",
"user",
"a",
"file",
"."
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/data/user.rb#L108-L110 | train | Send a file to the current image | [
30522,
13366,
4604,
1035,
5371,
1006,
5371,
1010,
14408,
3258,
1027,
9152,
2140,
1010,
5371,
18442,
1024,
9152,
2140,
1010,
27594,
2121,
1024,
9152,
2140,
1007,
7610,
1012,
4604,
1035,
5371,
1006,
5371,
1010,
14408,
3258,
1024,
14408,
3258,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ankane/ahoy | lib/ahoy/visit_properties.rb | Ahoy.VisitProperties.ip | def ip
ip = request.remote_ip
if ip && Ahoy.mask_ips
Ahoy.mask_ip(ip)
else
ip
end
end | ruby | def ip
ip = request.remote_ip
if ip && Ahoy.mask_ips
Ahoy.mask_ip(ip)
else
ip
end
end | [
"def",
"ip",
"ip",
"=",
"request",
".",
"remote_ip",
"if",
"ip",
"&&",
"Ahoy",
".",
"mask_ips",
"Ahoy",
".",
"mask_ip",
"(",
"ip",
")",
"else",
"ip",
"end",
"end"
] | masking based on Google Analytics anonymization
https://support.google.com/analytics/answer/2763052 | [
"masking",
"based",
"on",
"Google",
"Analytics",
"anonymization",
"https",
":",
"//",
"support",
".",
"google",
".",
"com",
"/",
"analytics",
"/",
"answer",
"/",
"2763052"
] | 514e4f9aed4ff87be791e4d8b73b0f2788233ba8 | https://github.com/ankane/ahoy/blob/514e4f9aed4ff87be791e4d8b73b0f2788233ba8/lib/ahoy/visit_properties.rb#L94-L101 | train | Returns the ip
for this request. | [
30522,
13366,
12997,
12997,
1027,
5227,
1012,
6556,
1035,
12997,
2065,
12997,
1004,
1004,
6289,
6977,
1012,
7308,
1035,
12997,
2015,
6289,
6977,
1012,
7308,
1035,
12997,
1006,
12997,
1007,
2842,
12997,
2203,
2203,
102,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
zipmark/rspec_api_documentation | lib/rspec_api_documentation/dsl.rb | RspecApiDocumentation.DSL.resource | def resource(*args, &block)
options = args.last.is_a?(Hash) ? args.pop : {}
options[:api_doc_dsl] = :resource
options[:resource_name] = args.first.to_s
options[:document] = :all unless options.key?(:document)
args.push(options)
describe(*args, &block)
end | ruby | def resource(*args, &block)
options = args.last.is_a?(Hash) ? args.pop : {}
options[:api_doc_dsl] = :resource
options[:resource_name] = args.first.to_s
options[:document] = :all unless options.key?(:document)
args.push(options)
describe(*args, &block)
end | [
"def",
"resource",
"(",
"*",
"args",
",",
"&",
"block",
")",
"options",
"=",
"args",
".",
"last",
".",
"is_a?",
"(",
"Hash",
")",
"?",
"args",
".",
"pop",
":",
"{",
"}",
"options",
"[",
":api_doc_dsl",
"]",
"=",
":resource",
"options",
"[",
":resou... | Custom describe block that sets metadata to enable the rest of RAD
resource "Orders", :meta => :data do
# ...
end
Params:
+args+:: Glob of RSpec's `describe` arguments
+block+:: Block to pass into describe | [
"Custom",
"describe",
"block",
"that",
"sets",
"metadata",
"to",
"enable",
"the",
"rest",
"of",
"RAD"
] | 54fbfda3ec8ede5b3d871700ff69aabe89eafb2f | https://github.com/zipmark/rspec_api_documentation/blob/54fbfda3ec8ede5b3d871700ff69aabe89eafb2f/lib/rspec_api_documentation/dsl.rb#L20-L27 | train | Returns the resource object for the given resource name. | [
30522,
13366,
7692,
1006,
1008,
12098,
5620,
1010,
1004,
3796,
1007,
7047,
1027,
12098,
5620,
1012,
2197,
1012,
2003,
1035,
1037,
1029,
1006,
23325,
1007,
1029,
12098,
5620,
1012,
3769,
1024,
1063,
1065,
7047,
1031,
1024,
17928,
1035,
9986,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.get_hierarchical_entity | def get_hierarchical_entity(app_id, version_id, h_entity_id, custom_headers:nil)
response = get_hierarchical_entity_async(app_id, version_id, h_entity_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_hierarchical_entity(app_id, version_id, h_entity_id, custom_headers:nil)
response = get_hierarchical_entity_async(app_id, version_id, h_entity_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_hierarchical_entity",
"(",
"app_id",
",",
"version_id",
",",
"h_entity_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_hierarchical_entity_async",
"(",
"app_id",
",",
"version_id",
",",
"h_entity_id",
",",
"custom_headers",
":custom_head... | Gets information about a hierarchical entity in a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param h_entity_id The hierarchical entity extractor ID.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [HierarchicalEntityExtractor] operation results. | [
"Gets",
"information",
"about",
"a",
"hierarchical",
"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#L2431-L2434 | train | Gets the hierarchical entity. | [
30522,
13366,
2131,
1035,
25835,
1035,
9178,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
1044,
1035,
9178,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
25835,
1035,
9178,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-iam/lib/aws-sdk-iam/user.rb | Aws::IAM.User.delete | def delete(options = {})
options = options.merge(user_name: @name)
resp = @client.delete_user(options)
resp.data
end | ruby | def delete(options = {})
options = options.merge(user_name: @name)
resp = @client.delete_user(options)
resp.data
end | [
"def",
"delete",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"user_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"delete_user",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
user.delete()
@param [Hash] options ({})
@return [EmptyStructure] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-iam/lib/aws-sdk-iam/user.rb#L509-L513 | train | Delete a user | [
30522,
13366,
3972,
12870,
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,
3972,
12870,
1035,
5310,
1006,
7047,
1007,
24501,
2361,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
decidim/decidim | decidim-core/lib/decidim/form_builder.rb | Decidim.FormBuilder.categories_select | def categories_select(name, collection, options = {})
options = {
disable_parents: true
}.merge(options)
disable_parents = options[:disable_parents]
selected = object.send(name)
categories = categories_for_select(collection)
disabled = if disable_parents
disabled_categories_for(collection)
else
[]
end
html_options = {}
select(name, @template.options_for_select(categories, selected: selected, disabled: disabled), options, html_options)
end | ruby | def categories_select(name, collection, options = {})
options = {
disable_parents: true
}.merge(options)
disable_parents = options[:disable_parents]
selected = object.send(name)
categories = categories_for_select(collection)
disabled = if disable_parents
disabled_categories_for(collection)
else
[]
end
html_options = {}
select(name, @template.options_for_select(categories, selected: selected, disabled: disabled), options, html_options)
end | [
"def",
"categories_select",
"(",
"name",
",",
"collection",
",",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"{",
"disable_parents",
":",
"true",
"}",
".",
"merge",
"(",
"options",
")",
"disable_parents",
"=",
"options",
"[",
":disable_parents",
"]",
"s... | Public: Generates a select field with the categories. Only leaf categories can be set as selected.
name - The name of the field (usually category_id)
collection - A collection of categories.
options - An optional Hash with options:
- prompt - An optional String with the text to display as prompt.
- disable_parents - A Boolean to disable parent categories. Defaults to `true`.
Returns a String. | [
"Public",
":",
"Generates",
"a",
"select",
"field",
"with",
"the",
"categories",
".",
"Only",
"leaf",
"categories",
"can",
"be",
"set",
"as",
"selected",
"."
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/lib/decidim/form_builder.rb#L186-L203 | train | Creates a select box for the given collection. | [
30522,
13366,
7236,
1035,
7276,
1006,
2171,
1010,
3074,
1010,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
1063,
4487,
19150,
1035,
3008,
1024,
2995,
1065,
1012,
13590,
1006,
7047,
1007,
4487,
19150,
1035,
3008,
1027,
7047,
1031,
1024,
4487,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sporkmonger/addressable | lib/addressable/uri.rb | Addressable.URI.authority= | def authority=(new_authority)
if new_authority
if !new_authority.respond_to?(:to_str)
raise TypeError, "Can't convert #{new_authority.class} into String."
end
new_authority = new_authority.to_str
new_userinfo = new_authority[/^([^\[\]]*)@/, 1]
if new_userinfo
new_user = new_userinfo.strip[/^([^:]*):?/, 1]
new_password = new_userinfo.strip[/:(.*)$/, 1]
end
new_host = new_authority.sub(
/^([^\[\]]*)@/, EMPTY_STR
).sub(
/:([^:@\[\]]*?)$/, EMPTY_STR
)
new_port =
new_authority[/:([^:@\[\]]*?)$/, 1]
end
# Password assigned first to ensure validity in case of nil
self.password = defined?(new_password) ? new_password : nil
self.user = defined?(new_user) ? new_user : nil
self.host = defined?(new_host) ? new_host : nil
self.port = defined?(new_port) ? new_port : nil
# Reset dependent values
remove_instance_variable(:@userinfo) if defined?(@userinfo)
remove_instance_variable(:@normalized_userinfo) if defined?(@normalized_userinfo)
remove_composite_values
# Ensure we haven't created an invalid URI
validate()
end | ruby | def authority=(new_authority)
if new_authority
if !new_authority.respond_to?(:to_str)
raise TypeError, "Can't convert #{new_authority.class} into String."
end
new_authority = new_authority.to_str
new_userinfo = new_authority[/^([^\[\]]*)@/, 1]
if new_userinfo
new_user = new_userinfo.strip[/^([^:]*):?/, 1]
new_password = new_userinfo.strip[/:(.*)$/, 1]
end
new_host = new_authority.sub(
/^([^\[\]]*)@/, EMPTY_STR
).sub(
/:([^:@\[\]]*?)$/, EMPTY_STR
)
new_port =
new_authority[/:([^:@\[\]]*?)$/, 1]
end
# Password assigned first to ensure validity in case of nil
self.password = defined?(new_password) ? new_password : nil
self.user = defined?(new_user) ? new_user : nil
self.host = defined?(new_host) ? new_host : nil
self.port = defined?(new_port) ? new_port : nil
# Reset dependent values
remove_instance_variable(:@userinfo) if defined?(@userinfo)
remove_instance_variable(:@normalized_userinfo) if defined?(@normalized_userinfo)
remove_composite_values
# Ensure we haven't created an invalid URI
validate()
end | [
"def",
"authority",
"=",
"(",
"new_authority",
")",
"if",
"new_authority",
"if",
"!",
"new_authority",
".",
"respond_to?",
"(",
":to_str",
")",
"raise",
"TypeError",
",",
"\"Can't convert #{new_authority.class} into String.\"",
"end",
"new_authority",
"=",
"new_authorit... | Sets the authority component for this URI.
@param [String, #to_str] new_authority The new authority component. | [
"Sets",
"the",
"authority",
"component",
"for",
"this",
"URI",
"."
] | 5894c95a7768435cb46d1355954611dbd194832e | https://github.com/sporkmonger/addressable/blob/5894c95a7768435cb46d1355954611dbd194832e/lib/addressable/uri.rb#L1245-L1278 | train | Sets the authority of the URI. | [
30522,
13366,
3691,
1027,
1006,
2047,
1035,
3691,
1007,
2065,
2047,
1035,
3691,
2065,
999,
2047,
1035,
3691,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
2000,
1035,
2358,
2099,
1007,
5333,
2828,
2121,
29165,
1010,
1000,
2064,
1005,
1056,
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_compute/lib/2018-04-01/generated/azure_mgmt_compute/virtual_machine_extensions.rb | Azure::Compute::Mgmt::V2018_04_01.VirtualMachineExtensions.begin_create_or_update | def begin_create_or_update(resource_group_name, vm_name, vm_extension_name, extension_parameters, custom_headers:nil)
response = begin_create_or_update_async(resource_group_name, vm_name, vm_extension_name, extension_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_create_or_update(resource_group_name, vm_name, vm_extension_name, extension_parameters, custom_headers:nil)
response = begin_create_or_update_async(resource_group_name, vm_name, vm_extension_name, extension_parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_create_or_update",
"(",
"resource_group_name",
",",
"vm_name",
",",
"vm_extension_name",
",",
"extension_parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"vm_name",
",",
... | The operation to create or update the extension.
@param resource_group_name [String] The name of the resource group.
@param vm_name [String] The name of the virtual machine where the extension
should be created or updated.
@param vm_extension_name [String] The name of the virtual machine extension.
@param extension_parameters [VirtualMachineExtension] Parameters supplied to
the Create Virtual Machine Extension operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [VirtualMachineExtension] operation results. | [
"The",
"operation",
"to",
"create",
"or",
"update",
"the",
"extension",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_compute/lib/2018-04-01/generated/azure_mgmt_compute/virtual_machine_extensions.rb#L380-L383 | train | Creates or updates an extension. | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
1058,
2213,
1035,
2171,
1010,
1058,
2213,
1035,
5331,
1035,
2171,
1010,
5331,
1035,
11709,
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_network/lib/2018-08-01/generated/azure_mgmt_network/network_watchers.rb | Azure::Network::Mgmt::V2018_08_01.NetworkWatchers.verify_ipflow | def verify_ipflow(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
response = verify_ipflow_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def verify_ipflow(resource_group_name, network_watcher_name, parameters, custom_headers:nil)
response = verify_ipflow_async(resource_group_name, network_watcher_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"verify_ipflow",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"verify_ipflow_async",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"parameters",
",",
"custom_h... | Verify IP flow from the specified VM to a location given the currently
configured NSG rules.
@param resource_group_name [String] The name of the resource group.
@param network_watcher_name [String] The name of the network watcher.
@param parameters [VerificationIPFlowParameters] Parameters that define the
IP flow to be verified.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [VerificationIPFlowResult] operation results. | [
"Verify",
"IP",
"flow",
"from",
"the",
"specified",
"VM",
"to",
"a",
"location",
"given",
"the",
"currently",
"configured",
"NSG",
"rules",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/network_watchers.rb#L667-L670 | train | Verify IP flow. | [
30522,
13366,
20410,
1035,
12997,
12314,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2897,
1035,
3422,
2121,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
20410,
1035,
12997,
12314,
1035,
2004,
60... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
googleapis/google-cloud-ruby | google-cloud-debugger/lib/google-cloud-debugger.rb | Google.Cloud.debugger | def debugger service_name: nil, service_version: nil, scope: nil,
timeout: nil, client_config: nil
Google::Cloud.debugger @project, @keyfile,
service_name: service_name,
service_version: service_version,
scope: scope,
timeout: (timeout || @timeout),
client_config: client_config
end | ruby | def debugger service_name: nil, service_version: nil, scope: nil,
timeout: nil, client_config: nil
Google::Cloud.debugger @project, @keyfile,
service_name: service_name,
service_version: service_version,
scope: scope,
timeout: (timeout || @timeout),
client_config: client_config
end | [
"def",
"debugger",
"service_name",
":",
"nil",
",",
"service_version",
":",
"nil",
",",
"scope",
":",
"nil",
",",
"timeout",
":",
"nil",
",",
"client_config",
":",
"nil",
"Google",
"::",
"Cloud",
".",
"debugger",
"@project",
",",
"@keyfile",
",",
"service_... | Creates a new debugger object for instrumenting Stackdriver Debugger for
an application. Each call creates a new debugger agent with independent
connection service.
For more information on connecting to Google Cloud see the
{file:AUTHENTICATION.md Authentication Guide}.
@param [String] service_name Name for the debuggee application. Optional.
@param [String] service_version Version identifier for the debuggee
application. Optional.
@param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
set of resources and operations that the connection can access. See
[Using OAuth 2.0 to Access Google
APIs](https://developers.google.com/identity/protocols/OAuth2).
The default scope is:
* `https://www.googleapis.com/auth/cloud_debugger`
* `https://www.googleapis.com/auth/logging.admin`
@param [Integer] timeout Default timeout to use in requests. Optional.
@param [Hash] client_config A hash of values to override the default
behavior of the API client. Optional.
@return [Google::Cloud::Debugger::Project]
@example
require "google/cloud"
gcloud = Google::Cloud.new
debugger = gcloud.debugger
debugger.start
@example The default scope can be overridden with the `scope` option:
require "google/cloud"
gcloud = Google::Cloud.new
platform_scope = "https://www.googleapis.com/auth/cloud-platform"
debugger = gcloud.debugger scope: platform_scope | [
"Creates",
"a",
"new",
"debugger",
"object",
"for",
"instrumenting",
"Stackdriver",
"Debugger",
"for",
"an",
"application",
".",
"Each",
"call",
"creates",
"a",
"new",
"debugger",
"agent",
"with",
"independent",
"connection",
"service",
"."
] | 846c1a57250ac860ef4de1b54853a480ab2ff702 | https://github.com/googleapis/google-cloud-ruby/blob/846c1a57250ac860ef4de1b54853a480ab2ff702/google-cloud-debugger/lib/google-cloud-debugger.rb#L71-L79 | train | Create a debugger | [
30522,
13366,
2139,
8569,
13327,
2326,
1035,
2171,
1024,
9152,
2140,
1010,
2326,
1035,
2544,
1024,
9152,
2140,
1010,
9531,
1024,
9152,
2140,
1010,
2051,
5833,
1024,
9152,
2140,
1010,
7396,
1035,
9530,
8873,
2290,
1024,
9152,
2140,
8224,
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... |
boazsegev/combine_pdf | lib/combine_pdf/page_methods.rb | CombinePDF.Page_Methods.copy | def copy(secure = false)
# since only the Content streams are modified (Resource hashes are created anew),
# it should be safe (and a lot faster) to create a deep copy only for the content hashes and streams.
delete :Parent
prep_content_array
page_copy = clone
page_copy[:Contents] = page_copy[:Contents].map do |obj|
obj = obj.dup
obj[:referenced_object] = obj[:referenced_object].dup if obj[:referenced_object]
obj[:referenced_object][:raw_stream_content] = obj[:referenced_object][:raw_stream_content].dup if obj[:referenced_object] && obj[:referenced_object][:raw_stream_content]
obj
end
if page_copy[:Resources]
page_res = page_copy[:Resources] = page_copy[:Resources].dup
page_res = page_copy[:Resources][:referenced_object] = page_copy[:Resources][:referenced_object].dup if page_copy[:Resources][:referenced_object]
page_res.each do |k, v|
v = page_res[k] = v.dup if v.is_a?(Array) || v.is_a?(Hash)
v = v[:referenced_object] = v[:referenced_object].dup if v.is_a?(Hash) && v[:referenced_object]
end
end
page_copy.instance_exec(secure || @secure_injection) { |s| secure_for_copy if s; init_contents; self }
end | ruby | def copy(secure = false)
# since only the Content streams are modified (Resource hashes are created anew),
# it should be safe (and a lot faster) to create a deep copy only for the content hashes and streams.
delete :Parent
prep_content_array
page_copy = clone
page_copy[:Contents] = page_copy[:Contents].map do |obj|
obj = obj.dup
obj[:referenced_object] = obj[:referenced_object].dup if obj[:referenced_object]
obj[:referenced_object][:raw_stream_content] = obj[:referenced_object][:raw_stream_content].dup if obj[:referenced_object] && obj[:referenced_object][:raw_stream_content]
obj
end
if page_copy[:Resources]
page_res = page_copy[:Resources] = page_copy[:Resources].dup
page_res = page_copy[:Resources][:referenced_object] = page_copy[:Resources][:referenced_object].dup if page_copy[:Resources][:referenced_object]
page_res.each do |k, v|
v = page_res[k] = v.dup if v.is_a?(Array) || v.is_a?(Hash)
v = v[:referenced_object] = v[:referenced_object].dup if v.is_a?(Hash) && v[:referenced_object]
end
end
page_copy.instance_exec(secure || @secure_injection) { |s| secure_for_copy if s; init_contents; self }
end | [
"def",
"copy",
"(",
"secure",
"=",
"false",
")",
"# since only the Content streams are modified (Resource hashes are created anew),",
"# it should be safe (and a lot faster) to create a deep copy only for the content hashes and streams.",
"delete",
":Parent",
"prep_content_array",
"page_copy... | creates a copy of the page. if the :secure flag is set to true, the resource indentifiers (fonts etc') will be renamed in order to secure their uniqueness. | [
"creates",
"a",
"copy",
"of",
"the",
"page",
".",
"if",
"the",
":",
"secure",
"flag",
"is",
"set",
"to",
"true",
"the",
"resource",
"indentifiers",
"(",
"fonts",
"etc",
")",
"will",
"be",
"renamed",
"in",
"order",
"to",
"secure",
"their",
"uniqueness",
... | 09054051019c069f551f3e60be789577c0f93900 | https://github.com/boazsegev/combine_pdf/blob/09054051019c069f551f3e60be789577c0f93900/lib/combine_pdf/page_methods.rb#L634-L655 | train | This method copies the contents of the page to the new location. | [
30522,
13366,
6100,
1006,
5851,
1027,
6270,
1007,
1001,
2144,
2069,
1996,
4180,
9199,
2024,
6310,
1006,
7692,
23325,
2229,
2024,
2580,
2019,
7974,
1007,
1010,
1001,
2009,
2323,
2022,
3647,
1006,
1998,
1037,
2843,
5514,
1007,
2000,
3443,
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... |
apache/thrift | lib/rb/lib/thrift/protocol/compact_protocol.rb | Thrift.CompactProtocol.write_field_begin_internal | def write_field_begin_internal(type, id, type_override=nil)
last_id = @last_field.pop
# if there's a type override, use that.
typeToWrite = type_override || CompactTypes.get_compact_type(type)
# check if we can use delta encoding for the field id
if id > last_id && id - last_id <= 15
# write them together
write_byte((id - last_id) << 4 | typeToWrite)
else
# write them separate
write_byte(typeToWrite)
write_i16(id)
end
@last_field.push(id)
nil
end | ruby | def write_field_begin_internal(type, id, type_override=nil)
last_id = @last_field.pop
# if there's a type override, use that.
typeToWrite = type_override || CompactTypes.get_compact_type(type)
# check if we can use delta encoding for the field id
if id > last_id && id - last_id <= 15
# write them together
write_byte((id - last_id) << 4 | typeToWrite)
else
# write them separate
write_byte(typeToWrite)
write_i16(id)
end
@last_field.push(id)
nil
end | [
"def",
"write_field_begin_internal",
"(",
"type",
",",
"id",
",",
"type_override",
"=",
"nil",
")",
"last_id",
"=",
"@last_field",
".",
"pop",
"# if there's a type override, use that.",
"typeToWrite",
"=",
"type_override",
"||",
"CompactTypes",
".",
"get_compact_type",
... | The workhorse of writeFieldBegin. It has the option of doing a
'type override' of the type header. This is used specifically in the
boolean field case. | [
"The",
"workhorse",
"of",
"writeFieldBegin",
".",
"It",
"has",
"the",
"option",
"of",
"doing",
"a",
"type",
"override",
"of",
"the",
"type",
"header",
".",
"This",
"is",
"used",
"specifically",
"in",
"the",
"boolean",
"field",
"case",
"."
] | 27d8387c49a49fcf193893f834e9766ae0b051c1 | https://github.com/apache/thrift/blob/27d8387c49a49fcf193893f834e9766ae0b051c1/lib/rb/lib/thrift/protocol/compact_protocol.rb#L140-L158 | train | Write the begin of a field | [
30522,
13366,
4339,
1035,
2492,
1035,
4088,
1035,
4722,
1006,
2828,
1010,
8909,
1010,
2828,
1035,
2058,
15637,
1027,
9152,
2140,
1007,
2197,
1035,
8909,
1027,
1030,
2197,
1035,
2492,
1012,
3769,
1001,
2065,
2045,
1005,
1055,
1037,
2828,
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_stream_analytics/lib/2016-03-01/generated/azure_mgmt_stream_analytics/subscriptions.rb | Azure::StreamAnalytics::Mgmt::V2016_03_01.Subscriptions.list_quotas | def list_quotas(location, custom_headers:nil)
response = list_quotas_async(location, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_quotas(location, custom_headers:nil)
response = list_quotas_async(location, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_quotas",
"(",
"location",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_quotas_async",
"(",
"location",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"response",
".",
"nil?",
"end"
... | Retrieves the subscription's current quota information in a particular
region.
@param location [String] The region in which to retrieve the subscription's
quota information. You can find out which regions Azure Stream Analytics is
supported in here: https://azure.microsoft.com/en-us/regions/
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [SubscriptionQuotasListResult] operation results. | [
"Retrieves",
"the",
"subscription",
"s",
"current",
"quota",
"information",
"in",
"a",
"particular",
"region",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_stream_analytics/lib/2016-03-01/generated/azure_mgmt_stream_analytics/subscriptions.rb#L36-L39 | train | Gets the list of quotas for the specified location. | [
30522,
13366,
2862,
1035,
20563,
2015,
1006,
3295,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
20563,
2015,
1035,
2004,
6038,
2278,
1006,
3295,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
20346,
2015,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_resources_management/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/management_groups.rb | Azure::ResourcesManagement::Mgmt::V2018_01_01_preview.ManagementGroups.list_as_lazy | def list_as_lazy(cache_control:'no-cache', custom_headers:nil)
response = list_async(cache_control:cache_control, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_next_async(next_page_link, cache_control:cache_control, custom_headers:custom_headers)
end
page
end
end | ruby | def list_as_lazy(cache_control:'no-cache', custom_headers:nil)
response = list_async(cache_control:cache_control, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_next_async(next_page_link, cache_control:cache_control, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_as_lazy",
"(",
"cache_control",
":",
"'no-cache'",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_async",
"(",
"cache_control",
":cache_control",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"unless",
"response",
".",
... | List management groups for the authenticated user.
@param cache_control [String] Indicates that the request shouldn't utilize
any caches.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ManagementGroupListResult] which provide lazy access to pages of the
response. | [
"List",
"management",
"groups",
"for",
"the",
"authenticated",
"user",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_resources_management/lib/2018-01-01-preview/generated/azure_mgmt_resources_management/management_groups.rb#L781-L790 | train | Gets a list of all the available CDNs. | [
30522,
13366,
2862,
1035,
2004,
1035,
13971,
1006,
17053,
1035,
2491,
1024,
1005,
2053,
1011,
17053,
1005,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2004,
6038,
2278,
1006,
17053,
1035,
2491,
1024,
17053... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_textanalytics/lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb | Azure::CognitiveServices::TextAnalytics::V2_1.TextAnalyticsClient.entities | def entities(show_stats:nil, multi_language_batch_input:nil, custom_headers:nil)
response = entities_async(show_stats:show_stats, multi_language_batch_input:multi_language_batch_input, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def entities(show_stats:nil, multi_language_batch_input:nil, custom_headers:nil)
response = entities_async(show_stats:show_stats, multi_language_batch_input:multi_language_batch_input, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"entities",
"(",
"show_stats",
":",
"nil",
",",
"multi_language_batch_input",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"entities_async",
"(",
"show_stats",
":show_stats",
",",
"multi_language_batch_input",
":multi_language_batch_input"... | The API returns a list of recognized entities in a given document.
To get even more information on each recognized entity we recommend using the
Bing Entity Search API by querying for the recognized entities names. See the
<a
href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages">Supported
languages in Text Analytics API</a> for the list of enabled languages.
@param show_stats [Boolean] (optional) if set to true, response will contain
input and document level statistics.
@param multi_language_batch_input [MultiLanguageBatchInput] Collection of
documents to analyze.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [EntitiesBatchResult] operation results. | [
"The",
"API",
"returns",
"a",
"list",
"of",
"recognized",
"entities",
"in",
"a",
"given",
"document",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_textanalytics/lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb#L245-L248 | train | Gets the entities for the specified language. | [
30522,
13366,
11422,
1006,
2265,
1035,
26319,
1024,
9152,
30524,
14108,
1035,
7953,
1024,
4800,
1035,
2653,
1035,
14108,
1035,
7953,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
20346,
2015,
1007,
1012,
3643,
999,
3433,
1012,
2303,
4983... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/views.rb | Azure::CustomerInsights::Mgmt::V2017_01_01.Views.get_with_http_info | def get_with_http_info(resource_group_name, hub_name, view_name, user_id, custom_headers:nil)
get_async(resource_group_name, hub_name, view_name, user_id, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, hub_name, view_name, user_id, custom_headers:nil)
get_async(resource_group_name, hub_name, view_name, user_id, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"hub_name",
",",
"view_name",
",",
"user_id",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"hub_name",
",",
"view_name",
",",
"user_id",
",",
"custom_headers",
"... | Gets a view in the hub.
@param resource_group_name [String] The name of the resource group.
@param hub_name [String] The name of the hub.
@param view_name [String] The name of the view.
@param user_id [String] The user ID. Use * to retreive hub level view.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"a",
"view",
"in",
"the",
"hub",
"."
] | 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/views.rb#L264-L266 | train | Gets the specified view s index. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
9594,
1035,
2171,
1010,
3193,
1035,
2171,
1010,
5310,
1035,
8909,
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... |
troessner/reek | lib/reek/context_builder.rb | Reek.ContextBuilder.process_defs | def process_defs(exp, parent)
inside_new_context(Context::SingletonMethodContext, exp, parent) do
increase_statement_count_by(exp.body)
process(exp)
end
end | ruby | def process_defs(exp, parent)
inside_new_context(Context::SingletonMethodContext, exp, parent) do
increase_statement_count_by(exp.body)
process(exp)
end
end | [
"def",
"process_defs",
"(",
"exp",
",",
"parent",
")",
"inside_new_context",
"(",
"Context",
"::",
"SingletonMethodContext",
",",
"exp",
",",
"parent",
")",
"do",
"increase_statement_count_by",
"(",
"exp",
".",
"body",
")",
"process",
"(",
"exp",
")",
"end",
... | Handles `defs` nodes ("define singleton").
An input example that would trigger this method would be:
def self.call_me; foo = 2; bar = 5; end
Given the above example we would count 2 statements overall. | [
"Handles",
"defs",
"nodes",
"(",
"define",
"singleton",
")",
"."
] | 8c6b5c0c6228a6981ab48543457889f9ea984054 | https://github.com/troessner/reek/blob/8c6b5c0c6228a6981ab48543457889f9ea984054/lib/reek/context_builder.rb#L138-L143 | train | Process definitions | [
30522,
13366,
2832,
1035,
13366,
2015,
1006,
4654,
2361,
1010,
6687,
1007,
2503,
1035,
2047,
1035,
6123,
1006,
6123,
1024,
1024,
28159,
11368,
6806,
16409,
28040,
18413,
1010,
4654,
2361,
1010,
6687,
1007,
2079,
3623,
1035,
4861,
1035,
4175... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | spaceship/lib/spaceship/tunes/tunes_client.rb | Spaceship.TunesClient.handle_itc_response | def handle_itc_response(raw, flaky_api_call: false)
return unless raw
return unless raw.kind_of?(Hash)
data = raw['data'] || raw # sometimes it's with data, sometimes it isn't
error_keys = ["sectionErrorKeys", "validationErrors", "serviceErrors"]
info_keys = ["sectionInfoKeys", "sectionWarningKeys"]
error_and_info_keys_to_check = error_keys + info_keys
errors_in_data = fetch_errors_in_data(data_section: data, keys: error_and_info_keys_to_check)
errors_in_version_info = fetch_errors_in_data(data_section: data, sub_section_name: "versionInfo", keys: error_and_info_keys_to_check)
# If we have any errors or "info" we need to treat them as warnings or errors
if errors_in_data.count == 0 && errors_in_version_info.count == 0
logger.debug("Request was successful")
end
# We pass on the `current_language` so that the error message tells the user
# what language the error was caused in
handle_response_hash = lambda do |hash, current_language = nil|
errors = []
if hash.kind_of?(Hash)
current_language ||= hash["language"]
hash.each do |key, value|
errors += handle_response_hash.call(value, current_language)
next unless key == 'errorKeys' && value.kind_of?(Array) && value.count > 0
# Prepend the error with the language so it's easier to understand for the user
errors += value.collect do |current_error_message|
current_language ? "[#{current_language}]: #{current_error_message}" : current_error_message
end
end
elsif hash.kind_of?(Array)
hash.each do |value|
errors += handle_response_hash.call(value)
end
# else: We don't care about simple values
end
return errors
end
errors = handle_response_hash.call(data)
# Search at data level, as well as "versionInfo" level for errors
errors_in_data = fetch_errors_in_data(data_section: data, keys: error_keys)
errors_in_version_info = fetch_errors_in_data(data_section: data, sub_section_name: "versionInfo", keys: error_keys)
errors += errors_in_data.values if errors_in_data.values
errors += errors_in_version_info.values if errors_in_version_info.values
errors = errors.flat_map { |value| value }
# Sometimes there is a different kind of error in the JSON response
# e.g. {"warn"=>nil, "error"=>["operation_failed"], "info"=>nil}
different_error = raw.fetch('messages', {}).fetch('error', nil)
errors << different_error if different_error
if errors.count > 0 # they are separated by `.` by default
# Sample `error` content: [["Forbidden"]]
if errors.count == 1 && errors.first == "You haven't made any changes."
# This is a special error which we really don't care about
elsif errors.count == 1 && errors.first.include?("try again later")
raise ITunesConnectTemporaryError.new, errors.first
elsif errors.count == 1 && errors.first.include?("Forbidden")
raise_insufficient_permission_error!
elsif flaky_api_call
raise ITunesConnectPotentialServerError.new, errors.join(' ')
else
raise ITunesConnectError.new, errors.join(' ')
end
end
# Search at data level, as well as "versionInfo" level for info and warnings
info_in_data = fetch_errors_in_data(data_section: data, keys: info_keys)
info_in_version_info = fetch_errors_in_data(data_section: data, sub_section_name: "versionInfo", keys: info_keys)
info_in_data.each do |info_key, info_value|
puts(info_value)
end
info_in_version_info.each do |info_key, info_value|
puts(info_value)
end
return data
end | ruby | def handle_itc_response(raw, flaky_api_call: false)
return unless raw
return unless raw.kind_of?(Hash)
data = raw['data'] || raw # sometimes it's with data, sometimes it isn't
error_keys = ["sectionErrorKeys", "validationErrors", "serviceErrors"]
info_keys = ["sectionInfoKeys", "sectionWarningKeys"]
error_and_info_keys_to_check = error_keys + info_keys
errors_in_data = fetch_errors_in_data(data_section: data, keys: error_and_info_keys_to_check)
errors_in_version_info = fetch_errors_in_data(data_section: data, sub_section_name: "versionInfo", keys: error_and_info_keys_to_check)
# If we have any errors or "info" we need to treat them as warnings or errors
if errors_in_data.count == 0 && errors_in_version_info.count == 0
logger.debug("Request was successful")
end
# We pass on the `current_language` so that the error message tells the user
# what language the error was caused in
handle_response_hash = lambda do |hash, current_language = nil|
errors = []
if hash.kind_of?(Hash)
current_language ||= hash["language"]
hash.each do |key, value|
errors += handle_response_hash.call(value, current_language)
next unless key == 'errorKeys' && value.kind_of?(Array) && value.count > 0
# Prepend the error with the language so it's easier to understand for the user
errors += value.collect do |current_error_message|
current_language ? "[#{current_language}]: #{current_error_message}" : current_error_message
end
end
elsif hash.kind_of?(Array)
hash.each do |value|
errors += handle_response_hash.call(value)
end
# else: We don't care about simple values
end
return errors
end
errors = handle_response_hash.call(data)
# Search at data level, as well as "versionInfo" level for errors
errors_in_data = fetch_errors_in_data(data_section: data, keys: error_keys)
errors_in_version_info = fetch_errors_in_data(data_section: data, sub_section_name: "versionInfo", keys: error_keys)
errors += errors_in_data.values if errors_in_data.values
errors += errors_in_version_info.values if errors_in_version_info.values
errors = errors.flat_map { |value| value }
# Sometimes there is a different kind of error in the JSON response
# e.g. {"warn"=>nil, "error"=>["operation_failed"], "info"=>nil}
different_error = raw.fetch('messages', {}).fetch('error', nil)
errors << different_error if different_error
if errors.count > 0 # they are separated by `.` by default
# Sample `error` content: [["Forbidden"]]
if errors.count == 1 && errors.first == "You haven't made any changes."
# This is a special error which we really don't care about
elsif errors.count == 1 && errors.first.include?("try again later")
raise ITunesConnectTemporaryError.new, errors.first
elsif errors.count == 1 && errors.first.include?("Forbidden")
raise_insufficient_permission_error!
elsif flaky_api_call
raise ITunesConnectPotentialServerError.new, errors.join(' ')
else
raise ITunesConnectError.new, errors.join(' ')
end
end
# Search at data level, as well as "versionInfo" level for info and warnings
info_in_data = fetch_errors_in_data(data_section: data, keys: info_keys)
info_in_version_info = fetch_errors_in_data(data_section: data, sub_section_name: "versionInfo", keys: info_keys)
info_in_data.each do |info_key, info_value|
puts(info_value)
end
info_in_version_info.each do |info_key, info_value|
puts(info_value)
end
return data
end | [
"def",
"handle_itc_response",
"(",
"raw",
",",
"flaky_api_call",
":",
"false",
")",
"return",
"unless",
"raw",
"return",
"unless",
"raw",
".",
"kind_of?",
"(",
"Hash",
")",
"data",
"=",
"raw",
"[",
"'data'",
"]",
"||",
"raw",
"# sometimes it's with data, somet... | rubocop:disable Metrics/PerceivedComplexity
If the response is coming from a flaky api, set flaky_api_call to true so we retry a little.
Patience is a virtue. | [
"rubocop",
":",
"disable",
"Metrics",
"/",
"PerceivedComplexity",
"If",
"the",
"response",
"is",
"coming",
"from",
"a",
"flaky",
"api",
"set",
"flaky_api_call",
"to",
"true",
"so",
"we",
"retry",
"a",
"little",
".",
"Patience",
"is",
"a",
"virtue",
"."
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/spaceship/lib/spaceship/tunes/tunes_client.rb#L161-L247 | train | This function handles the response from the itc server | [
30522,
13366,
5047,
1035,
2009,
2278,
1035,
3433,
1006,
6315,
1010,
13109,
4817,
2100,
1035,
17928,
1035,
2655,
1024,
6270,
1007,
2709,
4983,
6315,
2709,
4983,
6315,
1012,
2785,
1035,
1997,
1029,
1006,
23325,
1007,
2951,
1027,
6315,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_operational_insights/lib/2015-03-20/generated/azure_mgmt_operational_insights/storage_insights.rb | Azure::OperationalInsights::Mgmt::V2015_03_20.StorageInsights.list_by_workspace_as_lazy | def list_by_workspace_as_lazy(resource_group_name, workspace_name, custom_headers:nil)
response = list_by_workspace_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_workspace_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_by_workspace_as_lazy(resource_group_name, workspace_name, custom_headers:nil)
response = list_by_workspace_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_workspace_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_by_workspace_as_lazy",
"(",
"resource_group_name",
",",
"workspace_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_workspace_async",
"(",
"resource_group_name",
",",
"workspace_name",
",",
"custom_headers",
":custom_headers",
")",
"."... | Lists the storage insight instances within a workspace
@param resource_group_name [String] The name of the resource group to get.
The name is case insensitive.
@param workspace_name [String] Log Analytics Workspace name that will contain
the storageInsightsConfigs resource
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [StorageInsightListResult] which provide lazy access to pages of the
response. | [
"Lists",
"the",
"storage",
"insight",
"instances",
"within",
"a",
"workspace"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_operational_insights/lib/2015-03-20/generated/azure_mgmt_operational_insights/storage_insights.rb#L563-L572 | train | Gets the list of all the managed managed | [
30522,
13366,
2862,
1035,
2011,
1035,
2573,
15327,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2573,
15327,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
2573,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
haml/haml | lib/haml/buffer.rb | Haml.Buffer.push_text | def push_text(text, tab_change, dont_tab_up)
if @tabulation > 0
# Have to push every line in by the extra user set tabulation.
# Don't push lines with just whitespace, though,
# because that screws up precompiled indentation.
text.gsub!(/^(?!\s+$)/m, tabs)
text.sub!(tabs, '') if dont_tab_up
end
@real_tabs += tab_change
@buffer << text
end | ruby | def push_text(text, tab_change, dont_tab_up)
if @tabulation > 0
# Have to push every line in by the extra user set tabulation.
# Don't push lines with just whitespace, though,
# because that screws up precompiled indentation.
text.gsub!(/^(?!\s+$)/m, tabs)
text.sub!(tabs, '') if dont_tab_up
end
@real_tabs += tab_change
@buffer << text
end | [
"def",
"push_text",
"(",
"text",
",",
"tab_change",
",",
"dont_tab_up",
")",
"if",
"@tabulation",
">",
"0",
"# Have to push every line in by the extra user set tabulation.",
"# Don't push lines with just whitespace, though,",
"# because that screws up precompiled indentation.",
"text... | @param upper [Buffer] The parent buffer
@param options [{Symbol => Object}] An options hash.
See {Haml::Engine#options\_for\_buffer}
Appends text to the buffer, properly tabulated.
Also modifies the document's indentation.
@param text [String] The text to append
@param tab_change [Fixnum] The number of tabs by which to increase
or decrease the document's indentation
@param dont_tab_up [Boolean] If true, don't indent the first line of `text` | [
"@param",
"upper",
"[",
"Buffer",
"]",
"The",
"parent",
"buffer",
"@param",
"options",
"[",
"{",
"Symbol",
"=",
">",
"Object",
"}",
"]",
"An",
"options",
"hash",
".",
"See",
"{",
"Haml",
"::",
"Engine#options",
"\\",
"_for",
"\\",
"_buffer",
"}",
"Appe... | 9aa0fbe4a91b999978927be569d2ad0cd39076f1 | https://github.com/haml/haml/blob/9aa0fbe4a91b999978927be569d2ad0cd39076f1/lib/haml/buffer.rb#L111-L122 | train | Push a text to the buffer. | [
30522,
13366,
5245,
1035,
3793,
1006,
3793,
1010,
21628,
1035,
2689,
1010,
2123,
2102,
1035,
21628,
1035,
2039,
1007,
2065,
1030,
21628,
9513,
1028,
1014,
1001,
2031,
2000,
5245,
2296,
2240,
1999,
2011,
1996,
4469,
5310,
2275,
21628,
9513,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
flavorjones/loofah | lib/loofah/scrubber.rb | Loofah.Scrubber.append_attribute | def append_attribute(node, attribute, value)
current_value = node.get_attribute(attribute) || ''
current_values = current_value.split(/\s+/)
updated_value = current_values | [value]
node.set_attribute(attribute, updated_value.join(' '))
end | ruby | def append_attribute(node, attribute, value)
current_value = node.get_attribute(attribute) || ''
current_values = current_value.split(/\s+/)
updated_value = current_values | [value]
node.set_attribute(attribute, updated_value.join(' '))
end | [
"def",
"append_attribute",
"(",
"node",
",",
"attribute",
",",
"value",
")",
"current_value",
"=",
"node",
".",
"get_attribute",
"(",
"attribute",
")",
"||",
"''",
"current_values",
"=",
"current_value",
".",
"split",
"(",
"/",
"\\s",
"/",
")",
"updated_valu... | If the attribute is not set, add it
If the attribute is set, don't overwrite the existing value | [
"If",
"the",
"attribute",
"is",
"not",
"set",
"add",
"it",
"If",
"the",
"attribute",
"is",
"set",
"don",
"t",
"overwrite",
"the",
"existing",
"value"
] | 49f178941f10a97aa6441e71fae704a81cc3a731 | https://github.com/flavorjones/loofah/blob/49f178941f10a97aa6441e71fae704a81cc3a731/lib/loofah/scrubber.rb#L93-L98 | train | Append a value to the attribute of a node. | [
30522,
13366,
10439,
10497,
1035,
17961,
1006,
13045,
1010,
17961,
1010,
3643,
1007,
2783,
1035,
3643,
1027,
13045,
1012,
2131,
1035,
17961,
1006,
17961,
1007,
1064,
1064,
1005,
1005,
2783,
1035,
5300,
1027,
2783,
1035,
3643,
1012,
3975,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activerecord/lib/active_record/core.rb | ActiveRecord.Core.pretty_print | def pretty_print(pp)
return super if custom_inspect_method_defined?
pp.object_address_group(self) do
if defined?(@attributes) && @attributes
attr_names = self.class.attribute_names.select { |name| has_attribute?(name) }
pp.seplist(attr_names, proc { pp.text "," }) do |attr_name|
pp.breakable " "
pp.group(1) do
pp.text attr_name
pp.text ":"
pp.breakable
value = _read_attribute(attr_name)
value = inspection_filter.filter_param(attr_name, value) unless value.nil?
pp.pp value
end
end
else
pp.breakable " "
pp.text "not initialized"
end
end
end | ruby | def pretty_print(pp)
return super if custom_inspect_method_defined?
pp.object_address_group(self) do
if defined?(@attributes) && @attributes
attr_names = self.class.attribute_names.select { |name| has_attribute?(name) }
pp.seplist(attr_names, proc { pp.text "," }) do |attr_name|
pp.breakable " "
pp.group(1) do
pp.text attr_name
pp.text ":"
pp.breakable
value = _read_attribute(attr_name)
value = inspection_filter.filter_param(attr_name, value) unless value.nil?
pp.pp value
end
end
else
pp.breakable " "
pp.text "not initialized"
end
end
end | [
"def",
"pretty_print",
"(",
"pp",
")",
"return",
"super",
"if",
"custom_inspect_method_defined?",
"pp",
".",
"object_address_group",
"(",
"self",
")",
"do",
"if",
"defined?",
"(",
"@attributes",
")",
"&&",
"@attributes",
"attr_names",
"=",
"self",
".",
"class",
... | Takes a PP and prettily prints this record to it, allowing you to get a nice result from <tt>pp record</tt>
when pp is required. | [
"Takes",
"a",
"PP",
"and",
"prettily",
"prints",
"this",
"record",
"to",
"it",
"allowing",
"you",
"to",
"get",
"a",
"nice",
"result",
"from",
"<tt",
">",
"pp",
"record<",
"/",
"tt",
">",
"when",
"pp",
"is",
"required",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activerecord/lib/active_record/core.rb#L528-L549 | train | Pretty print the object. | [
30522,
13366,
3492,
1035,
6140,
1006,
4903,
1007,
2709,
3565,
2065,
7661,
1035,
22459,
1035,
4118,
1035,
4225,
1029,
4903,
1012,
4874,
1035,
4769,
1035,
2177,
1006,
2969,
1007,
2079,
2065,
4225,
1029,
1006,
1030,
12332,
1007,
1004,
1004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
awesome-print/awesome_print | lib/awesome_print/inspector.rb | AwesomePrint.Inspector.merge_custom_defaults! | def merge_custom_defaults!
load_dotfile
merge_options!(AwesomePrint.defaults) if AwesomePrint.defaults.is_a?(Hash)
rescue => e
$stderr.puts "Could not load '.aprc' from ENV['HOME']: #{e}"
end | ruby | def merge_custom_defaults!
load_dotfile
merge_options!(AwesomePrint.defaults) if AwesomePrint.defaults.is_a?(Hash)
rescue => e
$stderr.puts "Could not load '.aprc' from ENV['HOME']: #{e}"
end | [
"def",
"merge_custom_defaults!",
"load_dotfile",
"merge_options!",
"(",
"AwesomePrint",
".",
"defaults",
")",
"if",
"AwesomePrint",
".",
"defaults",
".",
"is_a?",
"(",
"Hash",
")",
"rescue",
"=>",
"e",
"$stderr",
".",
"puts",
"\"Could not load '.aprc' from ENV['HOME']... | Load ~/.aprc file with custom defaults that override default options.
--------------------------------------------------------------------------- | [
"Load",
"~",
"/",
".",
"aprc",
"file",
"with",
"custom",
"defaults",
"that",
"override",
"default",
"options",
".",
"---------------------------------------------------------------------------"
] | 4564fd74721562cbef2443f7d97109bf9192343d | https://github.com/awesome-print/awesome_print/blob/4564fd74721562cbef2443f7d97109bf9192343d/lib/awesome_print/inspector.rb#L162-L167 | train | Load the. aprc file and merge the defaults | [
30522,
13366,
13590,
1035,
7661,
1035,
12398,
2015,
999,
7170,
1035,
11089,
8873,
2571,
13590,
1035,
7047,
999,
1006,
12476,
16550,
1012,
12398,
30524,
1035,
1037,
1029,
1006,
23325,
1007,
5343,
1027,
1028,
1041,
1002,
2358,
4063,
2099,
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... |
meew0/discordrb | lib/discordrb/bot.rb | Discordrb.Bot.accept_invite | def accept_invite(invite)
resolved = invite(invite).code
API::Invite.accept(token, resolved)
end | ruby | def accept_invite(invite)
resolved = invite(invite).code
API::Invite.accept(token, resolved)
end | [
"def",
"accept_invite",
"(",
"invite",
")",
"resolved",
"=",
"invite",
"(",
"invite",
")",
".",
"code",
"API",
"::",
"Invite",
".",
"accept",
"(",
"token",
",",
"resolved",
")",
"end"
] | Makes the bot join an invite to a server.
@param invite [String, Invite] The invite to join. For possible formats see {#resolve_invite_code}. | [
"Makes",
"the",
"bot",
"join",
"an",
"invite",
"to",
"a",
"server",
"."
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/bot.rb#L272-L275 | train | Accept an invite | [
30522,
13366,
5138,
1035,
13260,
1006,
13260,
1007,
10395,
1027,
13260,
1006,
13260,
1007,
1012,
3642,
17928,
1024,
1024,
13260,
1012,
5138,
1006,
19204,
1010,
10395,
1007,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/uri.rb | Mongo.URI.max_staleness | def max_staleness(value)
if /\A\d+\z/ =~ value
int = value.to_i
if int >= 0 && int < 90
log_warn("max staleness must be either 0 or greater than 90: #{value}")
end
return int
end
log_warn("Invalid max staleness value: #{value}")
nil
end | ruby | def max_staleness(value)
if /\A\d+\z/ =~ value
int = value.to_i
if int >= 0 && int < 90
log_warn("max staleness must be either 0 or greater than 90: #{value}")
end
return int
end
log_warn("Invalid max staleness value: #{value}")
nil
end | [
"def",
"max_staleness",
"(",
"value",
")",
"if",
"/",
"\\A",
"\\d",
"\\z",
"/",
"=~",
"value",
"int",
"=",
"value",
".",
"to_i",
"if",
"int",
">=",
"0",
"&&",
"int",
"<",
"90",
"log_warn",
"(",
"\"max staleness must be either 0 or greater than 90: #{value}\"",... | Parses the max staleness value, which must be either "0" or an integer greater or equal to 90.
@param value [ String ] The max staleness string.
@return [ Integer | nil ] The max staleness integer parsed out if it is valid, otherwise nil
(and a warning will be logged). | [
"Parses",
"the",
"max",
"staleness",
"value",
"which",
"must",
"be",
"either",
"0",
"or",
"an",
"integer",
"greater",
"or",
"equal",
"to",
"90",
"."
] | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/uri.rb#L888-L901 | train | Returns the maximum staleness of a given value. | [
30522,
13366,
4098,
1035,
26729,
2791,
1006,
3643,
1007,
2065,
1013,
1032,
1037,
1032,
1040,
1009,
1032,
1062,
1013,
1027,
1066,
3643,
20014,
1027,
3643,
1012,
2000,
1035,
1045,
2065,
20014,
1028,
1027,
1014,
1004,
1004,
20014,
1026,
3938,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
meew0/discordrb | lib/discordrb/bot.rb | Discordrb.Bot.add_guild_member | def add_guild_member(data)
server_id = data['guild_id'].to_i
server = self.server(server_id)
member = Member.new(data, server, self)
server.add_member(member)
end | ruby | def add_guild_member(data)
server_id = data['guild_id'].to_i
server = self.server(server_id)
member = Member.new(data, server, self)
server.add_member(member)
end | [
"def",
"add_guild_member",
"(",
"data",
")",
"server_id",
"=",
"data",
"[",
"'guild_id'",
"]",
".",
"to_i",
"server",
"=",
"self",
".",
"server",
"(",
"server_id",
")",
"member",
"=",
"Member",
".",
"new",
"(",
"data",
",",
"server",
",",
"self",
")",
... | Internal handler for GUILD_MEMBER_ADD | [
"Internal",
"handler",
"for",
"GUILD_MEMBER_ADD"
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/bot.rb#L864-L870 | train | Add a member to the guild | [
30522,
13366,
5587,
1035,
9054,
1035,
2266,
1006,
2951,
1007,
8241,
1035,
8909,
1027,
2951,
1031,
1005,
9054,
1035,
8909,
1005,
1033,
1012,
2000,
1035,
1045,
8241,
1027,
2969,
1012,
8241,
1006,
30524,
1027,
2266,
1012,
2047,
1006,
2951,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
samvera/hyrax | lib/wings/active_fedora_converter.rb | Wings.ActiveFedoraConverter.add_access_control_attributes | def add_access_control_attributes(af_object)
af_object.visibility = attributes[:visibility] unless attributes[:visibility].blank?
af_object.read_users = attributes[:read_users] unless attributes[:read_users].blank?
af_object.edit_users = attributes[:edit_users] unless attributes[:edit_users].blank?
af_object.read_groups = attributes[:read_groups] unless attributes[:read_groups].blank?
af_object.edit_groups = attributes[:edit_groups] unless attributes[:edit_groups].blank?
end | ruby | def add_access_control_attributes(af_object)
af_object.visibility = attributes[:visibility] unless attributes[:visibility].blank?
af_object.read_users = attributes[:read_users] unless attributes[:read_users].blank?
af_object.edit_users = attributes[:edit_users] unless attributes[:edit_users].blank?
af_object.read_groups = attributes[:read_groups] unless attributes[:read_groups].blank?
af_object.edit_groups = attributes[:edit_groups] unless attributes[:edit_groups].blank?
end | [
"def",
"add_access_control_attributes",
"(",
"af_object",
")",
"af_object",
".",
"visibility",
"=",
"attributes",
"[",
":visibility",
"]",
"unless",
"attributes",
"[",
":visibility",
"]",
".",
"blank?",
"af_object",
".",
"read_users",
"=",
"attributes",
"[",
":rea... | Add attributes from resource which aren't AF properties into af_object | [
"Add",
"attributes",
"from",
"resource",
"which",
"aren",
"t",
"AF",
"properties",
"into",
"af_object"
] | e2b4f56e829a53b1f11296324736e9d5b8c9ee5f | https://github.com/samvera/hyrax/blob/e2b4f56e829a53b1f11296324736e9d5b8c9ee5f/lib/wings/active_fedora_converter.rb#L151-L157 | train | Adds access control attributes to the object | [
30522,
13366,
5587,
1035,
3229,
1035,
2491,
1035,
12332,
1006,
21358,
1035,
4874,
1007,
21358,
1035,
4874,
1012,
16476,
1027,
12332,
1031,
1024,
16476,
1033,
4983,
12332,
1031,
1024,
16476,
1033,
1012,
8744,
1029,
21358,
1035,
4874,
1012,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
DataDog/dogstatsd-ruby | lib/datadog/statsd.rb | Datadog.Statsd.decrement | def decrement(stat, opts=EMPTY_OPTIONS)
opts = {:sample_rate => opts} if opts.is_a? Numeric
decr_value = - opts.fetch(:by, 1)
count stat, decr_value, opts
end | ruby | def decrement(stat, opts=EMPTY_OPTIONS)
opts = {:sample_rate => opts} if opts.is_a? Numeric
decr_value = - opts.fetch(:by, 1)
count stat, decr_value, opts
end | [
"def",
"decrement",
"(",
"stat",
",",
"opts",
"=",
"EMPTY_OPTIONS",
")",
"opts",
"=",
"{",
":sample_rate",
"=>",
"opts",
"}",
"if",
"opts",
".",
"is_a?",
"Numeric",
"decr_value",
"=",
"-",
"opts",
".",
"fetch",
"(",
":by",
",",
"1",
")",
"count",
"st... | Sends a decrement (count = -1) for the given stat to the statsd server.
@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
@option opts [Numeric] :by decrement value, default 1
@see #count | [
"Sends",
"a",
"decrement",
"(",
"count",
"=",
"-",
"1",
")",
"for",
"the",
"given",
"stat",
"to",
"the",
"statsd",
"server",
"."
] | 0ea2a4d011958ad0d092654cae950e64b6475077 | https://github.com/DataDog/dogstatsd-ruby/blob/0ea2a4d011958ad0d092654cae950e64b6475077/lib/datadog/statsd.rb#L263-L267 | train | Decrement the value of a stat | [
30522,
13366,
11703,
28578,
4765,
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,
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/sheet_pr.rb | Axlsx.SheetPr.to_xml_string | def to_xml_string(str = '')
update_properties
str << "<sheetPr #{serialized_attributes}>"
tab_color.to_xml_string(str, 'tabColor') if tab_color
outline_pr.to_xml_string(str) if @outline_pr
page_setup_pr.to_xml_string(str)
str << "</sheetPr>"
end | ruby | def to_xml_string(str = '')
update_properties
str << "<sheetPr #{serialized_attributes}>"
tab_color.to_xml_string(str, 'tabColor') if tab_color
outline_pr.to_xml_string(str) if @outline_pr
page_setup_pr.to_xml_string(str)
str << "</sheetPr>"
end | [
"def",
"to_xml_string",
"(",
"str",
"=",
"''",
")",
"update_properties",
"str",
"<<",
"\"<sheetPr #{serialized_attributes}>\"",
"tab_color",
".",
"to_xml_string",
"(",
"str",
",",
"'tabColor'",
")",
"if",
"tab_color",
"outline_pr",
".",
"to_xml_string",
"(",
"str",
... | Serialize the object
@param [String] str serialized output will be appended to this object if provided.
@return [String] | [
"Serialize",
"the",
"object"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/worksheet/sheet_pr.rb#L51-L58 | train | Serialize the sheet to xml string | [
30522,
13366,
2000,
1035,
20950,
1035,
5164,
1006,
2358,
2099,
1027,
1005,
1005,
1007,
10651,
1035,
5144,
2358,
2099,
1026,
1026,
1000,
1026,
7123,
18098,
1001,
1063,
27289,
1035,
12332,
1065,
1028,
1000,
21628,
1035,
3609,
1012,
2000,
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 | fastlane/lib/fastlane/swift_fastlane_api_generator.rb | Fastlane.SwiftFastlaneAPIGenerator.increment_api_version_string | def increment_api_version_string(api_version_string: nil, increment_by: :patch)
versions = api_version_string.split(".")
major = versions[0].to_i
minor = versions[1].to_i
patch = versions[2].to_i
case increment_by
when :patch
patch += 1
when :minor
minor += 1
patch = 0
when :major
major += 1
minor = 0
patch = 0
end
new_version_string = [major, minor, patch].join(".")
return new_version_string
end | ruby | def increment_api_version_string(api_version_string: nil, increment_by: :patch)
versions = api_version_string.split(".")
major = versions[0].to_i
minor = versions[1].to_i
patch = versions[2].to_i
case increment_by
when :patch
patch += 1
when :minor
minor += 1
patch = 0
when :major
major += 1
minor = 0
patch = 0
end
new_version_string = [major, minor, patch].join(".")
return new_version_string
end | [
"def",
"increment_api_version_string",
"(",
"api_version_string",
":",
"nil",
",",
"increment_by",
":",
":patch",
")",
"versions",
"=",
"api_version_string",
".",
"split",
"(",
"\".\"",
")",
"major",
"=",
"versions",
"[",
"0",
"]",
".",
"to_i",
"minor",
"=",
... | expects format to be "X.Y.Z" where each value is a number | [
"expects",
"format",
"to",
"be",
"X",
".",
"Y",
".",
"Z",
"where",
"each",
"value",
"is",
"a",
"number"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/fastlane/lib/fastlane/swift_fastlane_api_generator.rb#L249-L269 | train | Increments the API version string of the API. | [
30522,
13366,
4297,
28578,
4765,
1035,
17928,
1035,
2544,
1035,
5164,
1006,
17928,
1035,
2544,
1035,
5164,
1024,
9152,
2140,
1010,
4297,
28578,
4765,
1035,
2011,
1024,
1024,
8983,
1007,
4617,
1027,
17928,
1035,
2544,
1035,
5164,
1012,
3975,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hashicorp/vagrant | lib/vagrant/environment.rb | Vagrant.Environment.machine | def machine(name, provider, refresh=false)
@logger.info("Getting machine: #{name} (#{provider})")
# Compose the cache key of the name and provider, and return from
# the cache if we have that.
cache_key = [name, provider]
@machines ||= {}
if refresh
@logger.info("Refreshing machine (busting cache): #{name} (#{provider})")
@machines.delete(cache_key)
end
if @machines.key?(cache_key)
@logger.info("Returning cached machine: #{name} (#{provider})")
return @machines[cache_key]
end
@logger.info("Uncached load of machine.")
# Determine the machine data directory and pass it to the machine.
machine_data_path = @local_data_path.join(
"machines/#{name}/#{provider}")
# Create the machine and cache it for future calls. This will also
# return the machine from this method.
@machines[cache_key] = vagrantfile.machine(
name, provider, boxes, machine_data_path, self)
end | ruby | def machine(name, provider, refresh=false)
@logger.info("Getting machine: #{name} (#{provider})")
# Compose the cache key of the name and provider, and return from
# the cache if we have that.
cache_key = [name, provider]
@machines ||= {}
if refresh
@logger.info("Refreshing machine (busting cache): #{name} (#{provider})")
@machines.delete(cache_key)
end
if @machines.key?(cache_key)
@logger.info("Returning cached machine: #{name} (#{provider})")
return @machines[cache_key]
end
@logger.info("Uncached load of machine.")
# Determine the machine data directory and pass it to the machine.
machine_data_path = @local_data_path.join(
"machines/#{name}/#{provider}")
# Create the machine and cache it for future calls. This will also
# return the machine from this method.
@machines[cache_key] = vagrantfile.machine(
name, provider, boxes, machine_data_path, self)
end | [
"def",
"machine",
"(",
"name",
",",
"provider",
",",
"refresh",
"=",
"false",
")",
"@logger",
".",
"info",
"(",
"\"Getting machine: #{name} (#{provider})\"",
")",
"# Compose the cache key of the name and provider, and return from",
"# the cache if we have that.",
"cache_key",
... | This returns a machine with the proper provider for this environment.
The machine named by `name` must be in this environment.
@param [Symbol] name Name of the machine (as configured in the
Vagrantfile).
@param [Symbol] provider The provider that this machine should be
backed by.
@param [Boolean] refresh If true, then if there is a cached version
it is reloaded.
@return [Machine] | [
"This",
"returns",
"a",
"machine",
"with",
"the",
"proper",
"provider",
"for",
"this",
"environment",
".",
"The",
"machine",
"named",
"by",
"name",
"must",
"be",
"in",
"this",
"environment",
"."
] | c22a145c59790c098f95d50141d9afb48e1ef55f | https://github.com/hashicorp/vagrant/blob/c22a145c59790c098f95d50141d9afb48e1ef55f/lib/vagrant/environment.rb#L692-L719 | train | Get the machine from the cache. | [
30522,
13366,
3698,
1006,
2171,
1010,
10802,
1010,
25416,
21898,
1027,
6270,
1007,
1030,
8833,
4590,
1012,
18558,
1006,
1000,
2893,
3698,
1024,
1001,
1063,
2171,
1065,
1006,
1001,
1063,
10802,
1065,
1007,
1000,
1007,
1001,
17202,
1996,
1705... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_api_management/lib/2019-01-01/generated/azure_mgmt_api_management/logger.rb | Azure::ApiManagement::Mgmt::V2019_01_01.Logger.get_with_http_info | def get_with_http_info(resource_group_name, service_name, logger_id, custom_headers:nil)
get_async(resource_group_name, service_name, logger_id, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, service_name, logger_id, custom_headers:nil)
get_async(resource_group_name, service_name, logger_id, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"service_name",
",",
"logger_id",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"service_name",
",",
"logger_id",
",",
"custom_headers",
":custom_headers",
")",
".",
... | Gets the details of the logger specified by its identifier.
@param resource_group_name [String] The name of the resource group.
@param service_name [String] The name of the API Management service.
@param logger_id [String] Logger identifier. Must be unique in the API
Management service instance.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"details",
"of",
"the",
"logger",
"specified",
"by",
"its",
"identifier",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2019-01-01/generated/azure_mgmt_api_management/logger.rb#L276-L278 | train | Gets the specified logger s information. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
8833,
4590,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.