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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
RailsEventStore/rails_event_store | ruby_event_store/lib/ruby_event_store/client.rb | RubyEventStore.Client.overwrite | def overwrite(events_or_event)
events = Array(events_or_event)
serialized_events = serialize_events(events)
repository.update_messages(serialized_events)
self
end | ruby | def overwrite(events_or_event)
events = Array(events_or_event)
serialized_events = serialize_events(events)
repository.update_messages(serialized_events)
self
end | [
"def",
"overwrite",
"(",
"events_or_event",
")",
"events",
"=",
"Array",
"(",
"events_or_event",
")",
"serialized_events",
"=",
"serialize_events",
"(",
"events",
")",
"repository",
".",
"update_messages",
"(",
"serialized_events",
")",
"self",
"end"
] | Overwrite existing event(s) with the same ID.
Does not notify any subscribed handlers.
Does not enrich with additional current metadata.
Does not allow changing which streams these events are in.
{http://railseventstore.org/docs/migrating_messages Read more}
@example Add data and metadata to existing events
events = event_store.read.limit(10).to_a
events.each do |ev|
ev.data[:tenant_id] = 1
ev.metadata[:server_id] = "eu-west-2"
end
event_store.overwrite(events)
@example Change event type
events = event_store.read.limit(10).each.select{|ev| OldType === ev }.map do |ev|
NewType.new(
event_id: ev.event_id,
data: ev.data,
metadata: ev.metadata,
)
end
event_store.overwrite(events)
@param events [Array<Event, Proto>, Event, Proto] event(s) to serialize and overwrite again
@return [self] | [
"Overwrite",
"existing",
"event",
"(",
"s",
")",
"with",
"the",
"same",
"ID",
"."
] | 3ee4f3148499794154ee6fec74ccf6d4670d85ac | https://github.com/RailsEventStore/rails_event_store/blob/3ee4f3148499794154ee6fec74ccf6d4670d85ac/ruby_event_store/lib/ruby_event_store/client.rb#L264-L269 | train | overwrite the events in the repository | [
30522,
13366,
2058,
26373,
1006,
2824,
1035,
2030,
1035,
2724,
1007,
2824,
1027,
9140,
1006,
2824,
1035,
2030,
1035,
2724,
1007,
27289,
1035,
2824,
1027,
7642,
4697,
1035,
2824,
1006,
2824,
1007,
22409,
1012,
10651,
1035,
7696,
1006,
27289,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/current_attributes.rb | ActiveSupport.CurrentAttributes.set | def set(set_attributes)
old_attributes = compute_attributes(set_attributes.keys)
assign_attributes(set_attributes)
yield
ensure
assign_attributes(old_attributes)
end | ruby | def set(set_attributes)
old_attributes = compute_attributes(set_attributes.keys)
assign_attributes(set_attributes)
yield
ensure
assign_attributes(old_attributes)
end | [
"def",
"set",
"(",
"set_attributes",
")",
"old_attributes",
"=",
"compute_attributes",
"(",
"set_attributes",
".",
"keys",
")",
"assign_attributes",
"(",
"set_attributes",
")",
"yield",
"ensure",
"assign_attributes",
"(",
"old_attributes",
")",
"end"
] | Expose one or more attributes within a block. Old values are returned after the block concludes.
Example demonstrating the common use of needing to set Current attributes outside the request-cycle:
class Chat::PublicationJob < ApplicationJob
def perform(attributes, room_number, creator)
Current.set(person: creator) do
Chat::Publisher.publish(attributes: attributes, room_number: room_number)
end
end
end | [
"Expose",
"one",
"or",
"more",
"attributes",
"within",
"a",
"block",
".",
"Old",
"values",
"are",
"returned",
"after",
"the",
"block",
"concludes",
".",
"Example",
"demonstrating",
"the",
"common",
"use",
"of",
"needing",
"to",
"set",
"Current",
"attributes",
... | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/current_attributes.rb#L179-L185 | train | Sets the attributes of the object to be set. | [
30522,
13366,
2275,
1006,
2275,
1035,
12332,
1007,
2214,
1035,
12332,
1027,
24134,
1035,
12332,
1006,
2275,
1035,
12332,
1012,
6309,
1007,
23911,
1035,
12332,
1006,
2275,
1035,
12332,
1007,
10750,
5676,
23911,
1035,
12332,
1006,
2214,
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/api_client.rb | SquareConnect.ApiClient.object_to_http_body | def object_to_http_body(model)
return model if model.nil? || model.is_a?(String)
local_body = nil
if model.is_a?(Array)
local_body = model.map{|m| object_to_hash(m) }
else
local_body = object_to_hash(model)
end
local_body.to_json
end | ruby | def object_to_http_body(model)
return model if model.nil? || model.is_a?(String)
local_body = nil
if model.is_a?(Array)
local_body = model.map{|m| object_to_hash(m) }
else
local_body = object_to_hash(model)
end
local_body.to_json
end | [
"def",
"object_to_http_body",
"(",
"model",
")",
"return",
"model",
"if",
"model",
".",
"nil?",
"||",
"model",
".",
"is_a?",
"(",
"String",
")",
"local_body",
"=",
"nil",
"if",
"model",
".",
"is_a?",
"(",
"Array",
")",
"local_body",
"=",
"model",
".",
... | Convert object (array, hash, object, etc) to JSON string.
@param [Object] model object to be converted into JSON string
@return [String] JSON string representation of the object | [
"Convert",
"object",
"(",
"array",
"hash",
"object",
"etc",
")",
"to",
"JSON",
"string",
"."
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api_client.rb#L343-L352 | train | Convert a model to a HTTP body | [
30522,
13366,
4874,
1035,
2000,
1035,
8299,
1035,
2303,
1006,
2944,
1007,
2709,
2944,
2065,
2944,
30524,
1049,
1007,
1065,
2842,
2334,
1035,
2303,
1027,
4874,
1035,
2000,
1035,
23325,
1006,
2944,
1007,
2203,
2334,
1035,
2303,
1012,
2000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_storage/lib/2018-07-01/generated/azure_mgmt_storage/blob_containers.rb | Azure::Storage::Mgmt::V2018_07_01.BlobContainers.set_legal_hold | def set_legal_hold(resource_group_name, account_name, container_name, legal_hold, custom_headers:nil)
response = set_legal_hold_async(resource_group_name, account_name, container_name, legal_hold, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def set_legal_hold(resource_group_name, account_name, container_name, legal_hold, custom_headers:nil)
response = set_legal_hold_async(resource_group_name, account_name, container_name, legal_hold, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"set_legal_hold",
"(",
"resource_group_name",
",",
"account_name",
",",
"container_name",
",",
"legal_hold",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"set_legal_hold_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"container_name",
... | Sets legal hold tags. Setting the same tag results in an idempotent
operation. SetLegalHold follows an append pattern and does not clear out the
existing tags that are not specified in the request.
@param resource_group_name [String] The name of the resource group within the
user's subscription. The name is case insensitive.
@param account_name [String] The name of the storage account within the
specified resource group. Storage account names must be between 3 and 24
characters in length and use numbers and lower-case letters only.
@param container_name [String] The name of the blob container within the
specified storage account. Blob container names must be between 3 and 63
characters in length and use numbers, lower-case letters and dash (-) only.
Every dash (-) character must be immediately preceded and followed by a
letter or number.
@param legal_hold [LegalHold] The LegalHold property that will be set to a
blob container.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [LegalHold] operation results. | [
"Sets",
"legal",
"hold",
"tags",
".",
"Setting",
"the",
"same",
"tag",
"results",
"in",
"an",
"idempotent",
"operation",
".",
"SetLegalHold",
"follows",
"an",
"append",
"pattern",
"and",
"does",
"not",
"clear",
"out",
"the",
"existing",
"tags",
"that",
"are"... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_storage/lib/2018-07-01/generated/azure_mgmt_storage/blob_containers.rb#L693-L696 | train | Set the legal hold of a container. | [
30522,
13366,
2275,
1035,
3423,
1035,
2907,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
11661,
1035,
2171,
1010,
3423,
1035,
2907,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2275,
1035,
3423,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jeremytregunna/ruby-trello | lib/trello/checklist.rb | Trello.Checklist.update_item_state | def update_item_state(item_id, state)
state = ( state ? 'complete' : 'incomplete' ) unless state.is_a?(String)
client.put(
"/cards/#{card_id}/checkItem/#{item_id}",
state: state
)
end | ruby | def update_item_state(item_id, state)
state = ( state ? 'complete' : 'incomplete' ) unless state.is_a?(String)
client.put(
"/cards/#{card_id}/checkItem/#{item_id}",
state: state
)
end | [
"def",
"update_item_state",
"(",
"item_id",
",",
"state",
")",
"state",
"=",
"(",
"state",
"?",
"'complete'",
":",
"'incomplete'",
")",
"unless",
"state",
".",
"is_a?",
"(",
"String",
")",
"client",
".",
"put",
"(",
"\"/cards/#{card_id}/checkItem/#{item_id}\"",
... | Update a checklist item's state, e.g.: "complete" or "incomplete" | [
"Update",
"a",
"checklist",
"item",
"s",
"state",
"e",
".",
"g",
".",
":",
"complete",
"or",
"incomplete"
] | ad79c9d8152ad5395b3b61c43170908f1912bfb2 | https://github.com/jeremytregunna/ruby-trello/blob/ad79c9d8152ad5395b3b61c43170908f1912bfb2/lib/trello/checklist.rb#L111-L117 | train | Update the item state of a check item | [
30522,
30524,
1006,
8875,
1035,
8909,
1010,
2110,
1007,
2110,
1027,
1006,
2110,
1029,
1005,
3143,
1005,
1024,
1005,
12958,
1005,
1007,
4983,
2110,
1012,
2003,
1035,
1037,
1029,
1006,
5164,
1007,
7396,
1012,
2404,
1006,
1000,
1013,
5329,
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... |
alexreisner/geocoder | lib/geocoder/stores/mongo_base.rb | Geocoder::Store.MongoBase.reverse_geocode | def reverse_geocode
do_lookup(true) do |o,rs|
if r = rs.first
unless r.address.nil?
o.__send__ "#{self.class.geocoder_options[:fetched_address]}=", r.address
end
r.address
end
end
end | ruby | def reverse_geocode
do_lookup(true) do |o,rs|
if r = rs.first
unless r.address.nil?
o.__send__ "#{self.class.geocoder_options[:fetched_address]}=", r.address
end
r.address
end
end
end | [
"def",
"reverse_geocode",
"do_lookup",
"(",
"true",
")",
"do",
"|",
"o",
",",
"rs",
"|",
"if",
"r",
"=",
"rs",
".",
"first",
"unless",
"r",
".",
"address",
".",
"nil?",
"o",
".",
"__send__",
"\"#{self.class.geocoder_options[:fetched_address]}=\"",
",",
"r",
... | Look up address and assign to +address+ attribute (or other as specified
in +reverse_geocoded_by+). Returns address (string). | [
"Look",
"up",
"address",
"and",
"assign",
"to",
"+",
"address",
"+",
"attribute",
"(",
"or",
"other",
"as",
"specified",
"in",
"+",
"reverse_geocoded_by",
"+",
")",
".",
"Returns",
"address",
"(",
"string",
")",
"."
] | e087dc2759264ee6f307b926bb2de4ec2406859e | https://github.com/alexreisner/geocoder/blob/e087dc2759264ee6f307b926bb2de4ec2406859e/lib/geocoder/stores/mongo_base.rb#L46-L55 | train | reverse_geocode
| [
30522,
13366,
7901,
1035,
20248,
16044,
2079,
1035,
2298,
6279,
1006,
2995,
1007,
2079,
1064,
1051,
1010,
12667,
1064,
2065,
1054,
1027,
12667,
1012,
2034,
4983,
1054,
1012,
4769,
1012,
9152,
2140,
1029,
1051,
1012,
1035,
1035,
4604,
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/api/customers_api.rb | SquareConnect.CustomersApi.delete_customer_card | def delete_customer_card(customer_id, card_id, opts = {})
data, _status_code, _headers = delete_customer_card_with_http_info(customer_id, card_id, opts)
return data
end | ruby | def delete_customer_card(customer_id, card_id, opts = {})
data, _status_code, _headers = delete_customer_card_with_http_info(customer_id, card_id, opts)
return data
end | [
"def",
"delete_customer_card",
"(",
"customer_id",
",",
"card_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"delete_customer_card_with_http_info",
"(",
"customer_id",
",",
"card_id",
",",
"opts",
")",
"return",
"data",
... | DeleteCustomerCard
Removes a card on file from a customer.
@param customer_id The ID of the customer that the card on file belongs to.
@param card_id The ID of the card on file to delete.
@param [Hash] opts the optional parameters
@return [DeleteCustomerCardResponse] | [
"DeleteCustomerCard",
"Removes",
"a",
"card",
"on",
"file",
"from",
"a",
"customer",
"."
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/customers_api.rb#L195-L198 | train | DeleteCustomerCard Returns a list of cards | [
30522,
13366,
3972,
12870,
1035,
8013,
1035,
4003,
1006,
8013,
1035,
8909,
1010,
4003,
1035,
8909,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
3972,
12870,
1035,
8013,
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... |
sds/overcommit | lib/overcommit/git_repo.rb | Overcommit.GitRepo.modified_files | def modified_files(options)
flags = '--cached' if options[:staged]
refs = options[:refs]
subcmd = options[:subcmd] || 'diff'
`git #{subcmd} --name-only -z --diff-filter=ACMR --ignore-submodules=all #{flags} #{refs}`.
split("\0").
map(&:strip).
reject(&:empty?).
map { |relative_file| File.expand_path(relative_file) }
end | ruby | def modified_files(options)
flags = '--cached' if options[:staged]
refs = options[:refs]
subcmd = options[:subcmd] || 'diff'
`git #{subcmd} --name-only -z --diff-filter=ACMR --ignore-submodules=all #{flags} #{refs}`.
split("\0").
map(&:strip).
reject(&:empty?).
map { |relative_file| File.expand_path(relative_file) }
end | [
"def",
"modified_files",
"(",
"options",
")",
"flags",
"=",
"'--cached'",
"if",
"options",
"[",
":staged",
"]",
"refs",
"=",
"options",
"[",
":refs",
"]",
"subcmd",
"=",
"options",
"[",
":subcmd",
"]",
"||",
"'diff'",
"`",
"#{",
"subcmd",
"}",
"#{",
"f... | Returns the names of all files that have been modified compared to HEAD.
@param options [Hash]
@return [Array<String>] list of absolute file paths | [
"Returns",
"the",
"names",
"of",
"all",
"files",
"that",
"have",
"been",
"modified",
"compared",
"to",
"HEAD",
"."
] | 35d60adb41da942178b789560968e3ad030b0ac7 | https://github.com/sds/overcommit/blob/35d60adb41da942178b789560968e3ad030b0ac7/lib/overcommit/git_repo.rb#L92-L102 | train | Returns the modified files for the given repository. | [
30522,
13366,
6310,
1035,
6764,
1006,
7047,
1007,
9245,
1027,
1005,
1011,
1011,
17053,
2094,
1005,
2065,
7047,
1031,
1024,
9813,
1033,
25416,
2015,
1027,
7047,
1031,
1024,
25416,
2015,
1033,
4942,
27487,
2094,
1027,
7047,
1031,
1024,
4942,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
appsignal/rdkafka-ruby | lib/rdkafka/consumer.rb | Rdkafka.Consumer.assign | def assign(list)
unless list.is_a?(TopicPartitionList)
raise TypeError.new("list has to be a TopicPartitionList")
end
tpl = list.to_native_tpl
response = Rdkafka::Bindings.rd_kafka_assign(@native_kafka, tpl)
if response != 0
raise Rdkafka::RdkafkaError.new(response, "Error assigning '#{list.to_h}'")
end
end | ruby | def assign(list)
unless list.is_a?(TopicPartitionList)
raise TypeError.new("list has to be a TopicPartitionList")
end
tpl = list.to_native_tpl
response = Rdkafka::Bindings.rd_kafka_assign(@native_kafka, tpl)
if response != 0
raise Rdkafka::RdkafkaError.new(response, "Error assigning '#{list.to_h}'")
end
end | [
"def",
"assign",
"(",
"list",
")",
"unless",
"list",
".",
"is_a?",
"(",
"TopicPartitionList",
")",
"raise",
"TypeError",
".",
"new",
"(",
"\"list has to be a TopicPartitionList\"",
")",
"end",
"tpl",
"=",
"list",
".",
"to_native_tpl",
"response",
"=",
"Rdkafka",... | Atomic assignment of partitions to consume
@param list [TopicPartitionList] The topic with partitions to assign
@raise [RdkafkaError] When assigning fails | [
"Atomic",
"assignment",
"of",
"partitions",
"to",
"consume"
] | 87b3e0ddae5ea576847cb67228fcea06ec2a24d6 | https://github.com/appsignal/rdkafka-ruby/blob/87b3e0ddae5ea576847cb67228fcea06ec2a24d6/lib/rdkafka/consumer.rb#L124-L133 | train | Assign a list of TopicPartition objects to this Kafka topic. | [
30522,
13366,
23911,
1006,
2862,
1007,
4983,
2862,
1012,
2003,
1035,
1037,
1029,
1006,
8476,
19362,
3775,
3508,
9863,
1007,
5333,
2828,
2121,
29165,
1012,
2047,
1006,
1000,
2862,
2038,
2000,
2022,
1037,
8476,
19362,
3775,
3508,
9863,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
strongself/Generamba | lib/generamba/template/helpers/catalog_downloader.rb | Generamba.CatalogDownloader.update_all_catalogs_and_return_filepaths | def update_all_catalogs_and_return_filepaths
does_rambafile_exist = Dir[RAMBAFILE_NAME].count > 0
if does_rambafile_exist
rambafile = YAML.load_file(RAMBAFILE_NAME)
catalogs = rambafile[CATALOGS_KEY]
end
terminator = CatalogTerminator.new
terminator.remove_all_catalogs
catalog_paths = [download_catalog(GENERAMBA_CATALOG_NAME, RAMBLER_CATALOG_REPO)]
if catalogs != nil && catalogs.count > 0
catalogs.each do |catalog_url|
catalog_name = catalog_url.split('://').last
catalog_name = catalog_name.gsub('/', '-');
catalog_paths.push(download_catalog(catalog_name, catalog_url))
end
end
return catalog_paths
end | ruby | def update_all_catalogs_and_return_filepaths
does_rambafile_exist = Dir[RAMBAFILE_NAME].count > 0
if does_rambafile_exist
rambafile = YAML.load_file(RAMBAFILE_NAME)
catalogs = rambafile[CATALOGS_KEY]
end
terminator = CatalogTerminator.new
terminator.remove_all_catalogs
catalog_paths = [download_catalog(GENERAMBA_CATALOG_NAME, RAMBLER_CATALOG_REPO)]
if catalogs != nil && catalogs.count > 0
catalogs.each do |catalog_url|
catalog_name = catalog_url.split('://').last
catalog_name = catalog_name.gsub('/', '-');
catalog_paths.push(download_catalog(catalog_name, catalog_url))
end
end
return catalog_paths
end | [
"def",
"update_all_catalogs_and_return_filepaths",
"does_rambafile_exist",
"=",
"Dir",
"[",
"RAMBAFILE_NAME",
"]",
".",
"count",
">",
"0",
"if",
"does_rambafile_exist",
"rambafile",
"=",
"YAML",
".",
"load_file",
"(",
"RAMBAFILE_NAME",
")",
"catalogs",
"=",
"rambafile... | Updates all of the template catalogs and returns their filepaths.
If there is a Rambafile in the current directory, it also updates all of the catalogs specified there.
@return [Array] An array of filepaths to downloaded catalogs | [
"Updates",
"all",
"of",
"the",
"template",
"catalogs",
"and",
"returns",
"their",
"filepaths",
".",
"If",
"there",
"is",
"a",
"Rambafile",
"in",
"the",
"current",
"directory",
"it",
"also",
"updates",
"all",
"of",
"the",
"catalogs",
"specified",
"there",
"."... | 9ef343805f3a66f58bc36e120e822d5436a4da97 | https://github.com/strongself/Generamba/blob/9ef343805f3a66f58bc36e120e822d5436a4da97/lib/generamba/template/helpers/catalog_downloader.rb#L12-L33 | train | Update all the catalogs and return the file paths of the generated catalog. | [
30522,
13366,
10651,
1035,
2035,
1035,
12105,
2015,
1035,
1998,
1035,
2709,
1035,
5371,
15069,
2015,
2515,
1035,
8223,
3676,
8873,
2571,
1035,
4839,
1027,
16101,
1031,
8223,
3676,
8873,
2571,
1035,
2171,
1033,
1012,
4175,
1028,
1014,
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... |
coinbase/geoengineer | lib/geoengineer/resources/aws/api_gateway/helpers.rb | GeoEngineer::ApiGatewayHelpers.ClassMethods._remote_rest_api_resource | def _remote_rest_api_resource(provider)
_fetch_remote_rest_apis(provider).map do |rr|
_fetch_remote_rest_api_resources_for_rest_api(provider, rr).map do |res|
yield rr, res
end
end
end | ruby | def _remote_rest_api_resource(provider)
_fetch_remote_rest_apis(provider).map do |rr|
_fetch_remote_rest_api_resources_for_rest_api(provider, rr).map do |res|
yield rr, res
end
end
end | [
"def",
"_remote_rest_api_resource",
"(",
"provider",
")",
"_fetch_remote_rest_apis",
"(",
"provider",
")",
".",
"map",
"do",
"|",
"rr",
"|",
"_fetch_remote_rest_api_resources_for_rest_api",
"(",
"provider",
",",
"rr",
")",
".",
"map",
"do",
"|",
"res",
"|",
"yie... | Combination Methods | [
"Combination",
"Methods"
] | d26f8850a492ddb3d27e78b25d1313cf593df5a9 | https://github.com/coinbase/geoengineer/blob/d26f8850a492ddb3d27e78b25d1313cf593df5a9/lib/geoengineer/resources/aws/api_gateway/helpers.rb#L72-L78 | train | Returns a list of remote REST API resources | [
30522,
13366,
1035,
6556,
1035,
2717,
1035,
17928,
1035,
7692,
1006,
10802,
1007,
1035,
18584,
1035,
6556,
1035,
2717,
1035,
17928,
2015,
1006,
10802,
1007,
1012,
4949,
2079,
1064,
25269,
1064,
1035,
18584,
1035,
6556,
1035,
2717,
1035,
179... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jekyll/jekyll | lib/jekyll/frontmatter_defaults.rb | Jekyll.FrontmatterDefaults.all | def all(path, type)
defaults = {}
old_scope = nil
matching_sets(path, type).each do |set|
if has_precedence?(old_scope, set["scope"])
defaults = Utils.deep_merge_hashes(defaults, set["values"])
old_scope = set["scope"]
else
defaults = Utils.deep_merge_hashes(set["values"], defaults)
end
end
defaults
end | ruby | def all(path, type)
defaults = {}
old_scope = nil
matching_sets(path, type).each do |set|
if has_precedence?(old_scope, set["scope"])
defaults = Utils.deep_merge_hashes(defaults, set["values"])
old_scope = set["scope"]
else
defaults = Utils.deep_merge_hashes(set["values"], defaults)
end
end
defaults
end | [
"def",
"all",
"(",
"path",
",",
"type",
")",
"defaults",
"=",
"{",
"}",
"old_scope",
"=",
"nil",
"matching_sets",
"(",
"path",
",",
"type",
")",
".",
"each",
"do",
"|",
"set",
"|",
"if",
"has_precedence?",
"(",
"old_scope",
",",
"set",
"[",
"\"scope\... | Collects a hash with all default values for a page or post
path - the relative path of the page or post
type - a symbol indicating the type (:post, :page or :draft)
Returns a hash with all default values (an empty hash if there are none) | [
"Collects",
"a",
"hash",
"with",
"all",
"default",
"values",
"for",
"a",
"page",
"or",
"post"
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/frontmatter_defaults.rb#L79-L91 | train | Returns the defaults for a given path and type | [
30522,
13366,
2035,
1006,
4130,
1010,
2828,
1007,
12398,
2015,
1027,
1063,
1065,
2214,
1035,
9531,
1027,
9152,
2140,
9844,
1035,
4520,
1006,
4130,
1010,
2828,
1007,
1012,
2169,
2079,
1064,
2275,
1064,
2065,
2038,
1035,
23359,
1029,
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... |
castwide/solargraph | lib/solargraph/range.rb | Solargraph.Range.include? | def include? position
position = Position.normalize(position)
contain?(position) && !(position.line == start.line && position.character == start.character)
end | ruby | def include? position
position = Position.normalize(position)
contain?(position) && !(position.line == start.line && position.character == start.character)
end | [
"def",
"include?",
"position",
"position",
"=",
"Position",
".",
"normalize",
"(",
"position",
")",
"contain?",
"(",
"position",
")",
"&&",
"!",
"(",
"position",
".",
"line",
"==",
"start",
".",
"line",
"&&",
"position",
".",
"character",
"==",
"start",
... | True if the range contains the specified position and the position does not precede it.
@param position [Position, Array(Integer, Integer)]
@return [Boolean] | [
"True",
"if",
"the",
"range",
"contains",
"the",
"specified",
"position",
"and",
"the",
"position",
"does",
"not",
"precede",
"it",
"."
] | 47badb5d151aca775ccbe6c470236089eae7839d | https://github.com/castwide/solargraph/blob/47badb5d151aca775ccbe6c470236089eae7839d/lib/solargraph/range.rb#L45-L48 | train | Returns true if the position is in the list of positions | [
30522,
13366,
2421,
1029,
2597,
2597,
1027,
2597,
1012,
3671,
4697,
1006,
2597,
1007,
5383,
1029,
1006,
2597,
1007,
1004,
1004,
999,
1006,
2597,
1012,
2240,
1027,
1027,
2707,
1012,
2240,
1004,
1004,
2597,
1012,
2839,
1027,
1027,
2707,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_container_registry/lib/2017-06-01-preview/generated/azure_mgmt_container_registry/replications.rb | Azure::ContainerRegistry::Mgmt::V2017_06_01_preview.Replications.create | def create(resource_group_name, registry_name, replication_name, replication, custom_headers:nil)
response = create_async(resource_group_name, registry_name, replication_name, replication, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create(resource_group_name, registry_name, replication_name, replication, custom_headers:nil)
response = create_async(resource_group_name, registry_name, replication_name, replication, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create",
"(",
"resource_group_name",
",",
"registry_name",
",",
"replication_name",
",",
"replication",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"replication_name",
",",
"... | Creates a replication 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 replication_name [String] The name of the replication.
@param replication [Replication] The parameters for creating a replication.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Replication] operation results. | [
"Creates",
"a",
"replication",
"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/2017-06-01-preview/generated/azure_mgmt_container_registry/replications.rb#L142-L145 | train | Creates a new cluster replication. | [
30522,
13366,
3443,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
21647,
1035,
2171,
1010,
21647,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3443,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jeremytregunna/ruby-trello | lib/trello/organization.rb | Trello.Organization.boards | def boards
boards = Board.from_response client.get("/organizations/#{id}/boards/all")
MultiAssociation.new(self, boards).proxy
end | ruby | def boards
boards = Board.from_response client.get("/organizations/#{id}/boards/all")
MultiAssociation.new(self, boards).proxy
end | [
"def",
"boards",
"boards",
"=",
"Board",
".",
"from_response",
"client",
".",
"get",
"(",
"\"/organizations/#{id}/boards/all\"",
")",
"MultiAssociation",
".",
"new",
"(",
"self",
",",
"boards",
")",
".",
"proxy",
"end"
] | Returns a list of boards under this organization. | [
"Returns",
"a",
"list",
"of",
"boards",
"under",
"this",
"organization",
"."
] | ad79c9d8152ad5395b3b61c43170908f1912bfb2 | https://github.com/jeremytregunna/ruby-trello/blob/ad79c9d8152ad5395b3b61c43170908f1912bfb2/lib/trello/organization.rb#L52-L55 | train | Returns the number of boards that this organization has. | [
30522,
13366,
7923,
7923,
1027,
2604,
1012,
2013,
1035,
3433,
7396,
1012,
2131,
1006,
1000,
1013,
4411,
1013,
1001,
1063,
8909,
1065,
1013,
7923,
1013,
2035,
1000,
1007,
4800,
12054,
10085,
18963,
1012,
2047,
1006,
2969,
1010,
7923,
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_event_grid/lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb | Azure::EventGrid::Mgmt::V2017_06_15_preview.EventSubscriptions.begin_create_with_http_info | def begin_create_with_http_info(scope, event_subscription_name, event_subscription_info, custom_headers:nil)
begin_create_async(scope, event_subscription_name, event_subscription_info, custom_headers:custom_headers).value!
end | ruby | def begin_create_with_http_info(scope, event_subscription_name, event_subscription_info, custom_headers:nil)
begin_create_async(scope, event_subscription_name, event_subscription_info, custom_headers:custom_headers).value!
end | [
"def",
"begin_create_with_http_info",
"(",
"scope",
",",
"event_subscription_name",
",",
"event_subscription_info",
",",
"custom_headers",
":",
"nil",
")",
"begin_create_async",
"(",
"scope",
",",
"event_subscription_name",
",",
"event_subscription_info",
",",
"custom_heade... | Create an event subscription
Asynchronously creates a new event subscription to the specified scope.
Existing event subscriptions cannot be updated with this API and should
instead use the Update event subscription API.
@param scope [String] The scope of the resource to which the event
subscription needs to be created. The scope can be a subscription, or a
resource group, or a top level resource belonging to a resource provider
namespace, or an EventGrid topic. For example, use
'/subscriptions/{subscriptionId}/' for a subscription,
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a
resource group, and
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}'
for a resource, and
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}'
for an EventGrid topic.
@param event_subscription_name [String] Name of the event subscription to be
created. Event subscription names must be between 3 and 64 characters in
length and use alphanumeric letters only.
@param event_subscription_info [EventSubscription] Event subscription
properties containing the destination and filter information
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Create",
"an",
"event",
"subscription"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_event_grid/lib/2017-06-15-preview/generated/azure_mgmt_event_grid/event_subscriptions.rb#L1463-L1465 | train | Creates an event subscription. | [
30522,
13366,
4088,
1035,
3443,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
9531,
1010,
2724,
1035,
15002,
1035,
2171,
1010,
2724,
1035,
15002,
1035,
18558,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
1035,
3443,
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... |
anycable/anycable | lib/anycable/cli.rb | AnyCable.CLI.log_errors! | def log_errors!
if AnyCable.config.debug?
# Print error with backtrace in debug mode
AnyCable.capture_exception do |e|
AnyCable.logger.error("#{e.message}:\n#{e.backtrace.take(20).join("\n")}")
end
else
AnyCable.capture_exception { |e| AnyCable.logger.error(e.message) }
end
end | ruby | def log_errors!
if AnyCable.config.debug?
# Print error with backtrace in debug mode
AnyCable.capture_exception do |e|
AnyCable.logger.error("#{e.message}:\n#{e.backtrace.take(20).join("\n")}")
end
else
AnyCable.capture_exception { |e| AnyCable.logger.error(e.message) }
end
end | [
"def",
"log_errors!",
"if",
"AnyCable",
".",
"config",
".",
"debug?",
"# Print error with backtrace in debug mode",
"AnyCable",
".",
"capture_exception",
"do",
"|",
"e",
"|",
"AnyCable",
".",
"logger",
".",
"error",
"(",
"\"#{e.message}:\\n#{e.backtrace.take(20).join(\"\\... | Add default exceptions handler: print error message to log | [
"Add",
"default",
"exceptions",
"handler",
":",
"print",
"error",
"message",
"to",
"log"
] | d7515e8e034d42e86ebeb09786a92aad2a11b25f | https://github.com/anycable/anycable/blob/d7515e8e034d42e86ebeb09786a92aad2a11b25f/lib/anycable/cli.rb#L222-L231 | train | Log any errors that occurred in the current request | [
30522,
13366,
8833,
1035,
10697,
999,
2065,
2151,
21170,
1012,
9530,
8873,
2290,
1012,
2139,
8569,
2290,
1029,
1001,
6140,
7561,
2007,
2067,
6494,
3401,
1999,
2139,
8569,
2290,
5549,
2151,
21170,
1012,
5425,
1035,
6453,
2079,
1064,
1041,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_datalake_analytics/lib/2015-10-01-preview/generated/azure_mgmt_datalake_analytics/account.rb | Azure::DataLakeAnalytics::Mgmt::V2015_10_01_preview.Account.list_with_http_info | def list_with_http_info(filter:nil, top:nil, skip:nil, expand:nil, select:nil, orderby:nil, count:nil, search:nil, format:nil, custom_headers:nil)
list_async(filter:filter, top:top, skip:skip, expand:expand, select:select, orderby:orderby, count:count, search:search, format:format, custom_headers:custom_headers).value!
end | ruby | def list_with_http_info(filter:nil, top:nil, skip:nil, expand:nil, select:nil, orderby:nil, count:nil, search:nil, format:nil, custom_headers:nil)
list_async(filter:filter, top:top, skip:skip, expand:expand, select:select, orderby:orderby, count:count, search:search, format:format, custom_headers:custom_headers).value!
end | [
"def",
"list_with_http_info",
"(",
"filter",
":",
"nil",
",",
"top",
":",
"nil",
",",
"skip",
":",
"nil",
",",
"expand",
":",
"nil",
",",
"select",
":",
"nil",
",",
"orderby",
":",
"nil",
",",
"count",
":",
"nil",
",",
"search",
":",
"nil",
",",
... | Gets the first page of Data Lake Analytics accounts, if any, within the
current subscription. This includes a link to the next page, if any.
@param filter [String] OData filter. Optional.
@param top [Integer] The number of items to return. Optional.
@param skip [Integer] The number of items to skip over before returning
elements. Optional.
@param expand [String] OData expansion. Expand related resources in line with
the retrieved resources, e.g. Categories/$expand=Products would expand
Product data in line with each Category entry. Optional.
@param select [String] OData Select statement. Limits the properties on each
entry to just those requested, e.g.
Categories?$select=CategoryName,Description. Optional.
@param orderby [String] OrderBy clause. One or more comma-separated
expressions with an optional "asc" (the default) or "desc" depending on the
order you'd like the values sorted, e.g. Categories?$orderby=CategoryName
desc. Optional.
@param count [Boolean] The Boolean value of true or false to request a count
of the matching resources included with the resources in the response, e.g.
Categories?$count=true. Optional.
@param search [String] A free form search. A free-text search expression to
match for whether a particular entry should be included in the feed, e.g.
Categories?$search=blue OR green. Optional.
@param format [String] The desired return format. Return the response in
particular formatxii without access to request headers for standard
content-type negotiation (e.g Orders?$format=json). Optional.
@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",
"first",
"page",
"of",
"Data",
"Lake",
"Analytics",
"accounts",
"if",
"any",
"within",
"the",
"current",
"subscription",
".",
"This",
"includes",
"a",
"link",
"to",
"the",
"next",
"page",
"if",
"any",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_datalake_analytics/lib/2015-10-01-preview/generated/azure_mgmt_datalake_analytics/account.rb#L1683-L1685 | train | Gets a list of all the image objects in a collection of image objects. | [
30522,
13366,
2862,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
11307,
1024,
9152,
2140,
1010,
2327,
1024,
9152,
2140,
1010,
13558,
1024,
9152,
2140,
1010,
7818,
1024,
9152,
2140,
1010,
7276,
1024,
9152,
2140,
1010,
2344,
3762,
1024,
9152,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | runtime/ms_rest/lib/ms_rest/credentials/token_credentials.rb | MsRest.TokenCredentials.sign_request | def sign_request(request)
super(request)
header = @token_provider.get_authentication_header
if (request.respond_to?(:request_headers))
request.request_headers[AUTHORIZATION] = header
elsif request.respond_to?(:headers)
request.headers[AUTHORIZATION] = header
else
fail ArgumentError, 'Incorrect request object was provided'
end
end | ruby | def sign_request(request)
super(request)
header = @token_provider.get_authentication_header
if (request.respond_to?(:request_headers))
request.request_headers[AUTHORIZATION] = header
elsif request.respond_to?(:headers)
request.headers[AUTHORIZATION] = header
else
fail ArgumentError, 'Incorrect request object was provided'
end
end | [
"def",
"sign_request",
"(",
"request",
")",
"super",
"(",
"request",
")",
"header",
"=",
"@token_provider",
".",
"get_authentication_header",
"if",
"(",
"request",
".",
"respond_to?",
"(",
":request_headers",
")",
")",
"request",
".",
"request_headers",
"[",
"AU... | Creates and initialize new instance of the TokenCredentials class.
@param token_provider [TokenProvider] the token provider.
@param token [String] the token.
Attaches OAuth authentication header to the given HTTP request.
@param request [Net::HTTPRequest] the request authentication header needs to be attached to.
@return [Net::HTTPRequest] request with attached authentication header | [
"Creates",
"and",
"initialize",
"new",
"instance",
"of",
"the",
"TokenCredentials",
"class",
".",
"@param",
"token_provider",
"[",
"TokenProvider",
"]",
"the",
"token",
"provider",
".",
"@param",
"token",
"[",
"String",
"]",
"the",
"token",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/runtime/ms_rest/lib/ms_rest/credentials/token_credentials.rb#L47-L58 | train | Sign the request object | [
30522,
13366,
3696,
1035,
5227,
1006,
5227,
1007,
3565,
1006,
5227,
1007,
20346,
1027,
1030,
19204,
1035,
10802,
1012,
2131,
1035,
27280,
1035,
20346,
2065,
1006,
5227,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
5227,
1035,
20346,
2015,
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... |
jekyll/jekyll | lib/jekyll/renderer.rb | Jekyll.Renderer.converters | def converters
@converters ||= site.converters.select { |c| c.matches(document.extname) }.sort
end | ruby | def converters
@converters ||= site.converters.select { |c| c.matches(document.extname) }.sort
end | [
"def",
"converters",
"@converters",
"||=",
"site",
".",
"converters",
".",
"select",
"{",
"|",
"c",
"|",
"c",
".",
"matches",
"(",
"document",
".",
"extname",
")",
"}",
".",
"sort",
"end"
] | Determine which converters to use based on this document's
extension.
Returns Array of Converter instances. | [
"Determine",
"which",
"converters",
"to",
"use",
"based",
"on",
"this",
"document",
"s",
"extension",
"."
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/renderer.rb#L38-L40 | train | Returns the list of converters that match the document extension. | [
30522,
13366,
10463,
2545,
1030,
10463,
2545,
1064,
1064,
1027,
2609,
1012,
10463,
2545,
1012,
7276,
1063,
1064,
1039,
1064,
1039,
1012,
3503,
1006,
6254,
1012,
4654,
2102,
18442,
1007,
1065,
1012,
4066,
2203,
102,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
randym/axlsx | lib/axlsx/drawing/num_data_source.rb | Axlsx.NumDataSource.to_xml_string | def to_xml_string(str="")
str << ('<c:' << tag_name.to_s << '>')
if @f
str << ('<c:' << @ref_tag_name.to_s << '>')
str << ('<c:f>' << @f.to_s << '</c:f>')
end
@data.to_xml_string str
if @f
str << ('</c:' << @ref_tag_name.to_s << '>')
end
str << ('</c:' << tag_name.to_s << '>')
end | ruby | def to_xml_string(str="")
str << ('<c:' << tag_name.to_s << '>')
if @f
str << ('<c:' << @ref_tag_name.to_s << '>')
str << ('<c:f>' << @f.to_s << '</c:f>')
end
@data.to_xml_string str
if @f
str << ('</c:' << @ref_tag_name.to_s << '>')
end
str << ('</c:' << tag_name.to_s << '>')
end | [
"def",
"to_xml_string",
"(",
"str",
"=",
"\"\"",
")",
"str",
"<<",
"(",
"'<c:'",
"<<",
"tag_name",
".",
"to_s",
"<<",
"'>'",
")",
"if",
"@f",
"str",
"<<",
"(",
"'<c:'",
"<<",
"@ref_tag_name",
".",
"to_s",
"<<",
"'>'",
")",
"str",
"<<",
"(",
"'<c:f>... | serialize the object
@param [String] str | [
"serialize",
"the",
"object"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/drawing/num_data_source.rb#L48-L59 | train | Convert the object to XML string. | [
30522,
13366,
2000,
1035,
20950,
1035,
5164,
1006,
2358,
2099,
1027,
1000,
1000,
1007,
2358,
2099,
1026,
1026,
1006,
1005,
1026,
1039,
1024,
1005,
1026,
1026,
6415,
1035,
2171,
1012,
2000,
1035,
1055,
1026,
1026,
1005,
1028,
1005,
1007,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | fastlane/lib/fastlane/server/socket_server.rb | Fastlane.SocketServer.execute_action_command | def execute_action_command(command: nil)
command_return = @command_executor.execute(command: command, target_object: nil)
## probably need to just return Strings, or ready_for_next with object isn't String
return_object = command_return.return_value
return_value_type = command_return.return_value_type
closure_arg = command_return.closure_argument_value
return_object = return_value_processor.prepare_object(
return_value: return_object,
return_value_type: return_value_type
)
if closure_arg.nil?
closure_arg = closure_arg.to_s
else
closure_arg = return_value_processor.prepare_object(
return_value: closure_arg,
return_value_type: :string # always assume string for closure error_callback
)
end
Thread.current[:exception] = nil
payload = {
payload: {
status: "ready_for_next",
return_object: return_object,
closure_argument_value: closure_arg
}
}
return JSON.generate(payload)
rescue StandardError => e
Thread.current[:exception] = e
exception_array = []
exception_array << "#{e.class}:"
exception_array << e.backtrace
while e.respond_to?("cause") && (e = e.cause)
exception_array << "cause: #{e.class}"
exception_array << e.backtrace
end
payload = {
payload: {
status: "failure",
failure_information: exception_array.flatten
}
}
return JSON.generate(payload)
end | ruby | def execute_action_command(command: nil)
command_return = @command_executor.execute(command: command, target_object: nil)
## probably need to just return Strings, or ready_for_next with object isn't String
return_object = command_return.return_value
return_value_type = command_return.return_value_type
closure_arg = command_return.closure_argument_value
return_object = return_value_processor.prepare_object(
return_value: return_object,
return_value_type: return_value_type
)
if closure_arg.nil?
closure_arg = closure_arg.to_s
else
closure_arg = return_value_processor.prepare_object(
return_value: closure_arg,
return_value_type: :string # always assume string for closure error_callback
)
end
Thread.current[:exception] = nil
payload = {
payload: {
status: "ready_for_next",
return_object: return_object,
closure_argument_value: closure_arg
}
}
return JSON.generate(payload)
rescue StandardError => e
Thread.current[:exception] = e
exception_array = []
exception_array << "#{e.class}:"
exception_array << e.backtrace
while e.respond_to?("cause") && (e = e.cause)
exception_array << "cause: #{e.class}"
exception_array << e.backtrace
end
payload = {
payload: {
status: "failure",
failure_information: exception_array.flatten
}
}
return JSON.generate(payload)
end | [
"def",
"execute_action_command",
"(",
"command",
":",
"nil",
")",
"command_return",
"=",
"@command_executor",
".",
"execute",
"(",
"command",
":",
"command",
",",
"target_object",
":",
"nil",
")",
"## probably need to just return Strings, or ready_for_next with object isn't... | execute fastlane action command | [
"execute",
"fastlane",
"action",
"command"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/fastlane/lib/fastlane/server/socket_server.rb#L180-L230 | train | Execute a command | [
30522,
13366,
15389,
1035,
2895,
1035,
3094,
1006,
3094,
1024,
9152,
2140,
1007,
3094,
1035,
2709,
1027,
1030,
3094,
1035,
4654,
8586,
16161,
2099,
1012,
15389,
1006,
3094,
1024,
3094,
1010,
4539,
1035,
4874,
1024,
9152,
2140,
1007,
1001,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mhenrixon/sidekiq-unique-jobs | lib/sidekiq_unique_jobs/util.rb | SidekiqUniqueJobs.Util.keys_with_ttl | def keys_with_ttl(pattern = SCAN_PATTERN, count = DEFAULT_COUNT)
hash = {}
redis do |conn|
conn.scan_each(match: prefix(pattern), count: count).each do |key|
hash[key] = conn.ttl(key)
end
end
hash
end | ruby | def keys_with_ttl(pattern = SCAN_PATTERN, count = DEFAULT_COUNT)
hash = {}
redis do |conn|
conn.scan_each(match: prefix(pattern), count: count).each do |key|
hash[key] = conn.ttl(key)
end
end
hash
end | [
"def",
"keys_with_ttl",
"(",
"pattern",
"=",
"SCAN_PATTERN",
",",
"count",
"=",
"DEFAULT_COUNT",
")",
"hash",
"=",
"{",
"}",
"redis",
"do",
"|",
"conn",
"|",
"conn",
".",
"scan_each",
"(",
"match",
":",
"prefix",
"(",
"pattern",
")",
",",
"count",
":",... | Find unique keys with ttl
@param [String] pattern a pattern to scan for in redis
@param [Integer] count the maximum number of keys to delete
@return [Hash<String, Integer>] a hash with active unique keys and corresponding ttl | [
"Find",
"unique",
"keys",
"with",
"ttl"
] | 2944b97c720528f53962ccfd17d43ac939a77f46 | https://github.com/mhenrixon/sidekiq-unique-jobs/blob/2944b97c720528f53962ccfd17d43ac939a77f46/lib/sidekiq_unique_jobs/util.rb#L31-L39 | train | Returns a hash of all keys with a TTL | [
30522,
13366,
6309,
1035,
2007,
1035,
23746,
2140,
1006,
5418,
1027,
13594,
1035,
5418,
1010,
4175,
1027,
12398,
1035,
4175,
1007,
23325,
1027,
1063,
1065,
2417,
2483,
2079,
1064,
9530,
2078,
1064,
9530,
2078,
1012,
13594,
1035,
2169,
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... |
meew0/discordrb | lib/discordrb/commands/command_bot.rb | Discordrb::Commands.CommandBot.create_message | def create_message(data)
message = Discordrb::Message.new(data, self)
return message if message.from_bot? && !@should_parse_self
return message if message.webhook? && !@attributes[:webhook_commands]
unless message.author
Discordrb::LOGGER.warn("Received a message (#{message.inspect}) with nil author! Ignoring, please report this if you can")
return
end
event = CommandEvent.new(message, self)
chain = trigger?(message)
return message unless chain
# Don't allow spaces between the prefix and the command
if chain.start_with?(' ') && !@attributes[:spaces_allowed]
debug('Chain starts with a space')
return message
end
if chain.strip.empty?
debug('Chain is empty')
return message
end
execute_chain(chain, event)
# Return the message so it doesn't get parsed again during the rest of the dispatch handling
message
end | ruby | def create_message(data)
message = Discordrb::Message.new(data, self)
return message if message.from_bot? && !@should_parse_self
return message if message.webhook? && !@attributes[:webhook_commands]
unless message.author
Discordrb::LOGGER.warn("Received a message (#{message.inspect}) with nil author! Ignoring, please report this if you can")
return
end
event = CommandEvent.new(message, self)
chain = trigger?(message)
return message unless chain
# Don't allow spaces between the prefix and the command
if chain.start_with?(' ') && !@attributes[:spaces_allowed]
debug('Chain starts with a space')
return message
end
if chain.strip.empty?
debug('Chain is empty')
return message
end
execute_chain(chain, event)
# Return the message so it doesn't get parsed again during the rest of the dispatch handling
message
end | [
"def",
"create_message",
"(",
"data",
")",
"message",
"=",
"Discordrb",
"::",
"Message",
".",
"new",
"(",
"data",
",",
"self",
")",
"return",
"message",
"if",
"message",
".",
"from_bot?",
"&&",
"!",
"@should_parse_self",
"return",
"message",
"if",
"message",... | Internal handler for MESSAGE_CREATE that is overwritten to allow for command handling | [
"Internal",
"handler",
"for",
"MESSAGE_CREATE",
"that",
"is",
"overwritten",
"to",
"allow",
"for",
"command",
"handling"
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/commands/command_bot.rb#L393-L423 | train | Create a message from the given data | [
30522,
13366,
3443,
1035,
4471,
1006,
2951,
1007,
4471,
1027,
12532,
4103,
15185,
1024,
1024,
4471,
1012,
2047,
1006,
2951,
1010,
2969,
1007,
2709,
4471,
2065,
4471,
1012,
2013,
1035,
28516,
1029,
1004,
1004,
999,
1030,
2323,
1035,
11968,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/template/resolver.rb | ActionView.Resolver.cached | def cached(key, path_info, details, locals)
name, prefix, partial = path_info
if key
@cache.cache(key, name, prefix, partial, locals) do
yield
end
else
yield
end
end | ruby | def cached(key, path_info, details, locals)
name, prefix, partial = path_info
if key
@cache.cache(key, name, prefix, partial, locals) do
yield
end
else
yield
end
end | [
"def",
"cached",
"(",
"key",
",",
"path_info",
",",
"details",
",",
"locals",
")",
"name",
",",
"prefix",
",",
"partial",
"=",
"path_info",
"if",
"key",
"@cache",
".",
"cache",
"(",
"key",
",",
"name",
",",
"prefix",
",",
"partial",
",",
"locals",
")... | Handles templates caching. If a key is given and caching is on
always check the cache before hitting the resolver. Otherwise,
it always hits the resolver but if the key is present, check if the
resolver is fresher before returning it. | [
"Handles",
"templates",
"caching",
".",
"If",
"a",
"key",
"is",
"given",
"and",
"caching",
"is",
"on",
"always",
"check",
"the",
"cache",
"before",
"hitting",
"the",
"resolver",
".",
"Otherwise",
"it",
"always",
"hits",
"the",
"resolver",
"but",
"if",
"the... | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/actionview/lib/action_view/template/resolver.rb#L151-L161 | train | Cache the result of the request | [
30522,
13366,
17053,
2094,
1006,
3145,
1010,
4130,
1035,
18558,
1010,
4751,
1010,
10575,
1007,
2171,
1010,
17576,
1010,
7704,
1027,
4130,
1035,
18558,
2065,
3145,
1030,
17053,
1012,
17053,
1006,
3145,
1010,
2171,
1010,
17576,
1010,
7704,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/models/order_line_item.rb | SquareConnect.OrderLineItem.catalog_object_id= | def catalog_object_id=(catalog_object_id)
if !catalog_object_id.nil? && catalog_object_id.to_s.length > 192
fail ArgumentError, "invalid value for 'catalog_object_id', the character length must be smaller than or equal to 192."
end
@catalog_object_id = catalog_object_id
end | ruby | def catalog_object_id=(catalog_object_id)
if !catalog_object_id.nil? && catalog_object_id.to_s.length > 192
fail ArgumentError, "invalid value for 'catalog_object_id', the character length must be smaller than or equal to 192."
end
@catalog_object_id = catalog_object_id
end | [
"def",
"catalog_object_id",
"=",
"(",
"catalog_object_id",
")",
"if",
"!",
"catalog_object_id",
".",
"nil?",
"&&",
"catalog_object_id",
".",
"to_s",
".",
"length",
">",
"192",
"fail",
"ArgumentError",
",",
"\"invalid value for 'catalog_object_id', the character length mus... | Custom attribute writer method with validation
@param [Object] catalog_object_id Value to be assigned | [
"Custom",
"attribute",
"writer",
"method",
"with",
"validation"
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/models/order_line_item.rb#L251-L258 | train | Set the catalog object id. | [
30522,
13366,
12105,
1035,
4874,
1035,
8909,
1027,
1006,
12105,
1035,
4874,
1035,
8909,
1007,
2065,
999,
12105,
1035,
4874,
1035,
8909,
1012,
9152,
2140,
1029,
1004,
1004,
12105,
1035,
4874,
1035,
8909,
1012,
2000,
1035,
1055,
1012,
3091,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_event_grid/lib/2019-02-01-preview/generated/azure_mgmt_event_grid/topics.rb | Azure::EventGrid::Mgmt::V2019_02_01_preview.Topics.list_by_resource_group_as_lazy | def list_by_resource_group_as_lazy(resource_group_name, filter:nil, top:nil, custom_headers:nil)
response = list_by_resource_group_async(resource_group_name, filter:filter, top:top, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_by_resource_group_as_lazy(resource_group_name, filter:nil, top:nil, custom_headers:nil)
response = list_by_resource_group_async(resource_group_name, filter:filter, top:top, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_by_resource_group_as_lazy",
"(",
"resource_group_name",
",",
"filter",
":",
"nil",
",",
"top",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_resource_group_async",
"(",
"resource_group_name",
",",
"filter",
":",
"filter",... | List topics under a resource group
List all the topics under a resource group
@param resource_group_name [String] The name of the resource group within the
user's subscription.
@param filter [String] Filter the results using OData syntax.
@param top [Integer] The number of results to return.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [TopicsListResult] which provide lazy access to pages of the
response. | [
"List",
"topics",
"under",
"a",
"resource",
"group"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_event_grid/lib/2019-02-01-preview/generated/azure_mgmt_event_grid/topics.rb#L1333-L1342 | train | Gets a list of all the available managed managed | [
30522,
13366,
2862,
1035,
2011,
1035,
7692,
1035,
2177,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
11307,
1024,
9152,
2140,
1010,
2327,
1024,
9152,
2140,
1010,
7661,
30524,
11307,
1024,
11307,
1010,
2327,
1024,
2327,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-sqs/lib/aws-sdk-sqs/queue.rb | Aws::SQS.Queue.delete | def delete(options = {})
options = options.merge(queue_url: @url)
resp = @client.delete_queue(options)
resp.data
end | ruby | def delete(options = {})
options = options.merge(queue_url: @url)
resp = @client.delete_queue(options)
resp.data
end | [
"def",
"delete",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"queue_url",
":",
"@url",
")",
"resp",
"=",
"@client",
".",
"delete_queue",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
queue.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-sqs/lib/aws-sdk-sqs/queue.rb#L154-L158 | train | Delete a queue | [
30522,
13366,
3972,
12870,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
24240,
1035,
24471,
2140,
1024,
1030,
24471,
2140,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
3972,
12870,
1035,
24240,
1006,
7047,
1007,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/api/v1_items_api.rb | SquareConnect.V1ItemsApi.create_modifier_option | def create_modifier_option(location_id, modifier_list_id, body, opts = {})
data, _status_code, _headers = create_modifier_option_with_http_info(location_id, modifier_list_id, body, opts)
return data
end | ruby | def create_modifier_option(location_id, modifier_list_id, body, opts = {})
data, _status_code, _headers = create_modifier_option_with_http_info(location_id, modifier_list_id, body, opts)
return data
end | [
"def",
"create_modifier_option",
"(",
"location_id",
",",
"modifier_list_id",
",",
"body",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"create_modifier_option_with_http_info",
"(",
"location_id",
",",
"modifier_list_id",
",",
... | CreateModifierOption
Creates an item modifier option and adds it to a modifier list.
@param location_id The ID of the item's associated location.
@param modifier_list_id The ID of the modifier list to edit.
@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 [V1ModifierOption] | [
"CreateModifierOption",
"Creates",
"an",
"item",
"modifier",
"option",
"and",
"adds",
"it",
"to",
"a",
"modifier",
"list",
"."
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/v1_items_api.rb#L511-L514 | train | Creates a modifier option | [
30522,
13366,
3443,
1035,
16913,
18095,
1035,
5724,
1006,
3295,
1035,
8909,
1010,
16913,
18095,
1035,
2862,
1035,
8909,
1010,
2303,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-iam/lib/aws-sdk-iam/resource.rb | Aws::IAM.Resource.instance_profiles | def instance_profiles(options = {})
batches = Enumerator.new do |y|
resp = @client.list_instance_profiles(options)
resp.each_page do |page|
batch = []
page.data.instance_profiles.each do |i|
batch << InstanceProfile.new(
name: i.instance_profile_name,
data: i,
client: @client
)
end
y.yield(batch)
end
end
InstanceProfile::Collection.new(batches)
end | ruby | def instance_profiles(options = {})
batches = Enumerator.new do |y|
resp = @client.list_instance_profiles(options)
resp.each_page do |page|
batch = []
page.data.instance_profiles.each do |i|
batch << InstanceProfile.new(
name: i.instance_profile_name,
data: i,
client: @client
)
end
y.yield(batch)
end
end
InstanceProfile::Collection.new(batches)
end | [
"def",
"instance_profiles",
"(",
"options",
"=",
"{",
"}",
")",
"batches",
"=",
"Enumerator",
".",
"new",
"do",
"|",
"y",
"|",
"resp",
"=",
"@client",
".",
"list_instance_profiles",
"(",
"options",
")",
"resp",
".",
"each_page",
"do",
"|",
"page",
"|",
... | @example Request syntax with placeholder values
instance_profiles = iam.instance_profiles({
path_prefix: "pathPrefixType",
})
@param [Hash] options ({})
@option options [String] :path_prefix
The path prefix for filtering the results. For example, the prefix
`/application_abc/component_xyz/` gets all instance profiles whose
path starts with `/application_abc/component_xyz/`.
This parameter is optional. If it is not included, it defaults to a
slash (/), listing all instance profiles. This parameter allows
(through its [regex pattern][1]) a string of characters consisting of
either a forward slash (/) by itself or a string that must begin and
end with forward slashes. In addition, it can contain any ASCII
character from the ! (\\u0021) through the DEL character (\\u007F),
including most punctuation characters, digits, and upper and
lowercased letters.
[1]: http://wikipedia.org/wiki/regex
@return [InstanceProfile::Collection] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-iam/lib/aws-sdk-iam/resource.rb#L873-L889 | train | Returns an array of InstanceProfiles | [
30522,
13366,
6013,
1035,
17879,
1006,
7047,
1027,
1063,
1065,
1007,
14108,
2229,
1027,
4372,
17897,
16259,
1012,
2047,
2079,
1064,
1061,
1064,
24501,
2361,
1027,
1030,
7396,
1012,
2862,
1035,
6013,
1035,
17879,
1006,
7047,
1007,
24501,
236... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/custom_domains.rb | Azure::CDN::Mgmt::V2017_04_02.CustomDomains.enable_custom_https | def enable_custom_https(resource_group_name, profile_name, endpoint_name, custom_domain_name, custom_headers:nil)
response = enable_custom_https_async(resource_group_name, profile_name, endpoint_name, custom_domain_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def enable_custom_https(resource_group_name, profile_name, endpoint_name, custom_domain_name, custom_headers:nil)
response = enable_custom_https_async(resource_group_name, profile_name, endpoint_name, custom_domain_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"enable_custom_https",
"(",
"resource_group_name",
",",
"profile_name",
",",
"endpoint_name",
",",
"custom_domain_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"enable_custom_https_async",
"(",
"resource_group_name",
",",
"profile_name",
",",
"e... | Enable https delivery of the custom domain.
@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 custom_domain_name [String] Name of the custom domain within an
endpoint.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [CustomDomain] operation results. | [
"Enable",
"https",
"delivery",
"of",
"the",
"custom",
"domain",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_cdn/lib/2017-04-02/generated/azure_mgmt_cdn/custom_domains.rb#L492-L495 | train | Enables the specified CDN endpoint for CDN authentication. | [
30522,
13366,
9585,
1035,
7661,
1035,
16770,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
6337,
1035,
2171,
1010,
2203,
8400,
1035,
2171,
1010,
7661,
1035,
5884,
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 | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.update_pattern_any_entity_role | def update_pattern_any_entity_role(app_id, version_id, entity_id, role_id, entity_role_update_object, custom_headers:nil)
response = update_pattern_any_entity_role_async(app_id, version_id, entity_id, role_id, entity_role_update_object, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def update_pattern_any_entity_role(app_id, version_id, entity_id, role_id, entity_role_update_object, custom_headers:nil)
response = update_pattern_any_entity_role_async(app_id, version_id, entity_id, role_id, entity_role_update_object, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"update_pattern_any_entity_role",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"role_id",
",",
"entity_role_update_object",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"update_pattern_any_entity_role_async",
"(",
"app_id",
",",
"version_i... | Update a role for a given Pattern.any entity in a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param entity_id The entity ID.
@param role_id The entity role ID.
@param entity_role_update_object [EntityRoleUpdateObject] The new entity
role.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OperationStatus] operation results. | [
"Update",
"a",
"role",
"for",
"a",
"given",
"Pattern",
".",
"any",
"entity",
"in",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L10443-L10446 | train | Updates an entity role in a version of the application. | [
30522,
13366,
10651,
1035,
5418,
1035,
2151,
1035,
9178,
1035,
2535,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
9178,
1035,
8909,
1010,
2535,
1035,
8909,
1010,
9178,
1035,
2535,
1035,
10651,
1035,
4874,
1010,
7661,
1035,
20346,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
lostisland/faraday | lib/faraday/autoload.rb | Faraday.AutoloadHelper.autoload_all | def autoload_all(prefix, options)
if prefix =~ %r{^faraday(/|$)}i
prefix = File.join(Faraday.root_path, prefix)
end
options.each do |const_name, path|
autoload const_name, File.join(prefix, path)
end
end | ruby | def autoload_all(prefix, options)
if prefix =~ %r{^faraday(/|$)}i
prefix = File.join(Faraday.root_path, prefix)
end
options.each do |const_name, path|
autoload const_name, File.join(prefix, path)
end
end | [
"def",
"autoload_all",
"(",
"prefix",
",",
"options",
")",
"if",
"prefix",
"=~",
"%r{",
"}i",
"prefix",
"=",
"File",
".",
"join",
"(",
"Faraday",
".",
"root_path",
",",
"prefix",
")",
"end",
"options",
".",
"each",
"do",
"|",
"const_name",
",",
"path",... | Registers the constants to be auto loaded.
@param prefix [String] The require prefix. If the path is inside Faraday,
then it will be prefixed with the root path of this loaded
Faraday version.
@param options [{ Symbol => String }] library names.
@example
Faraday.autoload_all 'faraday/foo',
Bar: 'bar'
# requires faraday/foo/bar to load Faraday::Bar.
Faraday::Bar
@return [void] | [
"Registers",
"the",
"constants",
"to",
"be",
"auto",
"loaded",
"."
] | 3abe9d1eea4bdf61cdf7b76ff9f1ae7e09482e70 | https://github.com/lostisland/faraday/blob/3abe9d1eea4bdf61cdf7b76ff9f1ae7e09482e70/lib/faraday/autoload.rb#L25-L33 | train | Autoloads all the resources in the given prefix. | [
30522,
13366,
8285,
11066,
1035,
2035,
1006,
17576,
1010,
7047,
1007,
2065,
17576,
1027,
1066,
1003,
1054,
1063,
1034,
2521,
28039,
1006,
1013,
1064,
1002,
1007,
1065,
1045,
17576,
1027,
5371,
1012,
3693,
1006,
2521,
28039,
1012,
7117,
1035... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
tongueroo/ufo | lib/ufo/task.rb | Ufo.Task.exit_if_failures! | def exit_if_failures!(resp)
return if resp[:failures].nil? || resp[:failures].empty?
puts "There was a failure running the ECS task.".color(:red)
puts "This might be happen if you have a network_mode of awsvpc and have assigned_public_ip to DISABLED."
puts "This cryptic error also shows up if the network settings have security groups and subnets that are not in the same vpc as the ECS cluster container instances. Please double check that."
puts "You can use this command to quickly reconfigure the network settings:"
puts " ufo network init --vpc-id XXX."
puts "More details on the can be found under the 'Task Networking Considerations' section at: "
puts "https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-networking.html"
puts "Original response with failures:"
pp resp
exit 1
end | ruby | def exit_if_failures!(resp)
return if resp[:failures].nil? || resp[:failures].empty?
puts "There was a failure running the ECS task.".color(:red)
puts "This might be happen if you have a network_mode of awsvpc and have assigned_public_ip to DISABLED."
puts "This cryptic error also shows up if the network settings have security groups and subnets that are not in the same vpc as the ECS cluster container instances. Please double check that."
puts "You can use this command to quickly reconfigure the network settings:"
puts " ufo network init --vpc-id XXX."
puts "More details on the can be found under the 'Task Networking Considerations' section at: "
puts "https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-networking.html"
puts "Original response with failures:"
pp resp
exit 1
end | [
"def",
"exit_if_failures!",
"(",
"resp",
")",
"return",
"if",
"resp",
"[",
":failures",
"]",
".",
"nil?",
"||",
"resp",
"[",
":failures",
"]",
".",
"empty?",
"puts",
"\"There was a failure running the ECS task.\"",
".",
"color",
"(",
":red",
")",
"puts",
"\"Th... | Pretty hard to produce this edge case. Happens when:
launch_type: EC2
network_mode: awsvpc
assign_public_ip: DISABLED | [
"Pretty",
"hard",
"to",
"produce",
"this",
"edge",
"case",
".",
"Happens",
"when",
":",
"launch_type",
":",
"EC2",
"network_mode",
":",
"awsvpc",
"assign_public_ip",
":",
"DISABLED"
] | 16ac3dad28edcab2693c0e7d89a1971aca65b8f9 | https://github.com/tongueroo/ufo/blob/16ac3dad28edcab2693c0e7d89a1971aca65b8f9/lib/ufo/task.rb#L57-L70 | train | This function is called when the task fails to run | [
30522,
13366,
6164,
1035,
2065,
1035,
15428,
999,
1006,
24501,
2361,
1007,
2709,
2065,
24501,
2361,
1031,
1024,
15428,
1033,
1012,
9152,
2140,
1029,
1064,
1064,
24501,
2361,
1031,
1024,
15428,
1033,
1012,
4064,
1029,
8509,
1000,
2045,
2001,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.fetch_errors_in_data | def fetch_errors_in_data(data_section: nil, sub_section_name: nil, keys: nil)
if data_section && sub_section_name
sub_section = data_section[sub_section_name]
else
sub_section = data_section
end
unless sub_section
return {}
end
error_map = {}
keys.each do |key|
errors = sub_section.fetch(key, [])
error_map[key] = errors if errors.count > 0
end
return error_map
end | ruby | def fetch_errors_in_data(data_section: nil, sub_section_name: nil, keys: nil)
if data_section && sub_section_name
sub_section = data_section[sub_section_name]
else
sub_section = data_section
end
unless sub_section
return {}
end
error_map = {}
keys.each do |key|
errors = sub_section.fetch(key, [])
error_map[key] = errors if errors.count > 0
end
return error_map
end | [
"def",
"fetch_errors_in_data",
"(",
"data_section",
":",
"nil",
",",
"sub_section_name",
":",
"nil",
",",
"keys",
":",
"nil",
")",
"if",
"data_section",
"&&",
"sub_section_name",
"sub_section",
"=",
"data_section",
"[",
"sub_section_name",
"]",
"else",
"sub_sectio... | Sometimes we get errors or info nested in our data
This method allows you to pass in a set of keys to check for
along with the name of the sub_section of your original data
where we should check
Returns a mapping of keys to data array if we find anything, otherwise, empty map | [
"Sometimes",
"we",
"get",
"errors",
"or",
"info",
"nested",
"in",
"our",
"data",
"This",
"method",
"allows",
"you",
"to",
"pass",
"in",
"a",
"set",
"of",
"keys",
"to",
"check",
"for",
"along",
"with",
"the",
"name",
"of",
"the",
"sub_section",
"of",
"y... | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/spaceship/lib/spaceship/tunes/tunes_client.rb#L139-L156 | train | Fetch errors in the data section | [
30522,
13366,
18584,
1035,
10697,
1035,
1999,
1035,
2951,
1006,
2951,
1035,
2930,
1024,
9152,
2140,
1010,
4942,
1035,
2930,
1035,
2171,
1024,
9152,
2140,
1010,
6309,
1024,
9152,
2140,
1007,
2065,
2951,
1035,
2930,
1004,
1004,
4942,
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... |
appium/ruby_lib | lib/appium_lib/android/element/textfield.rb | Appium.Android.textfield | def textfield(value)
return ele_index EDIT_TEXT, value if value.is_a? Numeric
complex_find_contains EDIT_TEXT, value
end | ruby | def textfield(value)
return ele_index EDIT_TEXT, value if value.is_a? Numeric
complex_find_contains EDIT_TEXT, value
end | [
"def",
"textfield",
"(",
"value",
")",
"return",
"ele_index",
"EDIT_TEXT",
",",
"value",
"if",
"value",
".",
"is_a?",
"Numeric",
"complex_find_contains",
"EDIT_TEXT",
",",
"value",
"end"
] | Find the first EditText that contains value or by index.
@param value [String, Integer] the text to match exactly.
If int then the EditText at that index is returned.
@return [EDIT_TEXT] | [
"Find",
"the",
"first",
"EditText",
"that",
"contains",
"value",
"or",
"by",
"index",
"."
] | 1f5898400dd1928bfe42ddd5f842d1f8738f2f76 | https://github.com/appium/ruby_lib/blob/1f5898400dd1928bfe42ddd5f842d1f8738f2f76/lib/appium_lib/android/element/textfield.rb#L24-L28 | train | Find the textfield in the current document. | [
30522,
13366,
3793,
3790,
1006,
3643,
1007,
2709,
3449,
2063,
1035,
5950,
10086,
1035,
3793,
1010,
3643,
2065,
3643,
1012,
2003,
1035,
1037,
1029,
16371,
25531,
3375,
1035,
2424,
1035,
3397,
10086,
1035,
3793,
1010,
3643,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_media_services/lib/2018-07-01/generated/azure_mgmt_media_services/assets.rb | Azure::MediaServices::Mgmt::V2018_07_01.Assets.list_container_sas | def list_container_sas(resource_group_name, account_name, asset_name, parameters, custom_headers:nil)
response = list_container_sas_async(resource_group_name, account_name, asset_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_container_sas(resource_group_name, account_name, asset_name, parameters, custom_headers:nil)
response = list_container_sas_async(resource_group_name, account_name, asset_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_container_sas",
"(",
"resource_group_name",
",",
"account_name",
",",
"asset_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_container_sas_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"asset_name",
... | List the Asset URLs
Lists storage container URLs with shared access signatures (SAS) for
uploading and downloading Asset content. The signatures are derived from the
storage account keys.
@param resource_group_name [String] The name of the resource group within the
Azure subscription.
@param account_name [String] The Media Services account name.
@param asset_name [String] The Asset name.
@param parameters [ListContainerSasInput] The request parameters
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [AssetContainerSas] operation results. | [
"List",
"the",
"Asset",
"URLs"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_media_services/lib/2018-07-01/generated/azure_mgmt_media_services/assets.rb#L604-L607 | train | Gets the SAS of the specified container. | [
30522,
13366,
2862,
1035,
11661,
1035,
21871,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
11412,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
11661,
1035,
2187... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-ec2/lib/aws-sdk-ec2/instance.rb | Aws::EC2.Instance.modify_attribute | def modify_attribute(options = {})
options = options.merge(instance_id: @id)
resp = @client.modify_instance_attribute(options)
resp.data
end | ruby | def modify_attribute(options = {})
options = options.merge(instance_id: @id)
resp = @client.modify_instance_attribute(options)
resp.data
end | [
"def",
"modify_attribute",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"instance_id",
":",
"@id",
")",
"resp",
"=",
"@client",
".",
"modify_instance_attribute",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
instance.modify_attribute({
source_dest_check: {
value: false,
},
attribute: "instanceType", # accepts instanceType, kernel, ramdisk, userData, disableApiTermination, instanceInitiatedShutdownBehavior, rootDeviceName, blockDeviceMapping, productCodes, sourceDestCheck, groupSet, ebsOptimized, sriovNetSupport, enaSupport
block_device_mappings: [
{
device_name: "String",
ebs: {
delete_on_termination: false,
volume_id: "String",
},
no_device: "String",
virtual_name: "String",
},
],
disable_api_termination: {
value: false,
},
dry_run: false,
ebs_optimized: {
value: false,
},
ena_support: {
value: false,
},
groups: ["String"],
instance_initiated_shutdown_behavior: "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
instance_type: "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
kernel: "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
ramdisk: "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
sriov_net_support: "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
user_data: {
value: "data",
},
value: "String",
})
@param [Hash] options ({})
@option options [Types::AttributeBooleanValue] :source_dest_check
Specifies whether source/destination checking is enabled. A value of
`true` means that checking is enabled, and `false` means that checking
is disabled. This value must be `false` for a NAT instance to perform
NAT.
@option options [String] :attribute
The name of the attribute.
@option options [Array<Types::InstanceBlockDeviceMappingSpecification>] :block_device_mappings
Modifies the `DeleteOnTermination` attribute for volumes that are
currently attached. The volume must be owned by the caller. If no
value is specified for `DeleteOnTermination`, the default is `true`
and the volume is deleted when the instance is terminated.
To add instance store volumes to an Amazon EBS-backed instance, you
must add them when you launch the instance. For more information, see
[Updating the Block Device Mapping when Launching an Instance][1] in
the *Amazon Elastic Compute Cloud User Guide*.
[1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html#Using_OverridingAMIBDM
@option options [Types::AttributeBooleanValue] :disable_api_termination
If the value is `true`, you can't terminate the instance using the
Amazon EC2 console, CLI, or API; otherwise, you can. You cannot use
this parameter for Spot Instances.
@option options [Boolean] :dry_run
Checks whether you have the required permissions for the action,
without actually making the request, and provides an error response.
If you have the required permissions, the error response is
`DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
@option options [Types::AttributeBooleanValue] :ebs_optimized
Specifies whether the instance is optimized for Amazon EBS I/O. This
optimization provides dedicated throughput to Amazon EBS and an
optimized configuration stack to provide optimal EBS I/O performance.
This optimization isn't available with all instance types. Additional
usage charges apply when using an EBS Optimized instance.
@option options [Types::AttributeBooleanValue] :ena_support
Set to `true` to enable enhanced networking with ENA for the instance.
This option is supported only for HVM instances. Specifying this
option with a PV instance can make it unreachable.
@option options [Array<String>] :groups
\[EC2-VPC\] Changes the security groups of the instance. You must
specify at least one security group, even if it's just the default
security group for the VPC. You must specify the security group ID,
not the security group name.
@option options [Types::AttributeValue] :instance_initiated_shutdown_behavior
Specifies whether an instance stops or terminates when you initiate
shutdown from the instance (using the operating system command for
system shutdown).
@option options [Types::AttributeValue] :instance_type
Changes the instance type to the specified value. For more
information, see [Instance Types][1]. If the instance type is not
valid, the error returned is `InvalidInstanceAttributeValue`.
[1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html
@option options [Types::AttributeValue] :kernel
Changes the instance's kernel to the specified value. We recommend
that you use PV-GRUB instead of kernels and RAM disks. For more
information, see [PV-GRUB][1].
[1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedKernels.html
@option options [Types::AttributeValue] :ramdisk
Changes the instance's RAM disk to the specified value. We recommend
that you use PV-GRUB instead of kernels and RAM disks. For more
information, see [PV-GRUB][1].
[1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedKernels.html
@option options [Types::AttributeValue] :sriov_net_support
Set to `simple` to enable enhanced networking with the Intel 82599
Virtual Function interface for the instance.
There is no way to disable enhanced networking with the Intel 82599
Virtual Function interface at this time.
This option is supported only for HVM instances. Specifying this
option with a PV instance can make it unreachable.
@option options [Types::BlobAttributeValue] :user_data
Changes the instance's user data to the specified value. If you are
using an AWS SDK or command line tool, base64-encoding is performed
for you, and you can load the text from a file. Otherwise, you must
provide base64-encoded text.
@option options [String] :value
A new value for the attribute. Use only with the `kernel`, `ramdisk`,
`userData`, `disableApiTermination`, or
`instanceInitiatedShutdownBehavior` attribute.
@return [EmptyStructure] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/instance.rb#L919-L923 | train | Modify the attributes of the instance. | [
30522,
13366,
19933,
1035,
17961,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
6013,
1035,
8909,
1024,
1030,
8909,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
19933,
1035,
6013,
1035,
17961,
1006,
7047,
1007,
2450... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_relay/lib/2016-07-01/generated/azure_mgmt_relay/hybrid_connections.rb | Azure::Relay::Mgmt::V2016_07_01.HybridConnections.get_authorization_rule | def get_authorization_rule(resource_group_name, namespace_name, hybrid_connection_name, authorization_rule_name, custom_headers:nil)
response = get_authorization_rule_async(resource_group_name, namespace_name, hybrid_connection_name, authorization_rule_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_authorization_rule(resource_group_name, namespace_name, hybrid_connection_name, authorization_rule_name, custom_headers:nil)
response = get_authorization_rule_async(resource_group_name, namespace_name, hybrid_connection_name, authorization_rule_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_authorization_rule",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"hybrid_connection_name",
",",
"authorization_rule_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_authorization_rule_async",
"(",
"resource_group_name",
",",
"name... | HybridConnection authorizationRule for a HybridConnection by name.
@param resource_group_name [String] Name of the Resource group within the
Azure subscription.
@param namespace_name [String] The Namespace Name
@param hybrid_connection_name [String] The hybrid connection name.
@param authorization_rule_name [String] The authorizationRule name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [AuthorizationRule] operation results. | [
"HybridConnection",
"authorizationRule",
"for",
"a",
"HybridConnection",
"by",
"name",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_relay/lib/2016-07-01/generated/azure_mgmt_relay/hybrid_connections.rb#L887-L890 | train | Gets the authorization rule for a HybridConnection. | [
30522,
13366,
2131,
1035,
20104,
1035,
3627,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3415,
15327,
1035,
2171,
1010,
8893,
1035,
4434,
1035,
2171,
1010,
20104,
1035,
3627,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.patch_closed_list_with_http_info | def patch_closed_list_with_http_info(app_id, version_id, cl_entity_id, closed_list_model_patch_object, custom_headers:nil)
patch_closed_list_async(app_id, version_id, cl_entity_id, closed_list_model_patch_object, custom_headers:custom_headers).value!
end | ruby | def patch_closed_list_with_http_info(app_id, version_id, cl_entity_id, closed_list_model_patch_object, custom_headers:nil)
patch_closed_list_async(app_id, version_id, cl_entity_id, closed_list_model_patch_object, custom_headers:custom_headers).value!
end | [
"def",
"patch_closed_list_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"cl_entity_id",
",",
"closed_list_model_patch_object",
",",
"custom_headers",
":",
"nil",
")",
"patch_closed_list_async",
"(",
"app_id",
",",
"version_id",
",",
"cl_entity_id",
",",
"close... | Adds a batch of sublists to an existing list entity in a version of the
application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param cl_entity_id The list entity model ID.
@param closed_list_model_patch_object [ClosedListModelPatchObject] A words
list batch.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Adds",
"a",
"batch",
"of",
"sublists",
"to",
"an",
"existing",
"list",
"entity",
"in",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L3258-L3260 | train | Patch an existing closed list entity. | [
30522,
13366,
8983,
1035,
2701,
1035,
2862,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
18856,
1035,
9178,
1035,
8909,
1010,
2701,
1035,
2862,
1035,
2944,
1035,
8983,
1035,
4874,
1010,
7661,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_iot_central/lib/2017-07-01-privatepreview/generated/azure_mgmt_iot_central/apps.rb | Azure::IotCentral::Mgmt::V2017_07_01_privatepreview.Apps.check_name_availability | def check_name_availability(operation_inputs, custom_headers:nil)
response = check_name_availability_async(operation_inputs, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def check_name_availability(operation_inputs, custom_headers:nil)
response = check_name_availability_async(operation_inputs, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"check_name_availability",
"(",
"operation_inputs",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"check_name_availability_async",
"(",
"operation_inputs",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",... | Check if an IoT Central application name is available.
@param operation_inputs [OperationInputs] Set the name parameter in the
OperationInputs structure to the name of the IoT Central application to
check.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [AppNameAvailabilityInfo] operation results. | [
"Check",
"if",
"an",
"IoT",
"Central",
"application",
"name",
"is",
"available",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_iot_central/lib/2017-07-01-privatepreview/generated/azure_mgmt_iot_central/apps.rb#L451-L454 | train | Check the name availability of the specified managed managed | [
30522,
13366,
4638,
1035,
2171,
1035,
11343,
1006,
3169,
1035,
20407,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4638,
1035,
2171,
1035,
11343,
1035,
2004,
6038,
2278,
1006,
3169,
1035,
20407,
1010,
7661,
1035,
20346... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rmagick/rmagick | ext/RMagick/extconf.rb | RMagick.Extconf.check_partial_imagemagick_versions | def check_partial_imagemagick_versions
prefix = config_string('prefix') || ''
matches = [
prefix + '/lib/lib?agick*',
prefix + '/include/ImageMagick',
prefix + '/bin/Magick-config'
].map do |file_glob|
Dir.glob(file_glob)
end
matches.delete_if(&:empty?)
return unless !matches.empty? && matches.length < 3
msg = "\nWarning: Found a partial ImageMagick installation. Your operating system likely has some built-in ImageMagick libraries but not all of ImageMagick. This will most likely cause problems at both compile and runtime.\nFound partial installation at: " + prefix + "\n"
Logging.message msg
message msg
end | ruby | def check_partial_imagemagick_versions
prefix = config_string('prefix') || ''
matches = [
prefix + '/lib/lib?agick*',
prefix + '/include/ImageMagick',
prefix + '/bin/Magick-config'
].map do |file_glob|
Dir.glob(file_glob)
end
matches.delete_if(&:empty?)
return unless !matches.empty? && matches.length < 3
msg = "\nWarning: Found a partial ImageMagick installation. Your operating system likely has some built-in ImageMagick libraries but not all of ImageMagick. This will most likely cause problems at both compile and runtime.\nFound partial installation at: " + prefix + "\n"
Logging.message msg
message msg
end | [
"def",
"check_partial_imagemagick_versions",
"prefix",
"=",
"config_string",
"(",
"'prefix'",
")",
"||",
"''",
"matches",
"=",
"[",
"prefix",
"+",
"'/lib/lib?agick*'",
",",
"prefix",
"+",
"'/include/ImageMagick'",
",",
"prefix",
"+",
"'/bin/Magick-config'",
"]",
"."... | Ubuntu (maybe other systems) comes with a partial installation of
ImageMagick in the prefix /usr (some libraries, no includes, and no
binaries). This causes problems when /usr/lib is in the path (e.g., using
the default Ruby installation). | [
"Ubuntu",
"(",
"maybe",
"other",
"systems",
")",
"comes",
"with",
"a",
"partial",
"installation",
"of",
"ImageMagick",
"in",
"the",
"prefix",
"/",
"usr",
"(",
"some",
"libraries",
"no",
"includes",
"and",
"no",
"binaries",
")",
".",
"This",
"causes",
"prob... | ef6688ed9d76bf123c2ea1a483eff8635051adb7 | https://github.com/rmagick/rmagick/blob/ef6688ed9d76bf123c2ea1a483eff8635051adb7/ext/RMagick/extconf.rb#L213-L228 | train | Check if the partial ImageMagick installation is available. | [
30522,
13366,
4638,
1035,
7704,
1035,
3746,
2863,
12863,
2243,
1035,
4617,
17576,
1027,
9530,
8873,
2290,
1035,
5164,
1006,
1005,
17576,
1005,
1007,
1064,
1064,
1005,
1005,
3503,
1027,
1031,
17576,
1009,
1005,
1013,
5622,
2497,
1013,
5622,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/error.rb | SquareConnect.Error.code= | def code=(code)
validator = EnumAttributeValidator.new('String', ["INTERNAL_SERVER_ERROR", "UNAUTHORIZED", "ACCESS_TOKEN_EXPIRED", "ACCESS_TOKEN_REVOKED", "FORBIDDEN", "INSUFFICIENT_SCOPES", "APPLICATION_DISABLED", "V1_APPLICATION", "V1_ACCESS_TOKEN", "CARD_PROCESSING_NOT_ENABLED", "BAD_REQUEST", "MISSING_REQUIRED_PARAMETER", "INCORRECT_TYPE", "INVALID_TIME", "INVALID_TIME_RANGE", "INVALID_VALUE", "INVALID_CURSOR", "UNKNOWN_QUERY_PARAMETER", "CONFLICTING_PARAMETERS", "EXPECTED_JSON_BODY", "INVALID_SORT_ORDER", "VALUE_REGEX_MISMATCH", "VALUE_TOO_SHORT", "VALUE_TOO_LONG", "VALUE_TOO_LOW", "VALUE_TOO_HIGH", "VALUE_EMPTY", "ARRAY_LENGTH_TOO_LONG", "ARRAY_LENGTH_TOO_SHORT", "ARRAY_EMPTY", "EXPECTED_BOOLEAN", "EXPECTED_INTEGER", "EXPECTED_FLOAT", "EXPECTED_STRING", "EXPECTED_OBJECT", "EXPECTED_ARRAY", "EXPECTED_MAP", "EXPECTED_BASE64_ENCODED_BYTE_ARRAY", "INVALID_ARRAY_VALUE", "INVALID_ENUM_VALUE", "INVALID_CONTENT_TYPE", "INVALID_FORM_VALUE", "ONE_INSTRUMENT_EXPECTED", "NO_FIELDS_SET", "DEPRECATED_FIELD_SET", "CARD_EXPIRED", "INVALID_EXPIRATION", "INVALID_EXPIRATION_YEAR", "INVALID_EXPIRATION_DATE", "UNSUPPORTED_CARD_BRAND", "UNSUPPORTED_ENTRY_METHOD", "INVALID_ENCRYPTED_CARD", "INVALID_CARD", "DELAYED_TRANSACTION_EXPIRED", "DELAYED_TRANSACTION_CANCELED", "DELAYED_TRANSACTION_CAPTURED", "DELAYED_TRANSACTION_FAILED", "CARD_TOKEN_EXPIRED", "CARD_TOKEN_USED", "AMOUNT_TOO_HIGH", "UNSUPPORTED_INSTRUMENT_TYPE", "REFUND_AMOUNT_INVALID", "REFUND_ALREADY_PENDING", "PAYMENT_NOT_REFUNDABLE", "INVALID_CARD_DATA", "LOCATION_MISMATCH", "IDEMPOTENCY_KEY_REUSED", "UNEXPECTED_VALUE", "SANDBOX_NOT_SUPPORTED", "INVALID_EMAIL_ADDRESS", "INVALID_PHONE_NUMBER", "CHECKOUT_EXPIRED", "BAD_CERTIFICATE", "CARD_DECLINED", "VERIFY_CVV_FAILURE", "VERIFY_AVS_FAILURE", "CARD_DECLINED_CALL_ISSUER", "NOT_FOUND", "APPLE_PAYMENT_PROCESSING_CERTIFICATE_HASH_NOT_FOUND", "METHOD_NOT_ALLOWED", "NOT_ACCEPTABLE", "REQUEST_TIMEOUT", "CONFLICT", "REQUEST_ENTITY_TOO_LARGE", "UNSUPPORTED_MEDIA_TYPE", "RATE_LIMITED", "NOT_IMPLEMENTED", "SERVICE_UNAVAILABLE", "GATEWAY_TIMEOUT"])
unless validator.valid?(code)
fail ArgumentError, "invalid value for 'code', must be one of #{validator.allowable_values}."
end
@code = code
end | ruby | def code=(code)
validator = EnumAttributeValidator.new('String', ["INTERNAL_SERVER_ERROR", "UNAUTHORIZED", "ACCESS_TOKEN_EXPIRED", "ACCESS_TOKEN_REVOKED", "FORBIDDEN", "INSUFFICIENT_SCOPES", "APPLICATION_DISABLED", "V1_APPLICATION", "V1_ACCESS_TOKEN", "CARD_PROCESSING_NOT_ENABLED", "BAD_REQUEST", "MISSING_REQUIRED_PARAMETER", "INCORRECT_TYPE", "INVALID_TIME", "INVALID_TIME_RANGE", "INVALID_VALUE", "INVALID_CURSOR", "UNKNOWN_QUERY_PARAMETER", "CONFLICTING_PARAMETERS", "EXPECTED_JSON_BODY", "INVALID_SORT_ORDER", "VALUE_REGEX_MISMATCH", "VALUE_TOO_SHORT", "VALUE_TOO_LONG", "VALUE_TOO_LOW", "VALUE_TOO_HIGH", "VALUE_EMPTY", "ARRAY_LENGTH_TOO_LONG", "ARRAY_LENGTH_TOO_SHORT", "ARRAY_EMPTY", "EXPECTED_BOOLEAN", "EXPECTED_INTEGER", "EXPECTED_FLOAT", "EXPECTED_STRING", "EXPECTED_OBJECT", "EXPECTED_ARRAY", "EXPECTED_MAP", "EXPECTED_BASE64_ENCODED_BYTE_ARRAY", "INVALID_ARRAY_VALUE", "INVALID_ENUM_VALUE", "INVALID_CONTENT_TYPE", "INVALID_FORM_VALUE", "ONE_INSTRUMENT_EXPECTED", "NO_FIELDS_SET", "DEPRECATED_FIELD_SET", "CARD_EXPIRED", "INVALID_EXPIRATION", "INVALID_EXPIRATION_YEAR", "INVALID_EXPIRATION_DATE", "UNSUPPORTED_CARD_BRAND", "UNSUPPORTED_ENTRY_METHOD", "INVALID_ENCRYPTED_CARD", "INVALID_CARD", "DELAYED_TRANSACTION_EXPIRED", "DELAYED_TRANSACTION_CANCELED", "DELAYED_TRANSACTION_CAPTURED", "DELAYED_TRANSACTION_FAILED", "CARD_TOKEN_EXPIRED", "CARD_TOKEN_USED", "AMOUNT_TOO_HIGH", "UNSUPPORTED_INSTRUMENT_TYPE", "REFUND_AMOUNT_INVALID", "REFUND_ALREADY_PENDING", "PAYMENT_NOT_REFUNDABLE", "INVALID_CARD_DATA", "LOCATION_MISMATCH", "IDEMPOTENCY_KEY_REUSED", "UNEXPECTED_VALUE", "SANDBOX_NOT_SUPPORTED", "INVALID_EMAIL_ADDRESS", "INVALID_PHONE_NUMBER", "CHECKOUT_EXPIRED", "BAD_CERTIFICATE", "CARD_DECLINED", "VERIFY_CVV_FAILURE", "VERIFY_AVS_FAILURE", "CARD_DECLINED_CALL_ISSUER", "NOT_FOUND", "APPLE_PAYMENT_PROCESSING_CERTIFICATE_HASH_NOT_FOUND", "METHOD_NOT_ALLOWED", "NOT_ACCEPTABLE", "REQUEST_TIMEOUT", "CONFLICT", "REQUEST_ENTITY_TOO_LARGE", "UNSUPPORTED_MEDIA_TYPE", "RATE_LIMITED", "NOT_IMPLEMENTED", "SERVICE_UNAVAILABLE", "GATEWAY_TIMEOUT"])
unless validator.valid?(code)
fail ArgumentError, "invalid value for 'code', must be one of #{validator.allowable_values}."
end
@code = code
end | [
"def",
"code",
"=",
"(",
"code",
")",
"validator",
"=",
"EnumAttributeValidator",
".",
"new",
"(",
"'String'",
",",
"[",
"\"INTERNAL_SERVER_ERROR\"",
",",
"\"UNAUTHORIZED\"",
",",
"\"ACCESS_TOKEN_EXPIRED\"",
",",
"\"ACCESS_TOKEN_REVOKED\"",
",",
"\"FORBIDDEN\"",
",",
... | Custom attribute writer method checking allowed values (enum).
@param [Object] code 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/error.rb#L134-L140 | train | Returns the key value pair for the given code. | [
30522,
13366,
3642,
1027,
1006,
3642,
1007,
9398,
8844,
1027,
4372,
12248,
4779,
3089,
8569,
2618,
10175,
8524,
4263,
1012,
2047,
1006,
1005,
5164,
1005,
1010,
1031,
1000,
4722,
1035,
8241,
1035,
7561,
1000,
1010,
1000,
24641,
1000,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_policy_insights/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_states.rb | Azure::PolicyInsights::Mgmt::V2018_04_04.PolicyStates.summarize_for_resource | def summarize_for_resource(resource_id, query_options:nil, custom_headers:nil)
response = summarize_for_resource_async(resource_id, query_options:query_options, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def summarize_for_resource(resource_id, query_options:nil, custom_headers:nil)
response = summarize_for_resource_async(resource_id, query_options:query_options, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"summarize_for_resource",
"(",
"resource_id",
",",
"query_options",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"summarize_for_resource_async",
"(",
"resource_id",
",",
"query_options",
":query_options",
",",
"custom_headers",
":custom_he... | Summarizes policy states for the resource.
@param resource_id [String] Resource ID.
@param query_options [QueryOptions] Additional parameters for the operation
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [SummarizeResults] operation results. | [
"Summarizes",
"policy",
"states",
"for",
"the",
"resource",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_policy_insights/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_states.rb#L890-L893 | train | Gets the number of documents that are associated with the resource. | [
30522,
13366,
7680,
7849,
4697,
1035,
2005,
1035,
7692,
1006,
7692,
1035,
8909,
1010,
23032,
1035,
7047,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
7680,
7849,
4697,
1035,
2005,
1035,
7692,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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.list_resource_usage_next | def list_resource_usage_next(next_page_link, custom_headers:nil)
response = list_resource_usage_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_resource_usage_next(next_page_link, custom_headers:nil)
response = list_resource_usage_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_resource_usage_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_resource_usage_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
... | Checks the quota and usage of geo filters and custom domains under the given
endpoint.
@param next_page_link [String] The NextLink from the previous successful call
to List operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ResourceUsageListResult] operation results. | [
"Checks",
"the",
"quota",
"and",
"usage",
"of",
"geo",
"filters",
"and",
"custom",
"domains",
"under",
"the",
"given",
"endpoint",
"."
] | 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#L1790-L1793 | train | Gets the resource usage of the specified resource group. | [
30522,
13366,
2862,
1035,
7692,
1035,
8192,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
7692,
1035,
8192,
1035,
2279,
1035,
2004,
6038,
2278,
1006,
2279,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_cdn/lib/2015-06-01/generated/azure_mgmt_cdn/endpoints.rb | Azure::CDN::Mgmt::V2015_06_01.Endpoints.begin_purge_content | def begin_purge_content(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:nil)
response = begin_purge_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:custom_headers).value!
nil
end | ruby | def begin_purge_content(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:nil)
response = begin_purge_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_purge_content",
"(",
"endpoint_name",
",",
"content_file_paths",
",",
"profile_name",
",",
"resource_group_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_purge_content_async",
"(",
"endpoint_name",
",",
"content_file_paths",
",",
"p... | Forcibly purges CDN endpoint content.
@param endpoint_name [String] Name of the endpoint within the CDN profile.
@param content_file_paths [PurgeParameters] The path to the content to be
purged. Path can describe a file or directory.
@param profile_name [String] Name of the CDN profile within the resource
group.
@param resource_group_name [String] Name of the resource group within the
Azure subscription.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Forcibly",
"purges",
"CDN",
"endpoint",
"content",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_cdn/lib/2015-06-01/generated/azure_mgmt_cdn/endpoints.rb#L1259-L1262 | train | Purges the content of the specified endpoint. | [
30522,
13366,
4088,
1035,
24694,
1035,
4180,
1006,
2203,
8400,
1035,
2171,
1010,
4180,
1035,
5371,
1035,
10425,
1010,
6337,
1035,
2171,
1010,
7692,
1035,
2177,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-ec2/lib/aws-sdk-ec2/instance.rb | Aws::EC2.Instance.vpc_addresses | def vpc_addresses(options = {})
batches = Enumerator.new do |y|
batch = []
options = Aws::Util.deep_merge(options, filters: [{
name: "instance-id",
values: [@id]
}])
resp = @client.describe_addresses(options)
resp.data.addresses.each do |a|
batch << VpcAddress.new(
allocation_id: a.allocation_id,
data: a,
client: @client
)
end
y.yield(batch)
end
VpcAddress::Collection.new(batches)
end | ruby | def vpc_addresses(options = {})
batches = Enumerator.new do |y|
batch = []
options = Aws::Util.deep_merge(options, filters: [{
name: "instance-id",
values: [@id]
}])
resp = @client.describe_addresses(options)
resp.data.addresses.each do |a|
batch << VpcAddress.new(
allocation_id: a.allocation_id,
data: a,
client: @client
)
end
y.yield(batch)
end
VpcAddress::Collection.new(batches)
end | [
"def",
"vpc_addresses",
"(",
"options",
"=",
"{",
"}",
")",
"batches",
"=",
"Enumerator",
".",
"new",
"do",
"|",
"y",
"|",
"batch",
"=",
"[",
"]",
"options",
"=",
"Aws",
"::",
"Util",
".",
"deep_merge",
"(",
"options",
",",
"filters",
":",
"[",
"{"... | @example Request syntax with placeholder values
vpc_addresses = instance.vpc_addresses({
filters: [
{
name: "String",
values: ["String"],
},
],
public_ips: ["String"],
allocation_ids: ["String"],
dry_run: false,
})
@param [Hash] options ({})
@option options [Array<Types::Filter>] :filters
One or more filters. Filter names and values are case-sensitive.
* `allocation-id` - \[EC2-VPC\] The allocation ID for the address.
* `association-id` - \[EC2-VPC\] The association ID for the address.
* `domain` - Indicates whether the address is for use in EC2-Classic
(`standard`) or in a VPC (`vpc`).
* `instance-id` - The ID of the instance the address is associated
with, if any.
* `network-interface-id` - \[EC2-VPC\] The ID of the network interface
that the address is associated with, if any.
* `network-interface-owner-id` - The AWS account ID of the owner.
* `private-ip-address` - \[EC2-VPC\] The private IP address associated
with the Elastic IP address.
* `public-ip` - The Elastic IP address.
* `tag`\:<key> - The key/value combination of a tag assigned to
the resource. Use the tag key in the filter name and the tag value
as the filter value. For example, to find all resources that have a
tag with the key `Owner` and the value `TeamA`, specify `tag:Owner`
for the filter name and `TeamA` for the filter value.
* `tag-key` - The key of a tag assigned to the resource. Use this
filter to find all resources assigned a tag with a specific key,
regardless of the tag value.
@option options [Array<String>] :public_ips
One or more Elastic IP addresses.
Default: Describes all your Elastic IP addresses.
@option options [Array<String>] :allocation_ids
\[EC2-VPC\] Information about the allocation IDs.
@option options [Boolean] :dry_run
Checks whether you have the required permissions for the action,
without actually making the request, and provides an error response.
If you have the required permissions, the error response is
`DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
@return [VpcAddress::Collection] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/instance.rb#L1457-L1475 | train | Returns a list of VpcAddress objects for this instance | [
30522,
13366,
21210,
2278,
1035,
11596,
1006,
7047,
1027,
1063,
1065,
1007,
14108,
2229,
1027,
4372,
17897,
16259,
1012,
2047,
2079,
1064,
1061,
1064,
14108,
1027,
1031,
1033,
7047,
1027,
22091,
2015,
1024,
1024,
21183,
4014,
1012,
2784,
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... |
jekyll/jekyll | lib/jekyll/utils.rb | Jekyll.Utils.replace_character_sequence_with_hyphen | def replace_character_sequence_with_hyphen(string, mode: "default")
replaceable_char =
case mode
when "raw"
SLUGIFY_RAW_REGEXP
when "pretty"
# "._~!$&'()+,;=@" is human readable (not URI-escaped) in URL
# and is allowed in both extN and NTFS.
SLUGIFY_PRETTY_REGEXP
when "ascii"
# For web servers not being able to handle Unicode, the safe
# method is to ditch anything else but latin letters and numeric
# digits.
SLUGIFY_ASCII_REGEXP
else
SLUGIFY_DEFAULT_REGEXP
end
# Strip according to the mode
string.gsub(replaceable_char, "-")
end | ruby | def replace_character_sequence_with_hyphen(string, mode: "default")
replaceable_char =
case mode
when "raw"
SLUGIFY_RAW_REGEXP
when "pretty"
# "._~!$&'()+,;=@" is human readable (not URI-escaped) in URL
# and is allowed in both extN and NTFS.
SLUGIFY_PRETTY_REGEXP
when "ascii"
# For web servers not being able to handle Unicode, the safe
# method is to ditch anything else but latin letters and numeric
# digits.
SLUGIFY_ASCII_REGEXP
else
SLUGIFY_DEFAULT_REGEXP
end
# Strip according to the mode
string.gsub(replaceable_char, "-")
end | [
"def",
"replace_character_sequence_with_hyphen",
"(",
"string",
",",
"mode",
":",
"\"default\"",
")",
"replaceable_char",
"=",
"case",
"mode",
"when",
"\"raw\"",
"SLUGIFY_RAW_REGEXP",
"when",
"\"pretty\"",
"# \"._~!$&'()+,;=@\" is human readable (not URI-escaped) in URL",
"# an... | Replace each character sequence with a hyphen.
See Utils#slugify for a description of the character sequence specified
by each mode. | [
"Replace",
"each",
"character",
"sequence",
"with",
"a",
"hyphen",
"."
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/utils.rb#L342-L362 | train | Replace the character sequence with a hyphen. | [
30522,
13366,
5672,
1035,
2839,
1035,
5537,
1035,
2007,
1035,
1044,
22571,
10222,
1006,
5164,
1010,
5549,
1024,
1000,
12398,
1000,
1007,
5672,
3085,
1035,
25869,
1027,
2553,
5549,
2043,
1000,
6315,
1000,
23667,
8757,
1035,
6315,
1035,
19723... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb | Azure::CognitiveServices::ComputerVision::V2_0.ComputerVisionClient.recognize_printed_text | def recognize_printed_text(detect_orientation, url, language:nil, custom_headers:nil)
response = recognize_printed_text_async(detect_orientation, url, language:language, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def recognize_printed_text(detect_orientation, url, language:nil, custom_headers:nil)
response = recognize_printed_text_async(detect_orientation, url, language:language, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"recognize_printed_text",
"(",
"detect_orientation",
",",
"url",
",",
"language",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"recognize_printed_text_async",
"(",
"detect_orientation",
",",
"url",
",",
"language",
":",
"language",
"... | Optical Character Recognition (OCR) detects text in an image and extracts the
recognized characters into a machine-usable character stream.
Upon success, the OCR results will be returned.
Upon failure, the error code together with an error message will be returned.
The error code can be one of InvalidImageUrl, InvalidImageFormat,
InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or
InternalServerError.
@param detect_orientation [Boolean] Whether detect the text orientation in
the image. With detectOrientation=true the OCR service tries to detect the
image orientation and correct it before further processing (e.g. if it's
upside-down).
@param url [String] Publicly reachable URL of an image.
@param language [OcrLanguages] The BCP-47 language code of the text to be
detected in the image. The default value is 'unk'. Possible values include:
'unk', 'zh-Hans', 'zh-Hant', 'cs', 'da', 'nl', 'en', 'fi', 'fr', 'de', 'el',
'hu', 'it', 'ja', 'ko', 'nb', 'pl', 'pt', 'ru', 'es', 'sv', 'tr', 'ar', 'ro',
'sr-Cyrl', 'sr-Latn', 'sk'
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OcrResult] operation results. | [
"Optical",
"Character",
"Recognition",
"(",
"OCR",
")",
"detects",
"text",
"in",
"an",
"image",
"and",
"extracts",
"the",
"recognized",
"characters",
"into",
"a",
"machine",
"-",
"usable",
"character",
"stream",
".",
"Upon",
"success",
"the",
"OCR",
"results",... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb#L833-L836 | train | Recognizes printed text in a given language. | [
30522,
13366,
6807,
1035,
6267,
1035,
3793,
1006,
11487,
1035,
10296,
1010,
24471,
2140,
1010,
2653,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
6807,
1035,
6267,
1035,
3793,
1035,
2004,
6038,
2278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/haml-lint | lib/haml_lint/runner.rb | HamlLint.Runner.run | def run(options = {})
@config = load_applicable_config(options)
@files = extract_applicable_files(config, options)
@linter_selector = HamlLint::LinterSelector.new(config, options)
@fail_fast = options.fetch(:fail_fast, false)
report(options)
end | ruby | def run(options = {})
@config = load_applicable_config(options)
@files = extract_applicable_files(config, options)
@linter_selector = HamlLint::LinterSelector.new(config, options)
@fail_fast = options.fetch(:fail_fast, false)
report(options)
end | [
"def",
"run",
"(",
"options",
"=",
"{",
"}",
")",
"@config",
"=",
"load_applicable_config",
"(",
"options",
")",
"@files",
"=",
"extract_applicable_files",
"(",
"config",
",",
"options",
")",
"@linter_selector",
"=",
"HamlLint",
"::",
"LinterSelector",
".",
"n... | Runs the appropriate linters against the desired files given the specified
options.
@param [Hash] options
@option options :config_file [String] path of configuration file to load
@option options :config [HamlLint::Configuration] configuration to use
@option options :excluded_files [Array<String>]
@option options :included_linters [Array<String>]
@option options :excluded_linters [Array<String>]
@option options :fail_fast [true, false] flag for failing after first failure
@option options :fail_level
@option options :reporter [HamlLint::Reporter]
@return [HamlLint::Report] a summary of all lints found | [
"Runs",
"the",
"appropriate",
"linters",
"against",
"the",
"desired",
"files",
"given",
"the",
"specified",
"options",
"."
] | 024c773667e54cf88db938c2b368977005d70ee8 | https://github.com/sds/haml-lint/blob/024c773667e54cf88db938c2b368977005d70ee8/lib/haml_lint/runner.rb#L19-L26 | train | Runs the linters | [
30522,
13366,
2448,
1006,
7047,
1027,
1063,
1065,
1007,
1030,
9530,
8873,
2290,
1027,
7170,
1035,
12711,
1035,
9530,
8873,
2290,
1006,
7047,
1007,
1030,
6764,
1027,
14817,
1035,
12711,
1035,
6764,
1006,
9530,
8873,
2290,
1010,
7047,
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... |
activerecord-hackery/ransack | lib/ransack/configuration.rb | Ransack.Configuration.custom_arrows= | def custom_arrows=(opts = {})
self.options[:up_arrow] = opts[:up_arrow].freeze if opts[:up_arrow]
self.options[:down_arrow] = opts[:down_arrow].freeze if opts[:down_arrow]
self.options[:default_arrow] = opts[:default_arrow].freeze if opts[:default_arrow]
end | ruby | def custom_arrows=(opts = {})
self.options[:up_arrow] = opts[:up_arrow].freeze if opts[:up_arrow]
self.options[:down_arrow] = opts[:down_arrow].freeze if opts[:down_arrow]
self.options[:default_arrow] = opts[:default_arrow].freeze if opts[:default_arrow]
end | [
"def",
"custom_arrows",
"=",
"(",
"opts",
"=",
"{",
"}",
")",
"self",
".",
"options",
"[",
":up_arrow",
"]",
"=",
"opts",
"[",
":up_arrow",
"]",
".",
"freeze",
"if",
"opts",
"[",
":up_arrow",
"]",
"self",
".",
"options",
"[",
":down_arrow",
"]",
"=",... | By default, Ransack displays sort order indicator arrows with HTML codes:
up_arrow: '▼'
down_arrow: '▲'
There is also a default arrow which is displayed if a column is not sorted.
By default this is nil so nothing will be displayed.
Any of the defaults may be globally overridden in an initializer file
like `config/initializers/ransack.rb` as follows:
Ransack.configure do |config|
# Globally set the up arrow to an icon, and the down and default arrows to unicode.
config.custom_arrows = {
up_arrow: '<i class="fa fa-long-arrow-up"></i>',
down_arrow: 'U+02193',
default_arrow: 'U+11047'
}
end | [
"By",
"default",
"Ransack",
"displays",
"sort",
"order",
"indicator",
"arrows",
"with",
"HTML",
"codes",
":"
] | d44bfe6fe21ab374ceea9d060267d0d38b09ef28 | https://github.com/activerecord-hackery/ransack/blob/d44bfe6fe21ab374ceea9d060267d0d38b09ef28/lib/ransack/configuration.rb#L122-L126 | train | Set custom arrows for the current object | [
30522,
13366,
7661,
1035,
12563,
1027,
1006,
23569,
2015,
1027,
1063,
1065,
1007,
2969,
1012,
7047,
1031,
1024,
2039,
1035,
8612,
1033,
1027,
23569,
2015,
1031,
1024,
2039,
1035,
8612,
1033,
1012,
13184,
2065,
23569,
2015,
1031,
1024,
2039,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.get_cluster_event_list | def get_cluster_event_list(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
response = get_cluster_event_list_async(start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_cluster_event_list(start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
response = get_cluster_event_list_async(start_time_utc, end_time_utc, timeout:timeout, events_types_filter:events_types_filter, exclude_analysis_events:exclude_analysis_events, skip_correlation_lookup:skip_correlation_lookup, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_cluster_event_list",
"(",
"start_time_utc",
",",
"end_time_utc",
",",
"timeout",
":",
"60",
",",
"events_types_filter",
":",
"nil",
",",
"exclude_analysis_events",
":",
"nil",
",",
"skip_correlation_lookup",
":",
"nil",
",",
"custom_headers",
":",
"nil",... | Gets all Cluster-related events.
The response is list of ClusterEvent objects.
@param start_time_utc [String] The start time of a lookup query in ISO UTC
yyyy-MM-ddTHH:mm:ssZ.
@param end_time_utc [String] The end time of a lookup query in ISO UTC
yyyy-MM-ddTHH:mm:ssZ.
@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 events_types_filter [String] This is a comma separated string
specifying the types of FabricEvents that should only be included in the
response.
@param exclude_analysis_events [Boolean] This param disables the retrieval of
AnalysisEvents if true is passed.
@param skip_correlation_lookup [Boolean] This param disables the search of
CorrelatedEvents information if true is passed. otherwise the
CorrelationEvents get processed and HasCorrelatedEvents field in every
FabricEvent gets populated.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array] operation results. | [
"Gets",
"all",
"Cluster",
"-",
"related",
"events",
"."
] | 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#L27211-L27214 | train | Gets the cluster event list. | [
30522,
13366,
2131,
1035,
9324,
1035,
2724,
1035,
2862,
1006,
2707,
1035,
2051,
1035,
11396,
1010,
2203,
1035,
2051,
1035,
11396,
1010,
2051,
5833,
1024,
3438,
1010,
2824,
1035,
4127,
1035,
11307,
1024,
9152,
2140,
1010,
23329,
1035,
4106,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb | Azure::Web::Mgmt::V2018_02_01.AppServiceEnvironments.list_web_worker_metrics_next | def list_web_worker_metrics_next(next_page_link, custom_headers:nil)
response = list_web_worker_metrics_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_web_worker_metrics_next(next_page_link, custom_headers:nil)
response = list_web_worker_metrics_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_web_worker_metrics_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_web_worker_metrics_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"un... | Get metrics for a worker pool of a AppServiceEnvironment (App Service
Environment).
Get metrics for a worker pool of a AppServiceEnvironment (App Service
Environment).
@param next_page_link [String] The NextLink from the previous successful call
to List operation.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ResourceMetricCollection] operation results. | [
"Get",
"metrics",
"for",
"a",
"worker",
"pool",
"of",
"a",
"AppServiceEnvironment",
"(",
"App",
"Service",
"Environment",
")",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb#L6850-L6853 | train | Gets metrics for a worker. | [
30522,
13366,
2862,
1035,
4773,
1035,
7309,
1035,
12046,
2015,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
4773,
1035,
7309,
1035,
12046,
2015,
1035,
2279,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/catalog_api.rb | SquareConnect.CatalogApi.retrieve_catalog_object | def retrieve_catalog_object(object_id, opts = {})
data, _status_code, _headers = retrieve_catalog_object_with_http_info(object_id, opts)
return data
end | ruby | def retrieve_catalog_object(object_id, opts = {})
data, _status_code, _headers = retrieve_catalog_object_with_http_info(object_id, opts)
return data
end | [
"def",
"retrieve_catalog_object",
"(",
"object_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"retrieve_catalog_object_with_http_info",
"(",
"object_id",
",",
"opts",
")",
"return",
"data",
"end"
] | RetrieveCatalogObject
Returns a single [CatalogItem](#type-catalogitem) as a [CatalogObject](#type-catalogobject) based on the provided ID. The returned object includes all of the relevant [CatalogItem](#type-catalogitem) information including: [CatalogItemVariation](#type-catalogitemvariation) children, references to its [CatalogModifierList](#type-catalogmodifierlist) objects, and the ids of any [CatalogTax](#type-catalogtax) objects that apply to it.
@param object_id The object ID of any type of [CatalogObject](#type-catalogobject)s to be retrieved.
@param [Hash] opts the optional parameters
@option opts [BOOLEAN] :include_related_objects If `true`, the response will include additional objects that are related to the requested object, as follows: If the `object` field of the response contains a [CatalogItem](#type-catalogitem), its associated [CatalogCategory](#type-catalogcategory), [CatalogTax](#type-catalogtax)es, and [CatalogModifierList](#type-catalogmodifierlist)s will be returned in the `related_objects` field of the response. If the `object` field of the response contains a [CatalogItemVariation](#type-catalogitemvariation), its parent [CatalogItem](#type-catalogitem) will be returned in the `related_objects` field of the response. Default value: `false`
@return [RetrieveCatalogObjectResponse] | [
"RetrieveCatalogObject",
"Returns",
"a",
"single",
"[",
"CatalogItem",
"]",
"(",
"#type",
"-",
"catalogitem",
")",
"as",
"a",
"[",
"CatalogObject",
"]",
"(",
"#type",
"-",
"catalogobject",
")",
"based",
"on",
"the",
"provided",
"ID",
".",
"The",
"returned",
... | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/catalog_api.rb#L354-L357 | train | Retrieve a single object from the catalog | [
30522,
13366,
12850,
1035,
12105,
1035,
4874,
1006,
4874,
1035,
8909,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
12850,
1035,
12105,
1035,
4874,
1035,
2007,
1035,
8299,
1035... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
github/linguist | samples/Ruby/sinatra.rb | Sinatra.Helpers.body | def body(value=nil, &block)
if block_given?
def block.each; yield(call) end
response.body = block
elsif value
response.body = value
else
response.body
end
end | ruby | def body(value=nil, &block)
if block_given?
def block.each; yield(call) end
response.body = block
elsif value
response.body = value
else
response.body
end
end | [
"def",
"body",
"(",
"value",
"=",
"nil",
",",
"&",
"block",
")",
"if",
"block_given?",
"def",
"block",
".",
"each",
";",
"yield",
"(",
"call",
")",
"end",
"response",
".",
"body",
"=",
"block",
"elsif",
"value",
"response",
".",
"body",
"=",
"value",... | Set or retrieve the response body. When a block is given,
evaluation is deferred until the body is read with #each. | [
"Set",
"or",
"retrieve",
"the",
"response",
"body",
".",
"When",
"a",
"block",
"is",
"given",
"evaluation",
"is",
"deferred",
"until",
"the",
"body",
"is",
"read",
"with",
"#each",
"."
] | 9116c90fcbb82ac03b4b33c58cfbde1fcf745e99 | https://github.com/github/linguist/blob/9116c90fcbb82ac03b4b33c58cfbde1fcf745e99/samples/Ruby/sinatra.rb#L155-L164 | train | Returns the body of the response. | [
30522,
13366,
2303,
1006,
3643,
1027,
9152,
2140,
1010,
1004,
3796,
1007,
2065,
3796,
1035,
2445,
1029,
13366,
3796,
1012,
2169,
1025,
10750,
1006,
2655,
1007,
2203,
3433,
1012,
2303,
1027,
3796,
3449,
5332,
2546,
3643,
3433,
1012,
2303,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
watir/watir | lib/watir/logger.rb | Watir.Logger.level= | def level=(severity)
if severity.is_a?(Integer)
@logger.level = severity
else
levels = %w[debug info warn error fatal unknown]
raise ArgumentError, "invalid log level: #{severity}" unless levels.include? severity.to_s.downcase
@logger.level = severity.to_s.upcase
end
end | ruby | def level=(severity)
if severity.is_a?(Integer)
@logger.level = severity
else
levels = %w[debug info warn error fatal unknown]
raise ArgumentError, "invalid log level: #{severity}" unless levels.include? severity.to_s.downcase
@logger.level = severity.to_s.upcase
end
end | [
"def",
"level",
"=",
"(",
"severity",
")",
"if",
"severity",
".",
"is_a?",
"(",
"Integer",
")",
"@logger",
".",
"level",
"=",
"severity",
"else",
"levels",
"=",
"%w[",
"debug",
"info",
"warn",
"error",
"fatal",
"unknown",
"]",
"raise",
"ArgumentError",
"... | For Ruby < 2.4 compatibility
Based on https://github.com/ruby/ruby/blob/ruby_2_3/lib/logger.rb#L250 | [
"For",
"Ruby",
"<",
"2",
".",
"4",
"compatibility",
"Based",
"on",
"https",
":",
"//",
"github",
".",
"com",
"/",
"ruby",
"/",
"ruby",
"/",
"blob",
"/",
"ruby_2_3",
"/",
"lib",
"/",
"logger",
".",
"rb#L250"
] | 2d8db09811c6221ae401b85b2f61f5fa66e463a3 | https://github.com/watir/watir/blob/2d8db09811c6221ae401b85b2f61f5fa66e463a3/lib/watir/logger.rb#L59-L68 | train | Set the log level. | [
30522,
13366,
2504,
1027,
1006,
18976,
1007,
2065,
18976,
1012,
2003,
1035,
1037,
1029,
1006,
16109,
1007,
1030,
8833,
4590,
1012,
2504,
1027,
18976,
2842,
3798,
1027,
1003,
1059,
1031,
2139,
8569,
2290,
18558,
11582,
7561,
10611,
4242,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_kusto/lib/2017-09-07-privatepreview/generated/azure_mgmt_kusto/databases.rb | Azure::Kusto::Mgmt::V2018_09_07_privatepreview.Databases.list_by_cluster | def list_by_cluster(resource_group_name, cluster_name, custom_headers:nil)
response = list_by_cluster_async(resource_group_name, cluster_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_cluster(resource_group_name, cluster_name, custom_headers:nil)
response = list_by_cluster_async(resource_group_name, cluster_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_cluster",
"(",
"resource_group_name",
",",
"cluster_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_cluster_async",
"(",
"resource_group_name",
",",
"cluster_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
... | Returns the list of databases of the given Kusto cluster.
@param resource_group_name [String] The name of the resource group containing
the Kusto cluster.
@param cluster_name [String] The name of the Kusto cluster.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [DatabaseListResult] operation results. | [
"Returns",
"the",
"list",
"of",
"databases",
"of",
"the",
"given",
"Kusto",
"cluster",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_kusto/lib/2017-09-07-privatepreview/generated/azure_mgmt_kusto/databases.rb#L143-L146 | train | Gets the list of all the cluster variants. | [
30522,
13366,
2862,
1035,
2011,
1035,
9324,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
9324,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
9324,
1035,
2004,
6038,
2278,
1006,
7692,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb | Azure::KeyVault::V2016_10_01.KeyVaultClient.get_certificate | def get_certificate(vault_base_url, certificate_name, certificate_version, custom_headers:nil)
response = get_certificate_async(vault_base_url, certificate_name, certificate_version, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_certificate(vault_base_url, certificate_name, certificate_version, custom_headers:nil)
response = get_certificate_async(vault_base_url, certificate_name, certificate_version, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_certificate",
"(",
"vault_base_url",
",",
"certificate_name",
",",
"certificate_version",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_certificate_async",
"(",
"vault_base_url",
",",
"certificate_name",
",",
"certificate_version",
",",
"cust... | Gets information about a certificate.
Gets information about a specific certificate. This operation requires the
certificates/get permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param certificate_name [String] The name of the certificate in the given
vault.
@param certificate_version [String] The version of the certificate.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [CertificateBundle] operation results. | [
"Gets",
"information",
"about",
"a",
"certificate",
"."
] | 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#L5943-L5946 | train | Gets the certificate. | [
30522,
13366,
2131,
1035,
8196,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
8196,
1035,
2171,
1010,
8196,
1035,
2544,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
8196,
1035,
2004,
6038,
2278,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_resources/lib/2016-02-01/generated/azure_mgmt_resources/resources.rb | Azure::Resources::Mgmt::V2016_02_01.Resources.move_resources_async | def move_resources_async(source_resource_group_name, parameters, custom_headers:nil)
# Send request
promise = begin_move_resources_async(source_resource_group_name, parameters, 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 move_resources_async(source_resource_group_name, parameters, custom_headers:nil)
# Send request
promise = begin_move_resources_async(source_resource_group_name, parameters, 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",
"move_resources_async",
"(",
"source_resource_group_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_move_resources_async",
"(",
"source_resource_group_name",
",",
"parameters",
",",
"custom_headers",
":custom... | @param source_resource_group_name [String] Source resource group name.
@param parameters [ResourcesMoveInfo] move resources' parameters.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"source_resource_group_name",
"[",
"String",
"]",
"Source",
"resource",
"group",
"name",
".",
"@param",
"parameters",
"[",
"ResourcesMoveInfo",
"]",
"move",
"resources",
"parameters",
".",
"@param",
"custom_headers",
"[",
"Hash",
"{",
"String",
"=",
">",... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_resources/lib/2016-02-01/generated/azure_mgmt_resources/resources.rb#L47-L61 | train | Move resources from one resource group to another resource group. | [
30522,
13366,
2693,
1035,
4219,
1035,
2004,
6038,
2278,
1006,
3120,
1035,
7692,
1035,
2177,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,
4088,
1035,
2693,
1035,
4219,
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... |
comfy/comfortable-mexican-sofa | lib/comfortable_mexican_sofa/extensions/has_revisions.rb | ComfortableMexicanSofa::HasRevisions.InstanceMethods.create_revision | def create_revision
return unless revision_data
limit = ComfortableMexicanSofa.config.revisions_limit.to_i
# creating revision
if limit != 0
revisions.create!(data: revision_data)
end
# blowing away old revisions
ids = [0] + revisions.order(created_at: :desc).limit(limit).pluck(:id)
revisions.where("id NOT IN (?)", ids).destroy_all
end | ruby | def create_revision
return unless revision_data
limit = ComfortableMexicanSofa.config.revisions_limit.to_i
# creating revision
if limit != 0
revisions.create!(data: revision_data)
end
# blowing away old revisions
ids = [0] + revisions.order(created_at: :desc).limit(limit).pluck(:id)
revisions.where("id NOT IN (?)", ids).destroy_all
end | [
"def",
"create_revision",
"return",
"unless",
"revision_data",
"limit",
"=",
"ComfortableMexicanSofa",
".",
"config",
".",
"revisions_limit",
".",
"to_i",
"# creating revision",
"if",
"limit",
"!=",
"0",
"revisions",
".",
"create!",
"(",
"data",
":",
"revision_data"... | Revision is created only if relevant data changed | [
"Revision",
"is",
"created",
"only",
"if",
"relevant",
"data",
"changed"
] | 38a31428f6e2c07d5bda64f0371eebfb29a3abc4 | https://github.com/comfy/comfortable-mexican-sofa/blob/38a31428f6e2c07d5bda64f0371eebfb29a3abc4/lib/comfortable_mexican_sofa/extensions/has_revisions.rb#L45-L58 | train | Creates a new revision object | [
30522,
13366,
3443,
1035,
13921,
2709,
4983,
13921,
1035,
2951,
5787,
1027,
6625,
4168,
9048,
26642,
11253,
2050,
1012,
9530,
8873,
2290,
1012,
24699,
1035,
5787,
1012,
2000,
1035,
1045,
1001,
4526,
13921,
2065,
5787,
999,
1027,
1014,
24699... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_agents.rb | Azure::SQL::Mgmt::V2015_05_01_preview.SyncAgents.generate_key_with_http_info | def generate_key_with_http_info(resource_group_name, server_name, sync_agent_name, custom_headers:nil)
generate_key_async(resource_group_name, server_name, sync_agent_name, custom_headers:custom_headers).value!
end | ruby | def generate_key_with_http_info(resource_group_name, server_name, sync_agent_name, custom_headers:nil)
generate_key_async(resource_group_name, server_name, sync_agent_name, custom_headers:custom_headers).value!
end | [
"def",
"generate_key_with_http_info",
"(",
"resource_group_name",
",",
"server_name",
",",
"sync_agent_name",
",",
"custom_headers",
":",
"nil",
")",
"generate_key_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"sync_agent_name",
",",
"custom_headers",
":cus... | Generates a sync agent key.
@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 on which the sync agent is
hosted.
@param sync_agent_name [String] The name of the sync agent.
@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. | [
"Generates",
"a",
"sync",
"agent",
"key",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_agents.rb#L364-L366 | train | Generates a key for a given sync agent. | [
30522,
13366,
9699,
1035,
3145,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
26351,
1035,
4005,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
9699,
1035,
3145,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
haml/haml | lib/haml/util.rb | Haml.Util.parse_haml_magic_comment | def parse_haml_magic_comment(str)
scanner = StringScanner.new(str.dup.force_encoding(Encoding::ASCII_8BIT))
bom = scanner.scan(/\xEF\xBB\xBF/n)
return bom unless scanner.scan(/-\s*#\s*/n)
if coding = try_parse_haml_emacs_magic_comment(scanner)
return bom, coding
end
return bom unless scanner.scan(/.*?coding[=:]\s*([\w-]+)/in)
return bom, scanner[1]
end | ruby | def parse_haml_magic_comment(str)
scanner = StringScanner.new(str.dup.force_encoding(Encoding::ASCII_8BIT))
bom = scanner.scan(/\xEF\xBB\xBF/n)
return bom unless scanner.scan(/-\s*#\s*/n)
if coding = try_parse_haml_emacs_magic_comment(scanner)
return bom, coding
end
return bom unless scanner.scan(/.*?coding[=:]\s*([\w-]+)/in)
return bom, scanner[1]
end | [
"def",
"parse_haml_magic_comment",
"(",
"str",
")",
"scanner",
"=",
"StringScanner",
".",
"new",
"(",
"str",
".",
"dup",
".",
"force_encoding",
"(",
"Encoding",
"::",
"ASCII_8BIT",
")",
")",
"bom",
"=",
"scanner",
".",
"scan",
"(",
"/",
"\\xEF",
"\\xBB",
... | Parses a magic comment at the beginning of a Haml file.
The parsing rules are basically the same as Ruby's.
@return [(Boolean, String or nil)]
Whether the document begins with a UTF-8 BOM,
and the declared encoding of the document (or nil if none is declared) | [
"Parses",
"a",
"magic",
"comment",
"at",
"the",
"beginning",
"of",
"a",
"Haml",
"file",
".",
"The",
"parsing",
"rules",
"are",
"basically",
"the",
"same",
"as",
"Ruby",
"s",
"."
] | 9aa0fbe4a91b999978927be569d2ad0cd39076f1 | https://github.com/haml/haml/blob/9aa0fbe4a91b999978927be569d2ad0cd39076f1/lib/haml/util.rb#L233-L243 | train | Parse a Haml magic comment | [
30522,
13366,
11968,
3366,
1035,
10654,
2140,
1035,
3894,
1035,
7615,
1006,
2358,
2099,
1007,
26221,
1027,
7817,
9336,
3678,
1012,
2047,
1006,
2358,
2099,
1012,
4241,
2361,
1012,
2486,
1035,
17181,
1006,
17181,
1024,
1024,
2004,
6895,
2072,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-04-01/generated/azure_mgmt_network/express_route_cross_connections.rb | Azure::Network::Mgmt::V2018_04_01.ExpressRouteCrossConnections.begin_list_routes_table_with_http_info | def begin_list_routes_table_with_http_info(resource_group_name, cross_connection_name, peering_name, device_path, custom_headers:nil)
begin_list_routes_table_async(resource_group_name, cross_connection_name, peering_name, device_path, custom_headers:custom_headers).value!
end | ruby | def begin_list_routes_table_with_http_info(resource_group_name, cross_connection_name, peering_name, device_path, custom_headers:nil)
begin_list_routes_table_async(resource_group_name, cross_connection_name, peering_name, device_path, custom_headers:custom_headers).value!
end | [
"def",
"begin_list_routes_table_with_http_info",
"(",
"resource_group_name",
",",
"cross_connection_name",
",",
"peering_name",
",",
"device_path",
",",
"custom_headers",
":",
"nil",
")",
"begin_list_routes_table_async",
"(",
"resource_group_name",
",",
"cross_connection_name",... | Gets the currently advertised routes table associated with the express route
cross connection in a resource group.
@param resource_group_name [String] The name of the resource group.
@param cross_connection_name [String] The name of the
ExpressRouteCrossConnection.
@param peering_name [String] The name of the peering.
@param device_path [String] The path of the device.
@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",
"currently",
"advertised",
"routes",
"table",
"associated",
"with",
"the",
"express",
"route",
"cross",
"connection",
"in",
"a",
"resource",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-04-01/generated/azure_mgmt_network/express_route_cross_connections.rb#L997-L999 | train | Gets the route table associated with the express route cross connection. | [
30522,
13366,
4088,
1035,
2862,
1035,
5847,
1035,
2795,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2892,
1035,
4434,
1035,
2171,
1010,
16740,
1035,
2171,
1010,
5080,
1035,
4130,
1010,
7661,
1035,
20346,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
twitter/secure_headers | lib/secure_headers/view_helper.rb | SecureHeaders.ViewHelpers.nonced_javascript_pack_tag | def nonced_javascript_pack_tag(*args, &block)
opts = extract_options(args).merge(nonce: _content_security_policy_nonce(:script))
javascript_pack_tag(*args, opts, &block)
end | ruby | def nonced_javascript_pack_tag(*args, &block)
opts = extract_options(args).merge(nonce: _content_security_policy_nonce(:script))
javascript_pack_tag(*args, opts, &block)
end | [
"def",
"nonced_javascript_pack_tag",
"(",
"*",
"args",
",",
"&",
"block",
")",
"opts",
"=",
"extract_options",
"(",
"args",
")",
".",
"merge",
"(",
"nonce",
":",
"_content_security_policy_nonce",
"(",
":script",
")",
")",
"javascript_pack_tag",
"(",
"args",
",... | Public: create a script Webpacker pack tag using the content security policy nonce.
Instructs secure_headers to append a nonce to script-src directive.
Returns an html-safe script tag with the nonce attribute. | [
"Public",
":",
"create",
"a",
"script",
"Webpacker",
"pack",
"tag",
"using",
"the",
"content",
"security",
"policy",
"nonce",
".",
"Instructs",
"secure_headers",
"to",
"append",
"a",
"nonce",
"to",
"script",
"-",
"src",
"directive",
"."
] | 543e6712aadae08f1653ed973e6b6204f7eac26a | https://github.com/twitter/secure_headers/blob/543e6712aadae08f1653ed973e6b6204f7eac26a/lib/secure_headers/view_helper.rb#L49-L53 | train | Returns a non - javascript tag with the nonce set to the nonce. | [
30522,
13366,
2512,
11788,
1035,
9262,
22483,
1035,
5308,
1035,
6415,
1006,
1008,
12098,
5620,
1010,
1004,
3796,
1007,
23569,
2015,
1027,
30524,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
refinery/refinerycms | images/app/models/refinery/image.rb | Refinery.Image.thumbnail | def thumbnail(options = {})
options = { geometry: nil, strip: false }.merge(options)
geometry = convert_to_geometry(options[:geometry])
thumbnail = image
thumbnail = thumbnail.thumb(geometry) if geometry
thumbnail = thumbnail.strip if options[:strip]
thumbnail
end | ruby | def thumbnail(options = {})
options = { geometry: nil, strip: false }.merge(options)
geometry = convert_to_geometry(options[:geometry])
thumbnail = image
thumbnail = thumbnail.thumb(geometry) if geometry
thumbnail = thumbnail.strip if options[:strip]
thumbnail
end | [
"def",
"thumbnail",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"{",
"geometry",
":",
"nil",
",",
"strip",
":",
"false",
"}",
".",
"merge",
"(",
"options",
")",
"geometry",
"=",
"convert_to_geometry",
"(",
"options",
"[",
":geometry",
"]",
")",... | Get a thumbnail job object given a geometry and whether to strip image profiles and comments. | [
"Get",
"a",
"thumbnail",
"job",
"object",
"given",
"a",
"geometry",
"and",
"whether",
"to",
"strip",
"image",
"profiles",
"and",
"comments",
"."
] | 67f117f937c5264ec0aeabe8e7eac1d562c5bc7b | https://github.com/refinery/refinerycms/blob/67f117f937c5264ec0aeabe8e7eac1d562c5bc7b/images/app/models/refinery/image.rb#L43-L50 | train | Returns the thumbnail of the image | [
30522,
13366,
7639,
25464,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
1063,
10988,
1024,
9152,
2140,
1010,
6167,
1024,
6270,
1065,
1012,
13590,
1006,
7047,
1007,
10988,
1027,
10463,
1035,
2000,
1035,
10988,
1006,
7047,
1031,
1024,
1098... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
nathanvda/cocoon | lib/cocoon/view_helpers.rb | Cocoon.ViewHelpers.create_object | def create_object(f, association, force_non_association_create=false)
assoc = f.object.class.reflect_on_association(association)
assoc ? create_object_on_association(f, association, assoc, force_non_association_create) : create_object_on_non_association(f, association)
end | ruby | def create_object(f, association, force_non_association_create=false)
assoc = f.object.class.reflect_on_association(association)
assoc ? create_object_on_association(f, association, assoc, force_non_association_create) : create_object_on_non_association(f, association)
end | [
"def",
"create_object",
"(",
"f",
",",
"association",
",",
"force_non_association_create",
"=",
"false",
")",
"assoc",
"=",
"f",
".",
"object",
".",
"class",
".",
"reflect_on_association",
"(",
"association",
")",
"assoc",
"?",
"create_object_on_association",
"(",... | creates new association object with its conditions, like
`` has_many :admin_comments, class_name: "Comment", conditions: { author: "Admin" }
will create new Comment with author "Admin" | [
"creates",
"new",
"association",
"object",
"with",
"its",
"conditions",
"like",
"has_many",
":",
"admin_comments",
"class_name",
":",
"Comment",
"conditions",
":",
"{",
"author",
":",
"Admin",
"}",
"will",
"create",
"new",
"Comment",
"with",
"author",
"Admin"
] | ec18c446a5475aa4959c699c797ee0fe9b0c9136 | https://github.com/nathanvda/cocoon/blob/ec18c446a5475aa4959c699c797ee0fe9b0c9136/lib/cocoon/view_helpers.rb#L110-L114 | train | Creates an object on the given association. | [
30522,
13366,
3443,
1035,
4874,
1006,
1042,
1010,
2523,
1010,
2486,
1035,
2512,
1035,
2523,
1035,
3443,
1027,
6270,
1007,
4632,
10085,
1027,
1042,
1012,
4874,
1012,
2465,
1012,
8339,
1035,
2006,
1035,
2523,
1006,
2523,
1007,
4632,
10085,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jekyll/jekyll | lib/jekyll/renderer.rb | Jekyll.Renderer.validate_layout | def validate_layout(layout)
if invalid_layout?(layout)
Jekyll.logger.warn(
"Build Warning:",
"Layout '#{document.data["layout"]}' requested "\
"in #{document.relative_path} does not exist."
)
elsif !layout.nil?
layout_source = layout.path.start_with?(site.source) ? :site : :theme
Jekyll.logger.debug "Layout source:", layout_source
end
end | ruby | def validate_layout(layout)
if invalid_layout?(layout)
Jekyll.logger.warn(
"Build Warning:",
"Layout '#{document.data["layout"]}' requested "\
"in #{document.relative_path} does not exist."
)
elsif !layout.nil?
layout_source = layout.path.start_with?(site.source) ? :site : :theme
Jekyll.logger.debug "Layout source:", layout_source
end
end | [
"def",
"validate_layout",
"(",
"layout",
")",
"if",
"invalid_layout?",
"(",
"layout",
")",
"Jekyll",
".",
"logger",
".",
"warn",
"(",
"\"Build Warning:\"",
",",
"\"Layout '#{document.data[\"layout\"]}' requested \"",
"\"in #{document.relative_path} does not exist.\"",
")",
... | Checks if the layout specified in the document actually exists
layout - the layout to check
Returns nothing | [
"Checks",
"if",
"the",
"layout",
"specified",
"in",
"the",
"document",
"actually",
"exists"
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/renderer.rb#L176-L187 | train | Validate the layout | [
30522,
13366,
9398,
3686,
1035,
9621,
1006,
9621,
1007,
2065,
19528,
1035,
9621,
1029,
1006,
9621,
1007,
15333,
4801,
3363,
1012,
8833,
4590,
1012,
11582,
1006,
1000,
3857,
5432,
1024,
1000,
1010,
1000,
9621,
1005,
1001,
1063,
6254,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-ec2/lib/aws-sdk-ec2/volume.rb | Aws::EC2.Volume.modify_attribute | def modify_attribute(options = {})
options = options.merge(volume_id: @id)
resp = @client.modify_volume_attribute(options)
resp.data
end | ruby | def modify_attribute(options = {})
options = options.merge(volume_id: @id)
resp = @client.modify_volume_attribute(options)
resp.data
end | [
"def",
"modify_attribute",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"volume_id",
":",
"@id",
")",
"resp",
"=",
"@client",
".",
"modify_volume_attribute",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
volume.modify_attribute({
auto_enable_io: {
value: false,
},
dry_run: false,
})
@param [Hash] options ({})
@option options [Types::AttributeBooleanValue] :auto_enable_io
Indicates whether the volume should be auto-enabled for I/O
operations.
@option options [Boolean] :dry_run
Checks whether you have the required permissions for the action,
without actually making the request, and provides an error response.
If you have the required permissions, the error response is
`DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
@return [EmptyStructure] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/volume.rb#L540-L544 | train | Modify the attributes of a volume | [
30522,
13366,
19933,
1035,
17961,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
3872,
1035,
8909,
1024,
1030,
8909,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
19933,
1035,
3872,
1035,
17961,
1006,
7047,
1007,
2450... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
samvera/hyrax | app/models/concerns/hyrax/collection_behavior.rb | Hyrax.CollectionBehavior.bytes | def bytes
return 0 if member_object_ids.empty?
raise "Collection must be saved to query for bytes" if new_record?
# One query per member_id because Solr is not a relational database
member_object_ids.collect { |work_id| size_for_work(work_id) }.sum
end | ruby | def bytes
return 0 if member_object_ids.empty?
raise "Collection must be saved to query for bytes" if new_record?
# One query per member_id because Solr is not a relational database
member_object_ids.collect { |work_id| size_for_work(work_id) }.sum
end | [
"def",
"bytes",
"return",
"0",
"if",
"member_object_ids",
".",
"empty?",
"raise",
"\"Collection must be saved to query for bytes\"",
"if",
"new_record?",
"# One query per member_id because Solr is not a relational database",
"member_object_ids",
".",
"collect",
"{",
"|",
"work_id... | Compute the sum of each file in the collection using Solr to
avoid having to access Fedora
@return [Fixnum] size of collection in bytes
@raise [RuntimeError] unsaved record does not exist in solr | [
"Compute",
"the",
"sum",
"of",
"each",
"file",
"in",
"the",
"collection",
"using",
"Solr",
"to",
"avoid",
"having",
"to",
"access",
"Fedora"
] | e2b4f56e829a53b1f11296324736e9d5b8c9ee5f | https://github.com/samvera/hyrax/blob/e2b4f56e829a53b1f11296324736e9d5b8c9ee5f/app/models/concerns/hyrax/collection_behavior.rb#L118-L125 | train | Returns the number of bytes of the current collection. | [
30522,
13366,
27507,
2709,
1014,
2065,
2266,
1035,
4874,
1035,
8909,
2015,
1012,
4064,
1029,
5333,
1000,
3074,
2442,
2022,
5552,
2000,
23032,
2005,
27507,
1000,
2065,
2047,
1035,
2501,
1029,
1001,
2028,
23032,
2566,
2266,
1035,
8909,
2138,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/express_route_ports.rb | Azure::Network::Mgmt::V2019_02_01.ExpressRoutePorts.delete | def delete(resource_group_name, express_route_port_name, custom_headers:nil)
response = delete_async(resource_group_name, express_route_port_name, custom_headers:custom_headers).value!
nil
end | ruby | def delete(resource_group_name, express_route_port_name, custom_headers:nil)
response = delete_async(resource_group_name, express_route_port_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"delete",
"(",
"resource_group_name",
",",
"express_route_port_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_async",
"(",
"resource_group_name",
",",
"express_route_port_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!"... | Deletes the specified ExpressRoutePort resource.
@param resource_group_name [String] The name of the resource group.
@param express_route_port_name [String] The name of the ExpressRoutePort
resource.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Deletes",
"the",
"specified",
"ExpressRoutePort",
"resource",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/express_route_ports.rb#L33-L36 | train | Deletes the specified ExpressRoutePort. | [
30522,
13366,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4671,
1035,
2799,
1035,
3417,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/managers.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.Managers.create_extended_info | def create_extended_info(parameters, resource_group_name, manager_name, custom_headers:nil)
response = create_extended_info_async(parameters, resource_group_name, manager_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_extended_info(parameters, resource_group_name, manager_name, custom_headers:nil)
response = create_extended_info_async(parameters, resource_group_name, manager_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_extended_info",
"(",
"parameters",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_extended_info_async",
"(",
"parameters",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_hea... | Creates the extended info of the manager.
@param parameters [ManagerExtendedInfo] The manager extended information.
@param resource_group_name [String] The resource group name
@param manager_name [String] The manager name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ManagerExtendedInfo] operation results. | [
"Creates",
"the",
"extended",
"info",
"of",
"the",
"manager",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/managers.rb#L890-L893 | train | Creates an extended info for the specified managed database. | [
30522,
13366,
3443,
1035,
3668,
1035,
18558,
1006,
11709,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3443,
1035,
3668,
1035,
18558,
1035,
2004,
6038,
2278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
tongueroo/jets | lib/jets/resource/lambda/function.rb | Jets::Resource::Lambda.Function.finalize_properties! | def finalize_properties!(props)
handler = full_handler(props)
runtime = get_runtime(props)
managed = {
handler: handler,
runtime: runtime,
description: description,
}
managed[:function_name] = function_name if function_name
layers = get_layers(runtime)
managed[:layers] = layers if layers
props.merge!(managed)
end | ruby | def finalize_properties!(props)
handler = full_handler(props)
runtime = get_runtime(props)
managed = {
handler: handler,
runtime: runtime,
description: description,
}
managed[:function_name] = function_name if function_name
layers = get_layers(runtime)
managed[:layers] = layers if layers
props.merge!(managed)
end | [
"def",
"finalize_properties!",
"(",
"props",
")",
"handler",
"=",
"full_handler",
"(",
"props",
")",
"runtime",
"=",
"get_runtime",
"(",
"props",
")",
"managed",
"=",
"{",
"handler",
":",
"handler",
",",
"runtime",
":",
"runtime",
",",
"description",
":",
... | Properties managed by Jets with merged with finality. | [
"Properties",
"managed",
"by",
"Jets",
"with",
"merged",
"with",
"finality",
"."
] | 46943a519224067e58aa3e2d5656e3ca083150f9 | https://github.com/tongueroo/jets/blob/46943a519224067e58aa3e2d5656e3ca083150f9/lib/jets/resource/lambda/function.rb#L124-L136 | train | Finalizes the properties of the object. | [
30522,
13366,
2345,
4697,
1035,
5144,
999,
1006,
24387,
1007,
28213,
1027,
2440,
1035,
28213,
1006,
24387,
1007,
2448,
7292,
1027,
2131,
1035,
2448,
7292,
1006,
24387,
1007,
3266,
1027,
1063,
28213,
1024,
28213,
1010,
2448,
7292,
1024,
2448... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/lib/ms_rest/http_operation_request.rb | MsRest.HttpOperationRequest.build_path | def build_path
template = path_template.dup
path_params.each{ |key, value| template["{#{key}}"] = ERB::Util.url_encode(value) if template.include?("{#{key}}") } unless path_params.nil?
skip_encoding_path_params.each{ |key, value| template["{#{key}}"] = value } unless skip_encoding_path_params.nil?
path = URI.parse(template.gsub(/([^:]|\A)\/\//, '\1/'))
unless skip_encoding_query_params.nil?
path.query = [(path.query || ""), skip_encoding_query_params.reject{|_, v| v.nil?}.map{|k,v| "#{k}=#{v}"}].join('&')
end
path
end | ruby | def build_path
template = path_template.dup
path_params.each{ |key, value| template["{#{key}}"] = ERB::Util.url_encode(value) if template.include?("{#{key}}") } unless path_params.nil?
skip_encoding_path_params.each{ |key, value| template["{#{key}}"] = value } unless skip_encoding_path_params.nil?
path = URI.parse(template.gsub(/([^:]|\A)\/\//, '\1/'))
unless skip_encoding_query_params.nil?
path.query = [(path.query || ""), skip_encoding_query_params.reject{|_, v| v.nil?}.map{|k,v| "#{k}=#{v}"}].join('&')
end
path
end | [
"def",
"build_path",
"template",
"=",
"path_template",
".",
"dup",
"path_params",
".",
"each",
"{",
"|",
"key",
",",
"value",
"|",
"template",
"[",
"\"{#{key}}\"",
"]",
"=",
"ERB",
"::",
"Util",
".",
"url_encode",
"(",
"value",
")",
"if",
"template",
"."... | Creates a path from the path template and the path_params and skip_encoding_path_params
@return [URI] body the HTTP response body. | [
"Creates",
"a",
"path",
"from",
"the",
"path",
"template",
"and",
"the",
"path_params",
"and",
"skip_encoding_path_params"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/runtime/ms_rest/lib/ms_rest/http_operation_request.rb#L98-L107 | train | Build the path object from the template and the skip_encoding_path_params | [
30522,
13366,
3857,
1035,
4130,
23561,
1027,
4130,
1035,
23561,
1012,
4241,
2361,
4130,
1035,
11498,
5244,
1012,
2169,
1063,
1064,
3145,
1010,
3643,
1064,
23561,
1031,
1000,
1063,
1001,
1063,
3145,
1065,
1065,
1000,
1033,
1027,
9413,
2497,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/pivot_table.rb | Axlsx.PivotTable.pages= | def pages=(v)
DataTypeValidator.validate "#{self.class}.pages", [Array], v
v.each do |ref|
DataTypeValidator.validate "#{self.class}.pages[]", [String], ref
end
@pages = v
end | ruby | def pages=(v)
DataTypeValidator.validate "#{self.class}.pages", [Array], v
v.each do |ref|
DataTypeValidator.validate "#{self.class}.pages[]", [String], ref
end
@pages = v
end | [
"def",
"pages",
"=",
"(",
"v",
")",
"DataTypeValidator",
".",
"validate",
"\"#{self.class}.pages\"",
",",
"[",
"Array",
"]",
",",
"v",
"v",
".",
"each",
"do",
"|",
"ref",
"|",
"DataTypeValidator",
".",
"validate",
"\"#{self.class}.pages[]\"",
",",
"[",
"Stri... | (see #pages) | [
"(",
"see",
"#pages",
")"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/worksheet/pivot_table.rb#L127-L133 | train | Sets the pages attribute. | [
30522,
13366,
5530,
1027,
1006,
1058,
1007,
2951,
13874,
10175,
8524,
4263,
1012,
9398,
3686,
1000,
1001,
1063,
2969,
1012,
2465,
1065,
1012,
5530,
1000,
1010,
1031,
9140,
1033,
1010,
1058,
1058,
1012,
2169,
2079,
1064,
25416,
1064,
2951,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
guard/guard | lib/guard/dsl.rb | Guard.Dsl.watch | def watch(pattern, &action)
# Allow watches in the global scope (to execute arbitrary commands) by
# building a generic Guard::Plugin.
@plugin_options ||= nil
return guard(:plugin) { watch(pattern, &action) } unless @plugin_options
@plugin_options[:watchers] << Watcher.new(pattern, action)
end | ruby | def watch(pattern, &action)
# Allow watches in the global scope (to execute arbitrary commands) by
# building a generic Guard::Plugin.
@plugin_options ||= nil
return guard(:plugin) { watch(pattern, &action) } unless @plugin_options
@plugin_options[:watchers] << Watcher.new(pattern, action)
end | [
"def",
"watch",
"(",
"pattern",
",",
"&",
"action",
")",
"# Allow watches in the global scope (to execute arbitrary commands) by",
"# building a generic Guard::Plugin.",
"@plugin_options",
"||=",
"nil",
"return",
"guard",
"(",
":plugin",
")",
"{",
"watch",
"(",
"pattern",
... | Defines a pattern to be watched in order to run actions on file
modification.
@example Declare watchers for a Guard
guard :rspec do
watch('spec/spec_helper.rb')
watch(%r{^.+_spec.rb})
watch(%r{^app/controllers/(.+).rb}) do |m|
'spec/acceptance/#{m[1]}s_spec.rb'
end
end
@example Declare global watchers outside of a Guard
watch(%r{^(.+)$}) { |m| puts "#{m[1]} changed." }
@param [String, Regexp] pattern the pattern that Guard must watch for
modification
@yield a block to be run when the pattern is matched
@yieldparam [MatchData] m matches of the pattern
@yieldreturn a directory, a filename, an array of
directories / filenames, or nothing (can be an arbitrary command)
@see Guard::Watcher
@see #guard | [
"Defines",
"a",
"pattern",
"to",
"be",
"watched",
"in",
"order",
"to",
"run",
"actions",
"on",
"file",
"modification",
"."
] | e2508cd83badf0d537dbaba35d307adc35d92e4f | https://github.com/guard/guard/blob/e2508cd83badf0d537dbaba35d307adc35d92e4f/lib/guard/dsl.rb#L217-L224 | train | Adds a watch to the plugin. | [
30522,
13366,
3422,
1006,
5418,
1010,
1004,
2895,
1007,
1001,
3499,
12197,
1999,
1996,
3795,
9531,
1006,
2000,
15389,
15275,
10954,
1007,
2011,
1001,
2311,
1037,
12391,
3457,
1024,
1024,
13354,
2378,
1012,
1030,
13354,
2378,
1035,
7047,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
github/graphql-client | lib/graphql/client.rb | GraphQL.Client.create_operation | def create_operation(fragment, filename = nil, lineno = nil)
unless fragment.is_a?(GraphQL::Client::FragmentDefinition)
raise TypeError, "expected fragment to be a GraphQL::Client::FragmentDefinition, but was #{fragment.class}"
end
if filename.nil? && lineno.nil?
location = caller_locations(1, 1).first
filename = location.path
lineno = location.lineno
end
variables = GraphQL::Client::DefinitionVariables.operation_variables(self.schema, fragment.document, fragment.definition_name)
type_name = fragment.definition_node.type.name
if schema.query && type_name == schema.query.name
operation_type = "query"
elsif schema.mutation && type_name == schema.mutation.name
operation_type = "mutation"
elsif schema.subscription && type_name == schema.subscription.name
operation_type = "subscription"
else
types = [schema.query, schema.mutation, schema.subscription].compact
raise Error, "Fragment must be defined on #{types.map(&:name).join(", ")}"
end
doc_ast = GraphQL::Language::Nodes::Document.new(definitions: [
GraphQL::Language::Nodes::OperationDefinition.new(
operation_type: operation_type,
variables: variables,
selections: [
GraphQL::Language::Nodes::FragmentSpread.new(name: fragment.name)
]
)
])
parse(doc_ast.to_query_string, filename, lineno)
end | ruby | def create_operation(fragment, filename = nil, lineno = nil)
unless fragment.is_a?(GraphQL::Client::FragmentDefinition)
raise TypeError, "expected fragment to be a GraphQL::Client::FragmentDefinition, but was #{fragment.class}"
end
if filename.nil? && lineno.nil?
location = caller_locations(1, 1).first
filename = location.path
lineno = location.lineno
end
variables = GraphQL::Client::DefinitionVariables.operation_variables(self.schema, fragment.document, fragment.definition_name)
type_name = fragment.definition_node.type.name
if schema.query && type_name == schema.query.name
operation_type = "query"
elsif schema.mutation && type_name == schema.mutation.name
operation_type = "mutation"
elsif schema.subscription && type_name == schema.subscription.name
operation_type = "subscription"
else
types = [schema.query, schema.mutation, schema.subscription].compact
raise Error, "Fragment must be defined on #{types.map(&:name).join(", ")}"
end
doc_ast = GraphQL::Language::Nodes::Document.new(definitions: [
GraphQL::Language::Nodes::OperationDefinition.new(
operation_type: operation_type,
variables: variables,
selections: [
GraphQL::Language::Nodes::FragmentSpread.new(name: fragment.name)
]
)
])
parse(doc_ast.to_query_string, filename, lineno)
end | [
"def",
"create_operation",
"(",
"fragment",
",",
"filename",
"=",
"nil",
",",
"lineno",
"=",
"nil",
")",
"unless",
"fragment",
".",
"is_a?",
"(",
"GraphQL",
"::",
"Client",
"::",
"FragmentDefinition",
")",
"raise",
"TypeError",
",",
"\"expected fragment to be a ... | Public: Create operation definition from a fragment definition.
Automatically determines operation variable set.
Examples
FooFragment = Client.parse <<-'GRAPHQL'
fragment on Mutation {
updateFoo(id: $id, content: $content)
}
GRAPHQL
# mutation($id: ID!, $content: String!) {
# updateFoo(id: $id, content: $content)
# }
FooMutation = Client.create_operation(FooFragment)
fragment - A FragmentDefinition definition.
Returns an OperationDefinition. | [
"Public",
":",
"Create",
"operation",
"definition",
"from",
"a",
"fragment",
"definition",
"."
] | f30d355666b83cd89cc5886e9ecc44f32de056db | https://github.com/github/graphql-client/blob/f30d355666b83cd89cc5886e9ecc44f32de056db/lib/graphql/client.rb#L281-L316 | train | Create an operation from a fragment | [
30522,
13366,
3443,
1035,
3169,
1006,
15778,
1010,
5371,
18442,
1027,
9152,
2140,
1010,
17517,
2080,
1027,
9152,
2140,
1007,
4983,
15778,
1012,
2003,
1035,
1037,
1029,
1006,
10629,
4160,
2140,
1024,
1024,
7396,
1024,
1024,
15778,
3207,
1629... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
appium/ruby_lib | lib/appium_lib/driver.rb | Appium.Driver.exists | def exists(pre_check = 0, post_check = @core.default_wait)
# do not uset set_wait here.
# it will cause problems with other methods reading the default_wait of 0
# which then gets converted to a 1 second wait.
@driver.manage.timeouts.implicit_wait = pre_check
# the element exists unless an error is raised.
exists = true
begin
yield # search for element
rescue StandardError
exists = false # error means it's not there
end
# restore wait
@driver.manage.timeouts.implicit_wait = post_check if post_check != pre_check
exists
end | ruby | def exists(pre_check = 0, post_check = @core.default_wait)
# do not uset set_wait here.
# it will cause problems with other methods reading the default_wait of 0
# which then gets converted to a 1 second wait.
@driver.manage.timeouts.implicit_wait = pre_check
# the element exists unless an error is raised.
exists = true
begin
yield # search for element
rescue StandardError
exists = false # error means it's not there
end
# restore wait
@driver.manage.timeouts.implicit_wait = post_check if post_check != pre_check
exists
end | [
"def",
"exists",
"(",
"pre_check",
"=",
"0",
",",
"post_check",
"=",
"@core",
".",
"default_wait",
")",
"# do not uset set_wait here.",
"# it will cause problems with other methods reading the default_wait of 0",
"# which then gets converted to a 1 second wait.",
"@driver",
".",
... | Returns existence of element.
Example:
exists { button('sign in') } ? puts('true') : puts('false')
@param [Integer] pre_check The amount in seconds to set the
wait to before checking existence
@param [Integer] post_check The amount in seconds to set the
wait to after checking existence
@yield The block to call
@return [Boolean] | [
"Returns",
"existence",
"of",
"element",
"."
] | 1f5898400dd1928bfe42ddd5f842d1f8738f2f76 | https://github.com/appium/ruby_lib/blob/1f5898400dd1928bfe42ddd5f842d1f8738f2f76/lib/appium_lib/driver.rb#L603-L621 | train | Checks if the element exists in the page. | [
30522,
13366,
6526,
1006,
3653,
1035,
4638,
1027,
1014,
1010,
2695,
1035,
4638,
1027,
1030,
4563,
1012,
12398,
1035,
3524,
1007,
1001,
2079,
2025,
2224,
2102,
2275,
1035,
3524,
2182,
1012,
1001,
2009,
2097,
3426,
3471,
2007,
2060,
4725,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/private_zones.rb | Azure::PrivateDns::Mgmt::V2018_09_01.PrivateZones.update | def update(resource_group_name, private_zone_name, parameters, if_match:nil, custom_headers:nil)
response = update_async(resource_group_name, private_zone_name, parameters, if_match:if_match, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def update(resource_group_name, private_zone_name, parameters, if_match:nil, custom_headers:nil)
response = update_async(resource_group_name, private_zone_name, parameters, if_match:if_match, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"update",
"(",
"resource_group_name",
",",
"private_zone_name",
",",
"parameters",
",",
"if_match",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"update_async",
"(",
"resource_group_name",
",",
"private_zone_name",
",",
"parameters",
... | Updates a Private DNS zone. Does not modify virtual network links or DNS
records within the zone.
@param resource_group_name [String] The name of the resource group.
@param private_zone_name [String] The name of the Private DNS zone (without a
terminating dot).
@param parameters [PrivateZone] Parameters supplied to the Update operation.
@param if_match [String] The ETag of the Private DNS zone. Omit this value to
always overwrite the current zone. Specify the last-seen ETag value to
prevent accidentally overwriting any concurrent changes.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [PrivateZone] operation results. | [
"Updates",
"a",
"Private",
"DNS",
"zone",
".",
"Does",
"not",
"modify",
"virtual",
"network",
"links",
"or",
"DNS",
"records",
"within",
"the",
"zone",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/private_zones.rb#L101-L104 | train | Updates a Private DNS zone. | [
30522,
13366,
10651,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2797,
1035,
4224,
1035,
2171,
1010,
11709,
1010,
2065,
1035,
2674,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
10651,
1035,
2004,
6038,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/thrift | lib/rb/lib/thrift/protocol/json_protocol.rb | Thrift.JsonProtocol.write_json_char | def write_json_char(ch)
# This table describes the handling for the first 0x30 characters
# 0 : escape using "\u00xx" notation
# 1 : just output index
# <other> : escape using "\<other>" notation
kJSONCharTable = [
# 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0,'b','t','n', 0,'f','r', 0, 0, # 0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 1
1, 1,'"', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, # 2
]
ch_value = ch[0]
if (ch_value.kind_of? String)
ch_value = ch.bytes.first
end
if (ch_value >= 0x30)
if (ch == @@kJSONBackslash) # Only special character >= 0x30 is '\'
trans.write(@@kJSONBackslash)
trans.write(@@kJSONBackslash)
else
trans.write(ch)
end
else
outCh = kJSONCharTable[ch_value];
# Check if regular character, backslash escaped, or JSON escaped
if outCh.kind_of? String
trans.write(@@kJSONBackslash)
trans.write(outCh)
elsif outCh == 1
trans.write(ch)
else
write_json_escape_char(ch)
end
end
end | ruby | def write_json_char(ch)
# This table describes the handling for the first 0x30 characters
# 0 : escape using "\u00xx" notation
# 1 : just output index
# <other> : escape using "\<other>" notation
kJSONCharTable = [
# 0 1 2 3 4 5 6 7 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0,'b','t','n', 0,'f','r', 0, 0, # 0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, # 1
1, 1,'"', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, # 2
]
ch_value = ch[0]
if (ch_value.kind_of? String)
ch_value = ch.bytes.first
end
if (ch_value >= 0x30)
if (ch == @@kJSONBackslash) # Only special character >= 0x30 is '\'
trans.write(@@kJSONBackslash)
trans.write(@@kJSONBackslash)
else
trans.write(ch)
end
else
outCh = kJSONCharTable[ch_value];
# Check if regular character, backslash escaped, or JSON escaped
if outCh.kind_of? String
trans.write(@@kJSONBackslash)
trans.write(outCh)
elsif outCh == 1
trans.write(ch)
else
write_json_escape_char(ch)
end
end
end | [
"def",
"write_json_char",
"(",
"ch",
")",
"# This table describes the handling for the first 0x30 characters",
"# 0 : escape using \"\\u00xx\" notation",
"# 1 : just output index",
"# <other> : escape using \"\\<other>\" notation",
"kJSONCharTable",
"=",
"[",
"# 0 1 2 3 4 5 6 7 8 9 A B C D E... | Write the character ch as part of a JSON string, escaping as appropriate. | [
"Write",
"the",
"character",
"ch",
"as",
"part",
"of",
"a",
"JSON",
"string",
"escaping",
"as",
"appropriate",
"."
] | 27d8387c49a49fcf193893f834e9766ae0b051c1 | https://github.com/apache/thrift/blob/27d8387c49a49fcf193893f834e9766ae0b051c1/lib/rb/lib/thrift/protocol/json_protocol.rb#L262-L297 | train | Write a single character to the output stream | [
30522,
13366,
4339,
1035,
1046,
3385,
1035,
25869,
1006,
10381,
1007,
1001,
2023,
2795,
5577,
1996,
8304,
2005,
1996,
2034,
1014,
2595,
14142,
3494,
1001,
1014,
1024,
4019,
2478,
1000,
1032,
1057,
8889,
20348,
1000,
14869,
1001,
1015,
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... |
alexreisner/geocoder | lib/geocoder/stores/active_record.rb | Geocoder::Store.ActiveRecord.nearbys | def nearbys(radius = 20, options = {})
return nil unless geocoded?
options.merge!(:exclude => self) unless send(self.class.primary_key).nil?
self.class.near(self, radius, options)
end | ruby | def nearbys(radius = 20, options = {})
return nil unless geocoded?
options.merge!(:exclude => self) unless send(self.class.primary_key).nil?
self.class.near(self, radius, options)
end | [
"def",
"nearbys",
"(",
"radius",
"=",
"20",
",",
"options",
"=",
"{",
"}",
")",
"return",
"nil",
"unless",
"geocoded?",
"options",
".",
"merge!",
"(",
":exclude",
"=>",
"self",
")",
"unless",
"send",
"(",
"self",
".",
"class",
".",
"primary_key",
")",
... | Get nearby geocoded objects.
Takes the same options hash as the near class method (scope).
Returns nil if the object is not geocoded. | [
"Get",
"nearby",
"geocoded",
"objects",
".",
"Takes",
"the",
"same",
"options",
"hash",
"as",
"the",
"near",
"class",
"method",
"(",
"scope",
")",
".",
"Returns",
"nil",
"if",
"the",
"object",
"is",
"not",
"geocoded",
"."
] | e087dc2759264ee6f307b926bb2de4ec2406859e | https://github.com/alexreisner/geocoder/blob/e087dc2759264ee6f307b926bb2de4ec2406859e/lib/geocoder/stores/active_record.rb#L287-L291 | train | Returns the nearest coordinates of the object. | [
30522,
13366,
3518,
2015,
1006,
12177,
1027,
2322,
1010,
7047,
1027,
1063,
1065,
1007,
2709,
9152,
2140,
4983,
20248,
16044,
2094,
1029,
7047,
1012,
13590,
999,
1006,
1024,
23329,
1027,
1028,
2969,
1007,
4983,
4604,
1006,
2969,
1012,
2465,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
randym/axlsx | lib/axlsx/drawing/marker.rb | Axlsx.Marker.to_xml_string | def to_xml_string(str = '')
[:col, :colOff, :row, :rowOff].each do |k|
str << ('<xdr:' << k.to_s << '>' << self.send(k).to_s << '</xdr:' << k.to_s << '>')
end
end | ruby | def to_xml_string(str = '')
[:col, :colOff, :row, :rowOff].each do |k|
str << ('<xdr:' << k.to_s << '>' << self.send(k).to_s << '</xdr:' << k.to_s << '>')
end
end | [
"def",
"to_xml_string",
"(",
"str",
"=",
"''",
")",
"[",
":col",
",",
":colOff",
",",
":row",
",",
":rowOff",
"]",
".",
"each",
"do",
"|",
"k",
"|",
"str",
"<<",
"(",
"'<xdr:'",
"<<",
"k",
".",
"to_s",
"<<",
"'>'",
"<<",
"self",
".",
"send",
"(... | Serializes the object
@param [String] str
@return [String] | [
"Serializes",
"the",
"object"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/drawing/marker.rb#L59-L63 | train | Convert the object to XML string. | [
30522,
13366,
2000,
1035,
20950,
1035,
5164,
1006,
2358,
2099,
1027,
1005,
1005,
1007,
1031,
1024,
8902,
1010,
1024,
8902,
7245,
1010,
1024,
5216,
1010,
1024,
5216,
7245,
1033,
1012,
2169,
2079,
1064,
1047,
1064,
2358,
2099,
1026,
1026,
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/drawing/pie_3D_chart.rb | Axlsx.Pie3DChart.to_xml_string | def to_xml_string(str = '')
super(str) do
str << '<c:pie3DChart>'
str << ('<c:varyColors val="' << vary_colors.to_s << '"/>')
@series.each { |ser| ser.to_xml_string(str) }
d_lbls.to_xml_string(str) if @d_lbls
str << '</c:pie3DChart>'
end
end | ruby | def to_xml_string(str = '')
super(str) do
str << '<c:pie3DChart>'
str << ('<c:varyColors val="' << vary_colors.to_s << '"/>')
@series.each { |ser| ser.to_xml_string(str) }
d_lbls.to_xml_string(str) if @d_lbls
str << '</c:pie3DChart>'
end
end | [
"def",
"to_xml_string",
"(",
"str",
"=",
"''",
")",
"super",
"(",
"str",
")",
"do",
"str",
"<<",
"'<c:pie3DChart>'",
"str",
"<<",
"(",
"'<c:varyColors val=\"'",
"<<",
"vary_colors",
".",
"to_s",
"<<",
"'\"/>'",
")",
"@series",
".",
"each",
"{",
"|",
"ser... | Creates a new pie chart object
@param [GraphicFrame] frame The workbook that owns this chart.
@option options [Cell, String] title
@option options [Boolean] show_legend
@option options [Symbol] grouping
@option options [String] gap_depth
@option options [Integer] rot_x
@option options [String] h_percent
@option options [Integer] rot_y
@option options [String] depth_percent
@option options [Boolean] r_ang_ax
@option options [Integer] perspective
@see Chart
@see View3D
Serializes the object
@param [String] str
@return [String] | [
"Creates",
"a",
"new",
"pie",
"chart",
"object"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/drawing/pie_3D_chart.rb#L36-L44 | train | Returns the XML string for this chart. | [
30522,
13366,
2000,
1035,
20950,
1035,
5164,
1006,
2358,
2099,
1027,
1005,
1005,
1007,
3565,
1006,
2358,
2099,
1007,
2079,
2358,
2099,
1026,
1026,
1005,
1026,
1039,
1024,
11345,
29097,
7507,
5339,
1028,
1005,
2358,
2099,
1026,
1026,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_batch/lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb | Azure::Batch::Mgmt::V2017_09_01.CertificateOperations.get_with_http_info | def get_with_http_info(resource_group_name, account_name, certificate_name, custom_headers:nil)
get_async(resource_group_name, account_name, certificate_name, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, account_name, certificate_name, custom_headers:nil)
get_async(resource_group_name, account_name, certificate_name, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"account_name",
",",
"certificate_name",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"certificate_name",
",",
"custom_headers",
":custom_headers",
... | Gets information about the specified certificate.
@param resource_group_name [String] The name of the resource group that
contains the Batch account.
@param account_name [String] The name of the Batch account.
@param certificate_name [String] The identifier for the certificate. This
must be made up of algorithm and thumbprint separated by a dash, and must
match the certificate data in the request. For example SHA1-a3d1c5.
@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",
"the",
"specified",
"certificate",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_batch/lib/2017-09-01/generated/azure_mgmt_batch/certificate_operations.rb#L428-L430 | train | Gets the specified certificate s index. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
8196,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
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 | management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/jobs.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.Jobs.list_by_manager_as_lazy | def list_by_manager_as_lazy(resource_group_name, manager_name, filter:nil, custom_headers:nil)
response = list_by_manager_async(resource_group_name, manager_name, filter:filter, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_manager_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_by_manager_as_lazy(resource_group_name, manager_name, filter:nil, custom_headers:nil)
response = list_by_manager_async(resource_group_name, manager_name, filter:filter, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_manager_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_by_manager_as_lazy",
"(",
"resource_group_name",
",",
"manager_name",
",",
"filter",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_manager_async",
"(",
"resource_group_name",
",",
"manager_name",
",",
"filter",
":",
"filt... | Gets all the jobs for the specified manager. With optional OData query
parameters, a filtered set of jobs is returned.
@param resource_group_name [String] The resource group name
@param manager_name [String] The manager name
@param filter [String] OData Filter options
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [JobList] which provide lazy access to pages of the response. | [
"Gets",
"all",
"the",
"jobs",
"for",
"the",
"specified",
"manager",
".",
"With",
"optional",
"OData",
"query",
"parameters",
"a",
"filtered",
"set",
"of",
"jobs",
"is",
"returned",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/jobs.rb#L683-L692 | train | Gets the list of all the managed database versions. | [
30522,
13366,
2862,
1035,
2011,
1035,
3208,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
11307,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
samvera/hyrax | app/indexers/hyrax/deep_indexing_service.rb | Hyrax.DeepIndexingService.append_to_solr_doc | def append_to_solr_doc(solr_doc, solr_field_key, field_info, val)
return super unless object.controlled_properties.include?(solr_field_key.to_sym)
case val
when ActiveTriples::Resource
append_label_and_uri(solr_doc, solr_field_key, field_info, val)
when String
append_label(solr_doc, solr_field_key, field_info, val)
else
raise ArgumentError, "Can't handle #{val.class}"
end
end | ruby | def append_to_solr_doc(solr_doc, solr_field_key, field_info, val)
return super unless object.controlled_properties.include?(solr_field_key.to_sym)
case val
when ActiveTriples::Resource
append_label_and_uri(solr_doc, solr_field_key, field_info, val)
when String
append_label(solr_doc, solr_field_key, field_info, val)
else
raise ArgumentError, "Can't handle #{val.class}"
end
end | [
"def",
"append_to_solr_doc",
"(",
"solr_doc",
",",
"solr_field_key",
",",
"field_info",
",",
"val",
")",
"return",
"super",
"unless",
"object",
".",
"controlled_properties",
".",
"include?",
"(",
"solr_field_key",
".",
"to_sym",
")",
"case",
"val",
"when",
"Acti... | We're overiding the default indexer in order to index the RDF labels. In order
for this to be called, you must specify at least one default indexer on the property.
@param [Hash] solr_doc
@param [String] solr_field_key
@param [Hash] field_info
@param [ActiveTriples::Resource, String] val | [
"We",
"re",
"overiding",
"the",
"default",
"indexer",
"in",
"order",
"to",
"index",
"the",
"RDF",
"labels",
".",
"In",
"order",
"for",
"this",
"to",
"be",
"called",
"you",
"must",
"specify",
"at",
"least",
"one",
"default",
"indexer",
"on",
"the",
"prope... | e2b4f56e829a53b1f11296324736e9d5b8c9ee5f | https://github.com/samvera/hyrax/blob/e2b4f56e829a53b1f11296324736e9d5b8c9ee5f/app/indexers/hyrax/deep_indexing_service.rb#L10-L20 | train | Append the field to the solr_doc | [
30522,
13366,
10439,
10497,
1035,
2000,
1035,
14017,
2099,
1035,
9986,
1006,
14017,
2099,
1035,
9986,
1010,
14017,
2099,
1035,
2492,
1035,
3145,
1010,
2492,
1035,
18558,
1010,
11748,
1007,
2709,
3565,
4983,
4874,
1012,
4758,
1035,
5144,
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... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/interface_endpoints.rb | Azure::Network::Mgmt::V2019_02_01.InterfaceEndpoints.begin_create_or_update_with_http_info | def begin_create_or_update_with_http_info(resource_group_name, interface_endpoint_name, parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, interface_endpoint_name, parameters, custom_headers:custom_headers).value!
end | ruby | def begin_create_or_update_with_http_info(resource_group_name, interface_endpoint_name, parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, interface_endpoint_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_create_or_update_with_http_info",
"(",
"resource_group_name",
",",
"interface_endpoint_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"interface_endpoint_name",
",",
"parameters",
... | Creates or updates an interface endpoint in the specified resource group.
@param resource_group_name [String] The name of the resource group.
@param interface_endpoint_name [String] The name of the interface endpoint.
@param parameters [InterfaceEndpoint] Parameters supplied to the create or
update interface endpoint 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",
"an",
"interface",
"endpoint",
"in",
"the",
"specified",
"resource",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/interface_endpoints.rb#L485-L487 | train | Creates or updates an interface endpoint. | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8278,
1035,
2203,
8400,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-ec2/lib/aws-sdk-ec2/dhcp_options.rb | Aws::EC2.DhcpOptions.associate_with_vpc | def associate_with_vpc(options = {})
options = options.merge(dhcp_options_id: @id)
resp = @client.associate_dhcp_options(options)
resp.data
end | ruby | def associate_with_vpc(options = {})
options = options.merge(dhcp_options_id: @id)
resp = @client.associate_dhcp_options(options)
resp.data
end | [
"def",
"associate_with_vpc",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"dhcp_options_id",
":",
"@id",
")",
"resp",
"=",
"@client",
".",
"associate_dhcp_options",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @!group Actions
@example Request syntax with placeholder values
dhcp_options.associate_with_vpc({
vpc_id: "String", # required
dry_run: false,
})
@param [Hash] options ({})
@option options [required, String] :vpc_id
The ID of the VPC.
@option options [Boolean] :dry_run
Checks whether you have the required permissions for the action,
without actually making the request, and provides an error response.
If you have the required permissions, the error response is
`DryRunOperation`. Otherwise, it is `UnauthorizedOperation`.
@return [EmptyStructure] | [
"@!group",
"Actions",
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-ec2/lib/aws-sdk-ec2/dhcp_options.rb#L199-L203 | train | Associate the DHCP options with a VPC | [
30522,
13366,
5482,
1035,
2007,
1035,
21210,
2278,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
28144,
21906,
1035,
7047,
1035,
8909,
1024,
1030,
8909,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
5482,
1035,
28144... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_consumption/lib/2018-06-30/generated/azure_mgmt_consumption/usage_details.rb | Azure::Consumption::Mgmt::V2018_06_30.UsageDetails.list_by_billing_account_with_http_info | def list_by_billing_account_with_http_info(billing_account_id, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
list_by_billing_account_async(billing_account_id, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
end | ruby | def list_by_billing_account_with_http_info(billing_account_id, expand:nil, filter:nil, skiptoken:nil, top:nil, query_options:nil, custom_headers:nil)
list_by_billing_account_async(billing_account_id, expand:expand, filter:filter, skiptoken:skiptoken, top:top, query_options:query_options, custom_headers:custom_headers).value!
end | [
"def",
"list_by_billing_account_with_http_info",
"(",
"billing_account_id",
",",
"expand",
":",
"nil",
",",
"filter",
":",
"nil",
",",
"skiptoken",
":",
"nil",
",",
"top",
":",
"nil",
",",
"query_options",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
... | Lists the usage details by billingAccountId for a scope by current billing
period. Usage details are available via this API only for May 1, 2014 or
later.
@param billing_account_id [String] BillingAccount ID
@param expand [String] May be used to expand the
properties/additionalProperties or properties/meterDetails within a list of
usage details. By default, these fields are not included when listing usage
details.
@param filter [String] May be used to filter usageDetails by
properties/usageEnd (Utc time), properties/usageStart (Utc time),
properties/resourceGroup, properties/instanceName, properties/instanceId or
tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does
not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair
string where key and value is separated by a colon (:).
@param skiptoken [String] Skiptoken is only used if a previous operation
returned a partial result. If a previous response contains a nextLink
element, the value of the nextLink element will include a skiptoken parameter
that specifies a starting point to use for subsequent calls.
@param top [Integer] May be used to limit the number of results to the most
recent N usageDetails.
@param query_options [QueryOptions] Additional parameters for the operation
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Lists",
"the",
"usage",
"details",
"by",
"billingAccountId",
"for",
"a",
"scope",
"by",
"current",
"billing",
"period",
".",
"Usage",
"details",
"are",
"available",
"via",
"this",
"API",
"only",
"for",
"May",
"1",
"2014",
"or",
"later",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_consumption/lib/2018-06-30/generated/azure_mgmt_consumption/usage_details.rb#L378-L380 | train | Gets the list of all the documents in a service plan. | [
30522,
13366,
2862,
1035,
2011,
1035,
25640,
1035,
4070,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
25640,
1035,
4070,
1035,
8909,
1010,
7818,
1024,
9152,
2140,
1010,
11307,
1024,
9152,
2140,
1010,
13558,
18715,
2368,
1024,
9152,
2140,
1010... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/backend.rb | Azure::ApiManagement::Mgmt::V2018_01_01.Backend.get_with_http_info | def get_with_http_info(resource_group_name, service_name, backendid, custom_headers:nil)
get_async(resource_group_name, service_name, backendid, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, service_name, backendid, custom_headers:nil)
get_async(resource_group_name, service_name, backendid, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"service_name",
",",
"backendid",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"service_name",
",",
"backendid",
",",
"custom_headers",
":custom_headers",
")",
".",
... | Gets the details of the backend 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 backendid [String] Identifier of the Backend entity. Must be unique in
the current API Management service instance.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"details",
"of",
"the",
"backend",
"specified",
"by",
"its",
"identifier",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/backend.rb#L274-L276 | train | Gets the specified HDInsight backend. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
2067,
10497,
3593,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
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... |
rails/rails | actionpack/lib/action_controller/metal/mime_responds.rb | ActionController.MimeResponds.respond_to | def respond_to(*mimes)
raise ArgumentError, "respond_to takes either types or a block, never both" if mimes.any? && block_given?
collector = Collector.new(mimes, request.variant)
yield collector if block_given?
if format = collector.negotiate_format(request)
if content_type && content_type != format
raise ActionController::RespondToMismatchError
end
_process_format(format)
_set_rendered_content_type format
response = collector.response
response.call if response
else
raise ActionController::UnknownFormat
end
end | ruby | def respond_to(*mimes)
raise ArgumentError, "respond_to takes either types or a block, never both" if mimes.any? && block_given?
collector = Collector.new(mimes, request.variant)
yield collector if block_given?
if format = collector.negotiate_format(request)
if content_type && content_type != format
raise ActionController::RespondToMismatchError
end
_process_format(format)
_set_rendered_content_type format
response = collector.response
response.call if response
else
raise ActionController::UnknownFormat
end
end | [
"def",
"respond_to",
"(",
"*",
"mimes",
")",
"raise",
"ArgumentError",
",",
"\"respond_to takes either types or a block, never both\"",
"if",
"mimes",
".",
"any?",
"&&",
"block_given?",
"collector",
"=",
"Collector",
".",
"new",
"(",
"mimes",
",",
"request",
".",
... | Without web-service support, an action which collects the data for displaying a list of people
might look something like this:
def index
@people = Person.all
end
That action implicitly responds to all formats, but formats can also be explicitly enumerated:
def index
@people = Person.all
respond_to :html, :js
end
Here's the same action, with web-service support baked in:
def index
@people = Person.all
respond_to do |format|
format.html
format.js
format.xml { render xml: @people }
end
end
What that says is, "if the client wants HTML or JS in response to this action, just respond as we
would have before, but if the client wants XML, return them the list of people in XML format."
(Rails determines the desired response format from the HTTP Accept header submitted by the client.)
Supposing you have an action that adds a new person, optionally creating their company
(by name) if it does not already exist, without web-services, it might look like this:
def create
@company = Company.find_or_create_by(name: params[:company][:name])
@person = @company.people.create(params[:person])
redirect_to(person_list_url)
end
Here's the same action, with web-service support baked in:
def create
company = params[:person].delete(:company)
@company = Company.find_or_create_by(name: company[:name])
@person = @company.people.create(params[:person])
respond_to do |format|
format.html { redirect_to(person_list_url) }
format.js
format.xml { render xml: @person.to_xml(include: @company) }
end
end
If the client wants HTML, we just redirect them back to the person list. If they want JavaScript,
then it is an Ajax request and we render the JavaScript template associated with this action.
Lastly, if the client wants XML, we render the created person as XML, but with a twist: we also
include the person's company in the rendered XML, so you get something like this:
<person>
<id>...</id>
...
<company>
<id>...</id>
<name>...</name>
...
</company>
</person>
Note, however, the extra bit at the top of that action:
company = params[:person].delete(:company)
@company = Company.find_or_create_by(name: company[:name])
This is because the incoming XML document (if a web-service request is in process) can only contain a
single root-node. So, we have to rearrange things so that the request looks like this (url-encoded):
person[name]=...&person[company][name]=...&...
And, like this (xml-encoded):
<person>
<name>...</name>
<company>
<name>...</name>
</company>
</person>
In other words, we make the request so that it operates on a single entity's person. Then, in the action,
we extract the company data from the request, find or create the company, and then create the new person
with the remaining data.
Note that you can define your own XML parameter parser which would allow you to describe multiple entities
in a single request (i.e., by wrapping them all in a single root node), but if you just go with the flow
and accept Rails' defaults, life will be much easier.
If you need to use a MIME type which isn't supported by default, you can register your own handlers in
+config/initializers/mime_types.rb+ as follows.
Mime::Type.register "image/jpg", :jpg
+respond_to+ also allows you to specify a common block for different formats by using +any+:
def index
@people = Person.all
respond_to do |format|
format.html
format.any(:xml, :json) { render request.format.to_sym => @people }
end
end
In the example above, if the format is xml, it will render:
render xml: @people
Or if the format is json:
render json: @people
+any+ can also be used with no arguments, in which case it will be used for any format requested by
the user:
respond_to do |format|
format.html
format.any { redirect_to support_path }
end
Formats can have different variants.
The request variant is a specialization of the request format, like <tt>:tablet</tt>,
<tt>:phone</tt>, or <tt>:desktop</tt>.
We often want to render different html/json/xml templates for phones,
tablets, and desktop browsers. Variants make it easy.
You can set the variant in a +before_action+:
request.variant = :tablet if request.user_agent =~ /iPad/
Respond to variants in the action just like you respond to formats:
respond_to do |format|
format.html do |variant|
variant.tablet # renders app/views/projects/show.html+tablet.erb
variant.phone { extra_setup; render ... }
variant.none { special_setup } # executed only if there is no variant set
end
end
Provide separate templates for each format and variant:
app/views/projects/show.html.erb
app/views/projects/show.html+tablet.erb
app/views/projects/show.html+phone.erb
When you're not sharing any code within the format, you can simplify defining variants
using the inline syntax:
respond_to do |format|
format.js { render "trash" }
format.html.phone { redirect_to progress_path }
format.html.none { render "trash" }
end
Variants also support common +any+/+all+ block that formats have.
It works for both inline:
respond_to do |format|
format.html.any { render html: "any" }
format.html.phone { render html: "phone" }
end
and block syntax:
respond_to do |format|
format.html do |variant|
variant.any(:tablet, :phablet){ render html: "any" }
variant.phone { render html: "phone" }
end
end
You can also set an array of variants:
request.variant = [:tablet, :phone]
This will work similarly to formats and MIME types negotiation. If there
is no +:tablet+ variant declared, the +:phone+ variant will be used:
respond_to do |format|
format.html.none
format.html.phone # this gets rendered
end | [
"Without",
"web",
"-",
"service",
"support",
"an",
"action",
"which",
"collects",
"the",
"data",
"for",
"displaying",
"a",
"list",
"of",
"people",
"might",
"look",
"something",
"like",
"this",
":"
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/actionpack/lib/action_controller/metal/mime_responds.rb#L201-L218 | train | Respond to the given types of content. | [
30522,
13366,
6869,
1035,
2000,
1006,
1008,
2771,
7834,
1007,
5333,
6685,
2121,
29165,
1010,
1000,
6869,
1035,
2000,
3138,
2593,
4127,
2030,
1037,
3796,
1010,
2196,
2119,
1000,
2065,
2771,
7834,
1012,
2151,
1029,
1004,
1004,
3796,
1035,
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_automation/lib/2015-10-31/generated/azure_mgmt_automation/variable_operations.rb | Azure::Automation::Mgmt::V2015_10_31.VariableOperations.delete_with_http_info | def delete_with_http_info(resource_group_name, automation_account_name, variable_name, custom_headers:nil)
delete_async(resource_group_name, automation_account_name, variable_name, custom_headers:custom_headers).value!
end | ruby | def delete_with_http_info(resource_group_name, automation_account_name, variable_name, custom_headers:nil)
delete_async(resource_group_name, automation_account_name, variable_name, custom_headers:custom_headers).value!
end | [
"def",
"delete_with_http_info",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"variable_name",
",",
"custom_headers",
":",
"nil",
")",
"delete_async",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"variable_name",
",",
"custom_headers",... | Delete the variable.
@param resource_group_name [String] Name of an Azure Resource group.
@param automation_account_name [String] The name of the automation account.
@param variable_name [String] The name of variable.
@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",
"variable",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/variable_operations.rb#L286-L288 | train | Deletes a variable. | [
30522,
13366,
3972,
12870,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
19309,
1035,
4070,
1035,
2171,
1010,
8023,
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... |
rails/rails | activesupport/lib/active_support/time_with_zone.rb | ActiveSupport.TimeWithZone.as_json | def as_json(options = nil)
if ActiveSupport::JSON::Encoding.use_standard_json_time_format
xmlschema(ActiveSupport::JSON::Encoding.time_precision)
else
%(#{time.strftime("%Y/%m/%d %H:%M:%S")} #{formatted_offset(false)})
end
end | ruby | def as_json(options = nil)
if ActiveSupport::JSON::Encoding.use_standard_json_time_format
xmlschema(ActiveSupport::JSON::Encoding.time_precision)
else
%(#{time.strftime("%Y/%m/%d %H:%M:%S")} #{formatted_offset(false)})
end
end | [
"def",
"as_json",
"(",
"options",
"=",
"nil",
")",
"if",
"ActiveSupport",
"::",
"JSON",
"::",
"Encoding",
".",
"use_standard_json_time_format",
"xmlschema",
"(",
"ActiveSupport",
"::",
"JSON",
"::",
"Encoding",
".",
"time_precision",
")",
"else",
"%(#{time.strftim... | Coerces time to a string for JSON encoding. The default format is ISO 8601.
You can get %Y/%m/%d %H:%M:%S +offset style by setting
<tt>ActiveSupport::JSON::Encoding.use_standard_json_time_format</tt>
to +false+.
# With ActiveSupport::JSON::Encoding.use_standard_json_time_format = true
Time.utc(2005,2,1,15,15,10).in_time_zone("Hawaii").to_json
# => "2005-02-01T05:15:10.000-10:00"
# With ActiveSupport::JSON::Encoding.use_standard_json_time_format = false
Time.utc(2005,2,1,15,15,10).in_time_zone("Hawaii").to_json
# => "2005/02/01 05:15:10 -1000" | [
"Coerces",
"time",
"to",
"a",
"string",
"for",
"JSON",
"encoding",
".",
"The",
"default",
"format",
"is",
"ISO",
"8601",
".",
"You",
"can",
"get",
"%Y",
"/",
"%m",
"/",
"%d",
"%H",
":",
"%M",
":",
"%S",
"+",
"offset",
"style",
"by",
"setting",
"<tt... | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/time_with_zone.rb#L167-L173 | train | Returns the XML representation of the object as a JSON string. | [
30522,
13366,
2004,
1035,
1046,
3385,
1006,
7047,
1027,
9152,
2140,
1007,
2065,
3161,
6342,
9397,
11589,
1024,
1024,
1046,
3385,
1024,
1024,
17181,
1012,
2224,
1035,
3115,
1035,
1046,
3385,
1035,
2051,
1035,
4289,
20950,
22842,
2863,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.get_partition_health_using_policy_with_http_info | def get_partition_health_using_policy_with_http_info(partition_id, events_health_state_filter:0, replicas_health_state_filter:0, application_health_policy:nil, exclude_health_statistics:false, timeout:60, custom_headers:nil)
get_partition_health_using_policy_async(partition_id, events_health_state_filter:events_health_state_filter, replicas_health_state_filter:replicas_health_state_filter, application_health_policy:application_health_policy, exclude_health_statistics:exclude_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def get_partition_health_using_policy_with_http_info(partition_id, events_health_state_filter:0, replicas_health_state_filter:0, application_health_policy:nil, exclude_health_statistics:false, timeout:60, custom_headers:nil)
get_partition_health_using_policy_async(partition_id, events_health_state_filter:events_health_state_filter, replicas_health_state_filter:replicas_health_state_filter, application_health_policy:application_health_policy, exclude_health_statistics:exclude_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"get_partition_health_using_policy_with_http_info",
"(",
"partition_id",
",",
"events_health_state_filter",
":",
"0",
",",
"replicas_health_state_filter",
":",
"0",
",",
"application_health_policy",
":",
"nil",
",",
"exclude_health_statistics",
":",
"false",
",",
"ti... | Gets the health of the specified Service Fabric partition, by using the
specified health policy.
Gets the health information of the specified partition.
If the application health policy is specified, the health evaluation uses it
to get the aggregated health state.
If the policy is not specified, the health evaluation uses the application
health policy defined in the application manifest, or the default health
policy, if no policy is defined in the manifest.
Use EventsHealthStateFilter to filter the collection of health events
reported on the partition based on the health state.
Use ReplicasHealthStateFilter to filter the collection of ReplicaHealthState
objects on the partition. Use ApplicationHealthPolicy in the POST body to
override the health policies used to evaluate the health.
If you specify a partition that does not exist in the health store, this
request returns an error.
@param partition_id The identity of the partition.
@param events_health_state_filter [Integer] Allows filtering the collection
of HealthEvent objects returned based on health state.
The possible values for this parameter include integer value of one of the
following health states.
Only events that match the filter are returned. All events are used to
evaluate the aggregated health state.
If not specified, all entries are returned. The state values are flag based
enumeration, so the value could be a combination of these value obtained
using bitwise 'OR' operator. For example, If the provided value is 6 then all
of the events with HealthState value of OK (2) and Warning (4) are returned.
- Default - Default value. Matches any HealthState. The value is zero.
- None - Filter that doesn't match any HealthState value. Used in order to
return no results on a given collection of states. The value is 1.
- Ok - Filter that matches input with HealthState value Ok. The value is 2.
- Warning - Filter that matches input with HealthState value Warning. The
value is 4.
- Error - Filter that matches input with HealthState value Error. The value
is 8.
- All - Filter that matches input with any HealthState value. The value is
65535.
@param replicas_health_state_filter [Integer] Allows filtering the collection
of ReplicaHealthState objects on the partition. The value can be obtained
from members or bitwise operations on members of HealthStateFilter. Only
replicas that match the filter will be returned. All replicas will be used to
evaluate the aggregated health state. If not specified, all entries will be
returned.The state values are flag based enumeration, so the value could be a
combination of these value obtained using bitwise 'OR' operator. For example,
If the provided value is 6 then all of the events with HealthState value of
OK (2) and Warning (4) will be returned. The possible values for this
parameter include integer value of one of the following health states.
- Default - Default value. Matches any HealthState. The value is zero.
- None - Filter that doesn't match any HealthState value. Used in order to
return no results on a given collection of states. The value is 1.
- Ok - Filter that matches input with HealthState value Ok. The value is 2.
- Warning - Filter that matches input with HealthState value Warning. The
value is 4.
- Error - Filter that matches input with HealthState value Error. The value
is 8.
- All - Filter that matches input with any HealthState value. The value is
65535.
@param application_health_policy [ApplicationHealthPolicy] Describes the
health policies used to evaluate the health of an application or one of its
children.
If not present, the health evaluation uses the health policy from application
manifest or the default health policy.
@param exclude_health_statistics [Boolean] Indicates whether the health
statistics should be returned as part of the query result. False by default.
The statistics show the number of children entities in health state Ok,
Warning, and Error.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"health",
"of",
"the",
"specified",
"Service",
"Fabric",
"partition",
"by",
"using",
"the",
"specified",
"health",
"policy",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L12612-L12614 | train | Gets the health of the specified partition using the specified policy. | [
30522,
13366,
2131,
1035,
13571,
1035,
2740,
1035,
2478,
1035,
3343,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
13571,
1035,
8909,
1010,
2824,
1035,
2740,
1035,
2110,
1035,
11307,
1024,
1014,
1010,
15059,
2015,
1035,
2740,
1035,
2110,
1035,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/public_ipaddresses.rb | Azure::Network::Mgmt::V2018_07_01.PublicIPAddresses.begin_create_or_update_with_http_info | def begin_create_or_update_with_http_info(resource_group_name, public_ip_address_name, parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, public_ip_address_name, parameters, custom_headers:custom_headers).value!
end | ruby | def begin_create_or_update_with_http_info(resource_group_name, public_ip_address_name, parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, public_ip_address_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_create_or_update_with_http_info",
"(",
"resource_group_name",
",",
"public_ip_address_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"public_ip_address_name",
",",
"parameters",
... | Creates or updates a static or dynamic public IP address.
@param resource_group_name [String] The name of the resource group.
@param public_ip_address_name [String] The name of the public IP address.
@param parameters [PublicIPAddress] Parameters supplied to the create or
update public IP address 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",
"static",
"or",
"dynamic",
"public",
"IP",
"address",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/public_ipaddresses.rb#L531-L533 | train | Creates or updates an existing public IP address. | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2270,
1035,
12997,
1035,
4769,
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... |
typhoeus/typhoeus | lib/typhoeus/expectation.rb | Typhoeus.Expectation.response | def response(request)
response = responses.fetch(@response_counter, responses.last)
if response.respond_to?(:call)
response = response.call(request)
end
@response_counter += 1
response.mock = @from || true
response
end | ruby | def response(request)
response = responses.fetch(@response_counter, responses.last)
if response.respond_to?(:call)
response = response.call(request)
end
@response_counter += 1
response.mock = @from || true
response
end | [
"def",
"response",
"(",
"request",
")",
"response",
"=",
"responses",
".",
"fetch",
"(",
"@response_counter",
",",
"responses",
".",
"last",
")",
"if",
"response",
".",
"respond_to?",
"(",
":call",
")",
"response",
"=",
"response",
".",
"call",
"(",
"reque... | Return the response. When there are
multiple responses, they are returned one
by one.
@example Return response.
expectation.response
@return [ Response ] The response.
@api private | [
"Return",
"the",
"response",
".",
"When",
"there",
"are",
"multiple",
"responses",
"they",
"are",
"returned",
"one",
"by",
"one",
"."
] | d072aaf6edcf46d54d6a6bce45286629bf4e5af6 | https://github.com/typhoeus/typhoeus/blob/d072aaf6edcf46d54d6a6bce45286629bf4e5af6/lib/typhoeus/expectation.rb#L180-L188 | train | Returns the response for the given request | [
30522,
13366,
3433,
1006,
5227,
1007,
3433,
1027,
10960,
1012,
18584,
1006,
1030,
3433,
1035,
4675,
1010,
10960,
1012,
2197,
1007,
2065,
3433,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
2655,
1007,
3433,
1027,
3433,
1012,
2655,
1006,
5227,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_cdn/lib/2015-06-01/generated/azure_mgmt_cdn/endpoints.rb | Azure::CDN::Mgmt::V2015_06_01.Endpoints.begin_purge_content_with_http_info | def begin_purge_content_with_http_info(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:nil)
begin_purge_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:custom_headers).value!
end | ruby | def begin_purge_content_with_http_info(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:nil)
begin_purge_content_async(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers:custom_headers).value!
end | [
"def",
"begin_purge_content_with_http_info",
"(",
"endpoint_name",
",",
"content_file_paths",
",",
"profile_name",
",",
"resource_group_name",
",",
"custom_headers",
":",
"nil",
")",
"begin_purge_content_async",
"(",
"endpoint_name",
",",
"content_file_paths",
",",
"profile... | Forcibly purges CDN endpoint content.
@param endpoint_name [String] Name of the endpoint within the CDN profile.
@param content_file_paths [PurgeParameters] The path to the content to be
purged. Path can describe a file or directory.
@param profile_name [String] Name of the CDN profile within the resource
group.
@param resource_group_name [String] Name of the resource group within the
Azure subscription.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Forcibly",
"purges",
"CDN",
"endpoint",
"content",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_cdn/lib/2015-06-01/generated/azure_mgmt_cdn/endpoints.rb#L1279-L1281 | train | Purges the content of the specified endpoint. | [
30522,
13366,
4088,
1035,
24694,
1035,
4180,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2203,
8400,
1035,
2171,
1010,
4180,
1035,
5371,
1035,
10425,
1010,
6337,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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.set_storage_account | def set_storage_account(vault_base_url, storage_account_name, resource_id, active_key_name, auto_regenerate_key, regeneration_period:nil, storage_account_attributes:nil, tags:nil, custom_headers:nil)
response = set_storage_account_async(vault_base_url, storage_account_name, resource_id, active_key_name, auto_regenerate_key, regeneration_period:regeneration_period, storage_account_attributes:storage_account_attributes, tags:tags, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def set_storage_account(vault_base_url, storage_account_name, resource_id, active_key_name, auto_regenerate_key, regeneration_period:nil, storage_account_attributes:nil, tags:nil, custom_headers:nil)
response = set_storage_account_async(vault_base_url, storage_account_name, resource_id, active_key_name, auto_regenerate_key, regeneration_period:regeneration_period, storage_account_attributes:storage_account_attributes, tags:tags, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"set_storage_account",
"(",
"vault_base_url",
",",
"storage_account_name",
",",
"resource_id",
",",
"active_key_name",
",",
"auto_regenerate_key",
",",
"regeneration_period",
":",
"nil",
",",
"storage_account_attributes",
":",
"nil",
",",
"tags",
":",
"nil",
",... | Creates or updates a new storage account. This operation requires the
storage/set 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 resource_id [String] Storage account resource id.
@param active_key_name [String] Current active storage account key name.
@param auto_regenerate_key [Boolean] whether keyvault should manage the
storage account for the user.
@param regeneration_period [String] The key regeneration time duration
specified in ISO-8601 format.
@param storage_account_attributes [StorageAccountAttributes] The attributes
of the storage account.
@param tags [Hash{String => String}] Application specific metadata in the
form of key-value pairs.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [StorageBundle] operation results. | [
"Creates",
"or",
"updates",
"a",
"new",
"storage",
"account",
".",
"This",
"operation",
"requires",
"the",
"storage",
"/",
"set",
"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#L7278-L7281 | train | Sets the storage account. | [
30522,
13366,
2275,
1035,
5527,
1035,
4070,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
5527,
1035,
4070,
1035,
2171,
1010,
7692,
1035,
8909,
1010,
3161,
1035,
3145,
1035,
2171,
1010,
8285,
1035,
19723,
24454,
3686,
1035,
3145,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_container_registry/lib/2017-06-01-preview/generated/azure_mgmt_container_registry/webhooks.rb | Azure::ContainerRegistry::Mgmt::V2017_06_01_preview.Webhooks.list_events_with_http_info | def list_events_with_http_info(resource_group_name, registry_name, webhook_name, custom_headers:nil)
list_events_async(resource_group_name, registry_name, webhook_name, custom_headers:custom_headers).value!
end | ruby | def list_events_with_http_info(resource_group_name, registry_name, webhook_name, custom_headers:nil)
list_events_async(resource_group_name, registry_name, webhook_name, custom_headers:custom_headers).value!
end | [
"def",
"list_events_with_http_info",
"(",
"resource_group_name",
",",
"registry_name",
",",
"webhook_name",
",",
"custom_headers",
":",
"nil",
")",
"list_events_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"webhook_name",
",",
"custom_headers",
":custom_... | Lists recent events for the specified 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. | [
"Lists",
"recent",
"events",
"for",
"the",
"specified",
"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#L608-L610 | train | Gets the list of events for the specified webhook. | [
30522,
13366,
2862,
1035,
2824,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
30524,
1035,
20346,
2015,
1024,
7661,
1035,
20346,
2015,
1007,
1012,
3643,
999,
2203,
102,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
watir/watir | lib/watir/wait.rb | Watir.Waitable.wait_until_present | def wait_until_present(depr_timeout = nil, timeout: nil, interval: nil, message: nil)
timeout = depr_timeout if depr_timeout
Watir.logger.deprecate "#{self.class}#wait_until_present",
"#{self.class}#wait_until(&:present?)",
ids: [:wait_until_present]
message ||= proc { |obj| "waiting for #{obj.inspect} to become present" }
wait_until(timeout: timeout, interval: interval, message: message, element_reset: true, &:present?)
end | ruby | def wait_until_present(depr_timeout = nil, timeout: nil, interval: nil, message: nil)
timeout = depr_timeout if depr_timeout
Watir.logger.deprecate "#{self.class}#wait_until_present",
"#{self.class}#wait_until(&:present?)",
ids: [:wait_until_present]
message ||= proc { |obj| "waiting for #{obj.inspect} to become present" }
wait_until(timeout: timeout, interval: interval, message: message, element_reset: true, &:present?)
end | [
"def",
"wait_until_present",
"(",
"depr_timeout",
"=",
"nil",
",",
"timeout",
":",
"nil",
",",
"interval",
":",
"nil",
",",
"message",
":",
"nil",
")",
"timeout",
"=",
"depr_timeout",
"if",
"depr_timeout",
"Watir",
".",
"logger",
".",
"deprecate",
"\"#{self.... | Waits until the element is present.
Element is always relocated, so this can be used in the case of an element going away and returning
@example
browser.text_field(name: "new_user_first_name").wait_until_present
@param [Integer] timeout seconds to wait before timing out
@param [Float] interval seconds to wait before each try
@param [String] message error message for when times out
@see Watir::Wait
@see Watir::Element#present? | [
"Waits",
"until",
"the",
"element",
"is",
"present",
".",
"Element",
"is",
"always",
"relocated",
"so",
"this",
"can",
"be",
"used",
"in",
"the",
"case",
"of",
"an",
"element",
"going",
"away",
"and",
"returning"
] | 2d8db09811c6221ae401b85b2f61f5fa66e463a3 | https://github.com/watir/watir/blob/2d8db09811c6221ae401b85b2f61f5fa66e463a3/lib/watir/wait.rb#L176-L184 | train | Wait until the element is present. | [
30522,
13366,
3524,
1035,
2127,
1035,
2556,
1006,
2139,
18098,
1035,
2051,
5833,
1027,
9152,
2140,
1010,
2051,
5833,
1024,
9152,
2140,
1010,
13483,
1024,
9152,
2140,
1010,
4471,
1024,
9152,
2140,
1007,
2051,
5833,
1027,
2139,
18098,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.cancel_operation | def cancel_operation(operation_id, force, timeout:60, custom_headers:nil)
response = cancel_operation_async(operation_id, force, timeout:timeout, custom_headers:custom_headers).value!
nil
end | ruby | def cancel_operation(operation_id, force, timeout:60, custom_headers:nil)
response = cancel_operation_async(operation_id, force, timeout:timeout, custom_headers:custom_headers).value!
nil
end | [
"def",
"cancel_operation",
"(",
"operation_id",
",",
"force",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"cancel_operation_async",
"(",
"operation_id",
",",
"force",
",",
"timeout",
":",
"timeout",
",",
"custom_headers",
... | Cancels a user-induced fault operation.
The following is a list of APIs that start fault operations that may be
cancelled using CancelOperation -
- StartDataLoss
- StartQuorumLoss
- StartPartitionRestart
- StartNodeTransition
If force is false, then the specified user-induced operation will be
gracefully stopped and cleaned up. If force is true, the command will be
aborted, and some internal state
may be left behind. Specifying force as true should be used with care.
Calling this API with force set to true is not allowed until this API has
already
been called on the same test command with force set to false first, or unless
the test command already has an OperationState of OperationState.RollingBack.
Clarification: OperationState.RollingBack means that the system will/is be
cleaning up internal system state caused by executing the command. It will
not restore data if the
test command was to cause data loss. For example, if you call StartDataLoss
then call this API, the system will only clean up internal state from running
the command.
It will not restore the target partition's data, if the command progressed
far enough to cause data loss.
Important note: if this API is invoked with force==true, internal state may
be left behind.
@param operation_id A GUID that identifies a call of this API. This is
passed into the corresponding GetProgress API
@param force [Boolean] Indicates whether to gracefully rollback and clean up
internal system state modified by executing the user-induced operation.
@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. | [
"Cancels",
"a",
"user",
"-",
"induced",
"fault",
"operation",
"."
] | 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#L22065-L22068 | train | Cancels an operation. | [
30522,
13366,
17542,
1035,
3169,
1006,
3169,
1035,
8909,
1010,
2486,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
17542,
1035,
3169,
1035,
2004,
6038,
2278,
1006,
3169,
1035,
8909,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.