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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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_regex_entity_role_with_http_info | def update_regex_entity_role_with_http_info(app_id, version_id, entity_id, role_id, entity_role_update_object, custom_headers:nil)
update_regex_entity_role_async(app_id, version_id, entity_id, role_id, entity_role_update_object, custom_headers:custom_headers).value!
end | ruby | def update_regex_entity_role_with_http_info(app_id, version_id, entity_id, role_id, entity_role_update_object, custom_headers:nil)
update_regex_entity_role_async(app_id, version_id, entity_id, role_id, entity_role_update_object, custom_headers:custom_headers).value!
end | [
"def",
"update_regex_entity_role_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"role_id",
",",
"entity_role_update_object",
",",
"custom_headers",
":",
"nil",
")",
"update_regex_entity_role_async",
"(",
"app_id",
",",
"version_id",
",",
"enti... | Update a role for a given regular expression entity in a version of the
application
@param app_id The application ID.
@param version_id [String] The version ID.
@param entity_id 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 [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Update",
"a",
"role",
"for",
"a",
"given",
"regular",
"expression",
"entity",
"in",
"a",
"version",
"of",
"the",
"application"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L9839-L9841 | train | Updates a regex entity role. | [
30522,
13366,
10651,
1035,
19723,
10288,
1035,
9178,
1035,
2535,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
9178,
1035,
8909,
1010,
2535,
1035,
8909,
1010,
9178,
1035,
2535,
1035,
10651,
1035... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_netapp/lib/2017-08-15-preview/generated/azure_mgmt_netapp/snapshots.rb | Azure::NetApp::Mgmt::V2017_08_15_preview.Snapshots.begin_create_with_http_info | def begin_create_with_http_info(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:nil)
begin_create_async(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:custom_headers).value!
end | ruby | def begin_create_with_http_info(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:nil)
begin_create_async(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:custom_headers).value!
end | [
"def",
"begin_create_with_http_info",
"(",
"body",
",",
"resource_group_name",
",",
"account_name",
",",
"pool_name",
",",
"volume_name",
",",
"snapshot_name",
",",
"custom_headers",
":",
"nil",
")",
"begin_create_async",
"(",
"body",
",",
"resource_group_name",
",",
... | Create a snapshot
@param body [Snapshot] Snapshot object supplied in the body of the operation.
@param resource_group_name [String] The name of the resource group.
@param account_name [String] The name of the NetApp account
@param pool_name [String] The name of the capacity pool
@param volume_name [String] The name of the volume
@param snapshot_name [String] The name of the mount target
@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",
"a",
"snapshot"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_netapp/lib/2017-08-15-preview/generated/azure_mgmt_netapp/snapshots.rb#L482-L484 | train | Creates a snapshot of a specified volume. | [
30522,
13366,
4088,
1035,
3443,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2303,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
4770,
1035,
2171,
1010,
3872,
1035,
2171,
1010,
20057,
12326,
1035,
2171,
1010,
7661,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jeremytregunna/ruby-trello | lib/trello/card.rb | Trello.Card.update! | def update!
@previously_changed = changes
# extract only new values to build payload
payload = Hash[changes.map { |key, values| [SYMBOL_TO_STRING[key.to_sym].to_sym, values[1]] }]
@changed_attributes.clear
client.put("/cards/#{id}", payload)
end | ruby | def update!
@previously_changed = changes
# extract only new values to build payload
payload = Hash[changes.map { |key, values| [SYMBOL_TO_STRING[key.to_sym].to_sym, values[1]] }]
@changed_attributes.clear
client.put("/cards/#{id}", payload)
end | [
"def",
"update!",
"@previously_changed",
"=",
"changes",
"# extract only new values to build payload",
"payload",
"=",
"Hash",
"[",
"changes",
".",
"map",
"{",
"|",
"key",
",",
"values",
"|",
"[",
"SYMBOL_TO_STRING",
"[",
"key",
".",
"to_sym",
"]",
".",
"to_sym"... | Update an existing record.
Warning: this updates all fields using values already in memory. If
an external resource has updated these fields, you should refresh!
this object before making your changes, and before updating the record.
@raise [Trello::Error] if the card could not be updated.
@return [String] The JSON representation of the updated card returned by
the Trello API. | [
"Update",
"an",
"existing",
"record",
"."
] | ad79c9d8152ad5395b3b61c43170908f1912bfb2 | https://github.com/jeremytregunna/ruby-trello/blob/ad79c9d8152ad5395b3b61c43170908f1912bfb2/lib/trello/card.rb#L276-L283 | train | Update the current card object | [
30522,
13366,
10651,
999,
1030,
3130,
1035,
2904,
1027,
3431,
1001,
14817,
2069,
2047,
5300,
2000,
3857,
18093,
18093,
1027,
23325,
1031,
3431,
1012,
4949,
1063,
1064,
3145,
1010,
5300,
1064,
1031,
6454,
1035,
2000,
1035,
5164,
1031,
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... |
realm/jazzy | lib/jazzy/podspec_documenter.rb | Jazzy.PodspecDocumenter.compiler_swift_version | def compiler_swift_version(user_version)
return LATEST_SWIFT_VERSION unless user_version
LONG_SWIFT_VERSIONS.select do |version|
user_version.start_with?(version)
end.last || "#{user_version[0]}.0"
end | ruby | def compiler_swift_version(user_version)
return LATEST_SWIFT_VERSION unless user_version
LONG_SWIFT_VERSIONS.select do |version|
user_version.start_with?(version)
end.last || "#{user_version[0]}.0"
end | [
"def",
"compiler_swift_version",
"(",
"user_version",
")",
"return",
"LATEST_SWIFT_VERSION",
"unless",
"user_version",
"LONG_SWIFT_VERSIONS",
".",
"select",
"do",
"|",
"version",
"|",
"user_version",
".",
"start_with?",
"(",
"version",
")",
"end",
".",
"last",
"||",... | Go from a full Swift version like 4.2.1 to
something valid for SWIFT_VERSION. | [
"Go",
"from",
"a",
"full",
"Swift",
"version",
"like",
"4",
".",
"2",
".",
"1",
"to",
"something",
"valid",
"for",
"SWIFT_VERSION",
"."
] | e8744dbdb78814b237e8d57a82d40953560e9143 | https://github.com/realm/jazzy/blob/e8744dbdb78814b237e8d57a82d40953560e9143/lib/jazzy/podspec_documenter.rb#L109-L115 | train | Returns the compiler swift version for the given user version. | [
30522,
13366,
21624,
1035,
9170,
1035,
2544,
1006,
5310,
1035,
2544,
1007,
2709,
6745,
1035,
9170,
1035,
2544,
4983,
5310,
1035,
2544,
2146,
1035,
9170,
1035,
4617,
1012,
7276,
2079,
1064,
2544,
1064,
5310,
1035,
2544,
1012,
2707,
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_batch/lib/2017-09-01/generated/azure_mgmt_batch/pool_operations.rb | Azure::Batch::Mgmt::V2017_09_01.PoolOperations.stop_resize_with_http_info | def stop_resize_with_http_info(resource_group_name, account_name, pool_name, custom_headers:nil)
stop_resize_async(resource_group_name, account_name, pool_name, custom_headers:custom_headers).value!
end | ruby | def stop_resize_with_http_info(resource_group_name, account_name, pool_name, custom_headers:nil)
stop_resize_async(resource_group_name, account_name, pool_name, custom_headers:custom_headers).value!
end | [
"def",
"stop_resize_with_http_info",
"(",
"resource_group_name",
",",
"account_name",
",",
"pool_name",
",",
"custom_headers",
":",
"nil",
")",
"stop_resize_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"pool_name",
",",
"custom_headers",
":custom_headers"... | Stops an ongoing resize operation on the pool.
This does not restore the pool to its previous state before the resize
operation: it only stops any further changes being made, and the pool
maintains its current state. After stopping, the pool stabilizes at the
number of nodes it was at when the stop operation was done. During the stop
operation, the pool allocation state changes first to stopping and then to
steady. A resize operation need not be an explicit resize pool request; this
API can also be used to halt the initial sizing of the pool when it is
created.
@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 pool_name [String] The pool name. This must be unique within the
account.
@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. | [
"Stops",
"an",
"ongoing",
"resize",
"operation",
"on",
"the",
"pool",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_batch/lib/2017-09-01/generated/azure_mgmt_batch/pool_operations.rb#L683-L685 | train | Stops resize of the specified pool. | [
30522,
13366,
2644,
1035,
24501,
4697,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
4770,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2644,
1035,
24501,
4697,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/sprockets | lib/sprockets/exporting.rb | Sprockets.Exporting.unregister_exporter | def unregister_exporter(mime_types, exporter = nil)
unless mime_types.is_a? Array
if mime_types.is_a? String
mime_types = [mime_types]
else # called with no mime type
exporter = mime_types
mime_types = nil
end
end
self.config = hash_reassoc(config, :exporters) do |_exporters|
_exporters.each do |mime_type, exporters_array|
next if mime_types && !mime_types.include?(mime_type)
if exporters_array.include? exporter
_exporters[mime_type] = exporters_array.dup.delete exporter
end
end
end
end | ruby | def unregister_exporter(mime_types, exporter = nil)
unless mime_types.is_a? Array
if mime_types.is_a? String
mime_types = [mime_types]
else # called with no mime type
exporter = mime_types
mime_types = nil
end
end
self.config = hash_reassoc(config, :exporters) do |_exporters|
_exporters.each do |mime_type, exporters_array|
next if mime_types && !mime_types.include?(mime_type)
if exporters_array.include? exporter
_exporters[mime_type] = exporters_array.dup.delete exporter
end
end
end
end | [
"def",
"unregister_exporter",
"(",
"mime_types",
",",
"exporter",
"=",
"nil",
")",
"unless",
"mime_types",
".",
"is_a?",
"Array",
"if",
"mime_types",
".",
"is_a?",
"String",
"mime_types",
"=",
"[",
"mime_types",
"]",
"else",
"# called with no mime type",
"exporter... | Public: Remove Exporting processor `klass` for `mime_type`.
environment.unregister_exporter '*/*', Sprockets::Exporters::Zlib
Can be called without a mime type
environment.unregister_exporter Sprockets::Exporters::Zlib
Does not remove any exporters that depend on `klass`. | [
"Public",
":",
"Remove",
"Exporting",
"processor",
"klass",
"for",
"mime_type",
"."
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/exporting.rb#L38-L56 | train | unregister an exporter from the config | [
30522,
13366,
4895,
2890,
24063,
2121,
1035,
9167,
2121,
1006,
2771,
4168,
1035,
4127,
1010,
9167,
2121,
1027,
9152,
2140,
1007,
4983,
2771,
4168,
1035,
4127,
1012,
2003,
1035,
1037,
1029,
9140,
2065,
2771,
4168,
1035,
4127,
1012,
2003,
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_recovery_services_site_recovery/lib/2018-01-10/generated/azure_mgmt_recovery_services_site_recovery/replication_protection_containers.rb | Azure::RecoveryServicesSiteRecovery::Mgmt::V2018_01_10.ReplicationProtectionContainers.begin_discover_protectable_item | def begin_discover_protectable_item(fabric_name, protection_container_name, discover_protectable_item_request, custom_headers:nil)
response = begin_discover_protectable_item_async(fabric_name, protection_container_name, discover_protectable_item_request, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_discover_protectable_item(fabric_name, protection_container_name, discover_protectable_item_request, custom_headers:nil)
response = begin_discover_protectable_item_async(fabric_name, protection_container_name, discover_protectable_item_request, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_discover_protectable_item",
"(",
"fabric_name",
",",
"protection_container_name",
",",
"discover_protectable_item_request",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_discover_protectable_item_async",
"(",
"fabric_name",
",",
"protection_conta... | Adds a protectable item to the replication protection container.
The operation to a add a protectable item to a protection container(Add
physical server.)
@param fabric_name [String] The name of the fabric.
@param protection_container_name [String] The name of the protection
container.
@param discover_protectable_item_request [DiscoverProtectableItemRequest] The
request object to add a protectable item.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ProtectionContainer] operation results. | [
"Adds",
"a",
"protectable",
"item",
"to",
"the",
"replication",
"protection",
"container",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_recovery_services_site_recovery/lib/2018-01-10/generated/azure_mgmt_recovery_services_site_recovery/replication_protection_containers.rb#L631-L634 | train | Discovers the protection container of the specified protection container. | [
30522,
13366,
4088,
1035,
7523,
1035,
4047,
3085,
1035,
8875,
1006,
8313,
1035,
2171,
1010,
3860,
1035,
11661,
1035,
2171,
1010,
7523,
1035,
4047,
3085,
1035,
8875,
1035,
5227,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ffaker/ffaker | lib/ffaker/ssn.rb | FFaker.SSN.ssn | def ssn
first_group = fetch_sample([*1..665, *667..899])
second_group = rand(1..99)
third_group = rand(1..9999)
group_numbers = [first_group, second_group, third_group]
result = format('%.3d-%.2d-%.4d', *group_numbers)
result
end | ruby | def ssn
first_group = fetch_sample([*1..665, *667..899])
second_group = rand(1..99)
third_group = rand(1..9999)
group_numbers = [first_group, second_group, third_group]
result = format('%.3d-%.2d-%.4d', *group_numbers)
result
end | [
"def",
"ssn",
"first_group",
"=",
"fetch_sample",
"(",
"[",
"1",
"..",
"665",
",",
"667",
"..",
"899",
"]",
")",
"second_group",
"=",
"rand",
"(",
"1",
"..",
"99",
")",
"third_group",
"=",
"rand",
"(",
"1",
"..",
"9999",
")",
"group_numbers",
"=",
... | The Social Security number is a nine-digit number in the format
"AAA-GG-SSSS". More info here:
http://en.wikipedia.org/wiki/Social_Security_number | [
"The",
"Social",
"Security",
"number",
"is",
"a",
"nine",
"-",
"digit",
"number",
"in",
"the",
"format",
"AAA",
"-",
"GG",
"-",
"SSSS",
".",
"More",
"info",
"here",
":"
] | 9570ac54874fec66a99b9c86401fb878f1e3e951 | https://github.com/ffaker/ffaker/blob/9570ac54874fec66a99b9c86401fb878f1e3e951/lib/ffaker/ssn.rb#L13-L22 | train | Returns the ssn_sequence for the given sample | [
30522,
13366,
7020,
2078,
2034,
1035,
2177,
1027,
18584,
1035,
7099,
1006,
1031,
1008,
1015,
1012,
1012,
5764,
2629,
1010,
1008,
5764,
2581,
1012,
1012,
6486,
2683,
1033,
1007,
2117,
1035,
2177,
1027,
14566,
1006,
1015,
1012,
1012,
5585,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.begin_delete | def begin_delete(resource_group_name, topic_name, custom_headers:nil)
response = begin_delete_async(resource_group_name, topic_name, custom_headers:custom_headers).value!
nil
end | ruby | def begin_delete(resource_group_name, topic_name, custom_headers:nil)
response = begin_delete_async(resource_group_name, topic_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_delete",
"(",
"resource_group_name",
",",
"topic_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_delete_async",
"(",
"resource_group_name",
",",
"topic_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"nil",
"... | Delete a topic
Delete existing topic
@param resource_group_name [String] The name of the resource group within the
user's subscription.
@param topic_name [String] Name of the topic
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Delete",
"a",
"topic"
] | 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#L913-L916 | train | Deletes a topic. | [
30522,
13366,
4088,
1035,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8476,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-rds/lib/aws-sdk-rds/db_security_group.rb | Aws::RDS.DBSecurityGroup.subscribe_to | def subscribe_to(options = {})
options = options.merge(source_identifier: @name)
resp = @client.add_source_identifier_to_subscription(options)
EventSubscription.new(
name: resp.data.event_subscription.cust_subscription_id,
data: resp.data.event_subscription,
client: @client
)
end | ruby | def subscribe_to(options = {})
options = options.merge(source_identifier: @name)
resp = @client.add_source_identifier_to_subscription(options)
EventSubscription.new(
name: resp.data.event_subscription.cust_subscription_id,
data: resp.data.event_subscription,
client: @client
)
end | [
"def",
"subscribe_to",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"source_identifier",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"add_source_identifier_to_subscription",
"(",
"options",
")",
"EventSubscription",
".",
... | @example Request syntax with placeholder values
eventsubscription = db_security_group.subscribe_to({
subscription_name: "String", # required
})
@param [Hash] options ({})
@option options [required, String] :subscription_name
The name of the RDS event notification subscription you want to add a
source identifier to.
@return [EventSubscription] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-rds/lib/aws-sdk-rds/db_security_group.rb#L334-L342 | train | Subscribe to the source identifier | [
30522,
13366,
4942,
29234,
1035,
2000,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
3120,
1035,
8909,
4765,
18095,
1024,
1030,
2171,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
5587,
1035,
3120,
1035,
8909,
4765,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_container_registry/lib/2018-02-01-preview/generated/azure_mgmt_container_registry/builds.rb | Azure::ContainerRegistry::Mgmt::V2018_02_01_preview.Builds.begin_cancel | def begin_cancel(resource_group_name, registry_name, build_id, custom_headers:nil)
response = begin_cancel_async(resource_group_name, registry_name, build_id, custom_headers:custom_headers).value!
nil
end | ruby | def begin_cancel(resource_group_name, registry_name, build_id, custom_headers:nil)
response = begin_cancel_async(resource_group_name, registry_name, build_id, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_cancel",
"(",
"resource_group_name",
",",
"registry_name",
",",
"build_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_cancel_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"build_id",
",",
"custom_headers",
":custom_... | Cancel an existing build.
@param resource_group_name [String] The name of the resource group to which
the container registry belongs.
@param registry_name [String] The name of the container registry.
@param build_id [String] The build ID.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Cancel",
"an",
"existing",
"build",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_registry/lib/2018-02-01-preview/generated/azure_mgmt_container_registry/builds.rb#L570-L573 | train | Cancels a build. | [
30522,
13366,
4088,
1035,
17542,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
3857,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
30524,
3857,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
gocardless/hutch | lib/hutch/worker.rb | Hutch.Worker.setup_queues | def setup_queues
logger.info 'setting up queues'
vetted = @consumers.reject { |c| group_configured? && group_restricted?(c) }
vetted.each do |c|
setup_queue(c)
end
end | ruby | def setup_queues
logger.info 'setting up queues'
vetted = @consumers.reject { |c| group_configured? && group_restricted?(c) }
vetted.each do |c|
setup_queue(c)
end
end | [
"def",
"setup_queues",
"logger",
".",
"info",
"'setting up queues'",
"vetted",
"=",
"@consumers",
".",
"reject",
"{",
"|",
"c",
"|",
"group_configured?",
"&&",
"group_restricted?",
"(",
"c",
")",
"}",
"vetted",
".",
"each",
"do",
"|",
"c",
"|",
"setup_queue"... | Set up the queues for each of the worker's consumers. | [
"Set",
"up",
"the",
"queues",
"for",
"each",
"of",
"the",
"worker",
"s",
"consumers",
"."
] | 9314b3b8c84abeb78170730757f3eb8ccc4f54c5 | https://github.com/gocardless/hutch/blob/9314b3b8c84abeb78170730757f3eb8ccc4f54c5/lib/hutch/worker.rb#L37-L43 | train | setup queues for all consumers | [
30522,
13366,
16437,
1035,
24240,
2015,
8833,
4590,
1012,
18558,
1005,
4292,
2039,
24240,
2015,
1005,
29525,
3064,
1027,
1030,
10390,
1012,
15454,
1063,
1064,
1039,
1064,
2177,
1035,
26928,
1029,
1004,
1004,
2177,
1035,
7775,
1029,
1006,
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... |
sensu/sensu | lib/sensu/utilities.rb | Sensu.Utilities.retry_until_true | def retry_until_true(wait=0.5, &block)
EM::Timer.new(wait) do
unless block.call
retry_until_true(wait, &block)
end
end
end | ruby | def retry_until_true(wait=0.5, &block)
EM::Timer.new(wait) do
unless block.call
retry_until_true(wait, &block)
end
end
end | [
"def",
"retry_until_true",
"(",
"wait",
"=",
"0.5",
",",
"&",
"block",
")",
"EM",
"::",
"Timer",
".",
"new",
"(",
"wait",
")",
"do",
"unless",
"block",
".",
"call",
"retry_until_true",
"(",
"wait",
",",
"block",
")",
"end",
"end",
"end"
] | Retry a code block until it retures true. The first attempt and
following retries are delayed.
@param wait [Numeric] time to delay block calls.
@param block [Proc] to call that needs to return true. | [
"Retry",
"a",
"code",
"block",
"until",
"it",
"retures",
"true",
".",
"The",
"first",
"attempt",
"and",
"following",
"retries",
"are",
"delayed",
"."
] | 51319e4b58c8d9986f101ad71ff729aa3e51e951 | https://github.com/sensu/sensu/blob/51319e4b58c8d9986f101ad71ff729aa3e51e951/lib/sensu/utilities.rb#L25-L31 | train | Tries to retry until the block returns true. | [
30522,
13366,
2128,
11129,
1035,
2127,
1035,
2995,
1006,
3524,
1027,
1014,
1012,
1019,
1010,
1004,
3796,
1007,
7861,
1024,
1024,
25309,
1012,
2047,
1006,
3524,
1007,
2079,
4983,
3796,
1012,
2655,
2128,
11129,
1035,
2127,
1035,
2995,
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... |
ai/autoprefixer-rails | lib/autoprefixer-rails/processor.rb | AutoprefixerRails.Processor.parse_config | def parse_config(config)
sections = {"defaults" => []}
current = "defaults"
config.gsub(/#[^\n]*/, "")
.split(/\n/)
.map(&:strip)
.reject(&:empty?)
.each do |line|
if IS_SECTION =~ line
current = line.match(IS_SECTION)[1].strip
sections[current] ||= []
else
sections[current] << line
end
end
sections
end | ruby | def parse_config(config)
sections = {"defaults" => []}
current = "defaults"
config.gsub(/#[^\n]*/, "")
.split(/\n/)
.map(&:strip)
.reject(&:empty?)
.each do |line|
if IS_SECTION =~ line
current = line.match(IS_SECTION)[1].strip
sections[current] ||= []
else
sections[current] << line
end
end
sections
end | [
"def",
"parse_config",
"(",
"config",
")",
"sections",
"=",
"{",
"\"defaults\"",
"=>",
"[",
"]",
"}",
"current",
"=",
"\"defaults\"",
"config",
".",
"gsub",
"(",
"/",
"\\n",
"/",
",",
"\"\"",
")",
".",
"split",
"(",
"/",
"\\n",
"/",
")",
".",
"map"... | Parse Browserslist config | [
"Parse",
"Browserslist",
"config"
] | 22543372b33c688c409b46adfef4d1763041961f | https://github.com/ai/autoprefixer-rails/blob/22543372b33c688c409b46adfef4d1763041961f/lib/autoprefixer-rails/processor.rb#L58-L74 | train | Parse the config file | [
30522,
13366,
11968,
3366,
1035,
9530,
8873,
2290,
1006,
9530,
8873,
2290,
1007,
5433,
1027,
1063,
1000,
12398,
2015,
1000,
1027,
1028,
1031,
1033,
1065,
2783,
1027,
1000,
12398,
2015,
1000,
9530,
8873,
2290,
1012,
28177,
12083,
1006,
1013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_api_management/lib/2018-01-01/generated/azure_mgmt_api_management/diagnostic.rb | Azure::ApiManagement::Mgmt::V2018_01_01.Diagnostic.get_entity_tag_with_http_info | def get_entity_tag_with_http_info(resource_group_name, service_name, diagnostic_id, custom_headers:nil)
get_entity_tag_async(resource_group_name, service_name, diagnostic_id, custom_headers:custom_headers).value!
end | ruby | def get_entity_tag_with_http_info(resource_group_name, service_name, diagnostic_id, custom_headers:nil)
get_entity_tag_async(resource_group_name, service_name, diagnostic_id, custom_headers:custom_headers).value!
end | [
"def",
"get_entity_tag_with_http_info",
"(",
"resource_group_name",
",",
"service_name",
",",
"diagnostic_id",
",",
"custom_headers",
":",
"nil",
")",
"get_entity_tag_async",
"(",
"resource_group_name",
",",
"service_name",
",",
"diagnostic_id",
",",
"custom_headers",
":c... | Gets the entity state (Etag) version of the Diagnostic 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 diagnostic_id [String] Diagnostic identifier. Must be unique in the
current API Management service instance.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"entity",
"state",
"(",
"Etag",
")",
"version",
"of",
"the",
"Diagnostic",
"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/diagnostic.rb#L169-L171 | train | Gets the entity tag for the specified diagnostic. | [
30522,
13366,
2131,
1035,
9178,
1035,
6415,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
16474,
1035,
30524,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
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... |
seejohnrun/ice_cube | lib/ice_cube/validations/fixed_value.rb | IceCube.Validations::FixedValue.validate_hour_lock | def validate_hour_lock(time, start_time)
h0 = starting_unit(start_time)
h1 = time.hour
if h0 >= h1
h0 - h1
else
if dst_offset = TimeUtil.dst_change(time)
h0 - h1 + dst_offset
else
24 - h1 + h0
end
end
end | ruby | def validate_hour_lock(time, start_time)
h0 = starting_unit(start_time)
h1 = time.hour
if h0 >= h1
h0 - h1
else
if dst_offset = TimeUtil.dst_change(time)
h0 - h1 + dst_offset
else
24 - h1 + h0
end
end
end | [
"def",
"validate_hour_lock",
"(",
"time",
",",
"start_time",
")",
"h0",
"=",
"starting_unit",
"(",
"start_time",
")",
"h1",
"=",
"time",
".",
"hour",
"if",
"h0",
">=",
"h1",
"h0",
"-",
"h1",
"else",
"if",
"dst_offset",
"=",
"TimeUtil",
".",
"dst_change",... | Lock the hour if explicitly set by hour_of_day, but allow for the nearest
hour during DST start to keep the correct interval. | [
"Lock",
"the",
"hour",
"if",
"explicitly",
"set",
"by",
"hour_of_day",
"but",
"allow",
"for",
"the",
"nearest",
"hour",
"during",
"DST",
"start",
"to",
"keep",
"the",
"correct",
"interval",
"."
] | fb6c657bdc4f87dfda2bf83f15c5f487b78ccabd | https://github.com/seejohnrun/ice_cube/blob/fb6c657bdc4f87dfda2bf83f15c5f487b78ccabd/lib/ice_cube/validations/fixed_value.rb#L37-L49 | train | Validate the hour lock | [
30522,
13366,
9398,
3686,
1035,
3178,
1035,
5843,
1006,
2051,
1010,
2707,
1035,
2051,
1007,
1044,
2692,
1027,
3225,
1035,
3131,
1006,
2707,
1035,
2051,
1007,
1044,
2487,
1027,
2051,
1012,
3178,
2065,
1044,
2692,
1028,
1027,
1044,
2487,
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... |
sds/overcommit | lib/overcommit/git_repo.rb | Overcommit.GitRepo.branches_containing_commit | def branches_containing_commit(commit_ref)
`git branch --column=dense --contains #{commit_ref}`.
sub(/\((HEAD )?detached (from|at) .*?\)/, ''). # ignore detached HEAD
split(/\s+/).
reject { |s| s.empty? || s == '*' }
end | ruby | def branches_containing_commit(commit_ref)
`git branch --column=dense --contains #{commit_ref}`.
sub(/\((HEAD )?detached (from|at) .*?\)/, ''). # ignore detached HEAD
split(/\s+/).
reject { |s| s.empty? || s == '*' }
end | [
"def",
"branches_containing_commit",
"(",
"commit_ref",
")",
"`",
"#{",
"commit_ref",
"}",
"`",
".",
"sub",
"(",
"/",
"\\(",
"\\)",
"/",
",",
"''",
")",
".",
"# ignore detached HEAD",
"split",
"(",
"/",
"\\s",
"/",
")",
".",
"reject",
"{",
"|",
"s",
... | Returns the names of all branches containing the given commit.
@param commit_ref [String] git tree ref that resolves to a commit
@return [Array<String>] list of branches containing the given commit | [
"Returns",
"the",
"names",
"of",
"all",
"branches",
"containing",
"the",
"given",
"commit",
"."
] | 35d60adb41da942178b789560968e3ad030b0ac7 | https://github.com/sds/overcommit/blob/35d60adb41da942178b789560968e3ad030b0ac7/lib/overcommit/git_repo.rb#L266-L271 | train | Return the branch containing the commit ref. | [
30522,
13366,
5628,
1035,
4820,
1035,
10797,
1006,
10797,
1035,
25416,
1007,
1036,
21025,
2102,
3589,
1011,
1011,
5930,
1027,
9742,
1011,
1011,
3397,
1001,
1063,
10797,
1035,
25416,
1065,
1036,
1012,
4942,
1006,
1013,
1032,
1006,
1006,
2132... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.update_service_with_http_info | def update_service_with_http_info(service_id, service_update_description, timeout:60, custom_headers:nil)
update_service_async(service_id, service_update_description, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def update_service_with_http_info(service_id, service_update_description, timeout:60, custom_headers:nil)
update_service_async(service_id, service_update_description, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"update_service_with_http_info",
"(",
"service_id",
",",
"service_update_description",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"update_service_async",
"(",
"service_id",
",",
"service_update_description",
",",
"timeout",
":",
"timeout",... | Updates a Service Fabric service using the specified update description.
This API allows updating properties of a running Service Fabric service. The
set of properties that can be updated are a subset of the properties that
were specified at the time of creating the service. The current set of
properties can be obtained using `GetServiceDescription` API. Please note
that updating the properties of a running service is different than upgrading
your application using `StartApplicationUpgrade` API. The upgrade is a long
running background operation that involves moving the application from one
version to another, one upgrade domain at a time, whereas update applies the
new properties immediately to the service.
@param service_id [String] The identity of the service. This is typically the
full name of the service without the 'fabric:' URI scheme.
Starting from version 6.0, hierarchical names are delimited with the "~"
character.
For example, if the service name is "fabric:/myapp/app1/svc1", the service
identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
versions.
@param service_update_description [ServiceUpdateDescription] The information
necessary to update a service.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Updates",
"a",
"Service",
"Fabric",
"service",
"using",
"the",
"specified",
"update",
"description",
"."
] | 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#L10584-L10586 | train | Updates a service. | [
30522,
13366,
10651,
1035,
2326,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2326,
1035,
8909,
1010,
2326,
1035,
10651,
1035,
6412,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
10651,
1035,
2326,
1035,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.get_deployed_service_type_info_by_name_with_http_info | def get_deployed_service_type_info_by_name_with_http_info(node_name, application_id, service_type_name, service_manifest_name:nil, timeout:60, custom_headers:nil)
get_deployed_service_type_info_by_name_async(node_name, application_id, service_type_name, service_manifest_name:service_manifest_name, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def get_deployed_service_type_info_by_name_with_http_info(node_name, application_id, service_type_name, service_manifest_name:nil, timeout:60, custom_headers:nil)
get_deployed_service_type_info_by_name_async(node_name, application_id, service_type_name, service_manifest_name:service_manifest_name, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"get_deployed_service_type_info_by_name_with_http_info",
"(",
"node_name",
",",
"application_id",
",",
"service_type_name",
",",
"service_manifest_name",
":",
"nil",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"get_deployed_service_type_info_by... | Gets the information about a specified service type of the application
deployed on a node in a Service Fabric cluster.
Gets the list containing the information about a specific service type from
the applications deployed on a node in a Service Fabric cluster. The response
includes the name of the service type, its registration status, the code
package that registered it and activation ID of the service package. Each
entry represents one activation of a service type, differentiated by the
activation ID.
@param node_name [String] The name of the node.
@param application_id [String] The identity of the application. This is
typically the full name of the application without the 'fabric:' URI scheme.
Starting from version 6.0, hierarchical names are delimited with the "~"
character.
For example, if the application name is "fabric:/myapp/app1", the application
identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
@param service_type_name [String] Specifies the name of a Service Fabric
service type.
@param service_manifest_name [String] The name of the service manifest to
filter the list of deployed service type information. If specified, the
response will only contain the information about service types that are
defined in this service manifest.
@param timeout [Integer] The server timeout for performing the operation in
seconds. This timeout specifies the time duration that the client is willing
to wait for the requested operation to complete. The default value for this
parameter is 60 seconds.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"information",
"about",
"a",
"specified",
"service",
"type",
"of",
"the",
"application",
"deployed",
"on",
"a",
"node",
"in",
"a",
"Service",
"Fabric",
"cluster",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L5939-L5941 | train | Gets the deployment information for a service type. | [
30522,
13366,
2131,
1035,
7333,
30524,
2171,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
13045,
1035,
2171,
1010,
4646,
1035,
8909,
1010,
2326,
1035,
2828,
1035,
2171,
1010,
2326,
1035,
19676,
1035,
2171,
1024,
9152,
2140,
1010,
2051,
5833,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_netapp/lib/2017-08-15-preview/generated/azure_mgmt_netapp/snapshots.rb | Azure::NetApp::Mgmt::V2017_08_15_preview.Snapshots.begin_create | def begin_create(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:nil)
response = begin_create_async(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_create(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:nil)
response = begin_create_async(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_create",
"(",
"body",
",",
"resource_group_name",
",",
"account_name",
",",
"pool_name",
",",
"volume_name",
",",
"snapshot_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_create_async",
"(",
"body",
",",
"resource_group_name",
... | Create a snapshot
@param body [Snapshot] Snapshot object supplied in the body of the operation.
@param resource_group_name [String] The name of the resource group.
@param account_name [String] The name of the NetApp account
@param pool_name [String] The name of the capacity pool
@param volume_name [String] The name of the volume
@param snapshot_name [String] The name of the mount target
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Snapshot] operation results. | [
"Create",
"a",
"snapshot"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_netapp/lib/2017-08-15-preview/generated/azure_mgmt_netapp/snapshots.rb#L463-L466 | train | Creates a snapshot of a specified volume. | [
30522,
13366,
4088,
1035,
3443,
1006,
2303,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
4770,
1035,
2171,
1010,
3872,
1035,
2171,
1010,
20057,
12326,
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... |
awesome-print/awesome_print | lib/awesome_print/formatter.rb | AwesomePrint.Formatter.awesome_self | def awesome_self(object, type)
if @options[:raw] && object.instance_variables.any?
awesome_object(object)
elsif (hash = convert_to_hash(object))
awesome_hash(hash)
else
awesome_simple(object.inspect.to_s, type, @inspector)
end
end | ruby | def awesome_self(object, type)
if @options[:raw] && object.instance_variables.any?
awesome_object(object)
elsif (hash = convert_to_hash(object))
awesome_hash(hash)
else
awesome_simple(object.inspect.to_s, type, @inspector)
end
end | [
"def",
"awesome_self",
"(",
"object",
",",
"type",
")",
"if",
"@options",
"[",
":raw",
"]",
"&&",
"object",
".",
"instance_variables",
".",
"any?",
"awesome_object",
"(",
"object",
")",
"elsif",
"(",
"hash",
"=",
"convert_to_hash",
"(",
"object",
")",
")",... | Catch all method to format an arbitrary object.
------------------------------------------------------------------------------ | [
"Catch",
"all",
"method",
"to",
"format",
"an",
"arbitrary",
"object",
".",
"------------------------------------------------------------------------------"
] | 4564fd74721562cbef2443f7d97109bf9192343d | https://github.com/awesome-print/awesome_print/blob/4564fd74721562cbef2443f7d97109bf9192343d/lib/awesome_print/formatter.rb#L44-L52 | train | awesome_self | [
30522,
13366,
12476,
1035,
2969,
1006,
4874,
1010,
2828,
1007,
2065,
1030,
7047,
1031,
1024,
6315,
1033,
1004,
1004,
4874,
1012,
6013,
1035,
10857,
1012,
2151,
1029,
12476,
1035,
4874,
1006,
4874,
1007,
3449,
5332,
2546,
1006,
23325,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/application_gateways.rb | Azure::Network::Mgmt::V2019_02_01.ApplicationGateways.list_available_server_variables | def list_available_server_variables(custom_headers:nil)
response = list_available_server_variables_async(custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_available_server_variables(custom_headers:nil)
response = list_available_server_variables_async(custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_available_server_variables",
"(",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_available_server_variables_async",
"(",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"response",
".",
"nil?",
"end"
] | Lists all available server variables.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array] operation results. | [
"Lists",
"all",
"available",
"server",
"variables",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/application_gateways.rb#L600-L603 | train | Gets all available server variables. | [
30522,
13366,
2862,
1035,
2800,
1035,
8241,
1035,
10857,
1006,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2800,
1035,
8241,
1035,
10857,
1035,
2004,
6038,
2278,
1006,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/scss-lint | lib/scss_lint/linter/trailing_semicolon.rb | SCSSLint.Linter::TrailingSemicolon.semicolon_after_parenthesis? | def semicolon_after_parenthesis?(node)
last_char = character_at(node.source_range.end_pos)
char_after = character_at(node.source_range.end_pos, 1)
(last_char == ')' && char_after == ';') ||
([last_char, char_after].include?("\n") &&
engine.lines[node.source_range.end_pos.line] =~ /\);(\s*})?$/)
end | ruby | def semicolon_after_parenthesis?(node)
last_char = character_at(node.source_range.end_pos)
char_after = character_at(node.source_range.end_pos, 1)
(last_char == ')' && char_after == ';') ||
([last_char, char_after].include?("\n") &&
engine.lines[node.source_range.end_pos.line] =~ /\);(\s*})?$/)
end | [
"def",
"semicolon_after_parenthesis?",
"(",
"node",
")",
"last_char",
"=",
"character_at",
"(",
"node",
".",
"source_range",
".",
"end_pos",
")",
"char_after",
"=",
"character_at",
"(",
"node",
".",
"source_range",
".",
"end_pos",
",",
"1",
")",
"(",
"last_cha... | Special case: Sass doesn't include the semicolon after an expression
in the source range it reports, so we need a helper to check after the
reported range. | [
"Special",
"case",
":",
"Sass",
"doesn",
"t",
"include",
"the",
"semicolon",
"after",
"an",
"expression",
"in",
"the",
"source",
"range",
"it",
"reports",
"so",
"we",
"need",
"a",
"helper",
"to",
"check",
"after",
"the",
"reported",
"range",
"."
] | e99afe4ede041a431a06e585c12ce82f6ad50116 | https://github.com/sds/scss-lint/blob/e99afe4ede041a431a06e585c12ce82f6ad50116/lib/scss_lint/linter/trailing_semicolon.rb#L79-L85 | train | Returns true if the given node is a semicolon after the parenthesis. | [
30522,
13366,
4100,
25778,
2239,
1035,
2044,
1035,
6687,
24124,
1029,
1006,
13045,
1007,
2197,
1035,
25869,
1027,
2839,
1035,
2012,
1006,
13045,
1012,
3120,
1035,
2846,
1012,
2203,
1035,
13433,
2015,
1007,
25869,
1035,
2044,
1027,
2839,
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_network/lib/2018-12-01/generated/azure_mgmt_network/virtual_network_peerings.rb | Azure::Network::Mgmt::V2018_12_01.VirtualNetworkPeerings.begin_create_or_update_with_http_info | def begin_create_or_update_with_http_info(resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers:custom_headers).value!
end | ruby | def begin_create_or_update_with_http_info(resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, virtual_network_name, virtual_network_peering_name, virtual_network_peering_parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_create_or_update_with_http_info",
"(",
"resource_group_name",
",",
"virtual_network_name",
",",
"virtual_network_peering_name",
",",
"virtual_network_peering_parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_create_or_update_async",
"(",
"resource_group_name... | Creates or updates a peering in the specified virtual network.
@param resource_group_name [String] The name of the resource group.
@param virtual_network_name [String] The name of the virtual network.
@param virtual_network_peering_name [String] The name of the peering.
@param virtual_network_peering_parameters [VirtualNetworkPeering] Parameters
supplied to the create or update virtual network peering 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",
"peering",
"in",
"the",
"specified",
"virtual",
"network",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-12-01/generated/azure_mgmt_network/virtual_network_peerings.rb#L424-L426 | train | Creates or updates a virtual network. | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7484,
1035,
2897,
1035,
2171,
1010,
7484,
1035,
2897,
1035,
16740,
1035,
2171,
1010,
7484,
1035,
2897,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mongodb/mongoid | lib/mongoid/atomic.rb | Mongoid.Atomic.add_atomic_unset | def add_atomic_unset(document)
document.flagged_for_destroy = true
(delayed_atomic_unsets[document.association_name.to_s] ||= []).push(document)
end | ruby | def add_atomic_unset(document)
document.flagged_for_destroy = true
(delayed_atomic_unsets[document.association_name.to_s] ||= []).push(document)
end | [
"def",
"add_atomic_unset",
"(",
"document",
")",
"document",
".",
"flagged_for_destroy",
"=",
"true",
"(",
"delayed_atomic_unsets",
"[",
"document",
".",
"association_name",
".",
"to_s",
"]",
"||=",
"[",
"]",
")",
".",
"push",
"(",
"document",
")",
"end"
] | Add an atomic unset for the document.
@example Add an atomic unset.
document.add_atomic_unset(doc)
@param [ Document ] document The child document.
@return [ Array<Document> ] The children.
@since 3.0.0 | [
"Add",
"an",
"atomic",
"unset",
"for",
"the",
"document",
"."
] | 56976e32610f4c2450882b0bfe14da099f0703f4 | https://github.com/mongodb/mongoid/blob/56976e32610f4c2450882b0bfe14da099f0703f4/lib/mongoid/atomic.rb#L53-L56 | train | Add a document to the delayed atomic unset list | [
30522,
13366,
5587,
1035,
9593,
1035,
4895,
13462,
1006,
6254,
1007,
6254,
1012,
5210,
5999,
1035,
2005,
1035,
6033,
1027,
2995,
1006,
8394,
1035,
9593,
1035,
4895,
13462,
2015,
1031,
6254,
1012,
2523,
1035,
2171,
1012,
2000,
1035,
1055,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/inventory_api.rb | SquareConnect.InventoryApi.retrieve_inventory_physical_count | def retrieve_inventory_physical_count(physical_count_id, opts = {})
data, _status_code, _headers = retrieve_inventory_physical_count_with_http_info(physical_count_id, opts)
return data
end | ruby | def retrieve_inventory_physical_count(physical_count_id, opts = {})
data, _status_code, _headers = retrieve_inventory_physical_count_with_http_info(physical_count_id, opts)
return data
end | [
"def",
"retrieve_inventory_physical_count",
"(",
"physical_count_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"retrieve_inventory_physical_count_with_http_info",
"(",
"physical_count_id",
",",
"opts",
")",
"return",
"data",
... | RetrieveInventoryPhysicalCount
Returns the [InventoryPhysicalCount](#type-inventoryphysicalcount) object with the provided `physical_count_id`.
@param physical_count_id ID of the [InventoryPhysicalCount](#type-inventoryphysicalcount) to retrieve.
@param [Hash] opts the optional parameters
@return [RetrieveInventoryPhysicalCountResponse] | [
"RetrieveInventoryPhysicalCount",
"Returns",
"the",
"[",
"InventoryPhysicalCount",
"]",
"(",
"#type",
"-",
"inventoryphysicalcount",
")",
"object",
"with",
"the",
"provided",
"physical_count_id",
"."
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/inventory_api.rb#L367-L370 | train | RetrieveInventoryPhysicalCount Returns the number of inventory physical elements in the inventory. | [
30522,
13366,
12850,
1035,
12612,
1035,
3558,
1035,
4175,
1006,
3558,
1035,
4175,
1035,
8909,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
12850,
1035,
12612,
1035,
3558,
1035... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
piotrmurach/tty-prompt | lib/tty/prompt.rb | TTY.Prompt.yes? | def yes?(message, *args, &block)
defaults = { default: true }
options = Utils.extract_options!(args)
options.merge!(defaults.reject { |k, _| options.key?(k) })
question = ConfirmQuestion.new(self, options)
question.call(message, &block)
end | ruby | def yes?(message, *args, &block)
defaults = { default: true }
options = Utils.extract_options!(args)
options.merge!(defaults.reject { |k, _| options.key?(k) })
question = ConfirmQuestion.new(self, options)
question.call(message, &block)
end | [
"def",
"yes?",
"(",
"message",
",",
"*",
"args",
",",
"&",
"block",
")",
"defaults",
"=",
"{",
"default",
":",
"true",
"}",
"options",
"=",
"Utils",
".",
"extract_options!",
"(",
"args",
")",
"options",
".",
"merge!",
"(",
"defaults",
".",
"reject",
... | A shortcut method to ask the user positive question and return
true for 'yes' reply, false for 'no'.
@example
prompt = TTY::Prompt.new
prompt.yes?('Are you human?')
# => Are you human? (Y/n)
@return [Boolean]
@api public | [
"A",
"shortcut",
"method",
"to",
"ask",
"the",
"user",
"positive",
"question",
"and",
"return",
"true",
"for",
"yes",
"reply",
"false",
"for",
"no",
"."
] | b1ff627afff98fa6477e5ef3ac4a718c52eff05a | https://github.com/piotrmurach/tty-prompt/blob/b1ff627afff98fa6477e5ef3ac4a718c52eff05a/lib/tty/prompt.rb#L329-L336 | train | Returns a boolean indicating whether the user has a confirmation. | [
30522,
13366,
2748,
1029,
1006,
4471,
1010,
1008,
12098,
5620,
1010,
1004,
3796,
1007,
12398,
2015,
1027,
1063,
12398,
1024,
2995,
1065,
7047,
1027,
21183,
12146,
1012,
14817,
1035,
7047,
999,
1006,
12098,
5620,
1007,
7047,
1012,
13590,
999... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_service_bus/lib/2017-04-01/generated/azure_mgmt_service_bus/rules.rb | Azure::ServiceBus::Mgmt::V2017_04_01.Rules.get_with_http_info | def get_with_http_info(resource_group_name, namespace_name, topic_name, subscription_name, rule_name, custom_headers:nil)
get_async(resource_group_name, namespace_name, topic_name, subscription_name, rule_name, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, namespace_name, topic_name, subscription_name, rule_name, custom_headers:nil)
get_async(resource_group_name, namespace_name, topic_name, subscription_name, rule_name, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"topic_name",
",",
"subscription_name",
",",
"rule_name",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"topic_name",
",... | Retrieves the description for the specified rule.
@param resource_group_name [String] Name of the Resource group within the
Azure subscription.
@param namespace_name [String] The namespace name
@param topic_name [String] The topic name.
@param subscription_name [String] The subscription name.
@param rule_name [String] The rule name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Retrieves",
"the",
"description",
"for",
"the",
"specified",
"rule",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_service_bus/lib/2017-04-01/generated/azure_mgmt_service_bus/rules.rb#L421-L423 | train | Gets the specified rule. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3415,
15327,
1035,
2171,
1010,
8476,
1035,
2171,
1010,
15002,
1035,
2171,
1010,
3627,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/ddos_custom_policies.rb | Azure::Network::Mgmt::V2019_02_01.DdosCustomPolicies.begin_update_tags_with_http_info | def begin_update_tags_with_http_info(resource_group_name, ddos_custom_policy_name, parameters, custom_headers:nil)
begin_update_tags_async(resource_group_name, ddos_custom_policy_name, parameters, custom_headers:custom_headers).value!
end | ruby | def begin_update_tags_with_http_info(resource_group_name, ddos_custom_policy_name, parameters, custom_headers:nil)
begin_update_tags_async(resource_group_name, ddos_custom_policy_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_update_tags_with_http_info",
"(",
"resource_group_name",
",",
"ddos_custom_policy_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_update_tags_async",
"(",
"resource_group_name",
",",
"ddos_custom_policy_name",
",",
"parameters",
",",
"... | Update a DDoS custom policy tags
@param resource_group_name [String] The name of the resource group.
@param ddos_custom_policy_name [String] The name of the DDoS custom policy.
@param parameters [TagsObject] Parameters supplied to the update DDoS custom
policy resource tags.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Update",
"a",
"DDoS",
"custom",
"policy",
"tags"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/ddos_custom_policies.rb#L472-L474 | train | Updates a DDoS custom policy tags. | [
30522,
13366,
4088,
1035,
10651,
1035,
22073,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
20315,
2891,
1035,
7661,
1035,
3343,
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... |
ruby2d/ruby2d | lib/ruby2d/triangle.rb | Ruby2D.Triangle.contains? | def contains?(x, y)
self_area = triangle_area(@x1, @y1, @x2, @y2, @x3, @y3)
questioned_area =
triangle_area(@x1, @y1, @x2, @y2, x, y) +
triangle_area(@x2, @y2, @x3, @y3, x, y) +
triangle_area(@x3, @y3, @x1, @y1, x, y)
questioned_area <= self_area
end | ruby | def contains?(x, y)
self_area = triangle_area(@x1, @y1, @x2, @y2, @x3, @y3)
questioned_area =
triangle_area(@x1, @y1, @x2, @y2, x, y) +
triangle_area(@x2, @y2, @x3, @y3, x, y) +
triangle_area(@x3, @y3, @x1, @y1, x, y)
questioned_area <= self_area
end | [
"def",
"contains?",
"(",
"x",
",",
"y",
")",
"self_area",
"=",
"triangle_area",
"(",
"@x1",
",",
"@y1",
",",
"@x2",
",",
"@y2",
",",
"@x3",
",",
"@y3",
")",
"questioned_area",
"=",
"triangle_area",
"(",
"@x1",
",",
"@y1",
",",
"@x2",
",",
"@y2",
",... | A point is inside a triangle if the area of 3 triangles, constructed from
triangle sides and the given point, is equal to the area of triangle. | [
"A",
"point",
"is",
"inside",
"a",
"triangle",
"if",
"the",
"area",
"of",
"3",
"triangles",
"constructed",
"from",
"triangle",
"sides",
"and",
"the",
"given",
"point",
"is",
"equal",
"to",
"the",
"area",
"of",
"triangle",
"."
] | 43ce9805a7ae8b82b7ab8c50bf6d4c845d395dc4 | https://github.com/ruby2d/ruby2d/blob/43ce9805a7ae8b82b7ab8c50bf6d4c845d395dc4/lib/ruby2d/triangle.rb#L31-L39 | train | Returns true if the triangle contains the given point. | [
30522,
13366,
3397,
1029,
1006,
1060,
1010,
1061,
1007,
2969,
1035,
2181,
1027,
9546,
1035,
2181,
1006,
1030,
1060,
2487,
1010,
1030,
1061,
2487,
1010,
1030,
1060,
2475,
1010,
1030,
1061,
2475,
1010,
1030,
1060,
2509,
1010,
1030,
1061,
25... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
meew0/discordrb | lib/discordrb/bot.rb | Discordrb.Bot.update_voice_server | def update_voice_server(data)
server_id = data['guild_id'].to_i
channel = @should_connect_to_voice[server_id]
debug("Voice server update received! chan: #{channel.inspect}")
return unless channel
@should_connect_to_voice.delete(server_id)
debug('Updating voice server!')
token = data['token']
endpoint = data['endpoint']
unless endpoint
debug('VOICE_SERVER_UPDATE sent with nil endpoint! Ignoring')
return
end
debug('Got data, now creating the bot.')
@voices[server_id] = Discordrb::Voice::VoiceBot.new(channel, self, token, @session_id, endpoint, @should_encrypt_voice)
end | ruby | def update_voice_server(data)
server_id = data['guild_id'].to_i
channel = @should_connect_to_voice[server_id]
debug("Voice server update received! chan: #{channel.inspect}")
return unless channel
@should_connect_to_voice.delete(server_id)
debug('Updating voice server!')
token = data['token']
endpoint = data['endpoint']
unless endpoint
debug('VOICE_SERVER_UPDATE sent with nil endpoint! Ignoring')
return
end
debug('Got data, now creating the bot.')
@voices[server_id] = Discordrb::Voice::VoiceBot.new(channel, self, token, @session_id, endpoint, @should_encrypt_voice)
end | [
"def",
"update_voice_server",
"(",
"data",
")",
"server_id",
"=",
"data",
"[",
"'guild_id'",
"]",
".",
"to_i",
"channel",
"=",
"@should_connect_to_voice",
"[",
"server_id",
"]",
"debug",
"(",
"\"Voice server update received! chan: #{channel.inspect}\"",
")",
"return",
... | Internal handler for VOICE_SERVER_UPDATE | [
"Internal",
"handler",
"for",
"VOICE_SERVER_UPDATE"
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/bot.rb#L780-L800 | train | Updates the voice server | [
30522,
13366,
10651,
1035,
2376,
1035,
8241,
1006,
2951,
1007,
8241,
1035,
8909,
1027,
2951,
1031,
1005,
9054,
1035,
8909,
1005,
1033,
1012,
2000,
1035,
1045,
3149,
1027,
1030,
2323,
1035,
7532,
1035,
2000,
1035,
2376,
1031,
8241,
1035,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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.change_vnet | def change_vnet(resource_group_name, name, vnet_info, custom_headers:nil)
first_page = change_vnet_as_lazy(resource_group_name, name, vnet_info, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def change_vnet(resource_group_name, name, vnet_info, custom_headers:nil)
first_page = change_vnet_as_lazy(resource_group_name, name, vnet_info, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"change_vnet",
"(",
"resource_group_name",
",",
"name",
",",
"vnet_info",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"change_vnet_as_lazy",
"(",
"resource_group_name",
",",
"name",
",",
"vnet_info",
",",
"custom_headers",
":custom_headers",
")... | Move an App Service Environment to a different VNET.
Move an App Service Environment to a different VNET.
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param name [String] Name of the App Service Environment.
@param vnet_info [VirtualNetworkProfile] Details for the new virtual network.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<Site>] operation results. | [
"Move",
"an",
"App",
"Service",
"Environment",
"to",
"a",
"different",
"VNET",
"."
] | 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#L796-L799 | train | Changes the virtual network. | [
30522,
13366,
2689,
1035,
1058,
7159,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
1058,
7159,
1035,
18558,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2689,
1035,
1058,
7159,
1035,
2004,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
devise-security/devise-security | lib/devise-security/models/password_expirable.rb | Devise::Models.PasswordExpirable.password_too_old? | def password_too_old?
return false if new_record?
return false unless password_expiration_enabled?
return false if expire_password_on_demand?
password_changed_at < expire_password_after.seconds.ago
end | ruby | def password_too_old?
return false if new_record?
return false unless password_expiration_enabled?
return false if expire_password_on_demand?
password_changed_at < expire_password_after.seconds.ago
end | [
"def",
"password_too_old?",
"return",
"false",
"if",
"new_record?",
"return",
"false",
"unless",
"password_expiration_enabled?",
"return",
"false",
"if",
"expire_password_on_demand?",
"password_changed_at",
"<",
"expire_password_after",
".",
"seconds",
".",
"ago",
"end"
] | Is this password older than the configured expiration timeout?
@return [Boolean] | [
"Is",
"this",
"password",
"older",
"than",
"the",
"configured",
"expiration",
"timeout?"
] | d0b44a7bb249f6763641f45d34dd52e7fda3fca2 | https://github.com/devise-security/devise-security/blob/d0b44a7bb249f6763641f45d34dd52e7fda3fca2/lib/devise-security/models/password_expirable.rb#L81-L87 | train | Returns true if the password has been changed since the last time it was created. | [
30522,
13366,
20786,
1035,
2205,
1035,
2214,
1029,
2709,
6270,
2065,
2047,
1035,
2501,
1029,
2709,
6270,
4983,
20786,
1035,
4654,
16781,
1035,
9124,
1029,
2709,
6270,
2065,
4654,
20781,
1035,
20786,
1035,
2006,
1035,
5157,
1029,
20786,
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/haml-lint | lib/haml_lint/configuration.rb | HamlLint.Configuration.for_linter | def for_linter(linter)
linter_name =
case linter
when Class
linter.name.split('::').last
when HamlLint::Linter
linter.name
end
@hash['linters'].fetch(linter_name, {}).dup.freeze
end | ruby | def for_linter(linter)
linter_name =
case linter
when Class
linter.name.split('::').last
when HamlLint::Linter
linter.name
end
@hash['linters'].fetch(linter_name, {}).dup.freeze
end | [
"def",
"for_linter",
"(",
"linter",
")",
"linter_name",
"=",
"case",
"linter",
"when",
"Class",
"linter",
".",
"name",
".",
"split",
"(",
"'::'",
")",
".",
"last",
"when",
"HamlLint",
"::",
"Linter",
"linter",
".",
"name",
"end",
"@hash",
"[",
"'linters'... | Compares this configuration with another.
@param other [HamlLint::Configuration]
@return [true,false] whether the given configuration is equivalent
Returns a non-modifiable configuration for the specified linter.
@param linter [HamlLint::Linter,Class] | [
"Compares",
"this",
"configuration",
"with",
"another",
"."
] | 024c773667e54cf88db938c2b368977005d70ee8 | https://github.com/sds/haml-lint/blob/024c773667e54cf88db938c2b368977005d70ee8/lib/haml_lint/configuration.rb#L43-L53 | train | Returns the result of the linter for the given linter. | [
30522,
13366,
2005,
1035,
11409,
3334,
1006,
11409,
3334,
1007,
11409,
3334,
1035,
2171,
1027,
2553,
11409,
3334,
2043,
2465,
11409,
3334,
1012,
2171,
1012,
3975,
1006,
1005,
1024,
1024,
1005,
1007,
1012,
2197,
2043,
10654,
21202,
2102,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sds/scss-lint | lib/scss_lint/linter/indentation.rb | SCSSLint.Linter::Indentation.one_shift_greater_than_parent? | def one_shift_greater_than_parent?(node, actual_indent)
parent_indent = node_indent(node_indent_parent(node)).length
expected_indent = parent_indent + @indent_width
expected_indent == actual_indent
end | ruby | def one_shift_greater_than_parent?(node, actual_indent)
parent_indent = node_indent(node_indent_parent(node)).length
expected_indent = parent_indent + @indent_width
expected_indent == actual_indent
end | [
"def",
"one_shift_greater_than_parent?",
"(",
"node",
",",
"actual_indent",
")",
"parent_indent",
"=",
"node_indent",
"(",
"node_indent_parent",
"(",
"node",
")",
")",
".",
"length",
"expected_indent",
"=",
"parent_indent",
"+",
"@indent_width",
"expected_indent",
"==... | Returns whether node is indented exactly one indent width greater than its
parent.
@param node [Sass::Tree::Node]
@return [true,false] | [
"Returns",
"whether",
"node",
"is",
"indented",
"exactly",
"one",
"indent",
"width",
"greater",
"than",
"its",
"parent",
"."
] | e99afe4ede041a431a06e585c12ce82f6ad50116 | https://github.com/sds/scss-lint/blob/e99afe4ede041a431a06e585c12ce82f6ad50116/lib/scss_lint/linter/indentation.rb#L183-L187 | train | Returns true if the node is one shift greater than the parent | [
30522,
13366,
2028,
1035,
5670,
1035,
3618,
1035,
2084,
1035,
6687,
1029,
1006,
13045,
1010,
5025,
1035,
27427,
4765,
1007,
6687,
1035,
27427,
4765,
1027,
13045,
1035,
27427,
4765,
1006,
13045,
1035,
27427,
4765,
1035,
6687,
1006,
13045,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/device_settings.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.DeviceSettings.sync_remotemanagement_certificate | def sync_remotemanagement_certificate(device_name, resource_group_name, manager_name, custom_headers:nil)
response = sync_remotemanagement_certificate_async(device_name, resource_group_name, manager_name, custom_headers:custom_headers).value!
nil
end | ruby | def sync_remotemanagement_certificate(device_name, resource_group_name, manager_name, custom_headers:nil)
response = sync_remotemanagement_certificate_async(device_name, resource_group_name, manager_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"sync_remotemanagement_certificate",
"(",
"device_name",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"sync_remotemanagement_certificate_async",
"(",
"device_name",
",",
"resource_group_name",
",",
"manager... | sync Remote management Certificate between appliance and Service
@param device_name [String] The device name
@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. | [
"sync",
"Remote",
"management",
"Certificate",
"between",
"appliance",
"and",
"Service"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/device_settings.rb#L467-L470 | train | Syncs the certificate of a managed cluster. | [
30522,
13366,
26351,
1035,
6556,
24805,
20511,
1035,
8196,
1006,
5080,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
26351,
1035,
6556,
24805,
2051... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
haml/haml | lib/haml/compiler.rb | Haml.Compiler.rstrip_buffer! | def rstrip_buffer!(index = -1)
last = @to_merge[index]
if last.nil?
push_silent("_hamlout.rstrip!", false)
return
end
case last.first
when :text
last[1] = last[1].rstrip
if last[1].empty?
@to_merge.slice! index
rstrip_buffer! index
end
when :script
last[1].gsub!(/\(haml_temp, (.*?)\);$/, '(haml_temp.rstrip, \1);')
rstrip_buffer! index - 1
else
raise SyntaxError.new("[HAML BUG] Undefined entry in Haml::Compiler@to_merge.")
end
end | ruby | def rstrip_buffer!(index = -1)
last = @to_merge[index]
if last.nil?
push_silent("_hamlout.rstrip!", false)
return
end
case last.first
when :text
last[1] = last[1].rstrip
if last[1].empty?
@to_merge.slice! index
rstrip_buffer! index
end
when :script
last[1].gsub!(/\(haml_temp, (.*?)\);$/, '(haml_temp.rstrip, \1);')
rstrip_buffer! index - 1
else
raise SyntaxError.new("[HAML BUG] Undefined entry in Haml::Compiler@to_merge.")
end
end | [
"def",
"rstrip_buffer!",
"(",
"index",
"=",
"-",
"1",
")",
"last",
"=",
"@to_merge",
"[",
"index",
"]",
"if",
"last",
".",
"nil?",
"push_silent",
"(",
"\"_hamlout.rstrip!\"",
",",
"false",
")",
"return",
"end",
"case",
"last",
".",
"first",
"when",
":tex... | Get rid of and whitespace at the end of the buffer
or the merged text | [
"Get",
"rid",
"of",
"and",
"whitespace",
"at",
"the",
"end",
"of",
"the",
"buffer",
"or",
"the",
"merged",
"text"
] | 9aa0fbe4a91b999978927be569d2ad0cd39076f1 | https://github.com/haml/haml/blob/9aa0fbe4a91b999978927be569d2ad0cd39076f1/lib/haml/compiler.rb#L309-L329 | train | Rstrip the buffer at the given index. | [
30522,
13366,
12667,
24901,
1035,
17698,
999,
1006,
5950,
1027,
1011,
1015,
1007,
2197,
1027,
1030,
2000,
1035,
13590,
1031,
5950,
1033,
2065,
2197,
1012,
9152,
2140,
1029,
5245,
1035,
4333,
1006,
1000,
1035,
10654,
23743,
2102,
1012,
12667... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ruby2d/ruby2d | lib/ruby2d/window.rb | Ruby2D.Window.key_callback | def key_callback(type, key)
key = key.downcase
# All key events
@events[:key].each do |id, e|
e.call(KeyEvent.new(type, key))
end
case type
# When key is pressed, fired once
when :down
@events[:key_down].each do |id, e|
e.call(KeyEvent.new(type, key))
end
# When key is being held down, fired every frame
when :held
@events[:key_held].each do |id, e|
e.call(KeyEvent.new(type, key))
end
# When key released, fired once
when :up
@events[:key_up].each do |id, e|
e.call(KeyEvent.new(type, key))
end
end
end | ruby | def key_callback(type, key)
key = key.downcase
# All key events
@events[:key].each do |id, e|
e.call(KeyEvent.new(type, key))
end
case type
# When key is pressed, fired once
when :down
@events[:key_down].each do |id, e|
e.call(KeyEvent.new(type, key))
end
# When key is being held down, fired every frame
when :held
@events[:key_held].each do |id, e|
e.call(KeyEvent.new(type, key))
end
# When key released, fired once
when :up
@events[:key_up].each do |id, e|
e.call(KeyEvent.new(type, key))
end
end
end | [
"def",
"key_callback",
"(",
"type",
",",
"key",
")",
"key",
"=",
"key",
".",
"downcase",
"# All key events",
"@events",
"[",
":key",
"]",
".",
"each",
"do",
"|",
"id",
",",
"e",
"|",
"e",
".",
"call",
"(",
"KeyEvent",
".",
"new",
"(",
"type",
",",
... | Key callback method, called by the native and web extentions | [
"Key",
"callback",
"method",
"called",
"by",
"the",
"native",
"and",
"web",
"extentions"
] | 43ce9805a7ae8b82b7ab8c50bf6d4c845d395dc4 | https://github.com/ruby2d/ruby2d/blob/43ce9805a7ae8b82b7ab8c50bf6d4c845d395dc4/lib/ruby2d/window.rb#L275-L300 | train | Called when a key is pressed | [
30522,
13366,
3145,
1035,
2655,
5963,
1006,
2828,
1010,
3145,
1007,
3145,
1027,
3145,
1012,
2091,
18382,
1001,
2035,
3145,
2824,
1030,
2824,
1031,
1024,
3145,
1033,
1012,
2169,
2079,
1064,
8909,
1010,
1041,
1064,
1041,
1012,
2655,
1006,
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_container_registry/lib/2017-06-01-preview/generated/azure_mgmt_container_registry/webhooks.rb | Azure::ContainerRegistry::Mgmt::V2017_06_01_preview.Webhooks.list_events_next | def list_events_next(next_page_link, custom_headers:nil)
response = list_events_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_events_next(next_page_link, custom_headers:nil)
response = list_events_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_events_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_events_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"response",
"... | Lists recent events for the specified webhook.
@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 [EventListResult] operation results. | [
"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#L1134-L1137 | train | Gets the next page of events. | [
30522,
13366,
2862,
1035,
2824,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2824,
1035,
2279,
1035,
2004,
6038,
2278,
1006,
2279,
1035,
3931,
1035,
4957,
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_container_registry/lib/2017-06-01-preview/generated/azure_mgmt_container_registry/webhooks.rb | Azure::ContainerRegistry::Mgmt::V2017_06_01_preview.Webhooks.list_events_as_lazy | def list_events_as_lazy(resource_group_name, registry_name, webhook_name, custom_headers:nil)
response = list_events_async(resource_group_name, registry_name, webhook_name, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_events_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_events_as_lazy(resource_group_name, registry_name, webhook_name, custom_headers:nil)
response = list_events_async(resource_group_name, registry_name, webhook_name, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_events_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_events_as_lazy",
"(",
"resource_group_name",
",",
"registry_name",
",",
"webhook_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_events_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"webhook_name",
",",
"custom_headers... | 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 [EventListResult] which provide lazy access to pages of the response. | [
"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#L1247-L1256 | train | Gets the events for the specified webhook. | [
30522,
13366,
2862,
1035,
2824,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
4773,
6806,
6559,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2824,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
toptal/chewy | lib/chewy/query.rb | Chewy.Query.boost_factor | def boost_factor(factor, options = {})
scoring = options.merge(boost_factor: factor.to_i)
chain { criteria.update_scores scoring }
end | ruby | def boost_factor(factor, options = {})
scoring = options.merge(boost_factor: factor.to_i)
chain { criteria.update_scores scoring }
end | [
"def",
"boost_factor",
"(",
"factor",
",",
"options",
"=",
"{",
"}",
")",
"scoring",
"=",
"options",
".",
"merge",
"(",
"boost_factor",
":",
"factor",
".",
"to_i",
")",
"chain",
"{",
"criteria",
".",
"update_scores",
"scoring",
"}",
"end"
] | Adds a boost factor to the search request. All scores are
added to the search request and combinded according to
`boost_mode` and `score_mode`
This probably only makes sense if you specify a filter
for the boost factor as well
@example
UsersIndex.boost_factor(23, filter: { term: { foo: :bar} })
# => {body:
query: {
function_score: {
query: { ...},
functions: [{
boost_factor: 23,
filter: { term: { foo: :bar } }
}]
} } } | [
"Adds",
"a",
"boost",
"factor",
"to",
"the",
"search",
"request",
".",
"All",
"scores",
"are",
"added",
"to",
"the",
"search",
"request",
"and",
"combinded",
"according",
"to",
"boost_mode",
"and",
"score_mode"
] | cb1bb3efb1bd8a31e7e31add6072189cb1f4f01b | https://github.com/toptal/chewy/blob/cb1bb3efb1bd8a31e7e31add6072189cb1f4f01b/lib/chewy/query.rb#L420-L423 | train | Boost the search terms based on the boost factor. | [
30522,
13366,
12992,
1035,
5387,
1006,
5387,
1010,
7047,
1027,
1063,
1065,
1007,
4577,
1027,
7047,
1012,
13590,
1006,
12992,
1035,
5387,
1024,
5387,
1012,
2000,
1035,
1045,
1007,
4677,
1063,
9181,
1012,
10651,
1035,
7644,
4577,
1065,
2203,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
opal/opal | lib/opal/compiler.rb | Opal.Compiler.process | def process(sexp, level = :expr)
return fragment('', scope) if sexp.nil?
if handler = handlers[sexp.type]
return handler.new(sexp, level, self).compile_to_fragments
else
error "Unsupported sexp: #{sexp.type}"
end
end | ruby | def process(sexp, level = :expr)
return fragment('', scope) if sexp.nil?
if handler = handlers[sexp.type]
return handler.new(sexp, level, self).compile_to_fragments
else
error "Unsupported sexp: #{sexp.type}"
end
end | [
"def",
"process",
"(",
"sexp",
",",
"level",
"=",
":expr",
")",
"return",
"fragment",
"(",
"''",
",",
"scope",
")",
"if",
"sexp",
".",
"nil?",
"if",
"handler",
"=",
"handlers",
"[",
"sexp",
".",
"type",
"]",
"return",
"handler",
".",
"new",
"(",
"s... | Process the given sexp by creating a node instance, based on its type,
and compiling it to fragments. | [
"Process",
"the",
"given",
"sexp",
"by",
"creating",
"a",
"node",
"instance",
"based",
"on",
"its",
"type",
"and",
"compiling",
"it",
"to",
"fragments",
"."
] | 41aedc0fd62aab00d3c117ba0caf00206bedd981 | https://github.com/opal/opal/blob/41aedc0fd62aab00d3c117ba0caf00206bedd981/lib/opal/compiler.rb#L354-L362 | train | Process a single sexp | [
30522,
13366,
2832,
1006,
3348,
2361,
1010,
2504,
1027,
1024,
4654,
18098,
1007,
2709,
15778,
1006,
1005,
1005,
1010,
9531,
1007,
2065,
3348,
2361,
1012,
9152,
2140,
1029,
2065,
28213,
1027,
28213,
2015,
1031,
3348,
2361,
1012,
2828,
1033,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
anycable/anycable | lib/anycable/server.rb | AnyCable.Server.start | def start
return if running?
raise "Cannot re-start stopped server" if stopped?
check_default_host
logger.info "RPC server is starting..."
@start_thread = Thread.new { grpc_server.run }
grpc_server.wait_till_running
logger.info "RPC server is listening on #{host}"
end | ruby | def start
return if running?
raise "Cannot re-start stopped server" if stopped?
check_default_host
logger.info "RPC server is starting..."
@start_thread = Thread.new { grpc_server.run }
grpc_server.wait_till_running
logger.info "RPC server is listening on #{host}"
end | [
"def",
"start",
"return",
"if",
"running?",
"raise",
"\"Cannot re-start stopped server\"",
"if",
"stopped?",
"check_default_host",
"logger",
".",
"info",
"\"RPC server is starting...\"",
"@start_thread",
"=",
"Thread",
".",
"new",
"{",
"grpc_server",
".",
"run",
"}",
... | Start gRPC server in background and
wait untill it ready to accept connections | [
"Start",
"gRPC",
"server",
"in",
"background",
"and",
"wait",
"untill",
"it",
"ready",
"to",
"accept",
"connections"
] | d7515e8e034d42e86ebeb09786a92aad2a11b25f | https://github.com/anycable/anycable/blob/d7515e8e034d42e86ebeb09786a92aad2a11b25f/lib/anycable/server.rb#L76-L90 | train | Start the server | [
30522,
13366,
2707,
2709,
2065,
2770,
1029,
5333,
1000,
3685,
2128,
1011,
2707,
3030,
8241,
1000,
2065,
3030,
1029,
4638,
1035,
12398,
1035,
3677,
8833,
4590,
1012,
18558,
1000,
1054,
15042,
8241,
2003,
3225,
1012,
1012,
1012,
1000,
1030,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
guard/guard | lib/guard/dsl.rb | Guard.Dsl.interactor | def interactor(options)
# TODO: remove dependency on Interactor (let session handle this)
case options
when :off
Interactor.enabled = false
when Hash
Interactor.options = options
end
end | ruby | def interactor(options)
# TODO: remove dependency on Interactor (let session handle this)
case options
when :off
Interactor.enabled = false
when Hash
Interactor.options = options
end
end | [
"def",
"interactor",
"(",
"options",
")",
"# TODO: remove dependency on Interactor (let session handle this)",
"case",
"options",
"when",
":off",
"Interactor",
".",
"enabled",
"=",
"false",
"when",
"Hash",
"Interactor",
".",
"options",
"=",
"options",
"end",
"end"
] | Sets the interactor options or disable the interactor.
@example Pass options to the interactor
interactor option1: 'value1', option2: 'value2'
@example Turn off interactions
interactor :off
@param [Symbol, Hash] options either `:off` or a Hash with interactor
options | [
"Sets",
"the",
"interactor",
"options",
"or",
"disable",
"the",
"interactor",
"."
] | e2508cd83badf0d537dbaba35d307adc35d92e4f | https://github.com/guard/guard/blob/e2508cd83badf0d537dbaba35d307adc35d92e4f/lib/guard/dsl.rb#L90-L98 | train | Sets the Interactor class to use for this session | [
30522,
13366,
11835,
2953,
1006,
7047,
1007,
1001,
28681,
2080,
1024,
6366,
24394,
2006,
11835,
2953,
1006,
2292,
5219,
5047,
2023,
1007,
2553,
7047,
2043,
1024,
2125,
11835,
2953,
1012,
9124,
1027,
6270,
2043,
23325,
11835,
2953,
1012,
704... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
forward3d/rbhive | lib/rbhive/t_c_l_i_connection.rb | RBHive.TCLIConnection.async_state | def async_state(handles)
response = @client.GetOperationStatus(
Hive2::Thrift::TGetOperationStatusReq.new(operationHandle: prepare_operation_handle(handles))
)
case response.operationState
when Hive2::Thrift::TOperationState::FINISHED_STATE
return :finished
when Hive2::Thrift::TOperationState::INITIALIZED_STATE
return :initialized
when Hive2::Thrift::TOperationState::RUNNING_STATE
return :running
when Hive2::Thrift::TOperationState::CANCELED_STATE
return :cancelled
when Hive2::Thrift::TOperationState::CLOSED_STATE
return :closed
when Hive2::Thrift::TOperationState::ERROR_STATE
return :error
when Hive2::Thrift::TOperationState::UKNOWN_STATE
return :unknown
when Hive2::Thrift::TOperationState::PENDING_STATE
return :pending
when nil
raise "No operation state found for handles - has the session been closed?"
else
return :state_not_in_protocol
end
end | ruby | def async_state(handles)
response = @client.GetOperationStatus(
Hive2::Thrift::TGetOperationStatusReq.new(operationHandle: prepare_operation_handle(handles))
)
case response.operationState
when Hive2::Thrift::TOperationState::FINISHED_STATE
return :finished
when Hive2::Thrift::TOperationState::INITIALIZED_STATE
return :initialized
when Hive2::Thrift::TOperationState::RUNNING_STATE
return :running
when Hive2::Thrift::TOperationState::CANCELED_STATE
return :cancelled
when Hive2::Thrift::TOperationState::CLOSED_STATE
return :closed
when Hive2::Thrift::TOperationState::ERROR_STATE
return :error
when Hive2::Thrift::TOperationState::UKNOWN_STATE
return :unknown
when Hive2::Thrift::TOperationState::PENDING_STATE
return :pending
when nil
raise "No operation state found for handles - has the session been closed?"
else
return :state_not_in_protocol
end
end | [
"def",
"async_state",
"(",
"handles",
")",
"response",
"=",
"@client",
".",
"GetOperationStatus",
"(",
"Hive2",
"::",
"Thrift",
"::",
"TGetOperationStatusReq",
".",
"new",
"(",
"operationHandle",
":",
"prepare_operation_handle",
"(",
"handles",
")",
")",
")",
"c... | Map states to symbols | [
"Map",
"states",
"to",
"symbols"
] | a630b57332f2face03501da3ecad2905c78056fa | https://github.com/forward3d/rbhive/blob/a630b57332f2face03501da3ecad2905c78056fa/lib/rbhive/t_c_l_i_connection.rb#L237-L264 | train | Returns the state of the operation | [
30522,
13366,
2004,
6038,
2278,
1035,
2110,
1006,
16024,
1007,
3433,
1027,
1030,
7396,
1012,
2131,
25918,
10708,
29336,
2271,
1006,
26736,
2475,
1024,
1024,
16215,
16338,
1024,
1024,
1056,
18150,
25918,
10708,
29336,
2271,
2890,
4160,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hashicorp/vault-ruby | lib/vault/persistent.rb | Vault.PersistentHTTP.proxy_from_env | def proxy_from_env
env_proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']
return nil if env_proxy.nil? or env_proxy.empty?
uri = URI normalize_uri env_proxy
env_no_proxy = ENV['no_proxy'] || ENV['NO_PROXY']
# '*' is special case for always bypass
return nil if env_no_proxy == '*'
if env_no_proxy then
uri.query = "no_proxy=#{escape(env_no_proxy)}"
end
unless uri.user or uri.password then
uri.user = escape ENV['http_proxy_user'] || ENV['HTTP_PROXY_USER']
uri.password = escape ENV['http_proxy_pass'] || ENV['HTTP_PROXY_PASS']
end
uri
end | ruby | def proxy_from_env
env_proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']
return nil if env_proxy.nil? or env_proxy.empty?
uri = URI normalize_uri env_proxy
env_no_proxy = ENV['no_proxy'] || ENV['NO_PROXY']
# '*' is special case for always bypass
return nil if env_no_proxy == '*'
if env_no_proxy then
uri.query = "no_proxy=#{escape(env_no_proxy)}"
end
unless uri.user or uri.password then
uri.user = escape ENV['http_proxy_user'] || ENV['HTTP_PROXY_USER']
uri.password = escape ENV['http_proxy_pass'] || ENV['HTTP_PROXY_PASS']
end
uri
end | [
"def",
"proxy_from_env",
"env_proxy",
"=",
"ENV",
"[",
"'http_proxy'",
"]",
"||",
"ENV",
"[",
"'HTTP_PROXY'",
"]",
"return",
"nil",
"if",
"env_proxy",
".",
"nil?",
"or",
"env_proxy",
".",
"empty?",
"uri",
"=",
"URI",
"normalize_uri",
"env_proxy",
"env_no_proxy... | Creates a URI for an HTTP proxy server from ENV variables.
If +HTTP_PROXY+ is set a proxy will be returned.
If +HTTP_PROXY_USER+ or +HTTP_PROXY_PASS+ are set the URI is given the
indicated user and password unless HTTP_PROXY contains either of these in
the URI.
The +NO_PROXY+ ENV variable can be used to specify hosts which shouldn't
be reached via proxy; if set it should be a comma separated list of
hostname suffixes, optionally with +:port+ appended, for example
<tt>example.com,some.host:8080</tt>. When set to <tt>*</tt> no proxy will
be returned.
For Windows users, lowercase ENV variables are preferred over uppercase ENV
variables. | [
"Creates",
"a",
"URI",
"for",
"an",
"HTTP",
"proxy",
"server",
"from",
"ENV",
"variables",
"."
] | 02f0532a802ba1a2a0d8703a4585dab76eb9d864 | https://github.com/hashicorp/vault-ruby/blob/02f0532a802ba1a2a0d8703a4585dab76eb9d864/lib/vault/persistent.rb#L841-L863 | train | Returns a proxy object from the env
| [
30522,
13366,
24540,
1035,
2013,
1035,
4372,
2615,
4372,
2615,
1035,
24540,
1027,
4372,
2615,
1031,
1005,
8299,
1035,
24540,
1005,
1033,
1064,
1064,
4372,
2615,
1031,
1005,
8299,
1035,
24540,
1005,
1033,
2709,
9152,
2140,
2065,
4372,
2615,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
tongueroo/jets | lib/jets/router.rb | Jets.Router.root | def root(to, options={})
default = {path: '', to: to, method: :get, root: true}
options = default.merge(options)
@routes << Route.new(options)
end | ruby | def root(to, options={})
default = {path: '', to: to, method: :get, root: true}
options = default.merge(options)
@routes << Route.new(options)
end | [
"def",
"root",
"(",
"to",
",",
"options",
"=",
"{",
"}",
")",
"default",
"=",
"{",
"path",
":",
"''",
",",
"to",
":",
"to",
",",
"method",
":",
":get",
",",
"root",
":",
"true",
"}",
"options",
"=",
"default",
".",
"merge",
"(",
"options",
")",... | root "posts#index" | [
"root",
"posts#index"
] | 46943a519224067e58aa3e2d5656e3ca083150f9 | https://github.com/tongueroo/jets/blob/46943a519224067e58aa3e2d5656e3ca083150f9/lib/jets/router.rb#L87-L91 | train | Add a root route to the routes list | [
30522,
13366,
7117,
1006,
2000,
1010,
7047,
1027,
1063,
1065,
1007,
12398,
1027,
1063,
4130,
1024,
1005,
1005,
1010,
2000,
1024,
2000,
1010,
4118,
1024,
1024,
2131,
1010,
7117,
1024,
2995,
1065,
7047,
1027,
12398,
1012,
13590,
1006,
7047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mongodb/mongo-ruby-driver | lib/mongo/client.rb | Mongo.Client.with | def with(new_options = Options::Redacted.new)
clone.tap do |client|
opts = validate_options!(new_options)
client.options.update(opts)
Database.create(client)
# We can't use the same cluster if some options that would affect it
# have changed.
if cluster_modifying?(opts)
Cluster.create(client)
end
end
end | ruby | def with(new_options = Options::Redacted.new)
clone.tap do |client|
opts = validate_options!(new_options)
client.options.update(opts)
Database.create(client)
# We can't use the same cluster if some options that would affect it
# have changed.
if cluster_modifying?(opts)
Cluster.create(client)
end
end
end | [
"def",
"with",
"(",
"new_options",
"=",
"Options",
"::",
"Redacted",
".",
"new",
")",
"clone",
".",
"tap",
"do",
"|",
"client",
"|",
"opts",
"=",
"validate_options!",
"(",
"new_options",
")",
"client",
".",
"options",
".",
"update",
"(",
"opts",
")",
"... | Creates a new client with the passed options merged over the existing
options of this client. Useful for one-offs to change specific options
without altering the original client.
@note Depending on options given, the returned client may share the
cluster with the original client or be created with a new cluster.
If a new cluster is created, the monitoring event subscribers on
the new client are set to the default event subscriber set and
none of the subscribers on the original client are copied over.
@example Get a client with changed options.
client.with(:read => { :mode => :primary_preferred })
@param [ Hash ] new_options The new options to use.
@return [ Mongo::Client ] A new client instance.
@since 2.0.0 | [
"Creates",
"a",
"new",
"client",
"with",
"the",
"passed",
"options",
"merged",
"over",
"the",
"existing",
"options",
"of",
"this",
"client",
".",
"Useful",
"for",
"one",
"-",
"offs",
"to",
"change",
"specific",
"options",
"without",
"altering",
"the",
"origi... | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/client.rb#L512-L523 | train | Create a new cluster with the given options. | [
30522,
13366,
2007,
1006,
2047,
1035,
7047,
1027,
7047,
1024,
1024,
2417,
18908,
2098,
1012,
2047,
1007,
17598,
1012,
11112,
2079,
1064,
7396,
1064,
23569,
30524,
1001,
2057,
2064,
1005,
1056,
2224,
1996,
2168,
9324,
2065,
2070,
7047,
2008,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/octo_fetcher.rb | GitHubChangelogGenerator.OctoFetcher.check_github_response | def check_github_response
Retriable.retriable(retry_options) do
yield
end
rescue MovedPermanentlyError => e
fail_with_message(e, "The repository has moved, update your configuration")
rescue Octokit::Forbidden => e
fail_with_message(e, "Exceeded retry limit")
rescue Octokit::Unauthorized => e
fail_with_message(e, "Error: wrong GitHub token")
end | ruby | def check_github_response
Retriable.retriable(retry_options) do
yield
end
rescue MovedPermanentlyError => e
fail_with_message(e, "The repository has moved, update your configuration")
rescue Octokit::Forbidden => e
fail_with_message(e, "Exceeded retry limit")
rescue Octokit::Unauthorized => e
fail_with_message(e, "Error: wrong GitHub token")
end | [
"def",
"check_github_response",
"Retriable",
".",
"retriable",
"(",
"retry_options",
")",
"do",
"yield",
"end",
"rescue",
"MovedPermanentlyError",
"=>",
"e",
"fail_with_message",
"(",
"e",
",",
"\"The repository has moved, update your configuration\"",
")",
"rescue",
"Oct... | This is wrapper with rescue block
@return [Object] returns exactly the same, what you put in the block, but wrap it with begin-rescue block | [
"This",
"is",
"wrapper",
"with",
"rescue",
"block"
] | f18c64b5cc0d7473b059275b88385ac11ca8b564 | https://github.com/github-changelog-generator/github-changelog-generator/blob/f18c64b5cc0d7473b059275b88385ac11ca8b564/lib/github_changelog_generator/octo_fetcher.rb#L396-L406 | train | Check the github response for the repository | [
30522,
13366,
4638,
1035,
21025,
2705,
12083,
1035,
3433,
2128,
18886,
3085,
1012,
2128,
18886,
3085,
1006,
2128,
11129,
1035,
7047,
1007,
2079,
10750,
2203,
5343,
2333,
4842,
2386,
28198,
2121,
29165,
1027,
1028,
1041,
8246,
1035,
2007,
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... |
david942j/one_gadget | lib/one_gadget/helper.rb | OneGadget.Helper.build_id_of | def build_id_of(path)
File.open(path) { |f| ELFTools::ELFFile.new(f).build_id }
end | ruby | def build_id_of(path)
File.open(path) { |f| ELFTools::ELFFile.new(f).build_id }
end | [
"def",
"build_id_of",
"(",
"path",
")",
"File",
".",
"open",
"(",
"path",
")",
"{",
"|",
"f",
"|",
"ELFTools",
"::",
"ELFFile",
".",
"new",
"(",
"f",
")",
".",
"build_id",
"}",
"end"
] | Get the Build ID of target ELF.
@param [String] path Absolute file path.
@return [String] Target build id.
@example
Helper.build_id_of('/lib/x86_64-linux-gnu/libc-2.23.so')
#=> '60131540dadc6796cab33388349e6e4e68692053' | [
"Get",
"the",
"Build",
"ID",
"of",
"target",
"ELF",
"."
] | ff6ef04541e83441bfe3c2664a6febd1640f4263 | https://github.com/david942j/one_gadget/blob/ff6ef04541e83441bfe3c2664a6febd1640f4263/lib/one_gadget/helper.rb#L88-L90 | train | Returns the build id of the file at the given path. | [
30522,
13366,
3857,
1035,
8909,
1035,
1997,
1006,
4130,
1007,
5371,
1012,
2330,
1006,
4130,
1007,
1063,
1064,
1042,
1064,
17163,
3406,
27896,
1024,
1024,
17163,
8873,
2571,
1012,
2047,
1006,
1042,
1007,
1012,
3857,
1035,
8909,
1065,
2203,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-glacier/lib/aws-sdk-glacier/archive.rb | Aws::Glacier.Archive.initiate_archive_retrieval | def initiate_archive_retrieval(options = {})
options = Aws::Util.deep_merge(options,
vault_name: @vault_name,
account_id: @account_id,
job_parameters: {
type: "archive-retrieval",
archive_id: @id
}
)
resp = @client.initiate_job(options)
Job.new(
id: resp.data.job_id,
account_id: @account_id,
vault_name: @vault_name,
client: @client
)
end | ruby | def initiate_archive_retrieval(options = {})
options = Aws::Util.deep_merge(options,
vault_name: @vault_name,
account_id: @account_id,
job_parameters: {
type: "archive-retrieval",
archive_id: @id
}
)
resp = @client.initiate_job(options)
Job.new(
id: resp.data.job_id,
account_id: @account_id,
vault_name: @vault_name,
client: @client
)
end | [
"def",
"initiate_archive_retrieval",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"Aws",
"::",
"Util",
".",
"deep_merge",
"(",
"options",
",",
"vault_name",
":",
"@vault_name",
",",
"account_id",
":",
"@account_id",
",",
"job_parameters",
":",
"{",
"t... | @example Request syntax with placeholder values
archive.initiate_archive_retrieval()
@param [Hash] options ({})
@return [Job] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-glacier/lib/aws-sdk-glacier/archive.rb#L194-L210 | train | Initiate an archive - retrieval job | [
30522,
13366,
17820,
1035,
8756,
1035,
30524,
1030,
11632,
1035,
2171,
1010,
4070,
1035,
8909,
1024,
1030,
4070,
1035,
8909,
1010,
3105,
1035,
11709,
1024,
1063,
2828,
1024,
1000,
8756,
1011,
26384,
1000,
1010,
8756,
1035,
8909,
1024,
1030,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/virtual_network_taps.rb | Azure::Network::Mgmt::V2019_02_01.VirtualNetworkTaps.begin_delete | def begin_delete(resource_group_name, tap_name, custom_headers:nil)
response = begin_delete_async(resource_group_name, tap_name, custom_headers:custom_headers).value!
nil
end | ruby | def begin_delete(resource_group_name, tap_name, custom_headers:nil)
response = begin_delete_async(resource_group_name, tap_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_delete",
"(",
"resource_group_name",
",",
"tap_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_delete_async",
"(",
"resource_group_name",
",",
"tap_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"nil",
"end"... | Deletes the specified virtual network tap.
@param resource_group_name [String] The name of the resource group.
@param tap_name [String] The name of the virtual network tap.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Deletes",
"the",
"specified",
"virtual",
"network",
"tap",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2019-02-01/generated/azure_mgmt_network/virtual_network_taps.rb#L427-L430 | train | Deletes a Tap. | [
30522,
13366,
4088,
1035,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
11112,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
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_cdn/lib/2015-06-01/generated/azure_mgmt_cdn/custom_domains.rb | Azure::CDN::Mgmt::V2015_06_01.CustomDomains.list_by_endpoint_with_http_info | def list_by_endpoint_with_http_info(endpoint_name, profile_name, resource_group_name, custom_headers:nil)
list_by_endpoint_async(endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
end | ruby | def list_by_endpoint_with_http_info(endpoint_name, profile_name, resource_group_name, custom_headers:nil)
list_by_endpoint_async(endpoint_name, profile_name, resource_group_name, custom_headers:custom_headers).value!
end | [
"def",
"list_by_endpoint_with_http_info",
"(",
"endpoint_name",
",",
"profile_name",
",",
"resource_group_name",
",",
"custom_headers",
":",
"nil",
")",
"list_by_endpoint_async",
"(",
"endpoint_name",
",",
"profile_name",
",",
"resource_group_name",
",",
"custom_headers",
... | Lists the existing CDN custom domains within an endpoint.
@param endpoint_name [String] Name of the endpoint within the CDN profile.
@param profile_name [String] Name of the CDN profile within the resource
group.
@param resource_group_name [String] Name of the resource group within the
Azure subscription.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Lists",
"the",
"existing",
"CDN",
"custom",
"domains",
"within",
"an",
"endpoint",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_cdn/lib/2015-06-01/generated/azure_mgmt_cdn/custom_domains.rb#L58-L60 | train | Gets the list of all the endpoints in the specified subscription. | [
30522,
13366,
2862,
1035,
2011,
1035,
2203,
8400,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2203,
8400,
1035,
2171,
1010,
6337,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2862,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
puppetlabs/puppet | lib/puppet/functions.rb | Puppet::Functions.DispatcherBuilder.create_callable | def create_callable(types, block_type, return_type, from, to)
mapped_types = types.map do |t|
t.is_a?(Puppet::Pops::Types::PAnyType) ? t : internal_type_parse(t, loader)
end
param_types = Puppet::Pops::Types::PTupleType.new(mapped_types, from > 0 && from == to ? nil : Puppet::Pops::Types::PIntegerType.new(from, to))
return_type = internal_type_parse(return_type, loader) unless return_type.nil? || return_type.is_a?(Puppet::Pops::Types::PAnyType)
Puppet::Pops::Types::PCallableType.new(param_types, block_type, return_type)
end | ruby | def create_callable(types, block_type, return_type, from, to)
mapped_types = types.map do |t|
t.is_a?(Puppet::Pops::Types::PAnyType) ? t : internal_type_parse(t, loader)
end
param_types = Puppet::Pops::Types::PTupleType.new(mapped_types, from > 0 && from == to ? nil : Puppet::Pops::Types::PIntegerType.new(from, to))
return_type = internal_type_parse(return_type, loader) unless return_type.nil? || return_type.is_a?(Puppet::Pops::Types::PAnyType)
Puppet::Pops::Types::PCallableType.new(param_types, block_type, return_type)
end | [
"def",
"create_callable",
"(",
"types",
",",
"block_type",
",",
"return_type",
",",
"from",
",",
"to",
")",
"mapped_types",
"=",
"types",
".",
"map",
"do",
"|",
"t",
"|",
"t",
".",
"is_a?",
"(",
"Puppet",
"::",
"Pops",
"::",
"Types",
"::",
"PAnyType",
... | Handles creation of a callable type from strings specifications of puppet
types and allows the min/max occurs of the given types to be given as one
or two integer values at the end. The given block_type should be
Optional[Callable], Callable, or nil.
@api private | [
"Handles",
"creation",
"of",
"a",
"callable",
"type",
"from",
"strings",
"specifications",
"of",
"puppet",
"types",
"and",
"allows",
"the",
"min",
"/",
"max",
"occurs",
"of",
"the",
"given",
"types",
"to",
"be",
"given",
"as",
"one",
"or",
"two",
"integer"... | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/functions.rb#L579-L586 | train | Create a callable type from the given types. | [
30522,
13366,
3443,
1035,
2655,
3085,
1006,
4127,
1010,
3796,
1035,
2828,
1010,
2709,
1035,
2828,
1010,
2013,
1010,
2000,
1007,
17715,
1035,
4127,
1027,
4127,
1012,
4949,
2079,
1064,
1056,
1064,
1056,
1012,
2003,
1035,
1037,
1029,
1006,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alexreisner/geocoder | lib/maxmind_database.rb | Geocoder.MaxmindDatabase.table_columns | def table_columns(table_name)
{
maxmind_geolite_city_blocks: %w[start_ip_num end_ip_num loc_id],
maxmind_geolite_city_location: %w[loc_id country region city postal_code latitude longitude metro_code area_code],
maxmind_geolite_country: %w[start_ip end_ip start_ip_num end_ip_num country_code country]
}[table_name.to_sym]
end | ruby | def table_columns(table_name)
{
maxmind_geolite_city_blocks: %w[start_ip_num end_ip_num loc_id],
maxmind_geolite_city_location: %w[loc_id country region city postal_code latitude longitude metro_code area_code],
maxmind_geolite_country: %w[start_ip end_ip start_ip_num end_ip_num country_code country]
}[table_name.to_sym]
end | [
"def",
"table_columns",
"(",
"table_name",
")",
"{",
"maxmind_geolite_city_blocks",
":",
"%w[",
"start_ip_num",
"end_ip_num",
"loc_id",
"]",
",",
"maxmind_geolite_city_location",
":",
"%w[",
"loc_id",
"country",
"region",
"city",
"postal_code",
"latitude",
"longitude",
... | ------------------------------------------------------------- | [
"-------------------------------------------------------------"
] | e087dc2759264ee6f307b926bb2de4ec2406859e | https://github.com/alexreisner/geocoder/blob/e087dc2759264ee6f307b926bb2de4ec2406859e/lib/maxmind_database.rb#L40-L46 | train | Returns the columns of a given table. | [
30522,
13366,
2795,
1035,
7753,
1006,
2795,
1035,
2171,
1007,
1063,
4098,
23356,
1035,
20248,
22779,
1035,
2103,
1035,
5991,
1024,
1003,
1059,
1031,
2707,
1035,
12997,
1035,
16371,
2213,
2203,
1035,
12997,
1035,
16371,
2213,
8840,
2278,
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 | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.get_explicit_list_with_http_info | def get_explicit_list_with_http_info(app_id, version_id, entity_id, custom_headers:nil)
get_explicit_list_async(app_id, version_id, entity_id, custom_headers:custom_headers).value!
end | ruby | def get_explicit_list_with_http_info(app_id, version_id, entity_id, custom_headers:nil)
get_explicit_list_async(app_id, version_id, entity_id, custom_headers:custom_headers).value!
end | [
"def",
"get_explicit_list_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"custom_headers",
":",
"nil",
")",
"get_explicit_list_async",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"custom_headers",
":custom_headers",
")",
".",
... | Get the explicit (exception) list of the pattern.any entity in a version of
the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param entity_id The Pattern.Any entity id.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Get",
"the",
"explicit",
"(",
"exception",
")",
"list",
"of",
"the",
"pattern",
".",
"any",
"entity",
"in",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L7964-L7966 | train | Gets the list of entities in a version of the application. | [
30522,
13366,
2131,
1035,
13216,
1035,
2862,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
9178,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
13216,
1035,
2862,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | fastlane/lib/fastlane/plugins/plugin_manager.rb | Fastlane.PluginManager.print_plugin_information | def print_plugin_information(references)
rows = references.collect do |current|
if current[1][:actions].empty?
# Something is wrong with this plugin, no available actions
[current[0].red, current[1][:version_number], "No actions found".red]
else
[current[0], current[1][:version_number], current[1][:actions].join("\n")]
end
end
require 'terminal-table'
puts(Terminal::Table.new({
rows: FastlaneCore::PrintTable.transform_output(rows),
title: "Used plugins".green,
headings: ["Plugin", "Version", "Action"]
}))
puts("")
end | ruby | def print_plugin_information(references)
rows = references.collect do |current|
if current[1][:actions].empty?
# Something is wrong with this plugin, no available actions
[current[0].red, current[1][:version_number], "No actions found".red]
else
[current[0], current[1][:version_number], current[1][:actions].join("\n")]
end
end
require 'terminal-table'
puts(Terminal::Table.new({
rows: FastlaneCore::PrintTable.transform_output(rows),
title: "Used plugins".green,
headings: ["Plugin", "Version", "Action"]
}))
puts("")
end | [
"def",
"print_plugin_information",
"(",
"references",
")",
"rows",
"=",
"references",
".",
"collect",
"do",
"|",
"current",
"|",
"if",
"current",
"[",
"1",
"]",
"[",
":actions",
"]",
".",
"empty?",
"# Something is wrong with this plugin, no available actions",
"[",
... | Prints a table all the plugins that were loaded | [
"Prints",
"a",
"table",
"all",
"the",
"plugins",
"that",
"were",
"loaded"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/fastlane/lib/fastlane/plugins/plugin_manager.rb#L319-L336 | train | Print the plugin information | [
30522,
13366,
6140,
1035,
13354,
2378,
1035,
2592,
1006,
7604,
1007,
10281,
1027,
7604,
1012,
8145,
2079,
1064,
2783,
1064,
2065,
2783,
1031,
1015,
1033,
1031,
1024,
4506,
1033,
1012,
4064,
1029,
1001,
2242,
2003,
3308,
2007,
2023,
13354,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/policy_version.rb | Aws::IAM.PolicyVersion.set_as_default | def set_as_default(options = {})
options = options.merge(
policy_arn: @arn,
version_id: @version_id
)
resp = @client.set_default_policy_version(options)
resp.data
end | ruby | def set_as_default(options = {})
options = options.merge(
policy_arn: @arn,
version_id: @version_id
)
resp = @client.set_default_policy_version(options)
resp.data
end | [
"def",
"set_as_default",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"policy_arn",
":",
"@arn",
",",
"version_id",
":",
"@version_id",
")",
"resp",
"=",
"@client",
".",
"set_default_policy_version",
"(",
"options",
")",
... | @example Request syntax with placeholder values
policy_version.set_as_default()
@param [Hash] options ({})
@return [EmptyStructure] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-iam/lib/aws-sdk-iam/policy_version.rb#L235-L242 | train | Set the policy as default | [
30522,
13366,
2275,
1035,
2004,
1035,
12398,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
3343,
1035,
12098,
2078,
1024,
1030,
12098,
2078,
1010,
2544,
1035,
8909,
1024,
1030,
2544,
1035,
8909,
1007,
24501,
2361,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
troessner/reek | lib/reek/documentation_link.rb | Reek.DocumentationLink.build | def build(subject)
Kernel.format(HELP_LINK_TEMPLATE, version: Version::STRING, item: name_to_param(subject))
end | ruby | def build(subject)
Kernel.format(HELP_LINK_TEMPLATE, version: Version::STRING, item: name_to_param(subject))
end | [
"def",
"build",
"(",
"subject",
")",
"Kernel",
".",
"format",
"(",
"HELP_LINK_TEMPLATE",
",",
"version",
":",
"Version",
"::",
"STRING",
",",
"item",
":",
"name_to_param",
"(",
"subject",
")",
")",
"end"
] | Build link to the documentation about the given subject for the current
version of Reek. The subject can be either a smell type like
'FeatureEnvy' or a general subject like 'Rake Task'.
@param subject [String]
@return [String] the full URL for the relevant documentation | [
"Build",
"link",
"to",
"the",
"documentation",
"about",
"the",
"given",
"subject",
"for",
"the",
"current",
"version",
"of",
"Reek",
".",
"The",
"subject",
"can",
"be",
"either",
"a",
"smell",
"type",
"like",
"FeatureEnvy",
"or",
"a",
"general",
"subject",
... | 8c6b5c0c6228a6981ab48543457889f9ea984054 | https://github.com/troessner/reek/blob/8c6b5c0c6228a6981ab48543457889f9ea984054/lib/reek/documentation_link.rb#L16-L18 | train | Build the link for the given subject | [
30522,
13366,
3857,
1006,
3395,
1007,
16293,
1012,
4289,
1006,
2393,
1035,
4957,
1035,
23561,
1010,
2544,
1024,
2544,
1024,
1024,
5164,
1010,
8875,
1024,
2171,
1035,
2000,
1035,
11498,
2213,
1006,
3395,
1007,
1007,
2203,
102,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activerecord/lib/active_record/relation/calculations.rb | ActiveRecord.Calculations.column_alias_for | def column_alias_for(field)
return field if field.match?(/\A\w{,#{connection.table_alias_length}}\z/)
column_alias = +field
column_alias.gsub!(/\*/, "all")
column_alias.gsub!(/\W+/, " ")
column_alias.strip!
column_alias.gsub!(/ +/, "_")
connection.table_alias_for(column_alias)
end | ruby | def column_alias_for(field)
return field if field.match?(/\A\w{,#{connection.table_alias_length}}\z/)
column_alias = +field
column_alias.gsub!(/\*/, "all")
column_alias.gsub!(/\W+/, " ")
column_alias.strip!
column_alias.gsub!(/ +/, "_")
connection.table_alias_for(column_alias)
end | [
"def",
"column_alias_for",
"(",
"field",
")",
"return",
"field",
"if",
"field",
".",
"match?",
"(",
"/",
"\\A",
"\\w",
"#{",
"connection",
".",
"table_alias_length",
"}",
"\\z",
"/",
")",
"column_alias",
"=",
"+",
"field",
"column_alias",
".",
"gsub!",
"("... | Converts the given field to the value that the database adapter returns as
a usable column name:
column_alias_for("users.id") # => "users_id"
column_alias_for("sum(id)") # => "sum_id"
column_alias_for("count(distinct users.id)") # => "count_distinct_users_id"
column_alias_for("count(*)") # => "count_all" | [
"Converts",
"the",
"given",
"field",
"to",
"the",
"value",
"that",
"the",
"database",
"adapter",
"returns",
"as",
"a",
"usable",
"column",
"name",
":"
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activerecord/lib/active_record/relation/calculations.rb#L376-L386 | train | Returns the column alias for the given field | [
30522,
13366,
5930,
1035,
14593,
1035,
2005,
1006,
2492,
1007,
2709,
2492,
2065,
2492,
1012,
2674,
1029,
1006,
1013,
1032,
1037,
1032,
1059,
1063,
1010,
1001,
1063,
4434,
1012,
2795,
1035,
14593,
1035,
3091,
1065,
1065,
1032,
1062,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
roo-rb/roo | lib/roo/open_office.rb | Roo.OpenOffice.find_cipher_key | def find_cipher_key(*args)
fail ArgumentError, 'Unknown key derivation name ', args[1] unless args[1] == 'PBKDF2'
::OpenSSL::PKCS5.pbkdf2_hmac_sha1(args[2], args[3], args[4], args[0].key_len)
end | ruby | def find_cipher_key(*args)
fail ArgumentError, 'Unknown key derivation name ', args[1] unless args[1] == 'PBKDF2'
::OpenSSL::PKCS5.pbkdf2_hmac_sha1(args[2], args[3], args[4], args[0].key_len)
end | [
"def",
"find_cipher_key",
"(",
"*",
"args",
")",
"fail",
"ArgumentError",
",",
"'Unknown key derivation name '",
",",
"args",
"[",
"1",
"]",
"unless",
"args",
"[",
"1",
"]",
"==",
"'PBKDF2'",
"::",
"OpenSSL",
"::",
"PKCS5",
".",
"pbkdf2_hmac_sha1",
"(",
"arg... | Create a cipher key based on an ODS algorithm string from manifest.xml | [
"Create",
"a",
"cipher",
"key",
"based",
"on",
"an",
"ODS",
"algorithm",
"string",
"from",
"manifest",
".",
"xml"
] | 4ec1104f0c3c2a29711c0c907371cd2be12bcc3c | https://github.com/roo-rb/roo/blob/4ec1104f0c3c2a29711c0c907371cd2be12bcc3c/lib/roo/open_office.rb#L361-L365 | train | Find the cipher key | [
30522,
13366,
2424,
1035,
27715,
1035,
3145,
1006,
1008,
12098,
5620,
1007,
8246,
30524,
7480,
14540,
1024,
1024,
1052,
2243,
6169,
2629,
1012,
1052,
2497,
2243,
20952,
2475,
1035,
20287,
6305,
1035,
21146,
2487,
1006,
12098,
5620,
1031,
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... |
GeorgeKaraszi/ActiveRecordExtended | lib/active_record_extended/query_methods/where_chain.rb | ActiveRecordExtended.WhereChain.contains | def contains(opts, *rest)
build_where_chain(opts, rest) do |arel|
case arel
when Arel::Nodes::In, Arel::Nodes::Equality
column = left_column(arel) || column_from_association(arel)
if [:hstore, :jsonb].include?(column.type)
Arel::Nodes::ContainsHStore.new(arel.left, arel.right)
elsif column.try(:array)
Arel::Nodes::ContainsArray.new(arel.left, arel.right)
else
raise ArgumentError, "Invalid argument for .where.contains(), got #{arel.class}"
end
else
raise ArgumentError, "Invalid argument for .where.contains(), got #{arel.class}"
end
end
end | ruby | def contains(opts, *rest)
build_where_chain(opts, rest) do |arel|
case arel
when Arel::Nodes::In, Arel::Nodes::Equality
column = left_column(arel) || column_from_association(arel)
if [:hstore, :jsonb].include?(column.type)
Arel::Nodes::ContainsHStore.new(arel.left, arel.right)
elsif column.try(:array)
Arel::Nodes::ContainsArray.new(arel.left, arel.right)
else
raise ArgumentError, "Invalid argument for .where.contains(), got #{arel.class}"
end
else
raise ArgumentError, "Invalid argument for .where.contains(), got #{arel.class}"
end
end
end | [
"def",
"contains",
"(",
"opts",
",",
"*",
"rest",
")",
"build_where_chain",
"(",
"opts",
",",
"rest",
")",
"do",
"|",
"arel",
"|",
"case",
"arel",
"when",
"Arel",
"::",
"Nodes",
"::",
"In",
",",
"Arel",
"::",
"Nodes",
"::",
"Equality",
"column",
"=",... | Finds Records that contains a nested set elements
Array Column Type:
User.where.contains(tags: [1, 3])
# SELECT user.* FROM user WHERE user.tags @> {1,3}
HStore Column Type:
User.where.contains(data: { nickname: 'chainer' })
# SELECT user.* FROM user WHERE user.data @> 'nickname' => 'chainer'
JSONB Column Type:
User.where.contains(data: { nickname: 'chainer' })
# SELECT user.* FROM user WHERE user.data @> {'nickname': 'chainer'}
This can also be used along side joined tables
JSONB Column Type Example:
Tag.joins(:user).where.contains(user: { data: { nickname: 'chainer' } })
# SELECT tags.* FROM tags INNER JOIN user on user.id = tags.user_id WHERE user.data @> { nickname: 'chainer' } | [
"Finds",
"Records",
"that",
"contains",
"a",
"nested",
"set",
"elements"
] | aca74eebb64b9957a2c8765bef6e43c7d5736fd8 | https://github.com/GeorgeKaraszi/ActiveRecordExtended/blob/aca74eebb64b9957a2c8765bef6e43c7d5736fd8/lib/active_record_extended/query_methods/where_chain.rb#L46-L63 | train | Returns the where chain for the where statement. | [
30522,
13366,
3397,
1006,
23569,
2015,
1010,
1008,
2717,
1007,
3857,
1035,
2073,
1035,
4677,
1006,
23569,
2015,
1010,
2717,
1007,
2079,
1064,
2024,
2140,
1064,
2553,
2024,
2140,
2043,
2024,
2140,
1024,
1024,
14164,
1024,
1024,
1999,
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... |
jeremytregunna/ruby-trello | lib/trello/webhook.rb | Trello.Webhook.save | def save
# If we have an id, just update our fields.
return update! if id
from_response client.post("/webhooks", {
description: description,
idModel: id_model,
callbackURL: callback_url
})
end | ruby | def save
# If we have an id, just update our fields.
return update! if id
from_response client.post("/webhooks", {
description: description,
idModel: id_model,
callbackURL: callback_url
})
end | [
"def",
"save",
"# If we have an id, just update our fields.",
"return",
"update!",
"if",
"id",
"from_response",
"client",
".",
"post",
"(",
"\"/webhooks\"",
",",
"{",
"description",
":",
"description",
",",
"idModel",
":",
"id_model",
",",
"callbackURL",
":",
"callb... | Save the webhook.
@raise [Trello::Error] if the Webhook could not be saved.
@return [String] the JSON representation of the saved webhook. | [
"Save",
"the",
"webhook",
"."
] | ad79c9d8152ad5395b3b61c43170908f1912bfb2 | https://github.com/jeremytregunna/ruby-trello/blob/ad79c9d8152ad5395b3b61c43170908f1912bfb2/lib/trello/webhook.rb#L64-L73 | train | Save the current object to the cluster. | [
30522,
13366,
3828,
1001,
2065,
2057,
2031,
2019,
8909,
1010,
2074,
10651,
2256,
4249,
1012,
2709,
10651,
999,
2065,
8909,
2013,
1035,
3433,
7396,
1012,
2695,
1006,
1000,
1013,
4773,
6806,
6559,
2015,
1000,
1010,
1063,
6412,
1024,
6412,
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... |
ruby/rake | lib/rake/file_list.rb | Rake.FileList.sub! | def sub!(pat, rep)
each_with_index { |fn, i| self[i] = fn.sub(pat, rep) }
self
end | ruby | def sub!(pat, rep)
each_with_index { |fn, i| self[i] = fn.sub(pat, rep) }
self
end | [
"def",
"sub!",
"(",
"pat",
",",
"rep",
")",
"each_with_index",
"{",
"|",
"fn",
",",
"i",
"|",
"self",
"[",
"i",
"]",
"=",
"fn",
".",
"sub",
"(",
"pat",
",",
"rep",
")",
"}",
"self",
"end"
] | Same as +sub+ except that the original file list is modified. | [
"Same",
"as",
"+",
"sub",
"+",
"except",
"that",
"the",
"original",
"file",
"list",
"is",
"modified",
"."
] | 1c22b490ee6cb8bd614fa8d0d6145f671466206b | https://github.com/ruby/rake/blob/1c22b490ee6cb8bd614fa8d0d6145f671466206b/lib/rake/file_list.rb#L258-L261 | train | Sub - function that matches the pattern and replaces the replacement pattern with the replacement pattern. | [
30522,
13366,
4942,
999,
1006,
6986,
1010,
16360,
1007,
2169,
1035,
2007,
1035,
5950,
1063,
1064,
1042,
2078,
1010,
1045,
1064,
2969,
1031,
1045,
1033,
1027,
1042,
2078,
1012,
4942,
1006,
6986,
1010,
16360,
1007,
1065,
2969,
2203,
102,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2018-06-01-preview/generated/azure_mgmt_sql/managed_database_columns.rb | Azure::SQL::Mgmt::V2018_06_01_preview.ManagedDatabaseColumns.list_by_table_next | def list_by_table_next(next_page_link, custom_headers:nil)
response = list_by_table_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_table_next(next_page_link, custom_headers:nil)
response = list_by_table_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_table_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_table_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"response",... | List managed database columns
@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 [DatabaseColumnListResult] operation results. | [
"List",
"managed",
"database",
"columns"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2018-06-01-preview/generated/azure_mgmt_sql/managed_database_columns.rb#L267-L270 | train | Gets the list of the elastic network tables. | [
30522,
13366,
2862,
1035,
2011,
1035,
2795,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
2795,
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... |
awesome-print/awesome_print | lib/awesome_print/core_ext/logger.rb | AwesomePrint.Logger.ap | def ap(object, level = nil)
level ||= AwesomePrint.defaults[:log_level] if AwesomePrint.defaults
level ||= :debug
send level, object.ai
end | ruby | def ap(object, level = nil)
level ||= AwesomePrint.defaults[:log_level] if AwesomePrint.defaults
level ||= :debug
send level, object.ai
end | [
"def",
"ap",
"(",
"object",
",",
"level",
"=",
"nil",
")",
"level",
"||=",
"AwesomePrint",
".",
"defaults",
"[",
":log_level",
"]",
"if",
"AwesomePrint",
".",
"defaults",
"level",
"||=",
":debug",
"send",
"level",
",",
"object",
".",
"ai",
"end"
] | Add ap method to logger
------------------------------------------------------------------------------ | [
"Add",
"ap",
"method",
"to",
"logger",
"------------------------------------------------------------------------------"
] | 4564fd74721562cbef2443f7d97109bf9192343d | https://github.com/awesome-print/awesome_print/blob/4564fd74721562cbef2443f7d97109bf9192343d/lib/awesome_print/core_ext/logger.rb#L11-L15 | train | Send a log message to the log | [
30522,
13366,
9706,
1006,
4874,
1010,
2504,
1027,
9152,
2140,
1007,
2504,
1064,
1064,
1027,
12476,
16550,
1012,
12398,
2015,
1031,
1024,
8833,
1035,
2504,
1033,
2065,
12476,
16550,
1012,
12398,
2015,
2504,
1064,
1064,
1027,
1024,
2139,
8569... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
meew0/discordrb | lib/discordrb/data/server.rb | Discordrb.Server.update_role_positions | def update_role_positions(role_positions)
response = JSON.parse(API::Server.update_role_positions(@bot.token, @id, role_positions))
response.each do |data|
updated_role = Role.new(data, @bot, self)
role(updated_role.id).update_from(updated_role)
end
end | ruby | def update_role_positions(role_positions)
response = JSON.parse(API::Server.update_role_positions(@bot.token, @id, role_positions))
response.each do |data|
updated_role = Role.new(data, @bot, self)
role(updated_role.id).update_from(updated_role)
end
end | [
"def",
"update_role_positions",
"(",
"role_positions",
")",
"response",
"=",
"JSON",
".",
"parse",
"(",
"API",
"::",
"Server",
".",
"update_role_positions",
"(",
"@bot",
".",
"token",
",",
"@id",
",",
"role_positions",
")",
")",
"response",
".",
"each",
"do"... | Updates the positions of all roles on the server
@note For internal use only
@!visibility private | [
"Updates",
"the",
"positions",
"of",
"all",
"roles",
"on",
"the",
"server"
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/data/server.rb#L380-L386 | train | Update the role positions of the current role. | [
30522,
13366,
10651,
1035,
2535,
1035,
4460,
1006,
2535,
1035,
4460,
1007,
3433,
1027,
1046,
3385,
1012,
11968,
3366,
1006,
17928,
1024,
1024,
8241,
1012,
10651,
1035,
2535,
1035,
4460,
1006,
1030,
28516,
1012,
19204,
1010,
1030,
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... |
floere/phony | lib/phony/country.rb | Phony.Country.normalize | def normalize national_number
clean! national_number
normalized = @codes.reduce national_number do |number, code|
result = code.normalize number
break result if result
number
end
normalized
end | ruby | def normalize national_number
clean! national_number
normalized = @codes.reduce national_number do |number, code|
result = code.normalize number
break result if result
number
end
normalized
end | [
"def",
"normalize",
"national_number",
"clean!",
"national_number",
"normalized",
"=",
"@codes",
".",
"reduce",
"national_number",
"do",
"|",
"number",
",",
"code",
"|",
"result",
"=",
"code",
".",
"normalize",
"number",
"break",
"result",
"if",
"result",
"numbe... | Removes 0s from partially normalized numbers
such as 410443643533.
Example:
410443643533 -> 41443643533
In some cases it doesn't, like Italy. | [
"Removes",
"0s",
"from",
"partially",
"normalized",
"numbers",
"such",
"as",
"410443643533",
"."
] | 9ca50743499cf478a25fdb927bcdacd29d2c90c7 | https://github.com/floere/phony/blob/9ca50743499cf478a25fdb927bcdacd29d2c90c7/lib/phony/country.rb#L159-L167 | train | Normalize the national number | [
30522,
13366,
3671,
4697,
2120,
1035,
2193,
4550,
999,
2120,
1035,
2193,
3671,
3550,
1027,
1030,
9537,
1012,
5547,
2120,
1035,
2193,
2079,
1064,
2193,
1010,
3642,
1064,
2765,
1027,
3642,
1012,
3671,
4697,
2193,
3338,
2765,
2065,
2765,
219... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
octokit/octokit.rb | lib/octokit/connection.rb | Octokit.Connection.agent | def agent
@agent ||= Sawyer::Agent.new(endpoint, sawyer_options) do |http|
http.headers[:accept] = default_media_type
http.headers[:content_type] = "application/json"
http.headers[:user_agent] = user_agent
if basic_authenticated?
http.basic_auth(@login, @password)
elsif token_authenticated?
http.authorization 'token', @access_token
elsif bearer_authenticated?
http.authorization 'Bearer', @bearer_token
elsif application_authenticated?
http.params = http.params.merge application_authentication
end
end
end | ruby | def agent
@agent ||= Sawyer::Agent.new(endpoint, sawyer_options) do |http|
http.headers[:accept] = default_media_type
http.headers[:content_type] = "application/json"
http.headers[:user_agent] = user_agent
if basic_authenticated?
http.basic_auth(@login, @password)
elsif token_authenticated?
http.authorization 'token', @access_token
elsif bearer_authenticated?
http.authorization 'Bearer', @bearer_token
elsif application_authenticated?
http.params = http.params.merge application_authentication
end
end
end | [
"def",
"agent",
"@agent",
"||=",
"Sawyer",
"::",
"Agent",
".",
"new",
"(",
"endpoint",
",",
"sawyer_options",
")",
"do",
"|",
"http",
"|",
"http",
".",
"headers",
"[",
":accept",
"]",
"=",
"default_media_type",
"http",
".",
"headers",
"[",
":content_type",... | Hypermedia agent for the GitHub API
@return [Sawyer::Agent] | [
"Hypermedia",
"agent",
"for",
"the",
"GitHub",
"API"
] | ddf750601529a6a7da5fe5293d10031709b8605d | https://github.com/octokit/octokit.rb/blob/ddf750601529a6a7da5fe5293d10031709b8605d/lib/octokit/connection.rb#L104-L119 | train | Returns an HTTP response object | [
30522,
13366,
4005,
1030,
4005,
1064,
1064,
1027,
13975,
1024,
1024,
4005,
1012,
2047,
1006,
2203,
8400,
1010,
13975,
1035,
7047,
1007,
2079,
1064,
8299,
1064,
8299,
1012,
20346,
2015,
1031,
1024,
5138,
1033,
1027,
12398,
1035,
2865,
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/haml-lint | lib/haml_lint/document.rb | HamlLint.Document.convert_tree | def convert_tree(haml_node, parent = nil)
new_node = @node_transformer.transform(haml_node)
new_node.parent = parent
new_node.children = haml_node.children.map do |child|
convert_tree(child, new_node)
end
new_node
end | ruby | def convert_tree(haml_node, parent = nil)
new_node = @node_transformer.transform(haml_node)
new_node.parent = parent
new_node.children = haml_node.children.map do |child|
convert_tree(child, new_node)
end
new_node
end | [
"def",
"convert_tree",
"(",
"haml_node",
",",
"parent",
"=",
"nil",
")",
"new_node",
"=",
"@node_transformer",
".",
"transform",
"(",
"haml_node",
")",
"new_node",
".",
"parent",
"=",
"parent",
"new_node",
".",
"children",
"=",
"haml_node",
".",
"children",
... | Converts a HAML parse tree to a tree of {HamlLint::Tree::Node} objects.
This provides a cleaner interface with which the linters can interact with
the parse tree.
@param haml_node [Haml::Parser::ParseNode]
@param parent [Haml::Tree::Node]
@return [Haml::Tree::Node] | [
"Converts",
"a",
"HAML",
"parse",
"tree",
"to",
"a",
"tree",
"of",
"{",
"HamlLint",
"::",
"Tree",
"::",
"Node",
"}",
"objects",
"."
] | 024c773667e54cf88db938c2b368977005d70ee8 | https://github.com/sds/haml-lint/blob/024c773667e54cf88db938c2b368977005d70ee8/lib/haml_lint/document.rb#L78-L87 | train | Convert a Haml node to a Haml tree | [
30522,
13366,
10463,
1035,
3392,
1006,
10654,
2140,
1035,
13045,
1010,
6687,
1027,
9152,
2140,
1007,
2047,
1035,
13045,
1027,
1030,
13045,
1035,
10938,
2121,
1012,
10938,
1006,
10654,
2140,
1035,
13045,
1007,
2047,
1035,
13045,
1012,
6687,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
zendesk/ruby-kafka | lib/kafka/consumer.rb | Kafka.Consumer.each_message | def each_message(min_bytes: 1, max_bytes: 10485760, max_wait_time: 1, automatically_mark_as_processed: true)
@fetcher.configure(
min_bytes: min_bytes,
max_bytes: max_bytes,
max_wait_time: max_wait_time,
)
consumer_loop do
batches = fetch_batches
batches.each do |batch|
batch.messages.each do |message|
notification = {
topic: message.topic,
partition: message.partition,
offset: message.offset,
offset_lag: batch.highwater_mark_offset - message.offset - 1,
create_time: message.create_time,
key: message.key,
value: message.value,
headers: message.headers
}
# Instrument an event immediately so that subscribers don't have to wait until
# the block is completed.
@instrumenter.instrument("start_process_message.consumer", notification)
@instrumenter.instrument("process_message.consumer", notification) do
begin
yield message unless message.is_control_record
@current_offsets[message.topic][message.partition] = message.offset
rescue => e
location = "#{message.topic}/#{message.partition} at offset #{message.offset}"
backtrace = e.backtrace.join("\n")
@logger.error "Exception raised when processing #{location} -- #{e.class}: #{e}\n#{backtrace}"
raise ProcessingError.new(message.topic, message.partition, message.offset)
end
end
mark_message_as_processed(message) if automatically_mark_as_processed
@offset_manager.commit_offsets_if_necessary
trigger_heartbeat
return if shutting_down?
end
# We've successfully processed a batch from the partition, so we can clear
# the pause.
pause_for(batch.topic, batch.partition).reset!
end
# We may not have received any messages, but it's still a good idea to
# commit offsets if we've processed messages in the last set of batches.
# This also ensures the offsets are retained if we haven't read any messages
# since the offset retention period has elapsed.
@offset_manager.commit_offsets_if_necessary
end
end | ruby | def each_message(min_bytes: 1, max_bytes: 10485760, max_wait_time: 1, automatically_mark_as_processed: true)
@fetcher.configure(
min_bytes: min_bytes,
max_bytes: max_bytes,
max_wait_time: max_wait_time,
)
consumer_loop do
batches = fetch_batches
batches.each do |batch|
batch.messages.each do |message|
notification = {
topic: message.topic,
partition: message.partition,
offset: message.offset,
offset_lag: batch.highwater_mark_offset - message.offset - 1,
create_time: message.create_time,
key: message.key,
value: message.value,
headers: message.headers
}
# Instrument an event immediately so that subscribers don't have to wait until
# the block is completed.
@instrumenter.instrument("start_process_message.consumer", notification)
@instrumenter.instrument("process_message.consumer", notification) do
begin
yield message unless message.is_control_record
@current_offsets[message.topic][message.partition] = message.offset
rescue => e
location = "#{message.topic}/#{message.partition} at offset #{message.offset}"
backtrace = e.backtrace.join("\n")
@logger.error "Exception raised when processing #{location} -- #{e.class}: #{e}\n#{backtrace}"
raise ProcessingError.new(message.topic, message.partition, message.offset)
end
end
mark_message_as_processed(message) if automatically_mark_as_processed
@offset_manager.commit_offsets_if_necessary
trigger_heartbeat
return if shutting_down?
end
# We've successfully processed a batch from the partition, so we can clear
# the pause.
pause_for(batch.topic, batch.partition).reset!
end
# We may not have received any messages, but it's still a good idea to
# commit offsets if we've processed messages in the last set of batches.
# This also ensures the offsets are retained if we haven't read any messages
# since the offset retention period has elapsed.
@offset_manager.commit_offsets_if_necessary
end
end | [
"def",
"each_message",
"(",
"min_bytes",
":",
"1",
",",
"max_bytes",
":",
"10485760",
",",
"max_wait_time",
":",
"1",
",",
"automatically_mark_as_processed",
":",
"true",
")",
"@fetcher",
".",
"configure",
"(",
"min_bytes",
":",
"min_bytes",
",",
"max_bytes",
... | Fetches and enumerates the messages in the topics that the consumer group
subscribes to.
Each message is yielded to the provided block. If the block returns
without raising an exception, the message will be considered successfully
processed. At regular intervals the offset of the most recent successfully
processed message in each partition will be committed to the Kafka
offset store. If the consumer crashes or leaves the group, the group member
that is tasked with taking over processing of these partitions will resume
at the last committed offsets.
@param min_bytes [Integer] the minimum number of bytes to read before
returning messages from each broker; if `max_wait_time` is reached, this
is ignored.
@param max_bytes [Integer] the maximum number of bytes to read before
returning messages from each broker.
@param max_wait_time [Integer, Float] the maximum duration of time to wait before
returning messages from each broker, in seconds.
@param automatically_mark_as_processed [Boolean] whether to automatically
mark a message as successfully processed when the block returns
without an exception. Once marked successful, the offsets of processed
messages can be committed to Kafka.
@yieldparam message [Kafka::FetchedMessage] a message fetched from Kafka.
@raise [Kafka::ProcessingError] if there was an error processing a message.
The original exception will be returned by calling `#cause` on the
{Kafka::ProcessingError} instance.
@return [nil] | [
"Fetches",
"and",
"enumerates",
"the",
"messages",
"in",
"the",
"topics",
"that",
"the",
"consumer",
"group",
"subscribes",
"to",
"."
] | 2a73471b6a607a52dc85c79301ba522acb4566b5 | https://github.com/zendesk/ruby-kafka/blob/2a73471b6a607a52dc85c79301ba522acb4566b5/lib/kafka/consumer.rb#L204-L263 | train | Yields each message from the consumer | [
30522,
13366,
2169,
1035,
4471,
1006,
8117,
1035,
27507,
1024,
1015,
1010,
4098,
1035,
27507,
1024,
9645,
27531,
2581,
16086,
1010,
4098,
1035,
3524,
1035,
2051,
1024,
1015,
1010,
8073,
1035,
2928,
1035,
2004,
1035,
13995,
1024,
2995,
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_edgegateway/lib/2019-03-01/generated/azure_mgmt_edgegateway/triggers.rb | Azure::EdgeGateway::Mgmt::V2019_03_01.Triggers.get_with_http_info | def get_with_http_info(device_name, name, resource_group_name, custom_headers:nil)
get_async(device_name, name, resource_group_name, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(device_name, name, resource_group_name, custom_headers:nil)
get_async(device_name, name, resource_group_name, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"device_name",
",",
"name",
",",
"resource_group_name",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"device_name",
",",
"name",
",",
"resource_group_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
... | Get a specific trigger by name.
@param device_name [String] The device name.
@param name [String] The trigger name.
@param resource_group_name [String] The resource group name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Get",
"a",
"specific",
"trigger",
"by",
"name",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_edgegateway/lib/2019-03-01/generated/azure_mgmt_edgegateway/triggers.rb#L149-L151 | train | Gets the specified HDInsight product. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
5080,
1035,
2171,
1010,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2131,
1035,
2004,
6038,
2278,
1006,
5080,
1035,
2171,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/runbook_operations.rb | Azure::Automation::Mgmt::V2015_10_31.RunbookOperations.delete | def delete(resource_group_name, automation_account_name, runbook_name, custom_headers:nil)
response = delete_async(resource_group_name, automation_account_name, runbook_name, custom_headers:custom_headers).value!
nil
end | ruby | def delete(resource_group_name, automation_account_name, runbook_name, custom_headers:nil)
response = delete_async(resource_group_name, automation_account_name, runbook_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"delete",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"runbook_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_async",
"(",
"resource_group_name",
",",
"automation_account_name",
",",
"runbook_name",
",",
"custom_heade... | Delete the runbook by name.
@param resource_group_name [String] Name of an Azure Resource group.
@param automation_account_name [String] The name of the automation account.
@param runbook_name [String] The runbook name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Delete",
"the",
"runbook",
"by",
"name",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_automation/lib/2015-10-31/generated/azure_mgmt_automation/runbook_operations.rb#L478-L481 | train | Deletes a runbook. | [
30522,
13366,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
19309,
1035,
4070,
1035,
2171,
1010,
2448,
8654,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
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... |
piotrmurach/github | lib/github_api/client/gitignore.rb | Github.Client::Gitignore.list | def list(*args)
arguments(args)
response = get_request("/gitignore/templates", arguments.params)
return response unless block_given?
response.each { |el| yield el }
end | ruby | def list(*args)
arguments(args)
response = get_request("/gitignore/templates", arguments.params)
return response unless block_given?
response.each { |el| yield el }
end | [
"def",
"list",
"(",
"*",
"args",
")",
"arguments",
"(",
"args",
")",
"response",
"=",
"get_request",
"(",
"\"/gitignore/templates\"",
",",
"arguments",
".",
"params",
")",
"return",
"response",
"unless",
"block_given?",
"response",
".",
"each",
"{",
"|",
"el... | List all templates available to pass as an option
when creating a repository.
@see https://developer.github.com/v3/gitignore/#listing-available-templates
@example
github = Github.new
github.gitignore.list
github.gitignore.list { |template| ... }
@api public | [
"List",
"all",
"templates",
"available",
"to",
"pass",
"as",
"an",
"option",
"when",
"creating",
"a",
"repository",
"."
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/gitignore.rb#L20-L26 | train | List all the templates | [
30522,
13366,
2862,
1006,
1008,
12098,
5620,
1007,
9918,
1006,
12098,
5620,
1007,
3433,
1027,
2131,
1035,
5227,
1006,
1000,
1013,
21025,
3775,
26745,
2890,
1013,
23561,
2015,
1000,
1010,
9918,
1012,
11498,
5244,
1007,
2709,
3433,
4983,
3796... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-rds/lib/aws-sdk-rds/db_subnet_group.rb | Aws::RDS.DBSubnetGroup.modify | def modify(options = {})
options = options.merge(db_subnet_group_name: @name)
resp = @client.modify_db_subnet_group(options)
DBSubnetGroup.new(
name: resp.data.db_subnet_group.db_subnet_group_name,
data: resp.data.db_subnet_group,
client: @client
)
end | ruby | def modify(options = {})
options = options.merge(db_subnet_group_name: @name)
resp = @client.modify_db_subnet_group(options)
DBSubnetGroup.new(
name: resp.data.db_subnet_group.db_subnet_group_name,
data: resp.data.db_subnet_group,
client: @client
)
end | [
"def",
"modify",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"db_subnet_group_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"modify_db_subnet_group",
"(",
"options",
")",
"DBSubnetGroup",
".",
"new",
"(",
"nam... | @example Request syntax with placeholder values
dbsubnetgroup = db_subnet_group.modify({
db_subnet_group_description: "String",
subnet_ids: ["String"], # required
})
@param [Hash] options ({})
@option options [String] :db_subnet_group_description
The description for the DB subnet group.
@option options [required, Array<String>] :subnet_ids
The EC2 subnet IDs for the DB subnet group.
@return [DBSubnetGroup] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-rds/lib/aws-sdk-rds/db_subnet_group.rb#L254-L262 | train | Modify the DB Subnet Group | [
30522,
13366,
19933,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
16962,
1035,
4942,
7159,
1035,
2177,
1035,
2171,
1024,
1030,
2171,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
19933,
1035,
16962,
1035,
4942,
7159... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/workflows.rb | Azure::Logic::Mgmt::V2016_06_01.Workflows.validate_with_http_info | def validate_with_http_info(resource_group_name, location, workflow_name, workflow, custom_headers:nil)
validate_async(resource_group_name, location, workflow_name, workflow, custom_headers:custom_headers).value!
end | ruby | def validate_with_http_info(resource_group_name, location, workflow_name, workflow, custom_headers:nil)
validate_async(resource_group_name, location, workflow_name, workflow, custom_headers:custom_headers).value!
end | [
"def",
"validate_with_http_info",
"(",
"resource_group_name",
",",
"location",
",",
"workflow_name",
",",
"workflow",
",",
"custom_headers",
":",
"nil",
")",
"validate_async",
"(",
"resource_group_name",
",",
"location",
",",
"workflow_name",
",",
"workflow",
",",
"... | Validates the workflow definition.
@param resource_group_name [String] The resource group name.
@param location [String] The workflow location.
@param workflow_name [String] The workflow name.
@param workflow [Workflow] The workflow definition.
@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. | [
"Validates",
"the",
"workflow",
"definition",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_logic/lib/2016-06-01/generated/azure_mgmt_logic/workflows.rb#L1353-L1355 | train | Validates the specified workflow. | [
30522,
13366,
9398,
3686,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3295,
1010,
2147,
12314,
1035,
2171,
1010,
2147,
12314,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
9398,
3686,
1035,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
randym/axlsx | lib/axlsx/drawing/vml_shape.rb | Axlsx.VmlShape.to_xml_string | def to_xml_string(str ='')
str << <<SHAME_ON_YOU
<v:shape id="#{@id}" type="#_x0000_t202" fillcolor="#ffffa1 [80]" o:insetmode="auto"
style="visibility:#{@visible ? 'visible' : 'hidden'}">
<v:fill color2="#ffffa1 [80]"/>
<v:shadow on="t" obscured="t"/>
<v:path o:connecttype="none"/>
<v:textbox style='mso-fit-text-with-word-wrap:t'>
<div style='text-align:left'></div>
</v:textbox>
<x:ClientData ObjectType="Note">
<x:MoveWithCells/>
<x:SizeWithCells/>
<x:Anchor>#{left_column}, #{left_offset}, #{top_row}, #{top_offset}, #{right_column}, #{right_offset}, #{bottom_row}, #{bottom_offset}</x:Anchor>
<x:AutoFill>False</x:AutoFill>
<x:Row>#{row}</x:Row>
<x:Column>#{column}</x:Column>
#{@visible ? '<x:Visible/>' : ''}
</x:ClientData>
</v:shape>
SHAME_ON_YOU
end | ruby | def to_xml_string(str ='')
str << <<SHAME_ON_YOU
<v:shape id="#{@id}" type="#_x0000_t202" fillcolor="#ffffa1 [80]" o:insetmode="auto"
style="visibility:#{@visible ? 'visible' : 'hidden'}">
<v:fill color2="#ffffa1 [80]"/>
<v:shadow on="t" obscured="t"/>
<v:path o:connecttype="none"/>
<v:textbox style='mso-fit-text-with-word-wrap:t'>
<div style='text-align:left'></div>
</v:textbox>
<x:ClientData ObjectType="Note">
<x:MoveWithCells/>
<x:SizeWithCells/>
<x:Anchor>#{left_column}, #{left_offset}, #{top_row}, #{top_offset}, #{right_column}, #{right_offset}, #{bottom_row}, #{bottom_offset}</x:Anchor>
<x:AutoFill>False</x:AutoFill>
<x:Row>#{row}</x:Row>
<x:Column>#{column}</x:Column>
#{@visible ? '<x:Visible/>' : ''}
</x:ClientData>
</v:shape>
SHAME_ON_YOU
end | [
"def",
"to_xml_string",
"(",
"str",
"=",
"''",
")",
"str",
"<<",
"<<SHAME_ON_YOU",
"#{",
"@id",
"}",
"#{",
"@visible",
"?",
"'visible'",
":",
"'hidden'",
"}",
"#{",
"left_column",
"}",
"#{",
"left_offset",
"}",
"#{",
"top_row",
"}",
"#{",
"top_offset",
"... | serialize the shape to a string
@param [String] str
@return [String] | [
"serialize",
"the",
"shape",
"to",
"a",
"string"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/drawing/vml_shape.rb#L40-L64 | train | Returns a string representation of the object. | [
30522,
13366,
2000,
1035,
20950,
1035,
5164,
1006,
2358,
2099,
1027,
1005,
1005,
1007,
2358,
2099,
1026,
1026,
1026,
1026,
9467,
1035,
2006,
1035,
2017,
1026,
1058,
1024,
4338,
8909,
1027,
1000,
1001,
1063,
1030,
8909,
1065,
1000,
2828,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/api/v1_items_api.rb | SquareConnect.V1ItemsApi.create_item | def create_item(location_id, body, opts = {})
data, _status_code, _headers = create_item_with_http_info(location_id, body, opts)
return data
end | ruby | def create_item(location_id, body, opts = {})
data, _status_code, _headers = create_item_with_http_info(location_id, body, opts)
return data
end | [
"def",
"create_item",
"(",
"location_id",
",",
"body",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"create_item_with_http_info",
"(",
"location_id",
",",
"body",
",",
"opts",
")",
"return",
"data",
"end"
] | CreateItem
Creates an item and at least one variation for it. Item-related entities include fields you can use to associate them with entities in a non-Square system. When you create an item-related entity, you can optionally specify its `id`. This value must be unique among all IDs ever specified for the account, including those specified by other applications. You can never reuse an entity ID. If you do not specify an ID, Square generates one for the entity. Item variations have a `user_data` string that lets you associate arbitrary metadata with the variation. The string cannot exceed 255 characters.
@param location_id The ID of the location to create an item for.
@param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
@param [Hash] opts the optional parameters
@return [V1Item] | [
"CreateItem",
"Creates",
"an",
"item",
"and",
"at",
"least",
"one",
"variation",
"for",
"it",
".",
"Item",
"-",
"related",
"entities",
"include",
"fields",
"you",
"can",
"use",
"to",
"associate",
"them",
"with",
"entities",
"in",
"a",
"non",
"-",
"Square",... | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/v1_items_api.rb#L392-L395 | train | Creates an item | [
30522,
13366,
3443,
1035,
8875,
1006,
3295,
1035,
8909,
1010,
2303,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
3443,
1035,
8875,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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_application_info | def get_application_info(application_id, exclude_application_parameters:false, timeout:60, custom_headers:nil)
response = get_application_info_async(application_id, exclude_application_parameters:exclude_application_parameters, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_application_info(application_id, exclude_application_parameters:false, timeout:60, custom_headers:nil)
response = get_application_info_async(application_id, exclude_application_parameters:exclude_application_parameters, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_application_info",
"(",
"application_id",
",",
"exclude_application_parameters",
":",
"false",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_application_info_async",
"(",
"application_id",
",",
"exclude_application_... | Gets information about a Service Fabric application.
Returns the information about the application that was created or in the
process of being created in the Service Fabric cluster and whose name matches
the one specified as the parameter. The response includes the name, type,
status, parameters and other details about the application.
@param application_id [String] The identity of the application. This is
typically the full name of the application without the 'fabric:' URI scheme.
Starting from version 6.0, hierarchical names are delimited with the "~"
character.
For example, if the application name is "fabric:/myapp/app1", the application
identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
@param exclude_application_parameters [Boolean] The flag that specifies
whether application parameters will be excluded from the result.
@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 [ApplicationInfo] operation results. | [
"Gets",
"information",
"about",
"a",
"Service",
"Fabric",
"application",
"."
] | 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#L6677-L6680 | train | Gets information about the application. | [
30522,
13366,
2131,
1035,
4646,
1035,
18558,
1006,
4646,
1035,
8909,
1010,
23329,
1035,
4646,
1035,
11709,
1024,
6270,
1010,
2051,
5833,
1024,
3438,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
4646,
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... |
Dynamoid/dynamoid | lib/dynamoid/persistence.rb | Dynamoid.Persistence.persist | def persist(conditions = nil)
run_callbacks(:save) do
self.hash_key = SecureRandom.uuid if hash_key.blank?
# Add an exists check to prevent overwriting existing records with new ones
if new_record?
conditions ||= {}
(conditions[:unless_exists] ||= []) << self.class.hash_key
end
# Add an optimistic locking check if the lock_version column exists
if self.class.attributes[:lock_version]
conditions ||= {}
self.lock_version = (lock_version || 0) + 1
# Uses the original lock_version value from ActiveModel::Dirty in case user changed lock_version manually
(conditions[:if] ||= {})[:lock_version] = changes[:lock_version][0] if changes[:lock_version][0]
end
attributes_dumped = Dumping.dump_attributes(attributes, self.class.attributes)
begin
Dynamoid.adapter.write(self.class.table_name, attributes_dumped, conditions)
@new_record = false
true
rescue Dynamoid::Errors::ConditionalCheckFailedException => e
if new_record?
raise Dynamoid::Errors::RecordNotUnique.new(e, self)
else
raise Dynamoid::Errors::StaleObjectError.new(self, 'persist')
end
end
end
end | ruby | def persist(conditions = nil)
run_callbacks(:save) do
self.hash_key = SecureRandom.uuid if hash_key.blank?
# Add an exists check to prevent overwriting existing records with new ones
if new_record?
conditions ||= {}
(conditions[:unless_exists] ||= []) << self.class.hash_key
end
# Add an optimistic locking check if the lock_version column exists
if self.class.attributes[:lock_version]
conditions ||= {}
self.lock_version = (lock_version || 0) + 1
# Uses the original lock_version value from ActiveModel::Dirty in case user changed lock_version manually
(conditions[:if] ||= {})[:lock_version] = changes[:lock_version][0] if changes[:lock_version][0]
end
attributes_dumped = Dumping.dump_attributes(attributes, self.class.attributes)
begin
Dynamoid.adapter.write(self.class.table_name, attributes_dumped, conditions)
@new_record = false
true
rescue Dynamoid::Errors::ConditionalCheckFailedException => e
if new_record?
raise Dynamoid::Errors::RecordNotUnique.new(e, self)
else
raise Dynamoid::Errors::StaleObjectError.new(self, 'persist')
end
end
end
end | [
"def",
"persist",
"(",
"conditions",
"=",
"nil",
")",
"run_callbacks",
"(",
":save",
")",
"do",
"self",
".",
"hash_key",
"=",
"SecureRandom",
".",
"uuid",
"if",
"hash_key",
".",
"blank?",
"# Add an exists check to prevent overwriting existing records with new ones",
"... | Persist the object into the datastore. Assign it an id first if it doesn't have one.
@since 0.2.0 | [
"Persist",
"the",
"object",
"into",
"the",
"datastore",
".",
"Assign",
"it",
"an",
"id",
"first",
"if",
"it",
"doesn",
"t",
"have",
"one",
"."
] | 9e3d006b039e45877b003564ded65509b10b6354 | https://github.com/Dynamoid/dynamoid/blob/9e3d006b039e45877b003564ded65509b10b6354/lib/dynamoid/persistence.rb#L289-L321 | train | Persist the record to the database | [
30522,
13366,
29486,
1006,
3785,
1027,
9152,
2140,
1007,
2448,
1035,
2655,
12221,
1006,
1024,
3828,
1007,
2079,
2969,
1012,
23325,
1035,
3145,
1027,
5851,
13033,
5358,
1012,
1057,
21272,
2065,
23325,
1035,
3145,
1012,
8744,
1029,
1001,
5587... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
chef/chef-zero | lib/chef_zero/server.rb | ChefZero.Server.data_store | def data_store
@data_store ||= begin
result = @options[:data_store] || DataStore::DefaultFacade.new(DataStore::MemoryStoreV2.new, options[:single_org], options[:osc_compat])
if options[:single_org]
if !result.respond_to?(:interface_version) || result.interface_version == 1
result = ChefZero::DataStore::V1ToV2Adapter.new(result, options[:single_org])
result = ChefZero::DataStore::DefaultFacade.new(result, options[:single_org], options[:osc_compat])
end
else
if !result.respond_to?(:interface_version) || result.interface_version == 1
raise "Multi-org not supported by data store #{result}!"
end
end
result
end
end | ruby | def data_store
@data_store ||= begin
result = @options[:data_store] || DataStore::DefaultFacade.new(DataStore::MemoryStoreV2.new, options[:single_org], options[:osc_compat])
if options[:single_org]
if !result.respond_to?(:interface_version) || result.interface_version == 1
result = ChefZero::DataStore::V1ToV2Adapter.new(result, options[:single_org])
result = ChefZero::DataStore::DefaultFacade.new(result, options[:single_org], options[:osc_compat])
end
else
if !result.respond_to?(:interface_version) || result.interface_version == 1
raise "Multi-org not supported by data store #{result}!"
end
end
result
end
end | [
"def",
"data_store",
"@data_store",
"||=",
"begin",
"result",
"=",
"@options",
"[",
":data_store",
"]",
"||",
"DataStore",
"::",
"DefaultFacade",
".",
"new",
"(",
"DataStore",
"::",
"MemoryStoreV2",
".",
"new",
",",
"options",
"[",
":single_org",
"]",
",",
"... | The data store for this server (default is in-memory).
@return [ChefZero::DataStore] | [
"The",
"data",
"store",
"for",
"this",
"server",
"(",
"default",
"is",
"in",
"-",
"memory",
")",
"."
] | 5873d906942770a34f0cf0fed05973ec3240a275 | https://github.com/chef/chef-zero/blob/5873d906942770a34f0cf0fed05973ec3240a275/lib/chef_zero/server.rb#L187-L205 | train | Returns the data store | [
30522,
13366,
2951,
1035,
3573,
1030,
2951,
1035,
3573,
1064,
1064,
1027,
4088,
2765,
1027,
1030,
7047,
1031,
1024,
2951,
1035,
3573,
1033,
1064,
1064,
2951,
23809,
2063,
1024,
1024,
12398,
7011,
21869,
1012,
2047,
1006,
2951,
23809,
2063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activesupport/lib/active_support/core_ext/date_and_time/calculations.rb | DateAndTime.Calculations.prev_week | def prev_week(start_day = Date.beginning_of_week, same_time: false)
result = first_hour(weeks_ago(1).beginning_of_week.days_since(days_span(start_day)))
same_time ? copy_time_to(result) : result
end | ruby | def prev_week(start_day = Date.beginning_of_week, same_time: false)
result = first_hour(weeks_ago(1).beginning_of_week.days_since(days_span(start_day)))
same_time ? copy_time_to(result) : result
end | [
"def",
"prev_week",
"(",
"start_day",
"=",
"Date",
".",
"beginning_of_week",
",",
"same_time",
":",
"false",
")",
"result",
"=",
"first_hour",
"(",
"weeks_ago",
"(",
"1",
")",
".",
"beginning_of_week",
".",
"days_since",
"(",
"days_span",
"(",
"start_day",
"... | Returns a new date/time representing the given day in the previous week.
Week is assumed to start on +start_day+, default is
+Date.beginning_of_week+ or +config.beginning_of_week+ when set.
DateTime objects have their time set to 0:00 unless +same_time+ is true. | [
"Returns",
"a",
"new",
"date",
"/",
"time",
"representing",
"the",
"given",
"day",
"in",
"the",
"previous",
"week",
".",
"Week",
"is",
"assumed",
"to",
"start",
"on",
"+",
"start_day",
"+",
"default",
"is",
"+",
"Date",
".",
"beginning_of_week",
"+",
"or... | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/core_ext/date_and_time/calculations.rb#L220-L223 | train | Returns the next week of the week | [
30522,
13366,
3653,
2615,
1035,
2733,
1006,
2707,
1035,
2154,
1027,
3058,
1012,
2927,
1035,
1997,
1035,
2733,
1010,
2168,
1035,
2051,
1024,
6270,
1007,
2765,
1027,
2034,
1035,
3178,
1006,
3134,
1035,
3283,
1006,
1015,
1007,
1012,
2927,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_cdn/lib/2016-04-02/generated/azure_mgmt_cdn/profiles.rb | Azure::CDN::Mgmt::V2016_04_02.Profiles.delete_if_exists | def delete_if_exists(profile_name, resource_group_name, custom_headers:nil)
response = delete_if_exists_async(profile_name, resource_group_name, custom_headers:custom_headers).value!
nil
end | ruby | def delete_if_exists(profile_name, resource_group_name, custom_headers:nil)
response = delete_if_exists_async(profile_name, resource_group_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"delete_if_exists",
"(",
"profile_name",
",",
"resource_group_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_if_exists_async",
"(",
"profile_name",
",",
"resource_group_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
... | Deletes an existing CDN profile with the specified parameters. Deleting a
profile will result in the deletion of all subresources including endpoints,
origins and custom domains.
@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. | [
"Deletes",
"an",
"existing",
"CDN",
"profile",
"with",
"the",
"specified",
"parameters",
".",
"Deleting",
"a",
"profile",
"will",
"result",
"in",
"the",
"deletion",
"of",
"all",
"subresources",
"including",
"endpoints",
"origins",
"and",
"custom",
"domains",
"."... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_cdn/lib/2016-04-02/generated/azure_mgmt_cdn/profiles.rb#L412-L415 | train | Deletes the specified managed network interface. | [
30522,
13366,
3972,
12870,
1035,
2065,
1035,
6526,
1006,
6337,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
1035,
2065,
1035,
6526,
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... |
Anthony-Gaudino/jekyll-multiple-languages-plugin | lib/jekyll-multiple-languages-plugin.rb | Jekyll.Page.permalink | def permalink
return nil if data.nil? || data['permalink'].nil?
if site.config['relative_permalinks']
File.join(@dir, data['permalink'])
else
# Look if there's a permalink overwrite specified for this lang
data['permalink_'+site.config['lang']] || data['permalink']
end
end | ruby | def permalink
return nil if data.nil? || data['permalink'].nil?
if site.config['relative_permalinks']
File.join(@dir, data['permalink'])
else
# Look if there's a permalink overwrite specified for this lang
data['permalink_'+site.config['lang']] || data['permalink']
end
end | [
"def",
"permalink",
"return",
"nil",
"if",
"data",
".",
"nil?",
"||",
"data",
"[",
"'permalink'",
"]",
".",
"nil?",
"if",
"site",
".",
"config",
"[",
"'relative_permalinks'",
"]",
"File",
".",
"join",
"(",
"@dir",
",",
"data",
"[",
"'permalink'",
"]",
... | ======================================
permalink
====================================== | [
"======================================",
"permalink",
"======================================"
] | 85e0e7972e6a4f94d5e7ab470ff0360905e11e4a | https://github.com/Anthony-Gaudino/jekyll-multiple-languages-plugin/blob/85e0e7972e6a4f94d5e7ab470ff0360905e11e4a/lib/jekyll-multiple-languages-plugin.rb#L202-L212 | train | Returns the permalink object for this page | [
30522,
13366,
2566,
9067,
19839,
2709,
9152,
2140,
2065,
2951,
1012,
9152,
2140,
1029,
1064,
1064,
2951,
1031,
1005,
2566,
9067,
19839,
1005,
1033,
1012,
9152,
2140,
1029,
2065,
2609,
1012,
9530,
8873,
2290,
1031,
1005,
5816,
1035,
2566,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_mixedreality/lib/2019-02-28-preview/generated/azure_mgmt_mixedreality/spatial_anchors_accounts.rb | Azure::MixedReality::Mgmt::V2019_02_28_preview.SpatialAnchorsAccounts.get_keys | def get_keys(resource_group_name, spatial_anchors_account_name, custom_headers:nil)
response = get_keys_async(resource_group_name, spatial_anchors_account_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_keys(resource_group_name, spatial_anchors_account_name, custom_headers:nil)
response = get_keys_async(resource_group_name, spatial_anchors_account_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_keys",
"(",
"resource_group_name",
",",
"spatial_anchors_account_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_keys_async",
"(",
"resource_group_name",
",",
"spatial_anchors_account_name",
",",
"custom_headers",
":custom_headers",
")",
"... | Get Both of the 2 Keys of a Spatial Anchors Account
@param resource_group_name [String] Name of an Azure resource group.
@param spatial_anchors_account_name [String] Name of an Mixed Reality Spatial
Anchors Account.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [SpatialAnchorsAccountKeys] operation results. | [
"Get",
"Both",
"of",
"the",
"2",
"Keys",
"of",
"a",
"Spatial",
"Anchors",
"Account"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_mixedreality/lib/2019-02-28-preview/generated/azure_mgmt_mixedreality/spatial_anchors_accounts.rb#L641-L644 | train | Gets the keys for the specified spatial anchors account. | [
30522,
13366,
2131,
1035,
6309,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
13589,
1035,
24674,
1035,
4070,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
6309,
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_web/lib/2018-02-01/generated/azure_mgmt_web/diagnostics.rb | Azure::Web::Mgmt::V2018_02_01.Diagnostics.list_site_detectors_slot_as_lazy | def list_site_detectors_slot_as_lazy(resource_group_name, site_name, diagnostic_category, slot, custom_headers:nil)
response = list_site_detectors_slot_async(resource_group_name, site_name, diagnostic_category, slot, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_site_detectors_slot_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_site_detectors_slot_as_lazy(resource_group_name, site_name, diagnostic_category, slot, custom_headers:nil)
response = list_site_detectors_slot_async(resource_group_name, site_name, diagnostic_category, slot, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_site_detectors_slot_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_site_detectors_slot_as_lazy",
"(",
"resource_group_name",
",",
"site_name",
",",
"diagnostic_category",
",",
"slot",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_site_detectors_slot_async",
"(",
"resource_group_name",
",",
"site_name",
",",
... | Get Detectors
Get Detectors
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param site_name [String] Site Name
@param diagnostic_category [String] Diagnostic Category
@param slot [String] Slot Name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [DiagnosticDetectorCollection] which provide lazy access to pages of
the response. | [
"Get",
"Detectors"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/diagnostics.rb#L3805-L3814 | train | Gets all the detectors for a site. | [
30522,
13366,
2862,
1035,
2609,
1035,
25971,
1035,
10453,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2609,
1035,
2171,
1010,
16474,
1035,
4696,
1010,
10453,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
appsignal/rdkafka-ruby | lib/rdkafka/consumer.rb | Rdkafka.Consumer.query_watermark_offsets | def query_watermark_offsets(topic, partition, timeout_ms=200)
low = FFI::MemoryPointer.new(:int64, 1)
high = FFI::MemoryPointer.new(:int64, 1)
response = Rdkafka::Bindings.rd_kafka_query_watermark_offsets(
@native_kafka,
topic,
partition,
low,
high,
timeout_ms
)
if response != 0
raise Rdkafka::RdkafkaError.new(response, "Error querying watermark offsets for partition #{partition} of #{topic}")
end
return low.read_int64, high.read_int64
end | ruby | def query_watermark_offsets(topic, partition, timeout_ms=200)
low = FFI::MemoryPointer.new(:int64, 1)
high = FFI::MemoryPointer.new(:int64, 1)
response = Rdkafka::Bindings.rd_kafka_query_watermark_offsets(
@native_kafka,
topic,
partition,
low,
high,
timeout_ms
)
if response != 0
raise Rdkafka::RdkafkaError.new(response, "Error querying watermark offsets for partition #{partition} of #{topic}")
end
return low.read_int64, high.read_int64
end | [
"def",
"query_watermark_offsets",
"(",
"topic",
",",
"partition",
",",
"timeout_ms",
"=",
"200",
")",
"low",
"=",
"FFI",
"::",
"MemoryPointer",
".",
"new",
"(",
":int64",
",",
"1",
")",
"high",
"=",
"FFI",
"::",
"MemoryPointer",
".",
"new",
"(",
":int64"... | Query broker for low (oldest/beginning) and high (newest/end) offsets for a partition.
@param topic [String] The topic to query
@param partition [Integer] The partition to query
@param timeout_ms [Integer] The timeout for querying the broker
@raise [RdkafkaError] When querying the broker fails.
@return [Integer] The low and high watermark | [
"Query",
"broker",
"for",
"low",
"(",
"oldest",
"/",
"beginning",
")",
"and",
"high",
"(",
"newest",
"/",
"end",
")",
"offsets",
"for",
"a",
"partition",
"."
] | 87b3e0ddae5ea576847cb67228fcea06ec2a24d6 | https://github.com/appsignal/rdkafka-ruby/blob/87b3e0ddae5ea576847cb67228fcea06ec2a24d6/lib/rdkafka/consumer.rb#L188-L205 | train | Query watermark offsets for a topic and partition | [
30522,
13366,
23032,
1035,
2300,
10665,
1035,
16396,
2015,
1006,
8476,
1010,
13571,
1010,
2051,
5833,
1035,
5796,
1027,
3263,
1007,
2659,
1027,
21461,
2072,
1024,
1024,
3638,
8400,
2121,
1012,
2047,
1006,
1024,
20014,
21084,
1010,
1015,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/virtual_wans.rb | Azure::Network::Mgmt::V2018_07_01.VirtualWANs.begin_delete | def begin_delete(resource_group_name, virtual_wanname, custom_headers:nil)
response = begin_delete_async(resource_group_name, virtual_wanname, custom_headers:custom_headers).value!
nil
end | ruby | def begin_delete(resource_group_name, virtual_wanname, custom_headers:nil)
response = begin_delete_async(resource_group_name, virtual_wanname, custom_headers:custom_headers).value!
nil
end | [
"def",
"begin_delete",
"(",
"resource_group_name",
",",
"virtual_wanname",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_delete_async",
"(",
"resource_group_name",
",",
"virtual_wanname",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
... | Deletes a VirtualWAN.
@param resource_group_name [String] The resource group name of the
VirtualWan.
@param virtual_wanname [String] The name of the VirtualWAN being deleted.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Deletes",
"a",
"VirtualWAN",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/virtual_wans.rb#L687-L690 | train | Deletes a virtual wan. | [
30522,
13366,
4088,
1035,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
7484,
1035,
10587,
4168,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
3972,
12870,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-rds/lib/aws-sdk-rds/db_parameter_group.rb | Aws::RDS.DBParameterGroup.create | def create(options = {})
options = options.merge(db_parameter_group_name: @name)
resp = @client.create_db_parameter_group(options)
DBParameterGroup.new(
name: resp.data.db_parameter_group.db_parameter_group_name,
data: resp.data.db_parameter_group,
client: @client
)
end | ruby | def create(options = {})
options = options.merge(db_parameter_group_name: @name)
resp = @client.create_db_parameter_group(options)
DBParameterGroup.new(
name: resp.data.db_parameter_group.db_parameter_group_name,
data: resp.data.db_parameter_group,
client: @client
)
end | [
"def",
"create",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"db_parameter_group_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"create_db_parameter_group",
"(",
"options",
")",
"DBParameterGroup",
".",
"new",
"(... | @!group Actions
@example Request syntax with placeholder values
dbparametergroup = db_parameter_group.create({
db_parameter_group_family: "String", # required
description: "String", # required
tags: [
{
key: "String",
value: "String",
},
],
})
@param [Hash] options ({})
@option options [required, String] :db_parameter_group_family
The DB parameter group family name. A DB parameter group can be
associated with one and only one DB parameter group family, and can be
applied only to a DB instance running a database engine and engine
version compatible with that DB parameter group family.
To list all of the available parameter group families, use the
following command:
`aws rds describe-db-engine-versions --query
"DBEngineVersions[].DBParameterGroupFamily"`
<note markdown="1"> The output contains duplicates.
</note>
@option options [required, String] :description
The description for the DB parameter group.
@option options [Array<Types::Tag>] :tags
A list of tags. For more information, see [Tagging Amazon RDS
Resources][1] in the *Amazon RDS User Guide.*
[1]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.html
@return [DBParameterGroup] | [
"@!group",
"Actions",
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-rds/lib/aws-sdk-rds/db_parameter_group.rb#L224-L232 | train | Creates a DB Parameter Group | [
30522,
13366,
3443,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
16962,
1035,
16381,
1035,
2177,
1035,
2171,
1024,
1030,
2171,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
3443,
1035,
16962,
1035,
16381,
1035,
2177... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.2.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_2_0_9.ServiceFabricClientAPIs.get_service_event_list_with_http_info | def get_service_event_list_with_http_info(service_id, start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
get_service_event_list_async(service_id, 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!
end | ruby | def get_service_event_list_with_http_info(service_id, start_time_utc, end_time_utc, timeout:60, events_types_filter:nil, exclude_analysis_events:nil, skip_correlation_lookup:nil, custom_headers:nil)
get_service_event_list_async(service_id, 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!
end | [
"def",
"get_service_event_list_with_http_info",
"(",
"service_id",
",",
"start_time_utc",
",",
"end_time_utc",
",",
"timeout",
":",
"60",
",",
"events_types_filter",
":",
"nil",
",",
"exclude_analysis_events",
":",
"nil",
",",
"skip_correlation_lookup",
":",
"nil",
",... | Gets a Service-related events.
The response is list of ServiceEvent objects.
@param service_id [String] The identity of the service. This is typically the
full name of the service without the 'fabric:' URI scheme.
Starting from version 6.0, hierarchical names are delimited with the "~"
character.
For example, if the service name is "fabric:/myapp/app1/svc1", the service
identity would be "myapp~app1~svc1" in 6.0+ and "myapp/app1/svc1" in previous
versions.
@param 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 [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"a",
"Service",
"-",
"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#L28236-L28238 | train | Gets the service event list. | [
30522,
13366,
2131,
1035,
2326,
1035,
2724,
1035,
2862,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2326,
1035,
8909,
1010,
2707,
1035,
2051,
1035,
11396,
1010,
2203,
1035,
2051,
1035,
11396,
1010,
2051,
5833,
1024,
3438,
1010,
2824,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb | Azure::Web::Mgmt::V2018_02_01.AppServiceEnvironments.list_worker_pool_instance_metrics_next | def list_worker_pool_instance_metrics_next(next_page_link, custom_headers:nil)
response = list_worker_pool_instance_metrics_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_worker_pool_instance_metrics_next(next_page_link, custom_headers:nil)
response = list_worker_pool_instance_metrics_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_worker_pool_instance_metrics_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_worker_pool_instance_metrics_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
... | Get metrics for a specific instance of a worker pool of an App Service
Environment.
Get metrics for a specific instance of a worker pool of an 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",
"specific",
"instance",
"of",
"a",
"worker",
"pool",
"of",
"an",
"App",
"Service",
"Environment",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2018-02-01/generated/azure_mgmt_web/app_service_environments.rb#L6656-L6659 | train | Gets metrics for a worker pool instance. | [
30522,
13366,
2862,
1035,
7309,
1035,
4770,
1035,
6013,
1035,
12046,
2015,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
7309,
1035,
4770,
1035,
6013,
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... |
opal/opal | lib/opal/compiler.rb | Opal.Compiler.compile | def compile
parse
@fragments = re_raise_with_location { process(@sexp).flatten }
@fragments << fragment("\n", nil, s(:newline)) unless @fragments.last.code.end_with?("\n")
@result = @fragments.map(&:code).join('')
end | ruby | def compile
parse
@fragments = re_raise_with_location { process(@sexp).flatten }
@fragments << fragment("\n", nil, s(:newline)) unless @fragments.last.code.end_with?("\n")
@result = @fragments.map(&:code).join('')
end | [
"def",
"compile",
"parse",
"@fragments",
"=",
"re_raise_with_location",
"{",
"process",
"(",
"@sexp",
")",
".",
"flatten",
"}",
"@fragments",
"<<",
"fragment",
"(",
"\"\\n\"",
",",
"nil",
",",
"s",
"(",
":newline",
")",
")",
"unless",
"@fragments",
".",
"l... | Compile some ruby code to a string.
@return [String] javascript code | [
"Compile",
"some",
"ruby",
"code",
"to",
"a",
"string",
"."
] | 41aedc0fd62aab00d3c117ba0caf00206bedd981 | https://github.com/opal/opal/blob/41aedc0fd62aab00d3c117ba0caf00206bedd981/lib/opal/compiler.rb#L172-L179 | train | Parse the sequence of code and return the result. | [
30522,
13366,
4012,
22090,
11968,
3366,
1030,
10341,
1027,
2128,
1035,
5333,
1035,
2007,
1035,
3295,
1063,
2832,
1006,
1030,
3348,
2361,
1007,
1012,
4257,
6528,
1065,
1030,
10341,
1026,
1026,
15778,
1006,
1000,
1032,
1050,
1000,
1010,
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 | 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_deployed_application_health | def get_deployed_application_health(node_name, application_id, events_health_state_filter:0, deployed_service_packages_health_state_filter:0, exclude_health_statistics:false, timeout:60, custom_headers:nil)
response = get_deployed_application_health_async(node_name, application_id, events_health_state_filter:events_health_state_filter, deployed_service_packages_health_state_filter:deployed_service_packages_health_state_filter, exclude_health_statistics:exclude_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_deployed_application_health(node_name, application_id, events_health_state_filter:0, deployed_service_packages_health_state_filter:0, exclude_health_statistics:false, timeout:60, custom_headers:nil)
response = get_deployed_application_health_async(node_name, application_id, events_health_state_filter:events_health_state_filter, deployed_service_packages_health_state_filter:deployed_service_packages_health_state_filter, exclude_health_statistics:exclude_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_deployed_application_health",
"(",
"node_name",
",",
"application_id",
",",
"events_health_state_filter",
":",
"0",
",",
"deployed_service_packages_health_state_filter",
":",
"0",
",",
"exclude_health_statistics",
":",
"false",
",",
"timeout",
":",
"60",
",",
... | Gets the information about health of an application deployed on a Service
Fabric node.
Gets the information about health of an application deployed on a Service
Fabric node. Use EventsHealthStateFilter to optionally filter for the
collection of HealthEvent objects reported on the deployed application based
on health state. Use DeployedServicePackagesHealthStateFilter to optionally
filter for DeployedServicePackageHealth children based on health state.
@param node_name [String] The name of the node.
@param application_id [String] The identity of the application. This is
typically the full name of the application without the 'fabric:' URI scheme.
Starting from version 6.0, hierarchical names are delimited with the "~"
character.
For example, if the application name is "fabric:/myapp/app1", the application
identity would be "myapp~app1" in 6.0+ and "myapp/app1" in previous versions.
@param 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 deployed_service_packages_health_state_filter [Integer] Allows
filtering of the deployed service package health state objects returned in
the result of deployed application health query based on their health state.
The possible values for this parameter include integer value of one of the
following health states.
Only deployed service packages that match the filter are returned. All
deployed service packages are used to evaluate the aggregated health state of
the deployed application.
If not specified, all entries are returned.
The state values are flag based enumeration, so the value can be a
combination of these value obtained using bitwise 'OR' operator.
For example, if the provided value is 6 then health state of service packages
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 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 [DeployedApplicationHealth] operation results. | [
"Gets",
"the",
"information",
"about",
"health",
"of",
"an",
"application",
"deployed",
"on",
"a",
"Service",
"Fabric",
"node",
"."
] | 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#L8783-L8786 | train | Gets the health of the specified application. | [
30522,
13366,
2131,
1035,
7333,
1035,
4646,
1035,
2740,
1006,
13045,
1035,
2171,
1010,
4646,
1035,
8909,
1010,
2824,
1035,
2740,
1035,
2110,
1035,
11307,
1024,
1014,
1010,
7333,
1035,
2326,
1035,
14555,
1035,
2740,
1035,
2110,
1035,
11307,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/examples.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Examples.add_with_http_info | def add_with_http_info(app_id, version_id, example_label_object, custom_headers:nil)
add_async(app_id, version_id, example_label_object, custom_headers:custom_headers).value!
end | ruby | def add_with_http_info(app_id, version_id, example_label_object, custom_headers:nil)
add_async(app_id, version_id, example_label_object, custom_headers:custom_headers).value!
end | [
"def",
"add_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"example_label_object",
",",
"custom_headers",
":",
"nil",
")",
"add_async",
"(",
"app_id",
",",
"version_id",
",",
"example_label_object",
",",
"custom_headers",
":custom_headers",
")",
".",
"value... | Adds a labeled example utterance in a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param example_label_object [ExampleLabelObject] A labeled example utterance
with the expected intent and entities.
@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",
"labeled",
"example",
"utterance",
"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/examples.rb#L53-L55 | train | Adds an example to the application version. | [
30522,
13366,
5587,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
2742,
1035,
3830,
1035,
4874,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
5587,
1035,
2004,
6038,
2278,
1006,
10439,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.validate_custom_domain | def validate_custom_domain(resource_group_name, profile_name, endpoint_name, custom_domain_properties, custom_headers:nil)
response = validate_custom_domain_async(resource_group_name, profile_name, endpoint_name, custom_domain_properties, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def validate_custom_domain(resource_group_name, profile_name, endpoint_name, custom_domain_properties, custom_headers:nil)
response = validate_custom_domain_async(resource_group_name, profile_name, endpoint_name, custom_domain_properties, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"validate_custom_domain",
"(",
"resource_group_name",
",",
"profile_name",
",",
"endpoint_name",
",",
"custom_domain_properties",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"validate_custom_domain_async",
"(",
"resource_group_name",
",",
"profile_name",... | Validates the custom domain mapping to ensure it maps to the correct CDN
endpoint in DNS.
@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_properties [ValidateCustomDomainInput] Custom domain to
be validated.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ValidateCustomDomainOutput] operation results. | [
"Validates",
"the",
"custom",
"domain",
"mapping",
"to",
"ensure",
"it",
"maps",
"to",
"the",
"correct",
"CDN",
"endpoint",
"in",
"DNS",
"."
] | 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#L619-L622 | train | Validates the specified custom domain. | [
30522,
13366,
9398,
3686,
1035,
7661,
1035,
5884,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
6337,
1035,
2171,
1010,
2203,
8400,
1035,
2171,
1010,
7661,
1035,
5884,
1035,
5144,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
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... |
sporkmonger/addressable | lib/addressable/uri.rb | Addressable.URI.host= | def host=(new_host)
if new_host && !new_host.respond_to?(:to_str)
raise TypeError, "Can't convert #{new_host.class} into String."
end
@host = new_host ? new_host.to_str : nil
# Reset dependent values
remove_instance_variable(:@authority) if defined?(@authority)
remove_instance_variable(:@normalized_host) if defined?(@normalized_host)
remove_composite_values
# Ensure we haven't created an invalid URI
validate()
end | ruby | def host=(new_host)
if new_host && !new_host.respond_to?(:to_str)
raise TypeError, "Can't convert #{new_host.class} into String."
end
@host = new_host ? new_host.to_str : nil
# Reset dependent values
remove_instance_variable(:@authority) if defined?(@authority)
remove_instance_variable(:@normalized_host) if defined?(@normalized_host)
remove_composite_values
# Ensure we haven't created an invalid URI
validate()
end | [
"def",
"host",
"=",
"(",
"new_host",
")",
"if",
"new_host",
"&&",
"!",
"new_host",
".",
"respond_to?",
"(",
":to_str",
")",
"raise",
"TypeError",
",",
"\"Can't convert #{new_host.class} into String.\"",
"end",
"@host",
"=",
"new_host",
"?",
"new_host",
".",
"to_... | Sets the host component for this URI.
@param [String, #to_str] new_host The new host component. | [
"Sets",
"the",
"host",
"component",
"for",
"this",
"URI",
"."
] | 5894c95a7768435cb46d1355954611dbd194832e | https://github.com/sporkmonger/addressable/blob/5894c95a7768435cb46d1355954611dbd194832e/lib/addressable/uri.rb#L1125-L1138 | train | Set the host attribute of this URI. | [
30522,
13366,
3677,
1027,
1006,
2047,
1035,
3677,
1007,
2065,
2047,
1035,
3677,
1004,
1004,
999,
2047,
1035,
3677,
1012,
6869,
1035,
2000,
1029,
1006,
1024,
2000,
1035,
2358,
2099,
1007,
5333,
2828,
2121,
29165,
1010,
1000,
2064,
1005,
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... |
Eric-Guo/wechat | lib/wechat/cipher.rb | Wechat.Cipher.pack | def pack(content, app_id)
random = SecureRandom.hex(8)
text = content.force_encoding('ASCII-8BIT')
msg_len = [text.length].pack('N')
encode_padding("#{random}#{msg_len}#{text}#{app_id}")
end | ruby | def pack(content, app_id)
random = SecureRandom.hex(8)
text = content.force_encoding('ASCII-8BIT')
msg_len = [text.length].pack('N')
encode_padding("#{random}#{msg_len}#{text}#{app_id}")
end | [
"def",
"pack",
"(",
"content",
",",
"app_id",
")",
"random",
"=",
"SecureRandom",
".",
"hex",
"(",
"8",
")",
"text",
"=",
"content",
".",
"force_encoding",
"(",
"'ASCII-8BIT'",
")",
"msg_len",
"=",
"[",
"text",
".",
"length",
"]",
".",
"pack",
"(",
"... | app_id or corp_id | [
"app_id",
"or",
"corp_id"
] | 2adcd4b3ad30cfe74930dec3ed8c7f4fdb1e6ec9 | https://github.com/Eric-Guo/wechat/blob/2adcd4b3ad30cfe74930dec3ed8c7f4fdb1e6ec9/lib/wechat/cipher.rb#L32-L38 | train | Packs a string into a byte array. | [
30522,
13366,
5308,
1006,
4180,
1010,
10439,
1035,
8909,
1007,
6721,
1027,
5851,
13033,
5358,
1012,
2002,
2595,
1006,
1022,
1007,
3793,
1027,
4180,
1012,
2486,
1035,
17181,
1006,
1005,
2004,
6895,
2072,
1011,
1022,
16313,
1005,
1007,
5796,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
soundcloud/lhm | lib/lhm/migrator.rb | Lhm.Migrator.rename_column | def rename_column(old, nu)
col = @origin.columns[old.to_s]
definition = col[:type]
definition += ' NOT NULL' unless col[:is_nullable]
definition += " DEFAULT #{@connection.quote(col[:column_default])}" if col[:column_default]
ddl('alter table `%s` change column `%s` `%s` %s' % [@name, old, nu, definition])
@renames[old.to_s] = nu.to_s
end | ruby | def rename_column(old, nu)
col = @origin.columns[old.to_s]
definition = col[:type]
definition += ' NOT NULL' unless col[:is_nullable]
definition += " DEFAULT #{@connection.quote(col[:column_default])}" if col[:column_default]
ddl('alter table `%s` change column `%s` `%s` %s' % [@name, old, nu, definition])
@renames[old.to_s] = nu.to_s
end | [
"def",
"rename_column",
"(",
"old",
",",
"nu",
")",
"col",
"=",
"@origin",
".",
"columns",
"[",
"old",
".",
"to_s",
"]",
"definition",
"=",
"col",
"[",
":type",
"]",
"definition",
"+=",
"' NOT NULL'",
"unless",
"col",
"[",
":is_nullable",
"]",
"definitio... | Rename an existing column.
@example
Lhm.change_table(:users) do |m|
m.rename_column(:login, :username)
end
@param [String] old Name of the column to change
@param [String] nu New name to use for the column | [
"Rename",
"an",
"existing",
"column",
"."
] | 50907121eee514649fa944fb300d5d8a64fa873e | https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/lib/lhm/migrator.rb#L83-L92 | train | rename a column | [
30522,
13366,
14916,
14074,
1035,
5930,
1006,
2214,
1010,
16371,
1007,
8902,
1027,
1030,
4761,
1012,
7753,
1031,
2214,
1012,
2000,
1035,
1055,
1033,
6210,
1027,
8902,
1031,
1024,
2828,
1033,
6210,
1009,
1027,
1005,
2025,
19701,
1005,
4983,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sporkmonger/addressable | lib/addressable/uri.rb | Addressable.URI.replace_self | def replace_self(uri)
# Reset dependent values
instance_variables.each do |var|
if instance_variable_defined?(var) && var != :@validation_deferred
remove_instance_variable(var)
end
end
@scheme = uri.scheme
@user = uri.user
@password = uri.password
@host = uri.host
@port = uri.port
@path = uri.path
@query = uri.query
@fragment = uri.fragment
return self
end | ruby | def replace_self(uri)
# Reset dependent values
instance_variables.each do |var|
if instance_variable_defined?(var) && var != :@validation_deferred
remove_instance_variable(var)
end
end
@scheme = uri.scheme
@user = uri.user
@password = uri.password
@host = uri.host
@port = uri.port
@path = uri.path
@query = uri.query
@fragment = uri.fragment
return self
end | [
"def",
"replace_self",
"(",
"uri",
")",
"# Reset dependent values",
"instance_variables",
".",
"each",
"do",
"|",
"var",
"|",
"if",
"instance_variable_defined?",
"(",
"var",
")",
"&&",
"var",
"!=",
":@validation_deferred",
"remove_instance_variable",
"(",
"var",
")"... | Replaces the internal state of self with the specified URI's state.
Used in destructive operations to avoid massive code repetition.
@param [Addressable::URI] uri The URI to replace <code>self</code> with.
@return [Addressable::URI] <code>self</code>. | [
"Replaces",
"the",
"internal",
"state",
"of",
"self",
"with",
"the",
"specified",
"URI",
"s",
"state",
".",
"Used",
"in",
"destructive",
"operations",
"to",
"avoid",
"massive",
"code",
"repetition",
"."
] | 5894c95a7768435cb46d1355954611dbd194832e | https://github.com/sporkmonger/addressable/blob/5894c95a7768435cb46d1355954611dbd194832e/lib/addressable/uri.rb#L2468-L2485 | train | Replace self with another URI | [
30522,
13366,
5672,
1035,
2969,
1006,
24471,
2072,
1007,
1001,
25141,
7790,
5300,
6013,
1035,
10857,
1012,
2169,
2079,
1064,
13075,
1064,
2065,
6013,
1035,
8023,
1035,
4225,
1029,
1006,
13075,
1007,
1004,
1004,
13075,
999,
1027,
1024,
1030,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/thrift | lib/rb/lib/thrift/protocol/base_protocol.rb | Thrift.BaseProtocol.read_type | def read_type(field_info)
# if field_info is a Fixnum, assume it is a Thrift::Types constant
# convert it into a field_info Hash for backwards compatibility
if field_info.is_a? Fixnum
field_info = {:type => field_info}
end
case field_info[:type]
when Types::BOOL
read_bool
when Types::BYTE
read_byte
when Types::DOUBLE
read_double
when Types::I16
read_i16
when Types::I32
read_i32
when Types::I64
read_i64
when Types::STRING
if field_info[:binary]
read_binary
else
read_string
end
else
raise NotImplementedError
end
end | ruby | def read_type(field_info)
# if field_info is a Fixnum, assume it is a Thrift::Types constant
# convert it into a field_info Hash for backwards compatibility
if field_info.is_a? Fixnum
field_info = {:type => field_info}
end
case field_info[:type]
when Types::BOOL
read_bool
when Types::BYTE
read_byte
when Types::DOUBLE
read_double
when Types::I16
read_i16
when Types::I32
read_i32
when Types::I64
read_i64
when Types::STRING
if field_info[:binary]
read_binary
else
read_string
end
else
raise NotImplementedError
end
end | [
"def",
"read_type",
"(",
"field_info",
")",
"# if field_info is a Fixnum, assume it is a Thrift::Types constant",
"# convert it into a field_info Hash for backwards compatibility",
"if",
"field_info",
".",
"is_a?",
"Fixnum",
"field_info",
"=",
"{",
":type",
"=>",
"field_info",
"}... | Reads a field value based on the field information.
field_info - A Hash containing the pertinent data to write:
:type - The Thrift::Types constant that determines how the value is written.
:binary - A flag that indicates if Thrift::Types::STRING is a binary string (string without encoding).
Returns the value read; object type varies based on field_info[:type]. | [
"Reads",
"a",
"field",
"value",
"based",
"on",
"the",
"field",
"information",
"."
] | 27d8387c49a49fcf193893f834e9766ae0b051c1 | https://github.com/apache/thrift/blob/27d8387c49a49fcf193893f834e9766ae0b051c1/lib/rb/lib/thrift/protocol/base_protocol.rb#L293-L322 | train | Reads a type from the given field_info Hash. | [
30522,
13366,
3191,
1035,
2828,
1006,
2492,
1035,
18558,
1007,
1001,
2065,
2492,
1035,
18558,
2003,
1037,
8081,
19172,
1010,
7868,
2009,
2003,
1037,
16215,
16338,
1024,
1024,
4127,
5377,
1001,
10463,
2009,
2046,
1037,
2492,
1035,
18558,
233... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.