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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
kaminari/kaminari | kaminari-core/lib/kaminari/models/page_scope_methods.rb | Kaminari.PageScopeMethods.per | def per(num, max_per_page: nil)
max_per_page ||= ((defined?(@_max_per_page) && @_max_per_page) || self.max_per_page)
@_per = (num || default_per_page).to_i
if (n = num.to_i) < 0 || !(/^\d/ =~ num.to_s)
self
elsif n.zero?
limit(n)
elsif max_per_page && (max_per_page < n)
limit(max_per_page).offset(offset_value / limit_value * max_per_page)
else
limit(n).offset(offset_value / limit_value * n)
end
end | ruby | def per(num, max_per_page: nil)
max_per_page ||= ((defined?(@_max_per_page) && @_max_per_page) || self.max_per_page)
@_per = (num || default_per_page).to_i
if (n = num.to_i) < 0 || !(/^\d/ =~ num.to_s)
self
elsif n.zero?
limit(n)
elsif max_per_page && (max_per_page < n)
limit(max_per_page).offset(offset_value / limit_value * max_per_page)
else
limit(n).offset(offset_value / limit_value * n)
end
end | [
"def",
"per",
"(",
"num",
",",
"max_per_page",
":",
"nil",
")",
"max_per_page",
"||=",
"(",
"(",
"defined?",
"(",
"@_max_per_page",
")",
"&&",
"@_max_per_page",
")",
"||",
"self",
".",
"max_per_page",
")",
"@_per",
"=",
"(",
"num",
"||",
"default_per_page"... | Specify the <tt>per_page</tt> value for the preceding <tt>page</tt> scope
Model.page(3).per(10) | [
"Specify",
"the",
"<tt",
">",
"per_page<",
"/",
"tt",
">",
"value",
"for",
"the",
"preceding",
"<tt",
">",
"page<",
"/",
"tt",
">",
"scope",
"Model",
".",
"page",
"(",
"3",
")",
".",
"per",
"(",
"10",
")"
] | e2078ce46b145b811423dc8b5993e4bc87dc88b8 | https://github.com/kaminari/kaminari/blob/e2078ce46b145b811423dc8b5993e4bc87dc88b8/kaminari-core/lib/kaminari/models/page_scope_methods.rb#L7-L19 | train | Returns a new Page object for the current page. | [
30522,
13366,
2566,
1006,
16371,
2213,
1010,
4098,
1035,
2566,
1035,
3931,
1024,
9152,
2140,
1007,
4098,
1035,
2566,
1035,
3931,
1064,
1064,
1027,
1006,
1006,
4225,
1029,
1006,
1030,
1035,
4098,
1035,
2566,
1035,
3931,
1007,
1004,
1004,
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_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/job_executions.rb | Azure::SQL::Mgmt::V2017_03_01_preview.JobExecutions.list_by_agent_next | def list_by_agent_next(next_page_link, custom_headers:nil)
response = list_by_agent_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_agent_next(next_page_link, custom_headers:nil)
response = list_by_agent_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_agent_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_agent_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"response",... | Lists all executions in a job agent.
@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 [JobExecutionListResult] operation results. | [
"Lists",
"all",
"executions",
"in",
"a",
"job",
"agent",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/job_executions.rb#L859-L862 | train | Gets the list of all the available advisors. | [
30522,
13366,
2862,
1035,
2011,
1035,
4005,
1035,
2279,
1006,
2279,
1035,
3931,
1035,
4957,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
4005,
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... |
github/linguist | samples/Ruby/sinatra.rb | Sinatra.Helpers.content_type | def content_type(type = nil, params={})
return response['Content-Type'] unless type
default = params.delete :default
mime_type = mime_type(type) || default
fail "Unknown media type: %p" % type if mime_type.nil?
mime_type = mime_type.dup
unless params.include? :charset or settings.add_charset.all? { |p| not p === mime_type }
params[:charset] = params.delete('charset') || settings.default_encoding
end
params.delete :charset if mime_type.include? 'charset'
unless params.empty?
mime_type << (mime_type.include?(';') ? ', ' : ';')
mime_type << params.map { |kv| kv.join('=') }.join(', ')
end
response['Content-Type'] = mime_type
end | ruby | def content_type(type = nil, params={})
return response['Content-Type'] unless type
default = params.delete :default
mime_type = mime_type(type) || default
fail "Unknown media type: %p" % type if mime_type.nil?
mime_type = mime_type.dup
unless params.include? :charset or settings.add_charset.all? { |p| not p === mime_type }
params[:charset] = params.delete('charset') || settings.default_encoding
end
params.delete :charset if mime_type.include? 'charset'
unless params.empty?
mime_type << (mime_type.include?(';') ? ', ' : ';')
mime_type << params.map { |kv| kv.join('=') }.join(', ')
end
response['Content-Type'] = mime_type
end | [
"def",
"content_type",
"(",
"type",
"=",
"nil",
",",
"params",
"=",
"{",
"}",
")",
"return",
"response",
"[",
"'Content-Type'",
"]",
"unless",
"type",
"default",
"=",
"params",
".",
"delete",
":default",
"mime_type",
"=",
"mime_type",
"(",
"type",
")",
"... | Set the Content-Type of the response body given a media type or file
extension. | [
"Set",
"the",
"Content",
"-",
"Type",
"of",
"the",
"response",
"body",
"given",
"a",
"media",
"type",
"or",
"file",
"extension",
"."
] | 9116c90fcbb82ac03b4b33c58cfbde1fcf745e99 | https://github.com/github/linguist/blob/9116c90fcbb82ac03b4b33c58cfbde1fcf745e99/samples/Ruby/sinatra.rb#L236-L251 | train | Returns the content - type header. | [
30522,
13366,
4180,
1035,
2828,
1006,
2828,
1027,
9152,
2140,
1010,
11498,
5244,
1027,
1063,
1065,
1007,
2709,
3433,
1031,
1005,
4180,
1011,
2828,
1005,
1033,
4983,
2828,
12398,
1027,
11498,
5244,
1012,
3972,
12870,
1024,
12398,
2771,
4168,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.delete_entity_role | def delete_entity_role(app_id, version_id, entity_id, role_id, custom_headers:nil)
response = delete_entity_role_async(app_id, version_id, entity_id, role_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def delete_entity_role(app_id, version_id, entity_id, role_id, custom_headers:nil)
response = delete_entity_role_async(app_id, version_id, entity_id, role_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"delete_entity_role",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"role_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_entity_role_async",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"role_id",
",",
"custom... | Delete an entity role 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 custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OperationStatus] operation results. | [
"Delete",
"an",
"entity",
"role",
"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#L8993-L8996 | train | Deletes a role from an entity. | [
30522,
13366,
3972,
12870,
1035,
9178,
1035,
2535,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
30524,
1010,
2544,
1035,
8909,
1010,
9178,
1035,
8909,
1010,
2535,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
20346,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_contentmoderator/lib/1.0/generated/azure_cognitiveservices_contentmoderator/list_management_term_lists.rb | Azure::CognitiveServices::ContentModerator::V1_0.ListManagementTermLists.update | def update(list_id, content_type, body, custom_headers:nil)
response = update_async(list_id, content_type, body, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def update(list_id, content_type, body, custom_headers:nil)
response = update_async(list_id, content_type, body, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"update",
"(",
"list_id",
",",
"content_type",
",",
"body",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"update_async",
"(",
"list_id",
",",
"content_type",
",",
"body",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"respons... | Updates an Term List.
@param list_id [String] List Id of the image list.
@param content_type [String] The content type.
@param body [Body] Schema of the body.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [TermList] operation results. | [
"Updates",
"an",
"Term",
"List",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_contentmoderator/lib/1.0/generated/azure_cognitiveservices_contentmoderator/list_management_term_lists.rb#L229-L232 | train | Updates a list s list specification. | [
30522,
13366,
10651,
1006,
2862,
1035,
8909,
1010,
4180,
1035,
2828,
1010,
2303,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
10651,
1035,
2004,
6038,
2278,
1006,
2862,
1035,
8909,
1010,
4180,
1035,
2828,
1010,
2303,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_reservations/lib/2017-11-01/generated/azure_mgmt_reservations/reservation.rb | Azure::Reservations::Mgmt::V2017_11_01.Reservation.merge | def merge(reservation_order_id, body, custom_headers:nil)
response = merge_async(reservation_order_id, body, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def merge(reservation_order_id, body, custom_headers:nil)
response = merge_async(reservation_order_id, body, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"merge",
"(",
"reservation_order_id",
",",
"body",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"merge_async",
"(",
"reservation_order_id",
",",
"body",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"un... | Merges two `Reservation`s.
Merge the specified `Reservation`s into a new `Reservation`. The two
`Reservation`s being merged must have same properties.
@param reservation_order_id [String] Order Id of the reservation
@param body [MergeRequest] Information needed for commercial request for a
reservation
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array] operation results. | [
"Merges",
"two",
"Reservation",
"s",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_reservations/lib/2017-11-01/generated/azure_mgmt_reservations/reservation.rb#L103-L106 | train | Merge a reservation order. | [
30522,
13366,
13590,
1006,
11079,
1035,
2344,
1035,
8909,
1010,
2303,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
13590,
1035,
2004,
6038,
2278,
1006,
11079,
1035,
2344,
1035,
8909,
1010,
2303,
1010,
7661,
1035,
20346... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
DataDog/dogstatsd-ruby | lib/datadog/statsd.rb | Datadog.Statsd.service_check | def service_check(name, status, opts=EMPTY_OPTIONS)
send_stat format_service_check(name, status, opts)
end | ruby | def service_check(name, status, opts=EMPTY_OPTIONS)
send_stat format_service_check(name, status, opts)
end | [
"def",
"service_check",
"(",
"name",
",",
"status",
",",
"opts",
"=",
"EMPTY_OPTIONS",
")",
"send_stat",
"format_service_check",
"(",
"name",
",",
"status",
",",
"opts",
")",
"end"
] | This method allows you to send custom service check statuses.
@param [String] name Service check name
@param [String] status Service check status.
@param [Hash] opts the additional data about the service check
@option opts [Integer, nil] :timestamp (nil) Assign a timestamp to the event. Default is now when none
@option opts [String, nil] :hostname (nil) Assign a hostname to the event.
@option opts [Array<String>, nil] :tags (nil) An array of tags
@option opts [String, nil] :message (nil) A message to associate with this service check status
@example Report a critical service check status
$statsd.service_check('my.service.check', Statsd::CRITICAL, :tags=>['urgent']) | [
"This",
"method",
"allows",
"you",
"to",
"send",
"custom",
"service",
"check",
"statuses",
"."
] | 0ea2a4d011958ad0d092654cae950e64b6475077 | https://github.com/DataDog/dogstatsd-ruby/blob/0ea2a4d011958ad0d092654cae950e64b6475077/lib/datadog/statsd.rb#L390-L392 | train | Send a service check | [
30522,
13366,
2326,
1035,
4638,
1006,
2171,
1010,
3570,
1010,
23569,
2015,
1027,
4064,
1035,
7047,
1007,
4604,
1035,
28093,
4289,
1035,
2326,
1035,
4638,
1006,
2171,
1010,
3570,
1010,
23569,
2015,
1007,
2203,
102,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alexreisner/geocoder | lib/geocoder/lookup.rb | Geocoder.Lookup.spawn | def spawn(name)
if all_services.include?(name)
name = name.to_s
require "geocoder/lookups/#{name}"
Geocoder::Lookup.const_get(classify_name(name)).new
else
valids = all_services.map(&:inspect).join(", ")
raise ConfigurationError, "Please specify a valid lookup for Geocoder " +
"(#{name.inspect} is not one of: #{valids})."
end
end | ruby | def spawn(name)
if all_services.include?(name)
name = name.to_s
require "geocoder/lookups/#{name}"
Geocoder::Lookup.const_get(classify_name(name)).new
else
valids = all_services.map(&:inspect).join(", ")
raise ConfigurationError, "Please specify a valid lookup for Geocoder " +
"(#{name.inspect} is not one of: #{valids})."
end
end | [
"def",
"spawn",
"(",
"name",
")",
"if",
"all_services",
".",
"include?",
"(",
"name",
")",
"name",
"=",
"name",
".",
"to_s",
"require",
"\"geocoder/lookups/#{name}\"",
"Geocoder",
"::",
"Lookup",
".",
"const_get",
"(",
"classify_name",
"(",
"name",
")",
")",... | -----------------------------------------------------------------
Spawn a Lookup of the given name. | [
"-----------------------------------------------------------------"
] | e087dc2759264ee6f307b926bb2de4ec2406859e | https://github.com/alexreisner/geocoder/blob/e087dc2759264ee6f307b926bb2de4ec2406859e/lib/geocoder/lookup.rb#L99-L109 | train | Spawn a new lookup object | [
30522,
13366,
25645,
1006,
2171,
1007,
2065,
2035,
1035,
2578,
1012,
2421,
1029,
1006,
2171,
1007,
2171,
1027,
2171,
1012,
2000,
1035,
1055,
5478,
1000,
20248,
16044,
2099,
1013,
2298,
22264,
1013,
1001,
1063,
2171,
1065,
1000,
20248,
16044... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
backup/backup | lib/backup/model.rb | Backup.Model.before_hook | def before_hook
return unless before
Logger.info "Before Hook Starting..."
before.call
Logger.info "Before Hook Finished."
rescue Exception => err
@before_hook_failed = true
ex = err.is_a?(StandardError) ? Error : FatalError
raise ex.wrap(err, "Before Hook Failed!")
end | ruby | def before_hook
return unless before
Logger.info "Before Hook Starting..."
before.call
Logger.info "Before Hook Finished."
rescue Exception => err
@before_hook_failed = true
ex = err.is_a?(StandardError) ? Error : FatalError
raise ex.wrap(err, "Before Hook Failed!")
end | [
"def",
"before_hook",
"return",
"unless",
"before",
"Logger",
".",
"info",
"\"Before Hook Starting...\"",
"before",
".",
"call",
"Logger",
".",
"info",
"\"Before Hook Finished.\"",
"rescue",
"Exception",
"=>",
"err",
"@before_hook_failed",
"=",
"true",
"ex",
"=",
"e... | Runs the +before+ hook.
Any exception raised will be wrapped and re-raised, where it will be
handled by #perform the same as an exception raised while performing
the model's #procedures. Only difference is that an exception raised
here will prevent any +after+ hook from being run. | [
"Runs",
"the",
"+",
"before",
"+",
"hook",
".",
"Any",
"exception",
"raised",
"will",
"be",
"wrapped",
"and",
"re",
"-",
"raised",
"where",
"it",
"will",
"be",
"handled",
"by",
"#perform",
"the",
"same",
"as",
"an",
"exception",
"raised",
"while",
"perfo... | 64370f925e859f858766b674717a3dbee0de7a26 | https://github.com/backup/backup/blob/64370f925e859f858766b674717a3dbee0de7a26/lib/backup/model.rb#L397-L407 | train | Before hooks are called in order to call the before hook. | [
30522,
13366,
2077,
1035,
8103,
2709,
4983,
2077,
8833,
4590,
1012,
18558,
1000,
2077,
8103,
3225,
1012,
1012,
1012,
30524,
1012,
18558,
1000,
2077,
8103,
2736,
1012,
1000,
5343,
6453,
1027,
1028,
9413,
2099,
1030,
2077,
1035,
8103,
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... |
mongodb/mongoid | lib/mongoid/changeable.rb | Mongoid.Changeable.attribute_changed? | def attribute_changed?(attr)
attr = database_field_name(attr)
return false unless changed_attributes.key?(attr)
changed_attributes[attr] != attributes[attr]
end | ruby | def attribute_changed?(attr)
attr = database_field_name(attr)
return false unless changed_attributes.key?(attr)
changed_attributes[attr] != attributes[attr]
end | [
"def",
"attribute_changed?",
"(",
"attr",
")",
"attr",
"=",
"database_field_name",
"(",
"attr",
")",
"return",
"false",
"unless",
"changed_attributes",
".",
"key?",
"(",
"attr",
")",
"changed_attributes",
"[",
"attr",
"]",
"!=",
"attributes",
"[",
"attr",
"]",... | Determine if a specific attribute has changed.
@example Has the attribute changed?
model.attribute_changed?("name")
@param [ String ] attr The name of the attribute.
@return [ true, false ] Whether the attribute has changed.
@since 2.1.6 | [
"Determine",
"if",
"a",
"specific",
"attribute",
"has",
"changed",
"."
] | 56976e32610f4c2450882b0bfe14da099f0703f4 | https://github.com/mongodb/mongoid/blob/56976e32610f4c2450882b0bfe14da099f0703f4/lib/mongoid/changeable.rb#L184-L188 | train | Returns true if the attribute has changed | [
30522,
13366,
17961,
1035,
2904,
1029,
1006,
2012,
16344,
1007,
2012,
16344,
1027,
7809,
1035,
2492,
1035,
2171,
1006,
2012,
16344,
1007,
2709,
6270,
4983,
2904,
1035,
12332,
1012,
3145,
1029,
1006,
2012,
16344,
1007,
2904,
1035,
12332,
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... |
decidim/decidim | decidim-core/lib/decidim/data_portability_file_zipper.rb | Decidim.DataPortabilityFileZipper.make_zip | def make_zip
Zip::OutputStream.open(file_path) do |zos|
@export_data.each do |element|
filename_file = element.last.filename(element.first.parameterize)
zos.put_next_entry(filename_file)
if element.last.read.presence
zos.write element.last.read
else
zos.write "No data"
end
end
end
zipfile = Zip::File.open(file_path)
@export_images.each do |image_block|
next if image_block.last.nil?
image_block.last.each do |image|
next if image.file.nil?
folder_name = image_block.first.parameterize
uploader = Decidim::ApplicationUploader.new(image.model, image.mounted_as)
if image.file.respond_to? :file
uploader.cache!(File.open(image.file.file))
uploader.retrieve_from_store!(image.file.filename)
else
my_uploader = image.mounted_as
element = image.model
element.send(my_uploader).cache_stored_file!
element.send(my_uploader).retrieve_from_cache!(element.send(my_uploader).cache_name)
end
my_image_path = File.open(image.file.file)
next unless File.exist?(my_image_path)
zipfile.add("#{folder_name}/#{image.file.filename}", my_image_path)
CarrierWave.clean_cached_files!
end
end
zipfile.close
end | ruby | def make_zip
Zip::OutputStream.open(file_path) do |zos|
@export_data.each do |element|
filename_file = element.last.filename(element.first.parameterize)
zos.put_next_entry(filename_file)
if element.last.read.presence
zos.write element.last.read
else
zos.write "No data"
end
end
end
zipfile = Zip::File.open(file_path)
@export_images.each do |image_block|
next if image_block.last.nil?
image_block.last.each do |image|
next if image.file.nil?
folder_name = image_block.first.parameterize
uploader = Decidim::ApplicationUploader.new(image.model, image.mounted_as)
if image.file.respond_to? :file
uploader.cache!(File.open(image.file.file))
uploader.retrieve_from_store!(image.file.filename)
else
my_uploader = image.mounted_as
element = image.model
element.send(my_uploader).cache_stored_file!
element.send(my_uploader).retrieve_from_cache!(element.send(my_uploader).cache_name)
end
my_image_path = File.open(image.file.file)
next unless File.exist?(my_image_path)
zipfile.add("#{folder_name}/#{image.file.filename}", my_image_path)
CarrierWave.clean_cached_files!
end
end
zipfile.close
end | [
"def",
"make_zip",
"Zip",
"::",
"OutputStream",
".",
"open",
"(",
"file_path",
")",
"do",
"|",
"zos",
"|",
"@export_data",
".",
"each",
"do",
"|",
"element",
"|",
"filename_file",
"=",
"element",
".",
"last",
".",
"filename",
"(",
"element",
".",
"first"... | Public: Initializes the zipper with a user, data, and images to
be zipped.
user - The user of data portability to be zipped.
data - An array of all data to be zipped.
images - An array of image files to be inclueded in the zipped file.
Public: Zips the file.
Returns a String with the zipped version of the file. | [
"Public",
":",
"Initializes",
"the",
"zipper",
"with",
"a",
"user",
"data",
"and",
"images",
"to",
"be",
"zipped",
"."
] | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/lib/decidim/data_portability_file_zipper.rb#L24-L62 | train | Create a zip file with the export data and images | [
30522,
13366,
2191,
1035,
14101,
14101,
1024,
1024,
27852,
25379,
1012,
2330,
1006,
5371,
1035,
4130,
1007,
2079,
1064,
1062,
2891,
1064,
1030,
9167,
1035,
2951,
1012,
2169,
2079,
1064,
5783,
1064,
5371,
18442,
1035,
5371,
1027,
5783,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.delete_hierarchical_entity | def delete_hierarchical_entity(app_id, version_id, h_entity_id, custom_headers:nil)
response = delete_hierarchical_entity_async(app_id, version_id, h_entity_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def delete_hierarchical_entity(app_id, version_id, h_entity_id, custom_headers:nil)
response = delete_hierarchical_entity_async(app_id, version_id, h_entity_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"delete_hierarchical_entity",
"(",
"app_id",
",",
"version_id",
",",
"h_entity_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_hierarchical_entity_async",
"(",
"app_id",
",",
"version_id",
",",
"h_entity_id",
",",
"custom_headers",
":custo... | Deletes a hierarchical entity from a version of the application.
@param app_id The application ID.
@param version_id [String] The version ID.
@param h_entity_id The hierarchical entity extractor ID.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [OperationStatus] operation results. | [
"Deletes",
"a",
"hierarchical",
"entity",
"from",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L2638-L2641 | train | Deletes a hierarchical entity. | [
30522,
13366,
3972,
12870,
1035,
25835,
1035,
9178,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
1044,
1035,
9178,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
1035,
25835,
1035,
9178... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/thrift | lib/rb/lib/thrift/protocol/json_protocol.rb | Thrift.JsonProtocol.write_json_escape_char | def write_json_escape_char(ch)
trans.write('\\u')
ch_value = ch[0]
if (ch_value.kind_of? String)
ch_value = ch.bytes.first
end
trans.write(ch_value.to_s(16).rjust(4,'0'))
end | ruby | def write_json_escape_char(ch)
trans.write('\\u')
ch_value = ch[0]
if (ch_value.kind_of? String)
ch_value = ch.bytes.first
end
trans.write(ch_value.to_s(16).rjust(4,'0'))
end | [
"def",
"write_json_escape_char",
"(",
"ch",
")",
"trans",
".",
"write",
"(",
"'\\\\u'",
")",
"ch_value",
"=",
"ch",
"[",
"0",
"]",
"if",
"(",
"ch_value",
".",
"kind_of?",
"String",
")",
"ch_value",
"=",
"ch",
".",
"bytes",
".",
"first",
"end",
"trans",... | Write the character ch as a JSON escape sequence ("\u00xx") | [
"Write",
"the",
"character",
"ch",
"as",
"a",
"JSON",
"escape",
"sequence",
"(",
"\\",
"u00xx",
")"
] | 27d8387c49a49fcf193893f834e9766ae0b051c1 | https://github.com/apache/thrift/blob/27d8387c49a49fcf193893f834e9766ae0b051c1/lib/rb/lib/thrift/protocol/json_protocol.rb#L252-L259 | train | Write a JSON escape character | [
30522,
13366,
4339,
1035,
1046,
3385,
1035,
4019,
1035,
25869,
1006,
10381,
1007,
9099,
1012,
4339,
1006,
1005,
1032,
1032,
1057,
1005,
1007,
10381,
1035,
3643,
1027,
10381,
1031,
1014,
1033,
2065,
1006,
10381,
1035,
3643,
1012,
2785,
1035,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb | Azure::CognitiveServices::LuisAuthoring::V2_0.Model.get_prebuilt_entity_role_with_http_info | def get_prebuilt_entity_role_with_http_info(app_id, version_id, entity_id, role_id, custom_headers:nil)
get_prebuilt_entity_role_async(app_id, version_id, entity_id, role_id, custom_headers:custom_headers).value!
end | ruby | def get_prebuilt_entity_role_with_http_info(app_id, version_id, entity_id, role_id, custom_headers:nil)
get_prebuilt_entity_role_async(app_id, version_id, entity_id, role_id, custom_headers:custom_headers).value!
end | [
"def",
"get_prebuilt_entity_role_with_http_info",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"role_id",
",",
"custom_headers",
":",
"nil",
")",
"get_prebuilt_entity_role_async",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"role_id",
",",
"... | Get one role for a given prebuilt entity in a version of the application
@param app_id The application ID.
@param version_id [String] The version ID.
@param entity_id entity ID.
@param role_id entity role ID.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Get",
"one",
"role",
"for",
"a",
"given",
"prebuilt",
"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#L9109-L9111 | train | Gets the role for a prebuilt entity. | [
30522,
13366,
2131,
1035,
3653,
8569,
4014,
2102,
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,
7661,
1035,
20346,
2015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
activeadmin/activeadmin | lib/active_admin/callbacks.rb | ActiveAdmin.Callbacks.run_callback | def run_callback(method, *args)
case method
when Symbol
send(method, *args)
when Proc
instance_exec(*args, &method)
else
raise "Please register with callbacks using a symbol or a block/proc."
end
end | ruby | def run_callback(method, *args)
case method
when Symbol
send(method, *args)
when Proc
instance_exec(*args, &method)
else
raise "Please register with callbacks using a symbol or a block/proc."
end
end | [
"def",
"run_callback",
"(",
"method",
",",
"*",
"args",
")",
"case",
"method",
"when",
"Symbol",
"send",
"(",
"method",
",",
"args",
")",
"when",
"Proc",
"instance_exec",
"(",
"args",
",",
"method",
")",
"else",
"raise",
"\"Please register with callbacks using... | Simple callback system. Implements before and after callbacks for
use within the controllers.
We didn't use the ActiveSupport callbacks because they do not support
passing in any arbitrary object into the callback method (which we
need to do) | [
"Simple",
"callback",
"system",
".",
"Implements",
"before",
"and",
"after",
"callbacks",
"for",
"use",
"within",
"the",
"controllers",
"."
] | 0759c8dcf97865748c9344459162ac3c7e65a6cd | https://github.com/activeadmin/activeadmin/blob/0759c8dcf97865748c9344459162ac3c7e65a6cd/lib/active_admin/callbacks.rb#L14-L23 | train | Run a callback | [
30522,
13366,
2448,
1035,
2655,
5963,
1006,
4118,
1010,
1008,
12098,
5620,
1007,
2553,
4118,
2043,
6454,
4604,
1006,
4118,
1010,
1008,
12098,
5620,
1007,
2043,
4013,
2278,
6013,
1035,
4654,
8586,
1006,
1008,
12098,
5620,
1010,
1004,
4118,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/2016-06-27-preview/generated/azure_mgmt_container_registry/registries.rb | Azure::ContainerRegistry::Mgmt::V2016_06_27_preview.Registries.create_or_update_with_http_info | def create_or_update_with_http_info(resource_group_name, registry_name, registry, custom_headers:nil)
create_or_update_async(resource_group_name, registry_name, registry, custom_headers:custom_headers).value!
end | ruby | def create_or_update_with_http_info(resource_group_name, registry_name, registry, custom_headers:nil)
create_or_update_async(resource_group_name, registry_name, registry, custom_headers:custom_headers).value!
end | [
"def",
"create_or_update_with_http_info",
"(",
"resource_group_name",
",",
"registry_name",
",",
"registry",
",",
"custom_headers",
":",
"nil",
")",
"create_or_update_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"registry",
",",
"custom_headers",
":custo... | Creates or updates a container registry with the specified parameters.
@param resource_group_name [String] The name of the resource group to which
the container registry belongs.
@param registry_name [String] The name of the container registry.
@param registry [Registry] The parameters for creating or updating a
container registry.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Creates",
"or",
"updates",
"a",
"container",
"registry",
"with",
"the",
"specified",
"parameters",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_registry/lib/2016-06-27-preview/generated/azure_mgmt_container_registry/registries.rb#L254-L256 | train | Creates or updates a container registry. | [
30522,
13366,
3443,
1035,
2030,
1035,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
15584,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3443,
1035,
2030,
1035,
10651... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activesupport/lib/active_support/lazy_load_hooks.rb | ActiveSupport.LazyLoadHooks.on_load | def on_load(name, options = {}, &block)
@loaded[name].each do |base|
execute_hook(name, base, options, block)
end
@load_hooks[name] << [block, options]
end | ruby | def on_load(name, options = {}, &block)
@loaded[name].each do |base|
execute_hook(name, base, options, block)
end
@load_hooks[name] << [block, options]
end | [
"def",
"on_load",
"(",
"name",
",",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"@loaded",
"[",
"name",
"]",
".",
"each",
"do",
"|",
"base",
"|",
"execute_hook",
"(",
"name",
",",
"base",
",",
"options",
",",
"block",
")",
"end",
"@load_hooks... | Declares a block that will be executed when a Rails component is fully
loaded.
Options:
* <tt>:yield</tt> - Yields the object that run_load_hooks to +block+.
* <tt>:run_once</tt> - Given +block+ will run only once. | [
"Declares",
"a",
"block",
"that",
"will",
"be",
"executed",
"when",
"a",
"Rails",
"component",
"is",
"fully",
"loaded",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/lazy_load_hooks.rb#L41-L47 | train | Execute the load hook for the given name. | [
30522,
13366,
2006,
1035,
7170,
1006,
2171,
1010,
7047,
1027,
1063,
1065,
1010,
1004,
3796,
1007,
1030,
8209,
1031,
2171,
1033,
1012,
2169,
2079,
1064,
2918,
1064,
15389,
1035,
8103,
1006,
2171,
1010,
2918,
1010,
7047,
1010,
3796,
1007,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_service_fabric/lib/2017-07-01-preview/generated/azure_mgmt_service_fabric/clusters.rb | Azure::ServiceFabric::Mgmt::V2017_07_01_preview.Clusters.list_by_resource_group | def list_by_resource_group(resource_group_name, api_version, subscription_id, custom_headers:nil)
response = list_by_resource_group_async(resource_group_name, api_version, subscription_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_resource_group(resource_group_name, api_version, subscription_id, custom_headers:nil)
response = list_by_resource_group_async(resource_group_name, api_version, subscription_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_resource_group",
"(",
"resource_group_name",
",",
"api_version",
",",
"subscription_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_resource_group_async",
"(",
"resource_group_name",
",",
"api_version",
",",
"subscription_id",
",",
... | List cluster resource by resource group
List cluster resource by resource group
@param resource_group_name [String] The name of the resource group.
@param api_version [String] The version of the API.
@param subscription_id [String] The customer subscription identifier
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ClusterListResult] operation results. | [
"List",
"cluster",
"resource",
"by",
"resource",
"group"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_service_fabric/lib/2017-07-01-preview/generated/azure_mgmt_service_fabric/clusters.rb#L347-L350 | train | Gets the list of all the elastic advantages in a resource group. | [
30522,
13366,
2862,
1035,
2011,
1035,
7692,
30524,
1035,
2544,
1010,
15002,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
2011,
1035,
7692,
1035,
2177,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_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_health_with_http_info | def get_service_health_with_http_info(service_id, events_health_state_filter:0, partitions_health_state_filter:0, exclude_health_statistics:false, timeout:60, custom_headers:nil)
get_service_health_async(service_id, events_health_state_filter:events_health_state_filter, partitions_health_state_filter:partitions_health_state_filter, exclude_health_statistics:exclude_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
end | ruby | def get_service_health_with_http_info(service_id, events_health_state_filter:0, partitions_health_state_filter:0, exclude_health_statistics:false, timeout:60, custom_headers:nil)
get_service_health_async(service_id, events_health_state_filter:events_health_state_filter, partitions_health_state_filter:partitions_health_state_filter, exclude_health_statistics:exclude_health_statistics, timeout:timeout, custom_headers:custom_headers).value!
end | [
"def",
"get_service_health_with_http_info",
"(",
"service_id",
",",
"events_health_state_filter",
":",
"0",
",",
"partitions_health_state_filter",
":",
"0",
",",
"exclude_health_statistics",
":",
"false",
",",
"timeout",
":",
"60",
",",
"custom_headers",
":",
"nil",
"... | Gets the health of the specified Service Fabric service.
Gets the health information of the specified service.
Use EventsHealthStateFilter to filter the collection of health events
reported on the service based on the health state.
Use PartitionsHealthStateFilter to filter the collection of partitions
returned.
If you specify a service that does not exist in the health store, this
request returns an error.
@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 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 partitions_health_state_filter [Integer] Allows filtering of the
partitions health state objects returned in the result of service health
query based on their health state.
The possible values for this parameter include integer value of one of the
following health states.
Only partitions that match the filter are returned. All partitions 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 health state of partitions with HealthState value of OK (2) and Warning
(4) will be 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 [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Gets",
"the",
"health",
"of",
"the",
"specified",
"Service",
"Fabric",
"service",
"."
] | 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#L10953-L10955 | train | Gets the health of the service. | [
30522,
13366,
2131,
1035,
2326,
1035,
2740,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
2326,
1035,
8909,
1010,
2824,
1035,
2740,
1035,
2110,
1035,
11307,
1024,
1014,
1010,
13571,
2015,
1035,
2740,
1035,
2110,
1035,
11307,
1024,
1014,
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... |
cheezy/page-object | lib/page-object/accessors.rb | PageObject.Accessors.ordered_list | def ordered_list(name, identifier={:index => 0}, &block)
standard_methods(name, identifier, 'ordered_list_for', &block)
define_method(name) do
return platform.ordered_list_text_for identifier.clone unless block_given?
self.send("#{name}_element").text
end
end | ruby | def ordered_list(name, identifier={:index => 0}, &block)
standard_methods(name, identifier, 'ordered_list_for', &block)
define_method(name) do
return platform.ordered_list_text_for identifier.clone unless block_given?
self.send("#{name}_element").text
end
end | [
"def",
"ordered_list",
"(",
"name",
",",
"identifier",
"=",
"{",
":index",
"=>",
"0",
"}",
",",
"&",
"block",
")",
"standard_methods",
"(",
"name",
",",
"identifier",
",",
"'ordered_list_for'",
",",
"block",
")",
"define_method",
"(",
"name",
")",
"do",
... | adds three methods - one to return the text within the ordered
list, one to retrieve the ordered list element, and another to
test it's existence.
@example
ordered_list(:top_five, :id => 'top')
# will generate 'top_five', 'top_five_element' and 'top_five?' methods
@param [Symbol] the name used for the generated methods
@param [Hash] identifier how we find an ordered list.
@param optional block to be invoked when element method is called | [
"adds",
"three",
"methods",
"-",
"one",
"to",
"return",
"the",
"text",
"within",
"the",
"ordered",
"list",
"one",
"to",
"retrieve",
"the",
"ordered",
"list",
"element",
"and",
"another",
"to",
"test",
"it",
"s",
"existence",
"."
] | 850d775bf63768fbb1551a34480195785fe8e193 | https://github.com/cheezy/page-object/blob/850d775bf63768fbb1551a34480195785fe8e193/lib/page-object/accessors.rb#L640-L646 | train | Define a method for retrieving the ordered list of elements. | [
30522,
13366,
3641,
1035,
2862,
1006,
2171,
1010,
8909,
4765,
18095,
1027,
1063,
1024,
5950,
1027,
1028,
1014,
1065,
1010,
1004,
3796,
1007,
3115,
1035,
4725,
1006,
2171,
1010,
8909,
4765,
18095,
1010,
1005,
3641,
1035,
2862,
1035,
2005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jekyll/jekyll | lib/jekyll/renderer.rb | Jekyll.Renderer.invalid_layout? | def invalid_layout?(layout)
!document.data["layout"].nil? && layout.nil? && !(document.is_a? Jekyll::Excerpt)
end | ruby | def invalid_layout?(layout)
!document.data["layout"].nil? && layout.nil? && !(document.is_a? Jekyll::Excerpt)
end | [
"def",
"invalid_layout?",
"(",
"layout",
")",
"!",
"document",
".",
"data",
"[",
"\"layout\"",
"]",
".",
"nil?",
"&&",
"layout",
".",
"nil?",
"&&",
"!",
"(",
"document",
".",
"is_a?",
"Jekyll",
"::",
"Excerpt",
")",
"end"
] | rubocop: enable RescueException
Checks if the layout specified in the document actually exists
layout - the layout to check
Returns Boolean true if the layout is invalid, false if otherwise | [
"rubocop",
":",
"enable",
"RescueException",
"Checks",
"if",
"the",
"layout",
"specified",
"in",
"the",
"document",
"actually",
"exists"
] | fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b | https://github.com/jekyll/jekyll/blob/fd74fe3e93a1fb506fa6621a2e271d7b9c5c3e3b/lib/jekyll/renderer.rb#L141-L143 | train | Returns true if the layout is invalid | [
30522,
13366,
19528,
1035,
9621,
1029,
1006,
9621,
1007,
999,
6254,
1012,
2951,
1031,
1000,
9621,
1000,
1033,
1012,
9152,
2140,
1029,
1004,
1004,
9621,
1012,
9152,
2140,
1029,
1004,
1004,
999,
1006,
6254,
1012,
2003,
1035,
1037,
1029,
153... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/2015-12-01/generated/azure_mgmt_batch/batch_account_operations.rb | Azure::Batch::Mgmt::V2015_12_01.BatchAccountOperations.regenerate_key_with_http_info | def regenerate_key_with_http_info(resource_group_name, account_name, parameters, custom_headers:nil)
regenerate_key_async(resource_group_name, account_name, parameters, custom_headers:custom_headers).value!
end | ruby | def regenerate_key_with_http_info(resource_group_name, account_name, parameters, custom_headers:nil)
regenerate_key_async(resource_group_name, account_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"regenerate_key_with_http_info",
"(",
"resource_group_name",
",",
"account_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"regenerate_key_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"parameters",
",",
"custom_headers",
":custom_... | Regenerates the specified account key for the Batch account.
@param resource_group_name [String] The name of the resource group that
contains the Batch account.
@param account_name [String] The name of the account.
@param parameters [BatchAccountRegenerateKeyParameters] The type of key to
regenerate.
@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. | [
"Regenerates",
"the",
"specified",
"account",
"key",
"for",
"the",
"Batch",
"account",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_batch/lib/2015-12-01/generated/azure_mgmt_batch/batch_account_operations.rb#L637-L639 | train | Regenerate the key for the specified container account. | [
30522,
13366,
30524,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
20346,
2015,
1007,
1012,
3643,
999,
2203,
102,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.post_filter | def post_filter(params = nil, &block)
params = Filters.new(&block).__render__ if block
chain { criteria.update_post_filters params }
end | ruby | def post_filter(params = nil, &block)
params = Filters.new(&block).__render__ if block
chain { criteria.update_post_filters params }
end | [
"def",
"post_filter",
"(",
"params",
"=",
"nil",
",",
"&",
"block",
")",
"params",
"=",
"Filters",
".",
"new",
"(",
"block",
")",
".",
"__render__",
"if",
"block",
"chain",
"{",
"criteria",
".",
"update_post_filters",
"params",
"}",
"end"
] | Adds one or more post_filter to the search request
Internally post_filters are stored as an array
While the full query compilation this array compiles
according to `:post_filter_mode` option value
By default it joins inside `and` filter
See `#post_filter_mode` chainable method for more info.
Also this method supports block DSL.
See `Chewy::Query::Filters` for more info.
@example
UsersIndex.post_filter(term: {name: 'Johny'}).post_filter(range: {age: {lte: 42}})
UsersIndex::User.post_filter(term: {name: 'Johny'}).post_filter(range: {age: {lte: 42}})
UsersIndex.post_filter{ name == 'Johny' }.post_filter{ age <= 42 }
# => {body: {
post_filter: {and: [{term: {name: 'Johny'}}, {range: {age: {lte: 42}}}]}
}}
If only one post_filter was specified, it will become a result
post_filter as is, without joining.
@example
UsersIndex.post_filter(term: {name: 'Johny'})
# => {body: {
post_filter: {term: {name: 'Johny'}}
}} | [
"Adds",
"one",
"or",
"more",
"post_filter",
"to",
"the",
"search",
"request",
"Internally",
"post_filters",
"are",
"stored",
"as",
"an",
"array",
"While",
"the",
"full",
"query",
"compilation",
"this",
"array",
"compiles",
"according",
"to",
":",
"post_filter_mo... | cb1bb3efb1bd8a31e7e31add6072189cb1f4f01b | https://github.com/toptal/chewy/blob/cb1bb3efb1bd8a31e7e31add6072189cb1f4f01b/lib/chewy/query.rb#L760-L763 | train | Update post filters | [
30522,
13366,
2695,
1035,
11307,
1006,
11498,
5244,
1027,
9152,
2140,
1010,
1004,
3796,
1007,
11498,
5244,
1027,
17736,
1012,
2047,
1006,
1004,
3796,
1007,
1012,
1035,
1035,
17552,
1035,
1035,
2065,
3796,
4677,
1063,
9181,
1012,
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 | data/azure_service_fabric/lib/6.4.0.36/generated/azure_service_fabric/mesh_secret_value.rb | Azure::ServiceFabric::V6_4_0_36.MeshSecretValue.delete | def delete(secret_resource_name, secret_value_resource_name, custom_headers:nil)
response = delete_async(secret_resource_name, secret_value_resource_name, custom_headers:custom_headers).value!
nil
end | ruby | def delete(secret_resource_name, secret_value_resource_name, custom_headers:nil)
response = delete_async(secret_resource_name, secret_value_resource_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"delete",
"(",
"secret_resource_name",
",",
"secret_value_resource_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_async",
"(",
"secret_resource_name",
",",
"secret_value_resource_name",
",",
"custom_headers",
":custom_headers",
")",
".",
... | Deletes the specified value of the named secret resource.
Deletes the secret value resource identified by the name. The name of the
resource is typically the version associated with that value. Deletion will
fail if the specified value is in use.
@param secret_resource_name [String] The name of the secret resource.
@param secret_value_resource_name [String] The name of the secret resource
value which is typically the version identifier for the value.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Deletes",
"the",
"specified",
"value",
"of",
"the",
"named",
"secret",
"resource",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.4.0.36/generated/azure_service_fabric/mesh_secret_value.rb#L272-L275 | train | Deletes the specified secret resource. | [
30522,
13366,
3972,
12870,
1006,
3595,
1035,
7692,
1035,
2171,
1010,
3595,
1035,
3643,
1035,
7692,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
30524,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.load_plugins | def load_plugins
UI.verbose("Checking if there are any plugins that should be loaded...")
loaded_plugins = false
available_plugins.each do |gem_name|
UI.verbose("Loading '#{gem_name}' plugin")
begin
# BEFORE requiring the gem, we get a list of loaded actions
# This way we can check inside `store_plugin_reference` if
# any actions were overwritten
self.loaded_fastlane_actions.concat(Fastlane::Actions.constants)
FastlaneRequire.install_gem_if_needed(gem_name: gem_name, require_gem: true)
store_plugin_reference(gem_name)
loaded_plugins = true
rescue StandardError, ScriptError => ex # some errors, like ScriptError are not caught unless explicitly
UI.error("Error loading plugin '#{gem_name}': #{ex}")
# We'll still add it to the table, to make the error
# much more visible and obvious
self.plugin_references[gem_name] = {
version_number: Fastlane::ActionCollector.determine_version(gem_name),
actions: []
}
end
end
if !loaded_plugins && self.pluginfile_content.to_s.include?(PluginManager.plugin_prefix)
UI.error("It seems like you wanted to load some plugins, however they couldn't be loaded")
UI.error("Please follow the troubleshooting guide: #{TROUBLESHOOTING_URL}")
end
skip_print_plugin_info = self.plugin_references.empty? || CLIToolsDistributor.running_version_command? || FastlaneCore::Env.truthy?("FASTLANE_ENV_PRINTER")
# We want to avoid printing output other than the version number if we are running `fastlane -v`
print_plugin_information(self.plugin_references) unless skip_print_plugin_info
end | ruby | def load_plugins
UI.verbose("Checking if there are any plugins that should be loaded...")
loaded_plugins = false
available_plugins.each do |gem_name|
UI.verbose("Loading '#{gem_name}' plugin")
begin
# BEFORE requiring the gem, we get a list of loaded actions
# This way we can check inside `store_plugin_reference` if
# any actions were overwritten
self.loaded_fastlane_actions.concat(Fastlane::Actions.constants)
FastlaneRequire.install_gem_if_needed(gem_name: gem_name, require_gem: true)
store_plugin_reference(gem_name)
loaded_plugins = true
rescue StandardError, ScriptError => ex # some errors, like ScriptError are not caught unless explicitly
UI.error("Error loading plugin '#{gem_name}': #{ex}")
# We'll still add it to the table, to make the error
# much more visible and obvious
self.plugin_references[gem_name] = {
version_number: Fastlane::ActionCollector.determine_version(gem_name),
actions: []
}
end
end
if !loaded_plugins && self.pluginfile_content.to_s.include?(PluginManager.plugin_prefix)
UI.error("It seems like you wanted to load some plugins, however they couldn't be loaded")
UI.error("Please follow the troubleshooting guide: #{TROUBLESHOOTING_URL}")
end
skip_print_plugin_info = self.plugin_references.empty? || CLIToolsDistributor.running_version_command? || FastlaneCore::Env.truthy?("FASTLANE_ENV_PRINTER")
# We want to avoid printing output other than the version number if we are running `fastlane -v`
print_plugin_information(self.plugin_references) unless skip_print_plugin_info
end | [
"def",
"load_plugins",
"UI",
".",
"verbose",
"(",
"\"Checking if there are any plugins that should be loaded...\"",
")",
"loaded_plugins",
"=",
"false",
"available_plugins",
".",
"each",
"do",
"|",
"gem_name",
"|",
"UI",
".",
"verbose",
"(",
"\"Loading '#{gem_name}' plugi... | @!group Requiring the plugins
Iterate over all available plugins
which follow the naming convention
fastlane-plugin-[plugin_name]
This will make sure to load the action
and all its helpers | [
"@!group",
"Requiring",
"the",
"plugins"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/fastlane/lib/fastlane/plugins/plugin_manager.rb#L279-L316 | train | Load all plugins from the pluginfile | [
30522,
13366,
7170,
1035,
13354,
7076,
21318,
1012,
12034,
9232,
1006,
1000,
9361,
2065,
2045,
2024,
2151,
13354,
7076,
2008,
2323,
2022,
8209,
1012,
1012,
1012,
1000,
1007,
8209,
1035,
13354,
7076,
1027,
6270,
2800,
1035,
13354,
7076,
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... |
plaid/plaid-ruby | lib/plaid/products/base_product.rb | Plaid.BaseProduct.post_with_auth | def post_with_auth(path, response_class, payload)
response_class.new(client.post_with_auth(path, payload))
end | ruby | def post_with_auth(path, response_class, payload)
response_class.new(client.post_with_auth(path, payload))
end | [
"def",
"post_with_auth",
"(",
"path",
",",
"response_class",
",",
"payload",
")",
"response_class",
".",
"new",
"(",
"client",
".",
"post_with_auth",
"(",
"path",
",",
"payload",
")",
")",
"end"
] | Internal: Do a POST to API and capture it into a response object. | [
"Internal",
":",
"Do",
"a",
"POST",
"to",
"API",
"and",
"capture",
"it",
"into",
"a",
"response",
"object",
"."
] | ce3da1c5559c739de88c5f59e54eef875f296673 | https://github.com/plaid/plaid-ruby/blob/ce3da1c5559c739de88c5f59e54eef875f296673/lib/plaid/products/base_product.rb#L60-L62 | train | Post a request with auth | [
30522,
13366,
2695,
1035,
2007,
1035,
8740,
2705,
1006,
4130,
1010,
3433,
1035,
2465,
1010,
18093,
1007,
3433,
1035,
2465,
1012,
2047,
1006,
7396,
1012,
2695,
1035,
2007,
1035,
8740,
2705,
1006,
4130,
1010,
18093,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_policy_insights/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/remediations.rb | Azure::PolicyInsights::Mgmt::V2018_07_01_preview.Remediations.list_for_management_group_as_lazy | def list_for_management_group_as_lazy(management_group_id, query_options:nil, custom_headers:nil)
response = list_for_management_group_async(management_group_id, query_options:query_options, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_for_management_group_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_for_management_group_as_lazy(management_group_id, query_options:nil, custom_headers:nil)
response = list_for_management_group_async(management_group_id, query_options:query_options, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_for_management_group_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_for_management_group_as_lazy",
"(",
"management_group_id",
",",
"query_options",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_for_management_group_async",
"(",
"management_group_id",
",",
"query_options",
":query_options",
",",
"... | Gets all remediations for the management group.
@param management_group_id [String] Management group ID.
@param query_options [QueryOptions] Additional parameters for the operation
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [RemediationListResult] which provide lazy access to pages of the
response. | [
"Gets",
"all",
"remediations",
"for",
"the",
"management",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_policy_insights/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/remediations.rb#L3085-L3094 | train | Gets the list of all the policies in a management group. | [
30522,
13366,
2862,
1035,
2005,
1035,
2968,
1035,
2177,
1035,
2004,
1035,
13971,
1006,
2968,
1035,
2177,
1035,
8909,
1010,
23032,
1035,
7047,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2862,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
activeadmin/activeadmin | lib/active_admin/router.rb | ActiveAdmin.Router.define_actions | def define_actions(config)
router.member do
config.member_actions.each { |action| build_action(action) }
end
router.collection do
config.collection_actions.each { |action| build_action(action) }
router.post :batch_action if config.batch_actions_enabled?
end
end | ruby | def define_actions(config)
router.member do
config.member_actions.each { |action| build_action(action) }
end
router.collection do
config.collection_actions.each { |action| build_action(action) }
router.post :batch_action if config.batch_actions_enabled?
end
end | [
"def",
"define_actions",
"(",
"config",
")",
"router",
".",
"member",
"do",
"config",
".",
"member_actions",
".",
"each",
"{",
"|",
"action",
"|",
"build_action",
"(",
"action",
")",
"}",
"end",
"router",
".",
"collection",
"do",
"config",
".",
"collection... | Defines member and collection actions | [
"Defines",
"member",
"and",
"collection",
"actions"
] | 0759c8dcf97865748c9344459162ac3c7e65a6cd | https://github.com/activeadmin/activeadmin/blob/0759c8dcf97865748c9344459162ac3c7e65a6cd/lib/active_admin/router.rb#L75-L84 | train | Define the actions for the given config | [
30522,
13366,
9375,
1035,
4506,
1006,
9530,
8873,
2290,
1007,
2799,
2099,
1012,
2266,
2079,
9530,
8873,
2290,
1012,
2266,
1035,
4506,
1012,
2169,
1063,
1064,
2895,
1064,
3857,
1035,
2895,
1006,
2895,
1007,
1065,
2203,
2799,
2099,
1012,
30... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb | Azure::KeyVault::V2016_10_01.KeyVaultClient.get_deleted_keys | def get_deleted_keys(vault_base_url, maxresults:nil, custom_headers:nil)
first_page = get_deleted_keys_as_lazy(vault_base_url, maxresults:maxresults, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def get_deleted_keys(vault_base_url, maxresults:nil, custom_headers:nil)
first_page = get_deleted_keys_as_lazy(vault_base_url, maxresults:maxresults, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"get_deleted_keys",
"(",
"vault_base_url",
",",
"maxresults",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"get_deleted_keys_as_lazy",
"(",
"vault_base_url",
",",
"maxresults",
":",
"maxresults",
",",
"custom_headers",
":custom_headers... | Lists the deleted keys in the specified vault.
Retrieves a list of the keys in the Key Vault as JSON Web Key structures that
contain the public part of a deleted key. This operation includes
deletion-specific information. The Get Deleted Keys operation is applicable
for vaults enabled for soft-delete. While the operation can be invoked on any
vault, it will return an error if invoked on a non soft-delete enabled vault.
This operation requires the keys/list permission.
@param vault_base_url [String] The vault name, for example
https://myvault.vault.azure.net.
@param maxresults [Integer] Maximum number of results to return in a page. If
not specified the service will return up to 25 results.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<DeletedKeyItem>] operation results. | [
"Lists",
"the",
"deleted",
"keys",
"in",
"the",
"specified",
"vault",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_key_vault/lib/2016-10-01/generated/azure_key_vault/key_vault_client.rb#L2223-L2226 | train | Gets the deleted keys for the specified vault. | [
30522,
13366,
2131,
1035,
17159,
1035,
6309,
1006,
11632,
1035,
2918,
1035,
24471,
2140,
1010,
4098,
6072,
11314,
2015,
1024,
9152,
2140,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2131,
1035,
17159,
1035... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb | Azure::SQL::Mgmt::V2015_05_01_preview.FailoverGroups.begin_force_failover_allow_data_loss_with_http_info | def begin_force_failover_allow_data_loss_with_http_info(resource_group_name, server_name, failover_group_name, custom_headers:nil)
begin_force_failover_allow_data_loss_async(resource_group_name, server_name, failover_group_name, custom_headers:custom_headers).value!
end | ruby | def begin_force_failover_allow_data_loss_with_http_info(resource_group_name, server_name, failover_group_name, custom_headers:nil)
begin_force_failover_allow_data_loss_async(resource_group_name, server_name, failover_group_name, custom_headers:custom_headers).value!
end | [
"def",
"begin_force_failover_allow_data_loss_with_http_info",
"(",
"resource_group_name",
",",
"server_name",
",",
"failover_group_name",
",",
"custom_headers",
":",
"nil",
")",
"begin_force_failover_allow_data_loss_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"... | Fails over from the current primary server to this server. This operation
might result in data loss.
@param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param server_name [String] The name of the server containing the failover
group.
@param failover_group_name [String] The name of the failover group.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Fails",
"over",
"from",
"the",
"current",
"primary",
"server",
"to",
"this",
"server",
".",
"This",
"operation",
"might",
"result",
"in",
"data",
"loss",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb#L960-L962 | train | Force failover allow data loss to be reflected in the specified server. | [
30522,
13366,
4088,
1035,
2486,
1035,
8246,
7840,
1035,
3499,
1035,
2951,
1035,
3279,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8241,
1035,
2171,
1010,
8246,
7840,
1035,
2177,
1035,
2171,
1010,
7661,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activesupport/lib/active_support/inflector/transliterate.rb | ActiveSupport.Inflector.parameterize | def parameterize(string, separator: "-", preserve_case: false, locale: nil)
# Replace accented chars with their ASCII equivalents.
parameterized_string = transliterate(string, locale: locale)
# Turn unwanted chars into the separator.
parameterized_string.gsub!(/[^a-z0-9\-_]+/i, separator)
unless separator.nil? || separator.empty?
if separator == "-"
re_duplicate_separator = /-{2,}/
re_leading_trailing_separator = /^-|-$/i
else
re_sep = Regexp.escape(separator)
re_duplicate_separator = /#{re_sep}{2,}/
re_leading_trailing_separator = /^#{re_sep}|#{re_sep}$/i
end
# No more than one of the separator in a row.
parameterized_string.gsub!(re_duplicate_separator, separator)
# Remove leading/trailing separator.
parameterized_string.gsub!(re_leading_trailing_separator, "")
end
parameterized_string.downcase! unless preserve_case
parameterized_string
end | ruby | def parameterize(string, separator: "-", preserve_case: false, locale: nil)
# Replace accented chars with their ASCII equivalents.
parameterized_string = transliterate(string, locale: locale)
# Turn unwanted chars into the separator.
parameterized_string.gsub!(/[^a-z0-9\-_]+/i, separator)
unless separator.nil? || separator.empty?
if separator == "-"
re_duplicate_separator = /-{2,}/
re_leading_trailing_separator = /^-|-$/i
else
re_sep = Regexp.escape(separator)
re_duplicate_separator = /#{re_sep}{2,}/
re_leading_trailing_separator = /^#{re_sep}|#{re_sep}$/i
end
# No more than one of the separator in a row.
parameterized_string.gsub!(re_duplicate_separator, separator)
# Remove leading/trailing separator.
parameterized_string.gsub!(re_leading_trailing_separator, "")
end
parameterized_string.downcase! unless preserve_case
parameterized_string
end | [
"def",
"parameterize",
"(",
"string",
",",
"separator",
":",
"\"-\"",
",",
"preserve_case",
":",
"false",
",",
"locale",
":",
"nil",
")",
"# Replace accented chars with their ASCII equivalents.",
"parameterized_string",
"=",
"transliterate",
"(",
"string",
",",
"local... | Replaces special characters in a string so that it may be used as part of
a 'pretty' URL.
parameterize("Donald E. Knuth") # => "donald-e-knuth"
parameterize("^très|Jolie-- ") # => "tres-jolie"
To use a custom separator, override the +separator+ argument.
parameterize("Donald E. Knuth", separator: '_') # => "donald_e_knuth"
parameterize("^très|Jolie__ ", separator: '_') # => "tres_jolie"
To preserve the case of the characters in a string, use the +preserve_case+ argument.
parameterize("Donald E. Knuth", preserve_case: true) # => "Donald-E-Knuth"
parameterize("^très|Jolie-- ", preserve_case: true) # => "tres-Jolie"
It preserves dashes and underscores unless they are used as separators:
parameterize("^très|Jolie__ ") # => "tres-jolie__"
parameterize("^très|Jolie-- ", separator: "_") # => "tres_jolie--"
parameterize("^très_Jolie-- ", separator: ".") # => "tres_jolie--"
If the optional parameter +locale+ is specified,
the word will be parameterized as a word of that language.
By default, this parameter is set to <tt>nil</tt> and it will use
the configured <tt>I18n.locale<tt>. | [
"Replaces",
"special",
"characters",
"in",
"a",
"string",
"so",
"that",
"it",
"may",
"be",
"used",
"as",
"part",
"of",
"a",
"pretty",
"URL",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/inflector/transliterate.rb#L95-L119 | train | Parameterizes a string to a parameterized form. | [
30522,
13366,
16381,
4697,
1006,
5164,
1010,
19802,
25879,
2953,
1024,
1000,
1011,
1000,
1010,
7969,
1035,
2553,
1024,
6270,
1010,
2334,
2063,
1024,
9152,
2140,
1007,
1001,
5672,
9669,
2098,
25869,
2015,
2007,
2037,
2004,
6895,
2072,
5662,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_media_services/lib/2018-07-01/generated/azure_mgmt_media_services/streaming_endpoints.rb | Azure::MediaServices::Mgmt::V2018_07_01.StreamingEndpoints.begin_delete_with_http_info | def begin_delete_with_http_info(resource_group_name, account_name, streaming_endpoint_name, custom_headers:nil)
begin_delete_async(resource_group_name, account_name, streaming_endpoint_name, custom_headers:custom_headers).value!
end | ruby | def begin_delete_with_http_info(resource_group_name, account_name, streaming_endpoint_name, custom_headers:nil)
begin_delete_async(resource_group_name, account_name, streaming_endpoint_name, custom_headers:custom_headers).value!
end | [
"def",
"begin_delete_with_http_info",
"(",
"resource_group_name",
",",
"account_name",
",",
"streaming_endpoint_name",
",",
"custom_headers",
":",
"nil",
")",
"begin_delete_async",
"(",
"resource_group_name",
",",
"account_name",
",",
"streaming_endpoint_name",
",",
"custom... | Delete StreamingEndpoint
Deletes a StreamingEndpoint.
@param resource_group_name [String] The name of the resource group within the
Azure subscription.
@param account_name [String] The Media Services account name.
@param streaming_endpoint_name [String] The name of the StreamingEndpoint.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Delete",
"StreamingEndpoint"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_media_services/lib/2018-07-01/generated/azure_mgmt_media_services/streaming_endpoints.rb#L823-L825 | train | Deletes a streaming endpoint. | [
30522,
13366,
4088,
1035,
3972,
12870,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
4070,
1035,
2171,
1010,
11058,
1035,
2203,
8400,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_face/lib/1.0/generated/azure_cognitiveservices_face/person_group_person.rb | Azure::CognitiveServices::Face::V1_0.PersonGroupPerson.delete | def delete(person_group_id, person_id, custom_headers:nil)
response = delete_async(person_group_id, person_id, custom_headers:custom_headers).value!
nil
end | ruby | def delete(person_group_id, person_id, custom_headers:nil)
response = delete_async(person_group_id, person_id, custom_headers:custom_headers).value!
nil
end | [
"def",
"delete",
"(",
"person_group_id",
",",
"person_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_async",
"(",
"person_group_id",
",",
"person_id",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"nil",
"end"
] | Delete an existing person from a person group. All stored person data, and
face features in the person entry will be deleted.
@param person_group_id [String] Id referencing a particular person group.
@param person_id Id referencing a particular person.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Delete",
"an",
"existing",
"person",
"from",
"a",
"person",
"group",
".",
"All",
"stored",
"person",
"data",
"and",
"face",
"features",
"in",
"the",
"person",
"entry",
"will",
"be",
"deleted",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_face/lib/1.0/generated/azure_cognitiveservices_face/person_group_person.rb#L269-L272 | train | Deletes a person from a person group. | [
30522,
13366,
3972,
12870,
1006,
2711,
1035,
2177,
1035,
8909,
1010,
2711,
1035,
8909,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
1035,
2004,
6038,
2278,
1006,
2711,
1035,
2177,
1035,
8909,
1010,
2711,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.create_closed_list_entity_role | def create_closed_list_entity_role(app_id, version_id, entity_id, entity_role_create_object, custom_headers:nil)
response = create_closed_list_entity_role_async(app_id, version_id, entity_id, entity_role_create_object, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create_closed_list_entity_role(app_id, version_id, entity_id, entity_role_create_object, custom_headers:nil)
response = create_closed_list_entity_role_async(app_id, version_id, entity_id, entity_role_create_object, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create_closed_list_entity_role",
"(",
"app_id",
",",
"version_id",
",",
"entity_id",
",",
"entity_role_create_object",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_closed_list_entity_role_async",
"(",
"app_id",
",",
"version_id",
",",
"entity... | Create a role for a list 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 model ID.
@param entity_role_create_object [EntityRoleCreateObject] An entity role
object containing the name of role.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Uuid] operation results. | [
"Create",
"a",
"role",
"for",
"a",
"list",
"entity",
"in",
"a",
"version",
"of",
"the",
"application",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_luisauthoring/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb#L6691-L6694 | train | Creates an entity role for a list entity. | [
30522,
13366,
3443,
1035,
2701,
1035,
2862,
1035,
9178,
1035,
2535,
1006,
10439,
1035,
8909,
1010,
2544,
1035,
8909,
1010,
9178,
1035,
8909,
1010,
9178,
1035,
2535,
1035,
3443,
1035,
4874,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alexreisner/geocoder | lib/geocoder/calculations.rb | Geocoder.Calculations.extract_coordinates | def extract_coordinates(point)
case point
when Array
if point.size == 2
lat, lon = point
if !lat.nil? && lat.respond_to?(:to_f) and
!lon.nil? && lon.respond_to?(:to_f)
then
return [ lat.to_f, lon.to_f ]
end
end
when String
point = Geocoder.coordinates(point) and return point
else
if point.respond_to?(:to_coordinates)
if Array === array = point.to_coordinates
return extract_coordinates(array)
end
end
end
[ NAN, NAN ]
end | ruby | def extract_coordinates(point)
case point
when Array
if point.size == 2
lat, lon = point
if !lat.nil? && lat.respond_to?(:to_f) and
!lon.nil? && lon.respond_to?(:to_f)
then
return [ lat.to_f, lon.to_f ]
end
end
when String
point = Geocoder.coordinates(point) and return point
else
if point.respond_to?(:to_coordinates)
if Array === array = point.to_coordinates
return extract_coordinates(array)
end
end
end
[ NAN, NAN ]
end | [
"def",
"extract_coordinates",
"(",
"point",
")",
"case",
"point",
"when",
"Array",
"if",
"point",
".",
"size",
"==",
"2",
"lat",
",",
"lon",
"=",
"point",
"if",
"!",
"lat",
".",
"nil?",
"&&",
"lat",
".",
"respond_to?",
"(",
":to_f",
")",
"and",
"!",
... | Takes an object which is a [lat,lon] array, a geocodable string,
or an object that implements +to_coordinates+ and returns a
[lat,lon] array. Note that if a string is passed this may be a slow-
running method and may return nil. | [
"Takes",
"an",
"object",
"which",
"is",
"a",
"[",
"lat",
"lon",
"]",
"array",
"a",
"geocodable",
"string",
"or",
"an",
"object",
"that",
"implements",
"+",
"to_coordinates",
"+",
"and",
"returns",
"a",
"[",
"lat",
"lon",
"]",
"array",
".",
"Note",
"tha... | e087dc2759264ee6f307b926bb2de4ec2406859e | https://github.com/alexreisner/geocoder/blob/e087dc2759264ee6f307b926bb2de4ec2406859e/lib/geocoder/calculations.rb#L397-L418 | train | Extract coordinates from a point | [
30522,
13366,
14817,
1035,
12093,
1006,
2391,
1007,
2553,
2391,
2043,
9140,
2065,
2391,
1012,
2946,
1027,
1027,
1016,
2474,
2102,
1010,
8840,
2078,
1027,
2391,
2065,
999,
2474,
2102,
1012,
9152,
2140,
1029,
1004,
1004,
2474,
2102,
1012,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/job/dsl/iot_event.rb | Jets::Job::Dsl.IotEvent.iot_event | def iot_event(props={})
if props.is_a?(String) # SQL Statement
props = {sql: props}
topic_props = {topic_rule_payload: props}
elsif props.key?(:topic_rule_payload) # full properties structure
topic_props = props
else # just the topic_rule_payload
topic_props = {topic_rule_payload: props}
end
declare_iot_topic(topic_props)
end | ruby | def iot_event(props={})
if props.is_a?(String) # SQL Statement
props = {sql: props}
topic_props = {topic_rule_payload: props}
elsif props.key?(:topic_rule_payload) # full properties structure
topic_props = props
else # just the topic_rule_payload
topic_props = {topic_rule_payload: props}
end
declare_iot_topic(topic_props)
end | [
"def",
"iot_event",
"(",
"props",
"=",
"{",
"}",
")",
"if",
"props",
".",
"is_a?",
"(",
"String",
")",
"# SQL Statement",
"props",
"=",
"{",
"sql",
":",
"props",
"}",
"topic_props",
"=",
"{",
"topic_rule_payload",
":",
"props",
"}",
"elsif",
"props",
"... | The user must at least pass in an SQL statement | [
"The",
"user",
"must",
"at",
"least",
"pass",
"in",
"an",
"SQL",
"statement"
] | 46943a519224067e58aa3e2d5656e3ca083150f9 | https://github.com/tongueroo/jets/blob/46943a519224067e58aa3e2d5656e3ca083150f9/lib/jets/job/dsl/iot_event.rb#L4-L15 | train | Declare an iot event | [
30522,
13366,
22834,
2102,
1035,
2724,
1006,
24387,
1027,
1063,
1065,
1007,
2065,
24387,
1012,
2003,
1035,
1037,
1029,
1006,
5164,
1007,
1001,
29296,
4861,
24387,
1027,
1063,
29296,
1024,
24387,
1065,
8476,
1035,
24387,
1027,
1063,
8476,
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... |
projectcypress/health-data-standards | lib/hqmf-parser/1.0/population_criteria.rb | HQMF1.PopulationCriteria.code | def code
value = attr_val('cda:observation/cda:value/@code') || HQMF::PopulationCriteria::STRAT
# exclusion population criteria has id of DENOM with actionNegationInd of true
# special case this to simply handling
if attr_val('cda:observation/@actionNegationInd')=='true' && value == HQMF::PopulationCriteria::DENOM
value = HQMF::PopulationCriteria::DENEX
end
value.upcase
end | ruby | def code
value = attr_val('cda:observation/cda:value/@code') || HQMF::PopulationCriteria::STRAT
# exclusion population criteria has id of DENOM with actionNegationInd of true
# special case this to simply handling
if attr_val('cda:observation/@actionNegationInd')=='true' && value == HQMF::PopulationCriteria::DENOM
value = HQMF::PopulationCriteria::DENEX
end
value.upcase
end | [
"def",
"code",
"value",
"=",
"attr_val",
"(",
"'cda:observation/cda:value/@code'",
")",
"||",
"HQMF",
"::",
"PopulationCriteria",
"::",
"STRAT",
"# exclusion population criteria has id of DENOM with actionNegationInd of true",
"# special case this to simply handling",
"if",
"attr_v... | Create a new population criteria from the supplied HQMF entry
@param [Nokogiri::XML::Element] the HQMF entry
Get the code for the population criteria
@return [String] the code (e.g. IPP, DEMON, NUMER, DENEX, DENEXCEP) | [
"Create",
"a",
"new",
"population",
"criteria",
"from",
"the",
"supplied",
"HQMF",
"entry"
] | 252d4f0927c513eacde6b9ea41b76faa1423c34b | https://github.com/projectcypress/health-data-standards/blob/252d4f0927c513eacde6b9ea41b76faa1423c34b/lib/hqmf-parser/1.0/population_criteria.rb#L28-L36 | train | Returns the code of the population criteria | [
30522,
13366,
3642,
3643,
1027,
2012,
16344,
1035,
11748,
1006,
1005,
3729,
2050,
1024,
8089,
1013,
3729,
2050,
1024,
3643,
1013,
1030,
3642,
1005,
1007,
1064,
1064,
16260,
2213,
2546,
1024,
1024,
2313,
26775,
21646,
2401,
1024,
1024,
2358,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
fastlane/fastlane | spaceship/lib/spaceship/tunes/tunes_client.rb | Spaceship.TunesClient.all_build_trains | def all_build_trains(app_id: nil, platform: 'ios')
platform = 'ios' if platform.nil?
r = request(:get, "ra/apps/#{app_id}/buildHistory?platform=#{platform}")
handle_itc_response(r.body)
end | ruby | def all_build_trains(app_id: nil, platform: 'ios')
platform = 'ios' if platform.nil?
r = request(:get, "ra/apps/#{app_id}/buildHistory?platform=#{platform}")
handle_itc_response(r.body)
end | [
"def",
"all_build_trains",
"(",
"app_id",
":",
"nil",
",",
"platform",
":",
"'ios'",
")",
"platform",
"=",
"'ios'",
"if",
"platform",
".",
"nil?",
"r",
"=",
"request",
"(",
":get",
",",
"\"ra/apps/#{app_id}/buildHistory?platform=#{platform}\"",
")",
"handle_itc_re... | All build trains, even if there is no TestFlight | [
"All",
"build",
"trains",
"even",
"if",
"there",
"is",
"no",
"TestFlight"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/spaceship/lib/spaceship/tunes/tunes_client.rb#L960-L964 | train | Get all build trains for an app | [
30522,
13366,
2035,
1035,
3857,
1035,
4499,
1006,
10439,
1035,
8909,
1024,
9152,
2140,
1010,
4132,
1024,
1005,
16380,
1005,
1007,
4132,
1027,
1005,
16380,
1005,
2065,
4132,
1012,
9152,
2140,
1029,
1054,
1027,
5227,
1006,
1024,
2131,
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... |
piotrmurach/github | lib/github_api/client/authorizations.rb | Github.Client::Authorizations.delete | def delete(*args)
raise_authentication_error unless authenticated?
arguments(args, required: [:id])
delete_request("/authorizations/#{arguments.id}", arguments.params)
end | ruby | def delete(*args)
raise_authentication_error unless authenticated?
arguments(args, required: [:id])
delete_request("/authorizations/#{arguments.id}", arguments.params)
end | [
"def",
"delete",
"(",
"*",
"args",
")",
"raise_authentication_error",
"unless",
"authenticated?",
"arguments",
"(",
"args",
",",
"required",
":",
"[",
":id",
"]",
")",
"delete_request",
"(",
"\"/authorizations/#{arguments.id}\"",
",",
"arguments",
".",
"params",
"... | Delete an authorization
@see https://developer.github.com/v3/oauth_authorizations/#delete-an-authorization
@example
github = Github.new
github.oauth.delete 'authorization-id'
@api public | [
"Delete",
"an",
"authorization"
] | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/client/authorizations.rb#L127-L132 | train | Delete an existing authorization | [
30522,
13366,
3972,
12870,
1006,
1008,
12098,
5620,
1007,
5333,
1035,
27280,
1035,
7561,
4983,
14469,
4383,
1029,
9918,
1006,
12098,
5620,
1010,
3223,
1024,
1031,
1024,
8909,
1033,
1007,
3972,
12870,
1035,
5227,
1006,
1000,
1013,
20104,
201... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.fetch_comments_async | def fetch_comments_async(prs)
threads = []
prs.each_slice(MAX_THREAD_NUMBER) do |prs_slice|
prs_slice.each do |pr|
threads << Thread.new do
pr["comments"] = []
iterate_pages(@client, "issue_comments", pr["number"]) do |new_comment|
pr["comments"].concat(new_comment)
end
pr["comments"] = pr["comments"].map { |comment| stringify_keys_deep(comment.to_hash) }
end
end
threads.each(&:join)
threads = []
end
nil
end | ruby | def fetch_comments_async(prs)
threads = []
prs.each_slice(MAX_THREAD_NUMBER) do |prs_slice|
prs_slice.each do |pr|
threads << Thread.new do
pr["comments"] = []
iterate_pages(@client, "issue_comments", pr["number"]) do |new_comment|
pr["comments"].concat(new_comment)
end
pr["comments"] = pr["comments"].map { |comment| stringify_keys_deep(comment.to_hash) }
end
end
threads.each(&:join)
threads = []
end
nil
end | [
"def",
"fetch_comments_async",
"(",
"prs",
")",
"threads",
"=",
"[",
"]",
"prs",
".",
"each_slice",
"(",
"MAX_THREAD_NUMBER",
")",
"do",
"|",
"prs_slice",
"|",
"prs_slice",
".",
"each",
"do",
"|",
"pr",
"|",
"threads",
"<<",
"Thread",
".",
"new",
"do",
... | Fetch comments for PRs and add them to "comments"
@param [Array] prs The array of PRs.
@return [Void] No return; PRs are updated in-place. | [
"Fetch",
"comments",
"for",
"PRs",
"and",
"add",
"them",
"to",
"comments"
] | f18c64b5cc0d7473b059275b88385ac11ca8b564 | https://github.com/github-changelog-generator/github-changelog-generator/blob/f18c64b5cc0d7473b059275b88385ac11ca8b564/lib/github_changelog_generator/octo_fetcher.rb#L217-L234 | train | Fetch comments asynchronously | [
30522,
13366,
18584,
1035,
7928,
1035,
2004,
6038,
2278,
1006,
10975,
2015,
1007,
16457,
1027,
1031,
1033,
10975,
2015,
1012,
2169,
1035,
14704,
1006,
4098,
1035,
11689,
1035,
2193,
1007,
2079,
1064,
10975,
2015,
1035,
14704,
1064,
10975,
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... |
aws/aws-sdk-ruby | gems/aws-sdk-iam/lib/aws-sdk-iam/group_policy.rb | Aws::IAM.GroupPolicy.put | def put(options = {})
options = options.merge(
group_name: @group_name,
policy_name: @name
)
resp = @client.put_group_policy(options)
resp.data
end | ruby | def put(options = {})
options = options.merge(
group_name: @group_name,
policy_name: @name
)
resp = @client.put_group_policy(options)
resp.data
end | [
"def",
"put",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"group_name",
":",
"@group_name",
",",
"policy_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"put_group_policy",
"(",
"options",
")",
"resp",
".",
... | @example Request syntax with placeholder values
group_policy.put({
policy_document: "policyDocumentType", # required
})
@param [Hash] options ({})
@option options [required, String] :policy_document
The policy document.
The [regex pattern][1] used to validate this parameter is a string of
characters consisting of the following:
* Any printable ASCII character ranging from the space character
(\\u0020) through the end of the ASCII character range
* The printable characters in the Basic Latin and Latin-1 Supplement
character set (through \\u00FF)
* The special characters tab (\\u0009), line feed (\\u000A), and
carriage return (\\u000D)
[1]: http://wikipedia.org/wiki/regex
@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/group_policy.rb#L222-L229 | train | Put a policy on a group | [
30522,
13366,
2404,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
2177,
1035,
2171,
1024,
1030,
2177,
1035,
2171,
1010,
3343,
1035,
2171,
1024,
1030,
2171,
1007,
24501,
2361,
1027,
1030,
7396,
1012,
2404,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
meew0/discordrb | lib/discordrb/data/server.rb | Discordrb.Server.unban | def unban(user, reason = nil)
API::Server.unban_user(@bot.token, @id, user.resolve_id, reason)
end | ruby | def unban(user, reason = nil)
API::Server.unban_user(@bot.token, @id, user.resolve_id, reason)
end | [
"def",
"unban",
"(",
"user",
",",
"reason",
"=",
"nil",
")",
"API",
"::",
"Server",
".",
"unban_user",
"(",
"@bot",
".",
"token",
",",
"@id",
",",
"user",
".",
"resolve_id",
",",
"reason",
")",
"end"
] | Unbans a previously banned user from this server.
@param user [User, #resolve_id] The user to unban.
@param reason [String] The reason the user is being unbanned. | [
"Unbans",
"a",
"previously",
"banned",
"user",
"from",
"this",
"server",
"."
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/data/server.rb#L559-L561 | train | Unban a user | [
30522,
13366,
4895,
8193,
1006,
5310,
1010,
3114,
1027,
9152,
2140,
1007,
17928,
1024,
1024,
8241,
1012,
4895,
8193,
1035,
5310,
1006,
1030,
28516,
1012,
19204,
1010,
1030,
8909,
1010,
5310,
1012,
10663,
1035,
8909,
1010,
3114,
1007,
2203,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
samvera/hyrax | app/models/hyrax/permission_template.rb | Hyrax.PermissionTemplate.collection | def collection
return Collection.find(source_id) if Collection.exists?(source_id)
raise ActiveFedora::ObjectNotFoundError
rescue ActiveFedora::ActiveFedoraError # TODO: remove the rescue when active_fedora issue #1276 is fixed
raise ActiveFedora::ObjectNotFoundError
end | ruby | def collection
return Collection.find(source_id) if Collection.exists?(source_id)
raise ActiveFedora::ObjectNotFoundError
rescue ActiveFedora::ActiveFedoraError # TODO: remove the rescue when active_fedora issue #1276 is fixed
raise ActiveFedora::ObjectNotFoundError
end | [
"def",
"collection",
"return",
"Collection",
".",
"find",
"(",
"source_id",
")",
"if",
"Collection",
".",
"exists?",
"(",
"source_id",
")",
"raise",
"ActiveFedora",
"::",
"ObjectNotFoundError",
"rescue",
"ActiveFedora",
"::",
"ActiveFedoraError",
"# TODO: remove the r... | A bit of an analogue for a `belongs_to :collection` as it crosses from Fedora to the DB
@return [Collection]
@raise [ActiveFedora::ObjectNotFoundError] when the we cannot find the Collection | [
"A",
"bit",
"of",
"an",
"analogue",
"for",
"a",
"belongs_to",
":",
"collection",
"as",
"it",
"crosses",
"from",
"Fedora",
"to",
"the",
"DB"
] | e2b4f56e829a53b1f11296324736e9d5b8c9ee5f | https://github.com/samvera/hyrax/blob/e2b4f56e829a53b1f11296324736e9d5b8c9ee5f/app/models/hyrax/permission_template.rb#L53-L58 | train | Returns the index of the object in the collection | [
30522,
13366,
3074,
2709,
3074,
1012,
2424,
1006,
3120,
1035,
8909,
1007,
2065,
3074,
1012,
6526,
1029,
1006,
3120,
1035,
8909,
1007,
5333,
3161,
25031,
6525,
1024,
1024,
4874,
17048,
14876,
20824,
29165,
5343,
3161,
25031,
6525,
1024,
1024... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activesupport/lib/active_support/file_update_checker.rb | ActiveSupport.FileUpdateChecker.max_mtime | def max_mtime(paths)
time_now = Time.now
max_mtime = nil
# Time comparisons are performed with #compare_without_coercion because
# AS redefines these operators in a way that is much slower and does not
# bring any benefit in this particular code.
#
# Read t1.compare_without_coercion(t2) < 0 as t1 < t2.
paths.each do |path|
mtime = File.mtime(path)
next if time_now.compare_without_coercion(mtime) < 0
if max_mtime.nil? || max_mtime.compare_without_coercion(mtime) < 0
max_mtime = mtime
end
end
max_mtime
end | ruby | def max_mtime(paths)
time_now = Time.now
max_mtime = nil
# Time comparisons are performed with #compare_without_coercion because
# AS redefines these operators in a way that is much slower and does not
# bring any benefit in this particular code.
#
# Read t1.compare_without_coercion(t2) < 0 as t1 < t2.
paths.each do |path|
mtime = File.mtime(path)
next if time_now.compare_without_coercion(mtime) < 0
if max_mtime.nil? || max_mtime.compare_without_coercion(mtime) < 0
max_mtime = mtime
end
end
max_mtime
end | [
"def",
"max_mtime",
"(",
"paths",
")",
"time_now",
"=",
"Time",
".",
"now",
"max_mtime",
"=",
"nil",
"# Time comparisons are performed with #compare_without_coercion because",
"# AS redefines these operators in a way that is much slower and does not",
"# bring any benefit in this parti... | This method returns the maximum mtime of the files in +paths+, or +nil+
if the array is empty.
Files with a mtime in the future are ignored. Such abnormal situation
can happen for example if the user changes the clock by hand. It is
healthy to consider this edge case because with mtimes in the future
reloading is not triggered. | [
"This",
"method",
"returns",
"the",
"maximum",
"mtime",
"of",
"the",
"files",
"in",
"+",
"paths",
"+",
"or",
"+",
"nil",
"+",
"if",
"the",
"array",
"is",
"empty",
"."
] | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/activesupport/lib/active_support/file_update_checker.rb#L121-L141 | train | Returns the max mtime of the given files | [
30522,
13366,
4098,
1035,
11047,
14428,
1006,
10425,
1007,
2051,
1035,
2085,
1027,
2051,
1012,
2085,
4098,
1035,
11047,
14428,
1027,
9152,
2140,
1001,
2051,
18539,
2024,
2864,
2007,
1001,
12826,
1035,
2302,
1035,
24873,
11890,
3258,
2138,
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/ext/mongo_mapper.rb | AwesomePrint.MongoMapper.awesome_mongo_mapper_instance | def awesome_mongo_mapper_instance(object)
return object.inspect if !defined?(::ActiveSupport::OrderedHash)
return awesome_object(object) if @options[:raw]
data = object.keys.keys.sort_by { |k| k }.inject(::ActiveSupport::OrderedHash.new) do |hash, name|
hash[name] = object[name]
hash
end
# Add in associations
if @options[:mongo_mapper][:show_associations]
object.associations.each do |name, assoc|
data[name.to_s] = if @options[:mongo_mapper][:inline_embedded] and assoc.embeddable?
object.send(name)
else
assoc
end
end
end
label = object.to_s
label = "#{colorize('embedded', :assoc)} #{label}" if object.is_a?(::MongoMapper::EmbeddedDocument)
"#{label} " << awesome_hash(data)
end | ruby | def awesome_mongo_mapper_instance(object)
return object.inspect if !defined?(::ActiveSupport::OrderedHash)
return awesome_object(object) if @options[:raw]
data = object.keys.keys.sort_by { |k| k }.inject(::ActiveSupport::OrderedHash.new) do |hash, name|
hash[name] = object[name]
hash
end
# Add in associations
if @options[:mongo_mapper][:show_associations]
object.associations.each do |name, assoc|
data[name.to_s] = if @options[:mongo_mapper][:inline_embedded] and assoc.embeddable?
object.send(name)
else
assoc
end
end
end
label = object.to_s
label = "#{colorize('embedded', :assoc)} #{label}" if object.is_a?(::MongoMapper::EmbeddedDocument)
"#{label} " << awesome_hash(data)
end | [
"def",
"awesome_mongo_mapper_instance",
"(",
"object",
")",
"return",
"object",
".",
"inspect",
"if",
"!",
"defined?",
"(",
"::",
"ActiveSupport",
"::",
"OrderedHash",
")",
"return",
"awesome_object",
"(",
"object",
")",
"if",
"@options",
"[",
":raw",
"]",
"da... | Format MongoMapper instance object.
NOTE: by default only instance attributes (i.e. keys) are shown. To format
MongoMapper instance as regular object showing its instance variables and
accessors use :raw => true option:
ap record, :raw => true
------------------------------------------------------------------------------ | [
"Format",
"MongoMapper",
"instance",
"object",
"."
] | 4564fd74721562cbef2443f7d97109bf9192343d | https://github.com/awesome-print/awesome_print/blob/4564fd74721562cbef2443f7d97109bf9192343d/lib/awesome_print/ext/mongo_mapper.rb#L67-L91 | train | Returns a string representation of the given object. | [
30522,
13366,
12476,
1035,
12256,
3995,
1035,
4949,
4842,
1035,
6013,
1006,
4874,
1007,
2709,
4874,
1012,
22459,
2065,
999,
4225,
1029,
1006,
1024,
1024,
3161,
6342,
9397,
11589,
1024,
1024,
3641,
14949,
2232,
1007,
2709,
12476,
1035,
4874,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mikel/mail | lib/mail/message.rb | Mail.Message.add_file | def add_file(values)
convert_to_multipart unless self.multipart? || Utilities.blank?(self.body.decoded)
add_multipart_mixed_header
if values.is_a?(String)
basename = File.basename(values)
filedata = File.open(values, 'rb') { |f| f.read }
else
basename = values[:filename]
filedata = values
end
self.attachments[basename] = filedata
end | ruby | def add_file(values)
convert_to_multipart unless self.multipart? || Utilities.blank?(self.body.decoded)
add_multipart_mixed_header
if values.is_a?(String)
basename = File.basename(values)
filedata = File.open(values, 'rb') { |f| f.read }
else
basename = values[:filename]
filedata = values
end
self.attachments[basename] = filedata
end | [
"def",
"add_file",
"(",
"values",
")",
"convert_to_multipart",
"unless",
"self",
".",
"multipart?",
"||",
"Utilities",
".",
"blank?",
"(",
"self",
".",
"body",
".",
"decoded",
")",
"add_multipart_mixed_header",
"if",
"values",
".",
"is_a?",
"(",
"String",
")",... | Adds a file to the message. You have two options with this method, you can
just pass in the absolute path to the file you want and Mail will read the file,
get the filename from the path you pass in and guess the MIME media type, or you
can pass in the filename as a string, and pass in the file content as a blob.
Example:
m = Mail.new
m.add_file('/path/to/filename.png')
m = Mail.new
m.add_file(:filename => 'filename.png', :content => File.read('/path/to/file.jpg'))
Note also that if you add a file to an existing message, Mail will convert that message
to a MIME multipart email, moving whatever plain text body you had into its own text
plain part.
Example:
m = Mail.new do
body 'this is some text'
end
m.multipart? #=> false
m.add_file('/path/to/filename.png')
m.multipart? #=> true
m.parts.first.content_type.content_type #=> 'text/plain'
m.parts.last.content_type.content_type #=> 'image/png'
See also #attachments | [
"Adds",
"a",
"file",
"to",
"the",
"message",
".",
"You",
"have",
"two",
"options",
"with",
"this",
"method",
"you",
"can",
"just",
"pass",
"in",
"the",
"absolute",
"path",
"to",
"the",
"file",
"you",
"want",
"and",
"Mail",
"will",
"read",
"the",
"file"... | fb53fb369eb2bf0494ac70675970c90cdcc3f495 | https://github.com/mikel/mail/blob/fb53fb369eb2bf0494ac70675970c90cdcc3f495/lib/mail/message.rb#L1755-L1766 | train | Add a file to the attachment | [
30522,
13366,
5587,
1035,
5371,
1006,
5300,
1007,
10463,
1035,
2000,
1035,
4800,
19362,
2102,
4983,
2969,
1012,
4800,
19362,
2102,
1029,
1064,
1064,
16548,
1012,
8744,
1029,
1006,
2969,
1012,
2303,
1012,
21933,
5732,
1007,
5587,
1035,
4800,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
cheezy/page-object | lib/page-object/accessors.rb | PageObject.Accessors.checkbox | def checkbox(name, identifier={:index => 0}, &block)
standard_methods(name, identifier, 'checkbox_for', &block)
define_method("check_#{name}") do
return platform.check_checkbox(identifier.clone) unless block_given?
self.send("#{name}_element").check
end
define_method("uncheck_#{name}") do
return platform.uncheck_checkbox(identifier.clone) unless block_given?
self.send("#{name}_element").uncheck
end
define_method("#{name}_checked?") do
return platform.checkbox_checked?(identifier.clone) unless block_given?
self.send("#{name}_element").checked?
end
end | ruby | def checkbox(name, identifier={:index => 0}, &block)
standard_methods(name, identifier, 'checkbox_for', &block)
define_method("check_#{name}") do
return platform.check_checkbox(identifier.clone) unless block_given?
self.send("#{name}_element").check
end
define_method("uncheck_#{name}") do
return platform.uncheck_checkbox(identifier.clone) unless block_given?
self.send("#{name}_element").uncheck
end
define_method("#{name}_checked?") do
return platform.checkbox_checked?(identifier.clone) unless block_given?
self.send("#{name}_element").checked?
end
end | [
"def",
"checkbox",
"(",
"name",
",",
"identifier",
"=",
"{",
":index",
"=>",
"0",
"}",
",",
"&",
"block",
")",
"standard_methods",
"(",
"name",
",",
"identifier",
",",
"'checkbox_for'",
",",
"block",
")",
"define_method",
"(",
"\"check_#{name}\"",
")",
"do... | adds five methods - one to check, another to uncheck, another
to return the state of a checkbox, another to return
a PageObject::Elements::CheckBox object representing the checkbox, and
a final method to check the checkbox's existence.
@example
checkbox(:active, :name => "is_active")
# will generate 'check_active', 'uncheck_active', 'active_checked?',
# 'active_element', and 'active?' methods
@param [Symbol] the name used for the generated methods
@param [Hash] identifier how we find a checkbox.
@param optional block to be invoked when element method is called | [
"adds",
"five",
"methods",
"-",
"one",
"to",
"check",
"another",
"to",
"uncheck",
"another",
"to",
"return",
"the",
"state",
"of",
"a",
"checkbox",
"another",
"to",
"return",
"a",
"PageObject",
"::",
"Elements",
"::",
"CheckBox",
"object",
"representing",
"t... | 850d775bf63768fbb1551a34480195785fe8e193 | https://github.com/cheezy/page-object/blob/850d775bf63768fbb1551a34480195785fe8e193/lib/page-object/accessors.rb#L326-L340 | train | Returns a checkbox object. | [
30522,
13366,
4638,
8758,
1006,
2171,
1010,
8909,
4765,
18095,
1027,
1063,
1024,
5950,
1027,
1028,
1014,
1065,
1010,
1004,
3796,
1007,
3115,
1035,
4725,
1006,
2171,
1010,
8909,
4765,
18095,
1010,
1005,
4638,
8758,
1035,
2005,
1005,
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... |
github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/generator/generator.rb | GitHubChangelogGenerator.Generator.filter_issues_for_tags | def filter_issues_for_tags(newer_tag, older_tag)
filtered_pull_requests = filter_by_tag(@pull_requests, newer_tag)
filtered_issues = delete_by_time(@issues, "actual_date", older_tag, newer_tag)
newer_tag_name = newer_tag.nil? ? nil : newer_tag["name"]
if options[:filter_issues_by_milestone]
# delete excess irrelevant issues (according milestones). Issue #22.
filtered_issues = filter_by_milestone(filtered_issues, newer_tag_name, @issues)
filtered_pull_requests = filter_by_milestone(filtered_pull_requests, newer_tag_name, @pull_requests)
end
[filtered_issues, filtered_pull_requests]
end | ruby | def filter_issues_for_tags(newer_tag, older_tag)
filtered_pull_requests = filter_by_tag(@pull_requests, newer_tag)
filtered_issues = delete_by_time(@issues, "actual_date", older_tag, newer_tag)
newer_tag_name = newer_tag.nil? ? nil : newer_tag["name"]
if options[:filter_issues_by_milestone]
# delete excess irrelevant issues (according milestones). Issue #22.
filtered_issues = filter_by_milestone(filtered_issues, newer_tag_name, @issues)
filtered_pull_requests = filter_by_milestone(filtered_pull_requests, newer_tag_name, @pull_requests)
end
[filtered_issues, filtered_pull_requests]
end | [
"def",
"filter_issues_for_tags",
"(",
"newer_tag",
",",
"older_tag",
")",
"filtered_pull_requests",
"=",
"filter_by_tag",
"(",
"@pull_requests",
",",
"newer_tag",
")",
"filtered_issues",
"=",
"delete_by_time",
"(",
"@issues",
",",
"\"actual_date\"",
",",
"older_tag",
... | Filters issues and pull requests based on, respectively, `actual_date`
and `merged_at` timestamp fields. `actual_date` is the detected form of
`closed_at` based on merge event SHA commit times.
@return [Array] filtered issues and pull requests | [
"Filters",
"issues",
"and",
"pull",
"requests",
"based",
"on",
"respectively",
"actual_date",
"and",
"merged_at",
"timestamp",
"fields",
".",
"actual_date",
"is",
"the",
"detected",
"form",
"of",
"closed_at",
"based",
"on",
"merge",
"event",
"SHA",
"commit",
"ti... | f18c64b5cc0d7473b059275b88385ac11ca8b564 | https://github.com/github-changelog-generator/github-changelog-generator/blob/f18c64b5cc0d7473b059275b88385ac11ca8b564/lib/github_changelog_generator/generator/generator.rb#L100-L112 | train | Filter issues for a given tag | [
30522,
13366,
11307,
1035,
3314,
1035,
2005,
1035,
22073,
1006,
10947,
1035,
6415,
1010,
3080,
1035,
6415,
1007,
21839,
1035,
4139,
1035,
11186,
1027,
11307,
1035,
2011,
1035,
6415,
1006,
1030,
4139,
1035,
11186,
1010,
10947,
1035,
6415,
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_recovery_services_site_recovery/lib/2018-01-10/generated/azure_mgmt_recovery_services_site_recovery/replication_vault_health.rb | Azure::RecoveryServicesSiteRecovery::Mgmt::V2018_01_10.ReplicationVaultHealth.refresh_async | def refresh_async(custom_headers:nil)
# Send request
promise = begin_refresh_async(custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2018_01_10::Models::VaultHealthDetails.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | ruby | def refresh_async(custom_headers:nil)
# Send request
promise = begin_refresh_async(custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::RecoveryServicesSiteRecovery::Mgmt::V2018_01_10::Models::VaultHealthDetails.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | [
"def",
"refresh_async",
"(",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_refresh_async",
"(",
"custom_headers",
":custom_headers",
")",
"promise",
"=",
"promise",
".",
"then",
"do",
"|",
"response",
"|",
"# Defining deserialization meth... | @param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"custom_headers",
"[",
"Hash",
"{",
"String",
"=",
">",
"String",
"}",
"]",
"A",
"hash",
"of",
"custom",
"headers",
"that",
"will",
"be",
"added",
"to",
"the",
"HTTP",
"request",
"."
] | 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_vault_health.rb#L136-L152 | train | Refresh a vault health details. | [
30522,
13366,
25416,
21898,
1035,
2004,
6038,
2278,
1006,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,
4088,
1035,
25416,
21898,
1035,
2004,
6038,
2278,
1006,
7661,
1035,
20346,
2015,
1024,
7661,
1035,
2034... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mhenrixon/sidekiq-unique-jobs | lib/sidekiq_unique_jobs/unique_args.rb | SidekiqUniqueJobs.UniqueArgs.digestable_hash | def digestable_hash
@item.slice(CLASS_KEY, QUEUE_KEY, UNIQUE_ARGS_KEY).tap do |hash|
hash.delete(QUEUE_KEY) if unique_across_queues?
hash.delete(CLASS_KEY) if unique_across_workers?
end
end | ruby | def digestable_hash
@item.slice(CLASS_KEY, QUEUE_KEY, UNIQUE_ARGS_KEY).tap do |hash|
hash.delete(QUEUE_KEY) if unique_across_queues?
hash.delete(CLASS_KEY) if unique_across_workers?
end
end | [
"def",
"digestable_hash",
"@item",
".",
"slice",
"(",
"CLASS_KEY",
",",
"QUEUE_KEY",
",",
"UNIQUE_ARGS_KEY",
")",
".",
"tap",
"do",
"|",
"hash",
"|",
"hash",
".",
"delete",
"(",
"QUEUE_KEY",
")",
"if",
"unique_across_queues?",
"hash",
".",
"delete",
"(",
"... | Filter a hash to use for digest
@return [Hash] to use for digest | [
"Filter",
"a",
"hash",
"to",
"use",
"for",
"digest"
] | 2944b97c720528f53962ccfd17d43ac939a77f46 | https://github.com/mhenrixon/sidekiq-unique-jobs/blob/2944b97c720528f53962ccfd17d43ac939a77f46/lib/sidekiq_unique_jobs/unique_args.rb#L62-L67 | train | Returns a hash of the digestable items | [
30522,
13366,
17886,
3085,
1035,
23325,
1030,
8875,
1012,
14704,
1006,
2465,
1035,
3145,
1010,
24240,
1035,
3145,
1010,
4310,
1035,
12098,
5620,
1035,
3145,
1007,
1012,
11112,
2079,
1064,
23325,
1064,
23325,
1012,
3972,
12870,
1006,
24240,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
castwide/solargraph | lib/solargraph/library.rb | Solargraph.Library.diagnose | def diagnose filename
# @todo Only open files get diagnosed. Determine whether anything or
# everything in the workspace should get diagnosed, or if there should
# be an option to do so.
#
return [] unless open?(filename)
catalog
result = []
source = read(filename)
workspace.config.reporters.each do |name|
reporter = Diagnostics.reporter(name)
raise DiagnosticsError, "Diagnostics reporter #{name} does not exist" if reporter.nil?
result.concat reporter.new.diagnose(source, api_map)
end
result
end | ruby | def diagnose filename
# @todo Only open files get diagnosed. Determine whether anything or
# everything in the workspace should get diagnosed, or if there should
# be an option to do so.
#
return [] unless open?(filename)
catalog
result = []
source = read(filename)
workspace.config.reporters.each do |name|
reporter = Diagnostics.reporter(name)
raise DiagnosticsError, "Diagnostics reporter #{name} does not exist" if reporter.nil?
result.concat reporter.new.diagnose(source, api_map)
end
result
end | [
"def",
"diagnose",
"filename",
"# @todo Only open files get diagnosed. Determine whether anything or",
"# everything in the workspace should get diagnosed, or if there should",
"# be an option to do so.",
"#",
"return",
"[",
"]",
"unless",
"open?",
"(",
"filename",
")",
"catalog",
... | Get diagnostics about a file.
@param filename [String]
@return [Array<Hash>] | [
"Get",
"diagnostics",
"about",
"a",
"file",
"."
] | 47badb5d151aca775ccbe6c470236089eae7839d | https://github.com/castwide/solargraph/blob/47badb5d151aca775ccbe6c470236089eae7839d/lib/solargraph/library.rb#L323-L338 | train | Diagnose a file | [
30522,
13366,
22939,
26745,
3366,
5371,
18442,
1001,
1030,
28681,
2080,
2069,
2330,
6764,
2131,
11441,
1012,
5646,
3251,
2505,
2030,
1001,
2673,
1999,
1996,
2573,
15327,
2323,
2131,
11441,
1010,
2030,
2065,
2045,
2323,
1001,
2022,
2019,
572... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/schedule.rb | IceCube.Schedule.enumerate_occurrences | def enumerate_occurrences(opening_time, closing_time = nil, options = {})
opening_time = TimeUtil.match_zone(opening_time, start_time)
closing_time = TimeUtil.match_zone(closing_time, start_time)
opening_time += TimeUtil.subsec(start_time) - TimeUtil.subsec(opening_time)
opening_time = start_time if opening_time < start_time
spans = options[:spans] == true && duration != 0
Enumerator.new do |yielder|
reset
t1 = full_required? ? start_time : opening_time
t1 -= duration if spans
t1 = start_time if t1 < start_time
loop do
break unless (t0 = next_time(t1, closing_time))
break if closing_time && t0 > closing_time
if (spans ? (t0.end_time > opening_time) : (t0 >= opening_time))
yielder << (block_given? ? yield(t0) : t0)
end
t1 = t0 + 1
end
end
end | ruby | def enumerate_occurrences(opening_time, closing_time = nil, options = {})
opening_time = TimeUtil.match_zone(opening_time, start_time)
closing_time = TimeUtil.match_zone(closing_time, start_time)
opening_time += TimeUtil.subsec(start_time) - TimeUtil.subsec(opening_time)
opening_time = start_time if opening_time < start_time
spans = options[:spans] == true && duration != 0
Enumerator.new do |yielder|
reset
t1 = full_required? ? start_time : opening_time
t1 -= duration if spans
t1 = start_time if t1 < start_time
loop do
break unless (t0 = next_time(t1, closing_time))
break if closing_time && t0 > closing_time
if (spans ? (t0.end_time > opening_time) : (t0 >= opening_time))
yielder << (block_given? ? yield(t0) : t0)
end
t1 = t0 + 1
end
end
end | [
"def",
"enumerate_occurrences",
"(",
"opening_time",
",",
"closing_time",
"=",
"nil",
",",
"options",
"=",
"{",
"}",
")",
"opening_time",
"=",
"TimeUtil",
".",
"match_zone",
"(",
"opening_time",
",",
"start_time",
")",
"closing_time",
"=",
"TimeUtil",
".",
"ma... | Find all of the occurrences for the schedule between opening_time
and closing_time
Iteration is unrolled in pairs to skip duplicate times in end of DST | [
"Find",
"all",
"of",
"the",
"occurrences",
"for",
"the",
"schedule",
"between",
"opening_time",
"and",
"closing_time",
"Iteration",
"is",
"unrolled",
"in",
"pairs",
"to",
"skip",
"duplicate",
"times",
"in",
"end",
"of",
"DST"
] | fb6c657bdc4f87dfda2bf83f15c5f487b78ccabd | https://github.com/seejohnrun/ice_cube/blob/fb6c657bdc4f87dfda2bf83f15c5f487b78ccabd/lib/ice_cube/schedule.rb#L424-L444 | train | Enumerate the occurrences of the given time. | [
30522,
13366,
4372,
17897,
11657,
1035,
27247,
1006,
3098,
1035,
2051,
1010,
5494,
1035,
2051,
1027,
9152,
2140,
1010,
7047,
1027,
1063,
1065,
1007,
3098,
1035,
2051,
1027,
2051,
21823,
2140,
1012,
2674,
1035,
4224,
1006,
3098,
1035,
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... |
rmagick/rmagick | ext/RMagick/extconf.rb | RMagick.Extconf.have_enum_value | def have_enum_value(enum, value, headers = nil, &b)
checking_for "#{enum}.#{value}" do
if try_compile(<<"SRC", &b)
#{COMMON_HEADERS}
#{cpp_include(headers)}
/*top*/
int main() { #{enum} t = #{value}; t = t; return 0; }
SRC
$defs.push(format('-DHAVE_ENUM_%s', value.upcase))
true
else
false
end
end
end | ruby | def have_enum_value(enum, value, headers = nil, &b)
checking_for "#{enum}.#{value}" do
if try_compile(<<"SRC", &b)
#{COMMON_HEADERS}
#{cpp_include(headers)}
/*top*/
int main() { #{enum} t = #{value}; t = t; return 0; }
SRC
$defs.push(format('-DHAVE_ENUM_%s', value.upcase))
true
else
false
end
end
end | [
"def",
"have_enum_value",
"(",
"enum",
",",
"value",
",",
"headers",
"=",
"nil",
",",
"&",
"b",
")",
"checking_for",
"\"#{enum}.#{value}\"",
"do",
"if",
"try_compile",
"(",
"<<\"SRC\"",
",",
"b",
")",
"#{",
"COMMON_HEADERS",
"}",
"#{",
"cpp_include",
"(",
... | Test for a specific value in an enum type | [
"Test",
"for",
"a",
"specific",
"value",
"in",
"an",
"enum",
"type"
] | ef6688ed9d76bf123c2ea1a483eff8635051adb7 | https://github.com/rmagick/rmagick/blob/ef6688ed9d76bf123c2ea1a483eff8635051adb7/ext/RMagick/extconf.rb#L119-L133 | train | Check if the given value is in the given enum. | [
30522,
13366,
2031,
1035,
4372,
2819,
1035,
3643,
1006,
4372,
2819,
1010,
3643,
1010,
20346,
2015,
1027,
9152,
2140,
1010,
1004,
1038,
1007,
9361,
1035,
2005,
1000,
1001,
1063,
4372,
2819,
1065,
1012,
1001,
1063,
3643,
1065,
1000,
2079,
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_event_hub/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/clusters.rb | Azure::EventHub::Mgmt::V2018_01_01_preview.Clusters.begin_patch | def begin_patch(resource_group_name, cluster_name, parameters, custom_headers:nil)
response = begin_patch_async(resource_group_name, cluster_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_patch(resource_group_name, cluster_name, parameters, custom_headers:nil)
response = begin_patch_async(resource_group_name, cluster_name, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_patch",
"(",
"resource_group_name",
",",
"cluster_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_patch_async",
"(",
"resource_group_name",
",",
"cluster_name",
",",
"parameters",
",",
"custom_headers",
":custom_... | Modifies mutable properties on the Event Hubs Cluster. This operation is
idempotent.
@param resource_group_name [String] Name of the resource group within the
Azure subscription.
@param cluster_name [String] The name of the Event Hubs Cluster.
@param parameters [Cluster] The properties of the Event Hubs Cluster which
should be updated.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Cluster] operation results. | [
"Modifies",
"mutable",
"properties",
"on",
"the",
"Event",
"Hubs",
"Cluster",
".",
"This",
"operation",
"is",
"idempotent",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_event_hub/lib/2018-01-01-preview/generated/azure_mgmt_event_hub/clusters.rb#L659-L662 | train | Patch a cluster s virtual network interface. | [
30522,
13366,
4088,
1035,
8983,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
9324,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
8983,
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... |
fastlane/fastlane | frameit/lib/frameit/editor.rb | Frameit.Editor.fetch_text | def fetch_text(type)
UI.user_error!("Valid parameters :keyword, :title") unless [:keyword, :title].include?(type)
# Try to get it from a keyword.strings or title.strings file
strings_path = File.join(File.expand_path("..", screenshot.path), "#{type}.strings")
if File.exist?(strings_path)
parsed = StringsParser.parse(strings_path)
text_array = parsed.find { |k, v| screenshot.path.upcase.include?(k.upcase) }
return text_array.last if text_array && text_array.last.length > 0 # Ignore empty string
end
UI.verbose("Falling back to text in Framefile.json as there was nothing specified in the #{type}.strings file")
# No string files, fallback to Framefile config
text = fetch_config[type.to_s]['text'] if fetch_config[type.to_s] && fetch_config[type.to_s]['text'] && fetch_config[type.to_s]['text'].length > 0 # Ignore empty string
return text
end | ruby | def fetch_text(type)
UI.user_error!("Valid parameters :keyword, :title") unless [:keyword, :title].include?(type)
# Try to get it from a keyword.strings or title.strings file
strings_path = File.join(File.expand_path("..", screenshot.path), "#{type}.strings")
if File.exist?(strings_path)
parsed = StringsParser.parse(strings_path)
text_array = parsed.find { |k, v| screenshot.path.upcase.include?(k.upcase) }
return text_array.last if text_array && text_array.last.length > 0 # Ignore empty string
end
UI.verbose("Falling back to text in Framefile.json as there was nothing specified in the #{type}.strings file")
# No string files, fallback to Framefile config
text = fetch_config[type.to_s]['text'] if fetch_config[type.to_s] && fetch_config[type.to_s]['text'] && fetch_config[type.to_s]['text'].length > 0 # Ignore empty string
return text
end | [
"def",
"fetch_text",
"(",
"type",
")",
"UI",
".",
"user_error!",
"(",
"\"Valid parameters :keyword, :title\"",
")",
"unless",
"[",
":keyword",
",",
":title",
"]",
".",
"include?",
"(",
"type",
")",
"# Try to get it from a keyword.strings or title.strings file",
"strings... | Fetches the title + keyword for this particular screenshot | [
"Fetches",
"the",
"title",
"+",
"keyword",
"for",
"this",
"particular",
"screenshot"
] | 457c5d647c77f0e078dafa5129da616914e002c5 | https://github.com/fastlane/fastlane/blob/457c5d647c77f0e078dafa5129da616914e002c5/frameit/lib/frameit/editor.rb#L504-L520 | train | Fetch the text from the strings file | [
30522,
13366,
18584,
1035,
3793,
1006,
2828,
1007,
21318,
1012,
5310,
1035,
7561,
999,
1006,
1000,
9398,
11709,
1024,
3145,
18351,
1010,
1024,
2516,
1000,
1007,
4983,
1031,
1024,
3145,
18351,
1010,
1024,
2516,
1033,
1012,
2421,
1029,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-10-01/generated/azure_mgmt_network/connection_monitors.rb | Azure::Network::Mgmt::V2018_10_01.ConnectionMonitors.begin_query | def begin_query(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
response = begin_query_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_query(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:nil)
response = begin_query_async(resource_group_name, network_watcher_name, connection_monitor_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_query",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"connection_monitor_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_query_async",
"(",
"resource_group_name",
",",
"network_watcher_name",
",",
"connection_monitor_nam... | Query a snapshot of the most recent connection states.
@param resource_group_name [String] The name of the resource group containing
Network Watcher.
@param network_watcher_name [String] The name of the Network Watcher
resource.
@param connection_monitor_name [String] The name given to the connection
monitor.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ConnectionMonitorQueryResult] operation results. | [
"Query",
"a",
"snapshot",
"of",
"the",
"most",
"recent",
"connection",
"states",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-10-01/generated/azure_mgmt_network/connection_monitors.rb#L871-L874 | train | Gets the list of all the available network endpoints in a resource group. | [
30522,
13366,
4088,
1035,
23032,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2897,
1035,
3422,
2121,
1035,
2171,
1010,
4434,
1035,
8080,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
23032,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/hardware_component_groups.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.HardwareComponentGroups.change_controller_power_state | def change_controller_power_state(device_name, hardware_component_group_name, parameters, resource_group_name, manager_name, custom_headers:nil)
response = change_controller_power_state_async(device_name, hardware_component_group_name, parameters, resource_group_name, manager_name, custom_headers:custom_headers).value!
nil
end | ruby | def change_controller_power_state(device_name, hardware_component_group_name, parameters, resource_group_name, manager_name, custom_headers:nil)
response = change_controller_power_state_async(device_name, hardware_component_group_name, parameters, resource_group_name, manager_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"change_controller_power_state",
"(",
"device_name",
",",
"hardware_component_group_name",
",",
"parameters",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"change_controller_power_state_async",
"(",
"device... | Changes the power state of the controller.
@param device_name [String] The device name
@param hardware_component_group_name [String] The hardware component group
name.
@param parameters [ControllerPowerStateChangeRequest] The controller power
state change request.
@param resource_group_name [String] The resource group name
@param manager_name [String] The manager name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Changes",
"the",
"power",
"state",
"of",
"the",
"controller",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/hardware_component_groups.rb#L135-L138 | train | Change controller power state of the hardware component group. | [
30522,
13366,
2689,
1035,
11486,
1035,
2373,
1035,
2110,
1006,
5080,
1035,
2171,
1010,
8051,
1035,
6922,
1035,
2177,
1035,
2171,
1010,
11709,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_recovery_services_backup/lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/protection_policies.rb | Azure::RecoveryServicesBackup::Mgmt::V2016_06_01.ProtectionPolicies.delete_with_http_info | def delete_with_http_info(vault_name, resource_group_name, policy_name, custom_headers:nil)
delete_async(vault_name, resource_group_name, policy_name, custom_headers:custom_headers).value!
end | ruby | def delete_with_http_info(vault_name, resource_group_name, policy_name, custom_headers:nil)
delete_async(vault_name, resource_group_name, policy_name, custom_headers:custom_headers).value!
end | [
"def",
"delete_with_http_info",
"(",
"vault_name",
",",
"resource_group_name",
",",
"policy_name",
",",
"custom_headers",
":",
"nil",
")",
"delete_async",
"(",
"vault_name",
",",
"resource_group_name",
",",
"policy_name",
",",
"custom_headers",
":custom_headers",
")",
... | Deletes the specified backup policy from your Recovery Services vault. This
is an asynchronous operation. Use the GetPolicyOperationResult API to Get the
operation status.
@param vault_name [String] The name of the Recovery Services vault.
@param resource_group_name [String] The name of the resource group associated
with the Recovery Services vault.
@param policy_name [String] The name of the backup policy to be deleted.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Deletes",
"the",
"specified",
"backup",
"policy",
"from",
"your",
"Recovery",
"Services",
"vault",
".",
"This",
"is",
"an",
"asynchronous",
"operation",
".",
"Use",
"the",
"GetPolicyOperationResult",
"API",
"to",
"Get",
"the",
"operation",
"status",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_recovery_services_backup/lib/2016-06-01/generated/azure_mgmt_recovery_services_backup/protection_policies.rb#L284-L286 | train | Deletes the specified policy from the specified vault. | [
30522,
13366,
3972,
12870,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
11632,
1035,
2171,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3343,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3972,
12870,
1035,
2004,
6038,
2278,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_api_management/lib/2016-10-10/generated/azure_mgmt_api_management/api_management_services.rb | Azure::ApiManagement::Mgmt::V2016_10_10.ApiManagementServices.begin_restore_with_http_info | def begin_restore_with_http_info(resource_group_name, service_name, parameters, custom_headers:nil)
begin_restore_async(resource_group_name, service_name, parameters, custom_headers:custom_headers).value!
end | ruby | def begin_restore_with_http_info(resource_group_name, service_name, parameters, custom_headers:nil)
begin_restore_async(resource_group_name, service_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_restore_with_http_info",
"(",
"resource_group_name",
",",
"service_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_restore_async",
"(",
"resource_group_name",
",",
"service_name",
",",
"parameters",
",",
"custom_headers",
":custom_he... | Restores a backup of an API Management service created using the
ApiManagementServices_Backup operation on the current service. This is a long
running operation and could take several minutes to complete.
@param resource_group_name [String] The name of the resource group.
@param service_name [String] The name of the API Management service.
@param parameters [ApiManagementServiceBackupRestoreParameters] Parameters
supplied to the Restore API Management service from backup 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. | [
"Restores",
"a",
"backup",
"of",
"an",
"API",
"Management",
"service",
"created",
"using",
"the",
"ApiManagementServices_Backup",
"operation",
"on",
"the",
"current",
"service",
".",
"This",
"is",
"a",
"long",
"running",
"operation",
"and",
"could",
"take",
"sev... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_api_management/lib/2016-10-10/generated/azure_mgmt_api_management/api_management_services.rb#L1248-L1250 | train | Restores a managed managed | [
30522,
13366,
4088,
1035,
9239,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2171,
1010,
11709,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
1035,
9239,
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... |
randym/axlsx | lib/axlsx/workbook/worksheet/pivot_table.rb | Axlsx.PivotTable.relationships | def relationships
r = Relationships.new
r << Relationship.new(cache_definition, PIVOT_TABLE_CACHE_DEFINITION_R, "../#{cache_definition.pn}")
r
end | ruby | def relationships
r = Relationships.new
r << Relationship.new(cache_definition, PIVOT_TABLE_CACHE_DEFINITION_R, "../#{cache_definition.pn}")
r
end | [
"def",
"relationships",
"r",
"=",
"Relationships",
".",
"new",
"r",
"<<",
"Relationship",
".",
"new",
"(",
"cache_definition",
",",
"PIVOT_TABLE_CACHE_DEFINITION_R",
",",
"\"../#{cache_definition.pn}\"",
")",
"r",
"end"
] | The relationships for this pivot table.
@return [Relationships] | [
"The",
"relationships",
"for",
"this",
"pivot",
"table",
"."
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/workbook/worksheet/pivot_table.rb#L161-L165 | train | Returns the array of relationships for this cache definition. | [
30522,
13366,
6550,
1054,
1027,
6550,
1012,
2047,
1054,
1026,
1026,
3276,
1012,
2047,
1006,
17053,
1035,
6210,
1010,
14255,
22994,
1035,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
sferik/rails_admin | app/helpers/rails_admin/application_helper.rb | RailsAdmin.ApplicationHelper.menu_for | def menu_for(parent, abstract_model = nil, object = nil, only_icon = false) # perf matters here (no action view trickery)
actions = actions(parent, abstract_model, object).select { |a| a.http_methods.include?(:get) }
actions.collect do |action|
wording = wording_for(:menu, action)
%(
<li title="#{wording if only_icon}" rel="#{'tooltip' if only_icon}" class="icon #{action.key}_#{parent}_link #{'active' if current_action?(action)}">
<a class="#{action.pjax? ? 'pjax' : ''}" href="#{rails_admin.url_for(action: action.action_name, controller: 'rails_admin/main', model_name: abstract_model.try(:to_param), id: (object.try(:persisted?) && object.try(:id) || nil))}">
<i class="#{action.link_icon}"></i>
<span#{only_icon ? " style='display:none'" : ''}>#{wording}</span>
</a>
</li>
)
end.join.html_safe
end | ruby | def menu_for(parent, abstract_model = nil, object = nil, only_icon = false) # perf matters here (no action view trickery)
actions = actions(parent, abstract_model, object).select { |a| a.http_methods.include?(:get) }
actions.collect do |action|
wording = wording_for(:menu, action)
%(
<li title="#{wording if only_icon}" rel="#{'tooltip' if only_icon}" class="icon #{action.key}_#{parent}_link #{'active' if current_action?(action)}">
<a class="#{action.pjax? ? 'pjax' : ''}" href="#{rails_admin.url_for(action: action.action_name, controller: 'rails_admin/main', model_name: abstract_model.try(:to_param), id: (object.try(:persisted?) && object.try(:id) || nil))}">
<i class="#{action.link_icon}"></i>
<span#{only_icon ? " style='display:none'" : ''}>#{wording}</span>
</a>
</li>
)
end.join.html_safe
end | [
"def",
"menu_for",
"(",
"parent",
",",
"abstract_model",
"=",
"nil",
",",
"object",
"=",
"nil",
",",
"only_icon",
"=",
"false",
")",
"# perf matters here (no action view trickery)",
"actions",
"=",
"actions",
"(",
"parent",
",",
"abstract_model",
",",
"object",
... | parent => :root, :collection, :member | [
"parent",
"=",
">",
":",
"root",
":",
"collection",
":",
"member"
] | 0e341a4804c9011d712ecda6f5d7350708505bb7 | https://github.com/sferik/rails_admin/blob/0e341a4804c9011d712ecda6f5d7350708505bb7/app/helpers/rails_admin/application_helper.rb#L140-L153 | train | Returns a menu for the given parent | [
30522,
13366,
12183,
1035,
2005,
1006,
6687,
1010,
10061,
1035,
2944,
1027,
9152,
2140,
1010,
4874,
1027,
9152,
2140,
1010,
2069,
1035,
12696,
1027,
6270,
1007,
1001,
2566,
2546,
5609,
2182,
1006,
2053,
2895,
3193,
7577,
7301,
1007,
4506,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mhenrixon/sidekiq-unique-jobs | lib/sidekiq_unique_jobs/locksmith.rb | SidekiqUniqueJobs.Locksmith.lock | def lock(timeout = nil, &block)
Scripts.call(:lock, redis_pool,
keys: [exists_key, grabbed_key, available_key, UNIQUE_SET, unique_digest],
argv: [jid, ttl, lock_type])
grab_token(timeout) do |token|
touch_grabbed_token(token)
return_token_or_block_value(token, &block)
end
end | ruby | def lock(timeout = nil, &block)
Scripts.call(:lock, redis_pool,
keys: [exists_key, grabbed_key, available_key, UNIQUE_SET, unique_digest],
argv: [jid, ttl, lock_type])
grab_token(timeout) do |token|
touch_grabbed_token(token)
return_token_or_block_value(token, &block)
end
end | [
"def",
"lock",
"(",
"timeout",
"=",
"nil",
",",
"&",
"block",
")",
"Scripts",
".",
"call",
"(",
":lock",
",",
"redis_pool",
",",
"keys",
":",
"[",
"exists_key",
",",
"grabbed_key",
",",
"available_key",
",",
"UNIQUE_SET",
",",
"unique_digest",
"]",
",",
... | Create a lock for the item
@param [Integer] timeout the number of seconds to wait for a lock.
@return [String] the Sidekiq job_id (jid) | [
"Create",
"a",
"lock",
"for",
"the",
"item"
] | 2944b97c720528f53962ccfd17d43ac939a77f46 | https://github.com/mhenrixon/sidekiq-unique-jobs/blob/2944b97c720528f53962ccfd17d43ac939a77f46/lib/sidekiq_unique_jobs/locksmith.rb#L58-L67 | train | Lock the connection to the server. | [
30522,
13366,
5843,
1006,
2051,
5833,
1027,
9152,
2140,
1010,
1004,
3796,
1007,
14546,
1012,
2655,
1006,
1024,
5843,
1010,
2417,
2483,
1035,
4770,
1010,
6309,
1024,
1031,
6526,
1035,
3145,
1010,
4046,
1035,
3145,
1010,
2800,
1035,
3145,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_cdn/lib/2017-04-02/generated/azure_mgmt_cdn/endpoints.rb | Azure::CDN::Mgmt::V2017_04_02.Endpoints.begin_create_with_http_info | def begin_create_with_http_info(resource_group_name, profile_name, endpoint_name, endpoint, custom_headers:nil)
begin_create_async(resource_group_name, profile_name, endpoint_name, endpoint, custom_headers:custom_headers).value!
end | ruby | def begin_create_with_http_info(resource_group_name, profile_name, endpoint_name, endpoint, custom_headers:nil)
begin_create_async(resource_group_name, profile_name, endpoint_name, endpoint, custom_headers:custom_headers).value!
end | [
"def",
"begin_create_with_http_info",
"(",
"resource_group_name",
",",
"profile_name",
",",
"endpoint_name",
",",
"endpoint",
",",
"custom_headers",
":",
"nil",
")",
"begin_create_async",
"(",
"resource_group_name",
",",
"profile_name",
",",
"endpoint_name",
",",
"endpo... | Creates a new CDN endpoint with the specified endpoint name under the
specified subscription, resource group and profile.
@param resource_group_name [String] Name of the Resource group within the
Azure subscription.
@param profile_name [String] Name of the CDN profile which is unique within
the resource group.
@param endpoint_name [String] Name of the endpoint under the profile which is
unique globally.
@param endpoint [Endpoint] Endpoint properties
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information. | [
"Creates",
"a",
"new",
"CDN",
"endpoint",
"with",
"the",
"specified",
"endpoint",
"name",
"under",
"the",
"specified",
"subscription",
"resource",
"group",
"and",
"profile",
"."
] | 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#L875-L877 | train | Creates an endpoint in the specified subscription. | [
30522,
13366,
4088,
1035,
3443,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
6337,
1035,
2171,
1010,
2203,
8400,
1035,
2171,
1010,
2203,
8400,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
4088,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
decidim/decidim | decidim-core/lib/decidim/resource_manifest.rb | Decidim.ResourceManifest.resource_scope | def resource_scope(component)
return model_class.none unless component_manifest
component_ids = Decidim::Component.where(participatory_space: component.participatory_space, manifest_name: component_manifest.name).pluck(:id)
return model_class.none if component_ids.empty?
model_class.where(component: component_ids)
end | ruby | def resource_scope(component)
return model_class.none unless component_manifest
component_ids = Decidim::Component.where(participatory_space: component.participatory_space, manifest_name: component_manifest.name).pluck(:id)
return model_class.none if component_ids.empty?
model_class.where(component: component_ids)
end | [
"def",
"resource_scope",
"(",
"component",
")",
"return",
"model_class",
".",
"none",
"unless",
"component_manifest",
"component_ids",
"=",
"Decidim",
"::",
"Component",
".",
"where",
"(",
"participatory_space",
":",
"component",
".",
"participatory_space",
",",
"ma... | Finds an ActiveRecord::Relation of the resource `model_class`, scoped to the
given component. This way you can find resources from another engine without
actually coupling both engines. If no `component_manifest` is set for this
manifest, it returns an empty collection.
component - a Decidim::Component
Returns an ActiveRecord::Relation. | [
"Finds",
"an",
"ActiveRecord",
"::",
"Relation",
"of",
"the",
"resource",
"model_class",
"scoped",
"to",
"the",
"given",
"component",
".",
"This",
"way",
"you",
"can",
"find",
"resources",
"from",
"another",
"engine",
"without",
"actually",
"coupling",
"both",
... | 6e2b14e559a63088669904e3c5c49a5180700cf7 | https://github.com/decidim/decidim/blob/6e2b14e559a63088669904e3c5c49a5180700cf7/decidim-core/lib/decidim/resource_manifest.rb#L63-L70 | train | Returns the resource scope for the given component | [
30522,
13366,
7692,
1035,
9531,
1006,
6922,
1007,
2709,
2944,
1035,
2465,
1012,
3904,
4983,
6922,
1035,
19676,
6922,
1035,
8909,
2015,
1027,
11703,
28173,
2213,
1024,
1024,
6922,
1012,
2073,
1006,
2112,
28775,
4502,
7062,
1035,
2686,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/service_endpoint_policy_definitions.rb | Azure::Network::Mgmt::V2018_08_01.ServiceEndpointPolicyDefinitions.get_with_http_info | def get_with_http_info(resource_group_name, service_endpoint_policy_name, service_endpoint_policy_definition_name, custom_headers:nil)
get_async(resource_group_name, service_endpoint_policy_name, service_endpoint_policy_definition_name, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, service_endpoint_policy_name, service_endpoint_policy_definition_name, custom_headers:nil)
get_async(resource_group_name, service_endpoint_policy_name, service_endpoint_policy_definition_name, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"service_endpoint_policy_name",
",",
"service_endpoint_policy_definition_name",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"service_endpoint_policy_name",
",",
"service_endp... | Get the specified service endpoint policy definitions from service endpoint
policy.
@param resource_group_name [String] The name of the resource group.
@param service_endpoint_policy_name [String] The name of the service endpoint
policy name.
@param service_endpoint_policy_definition_name [String] The name of the
service endpoint policy definition 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",
"the",
"specified",
"service",
"endpoint",
"policy",
"definitions",
"from",
"service",
"endpoint",
"policy",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-08-01/generated/azure_mgmt_network/service_endpoint_policy_definitions.rb#L101-L103 | train | Gets the specified service endpoint policy definition. | [
30522,
13366,
2131,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2326,
1035,
2203,
8400,
1035,
3343,
1035,
2171,
1010,
2326,
1035,
2203,
8400,
1035,
3343,
1035,
6210,
1035,
2171,
1010,
7661,
1035,
20346,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mikel/mail | lib/mail/body.rb | Mail.Body.encoded | def encoded(transfer_encoding = nil)
if multipart?
self.sort_parts!
encoded_parts = parts.map { |p| p.encoded }
([preamble] + encoded_parts).join(crlf_boundary) + end_boundary + epilogue.to_s
else
dec = Mail::Encodings.get_encoding(encoding)
enc =
if Utilities.blank?(transfer_encoding)
dec
else
negotiate_best_encoding(transfer_encoding)
end
if dec.nil?
# Cannot decode, so skip normalization
raw_source
else
# Decode then encode to normalize and allow transforming
# from base64 to Q-P and vice versa
decoded = dec.decode(raw_source)
if defined?(Encoding) && charset && charset != "US-ASCII"
decoded = decoded.encode(charset)
decoded.force_encoding('BINARY') unless Encoding.find(charset).ascii_compatible?
end
enc.encode(decoded)
end
end
end | ruby | def encoded(transfer_encoding = nil)
if multipart?
self.sort_parts!
encoded_parts = parts.map { |p| p.encoded }
([preamble] + encoded_parts).join(crlf_boundary) + end_boundary + epilogue.to_s
else
dec = Mail::Encodings.get_encoding(encoding)
enc =
if Utilities.blank?(transfer_encoding)
dec
else
negotiate_best_encoding(transfer_encoding)
end
if dec.nil?
# Cannot decode, so skip normalization
raw_source
else
# Decode then encode to normalize and allow transforming
# from base64 to Q-P and vice versa
decoded = dec.decode(raw_source)
if defined?(Encoding) && charset && charset != "US-ASCII"
decoded = decoded.encode(charset)
decoded.force_encoding('BINARY') unless Encoding.find(charset).ascii_compatible?
end
enc.encode(decoded)
end
end
end | [
"def",
"encoded",
"(",
"transfer_encoding",
"=",
"nil",
")",
"if",
"multipart?",
"self",
".",
"sort_parts!",
"encoded_parts",
"=",
"parts",
".",
"map",
"{",
"|",
"p",
"|",
"p",
".",
"encoded",
"}",
"(",
"[",
"preamble",
"]",
"+",
"encoded_parts",
")",
... | Returns a body encoded using transfer_encoding. Multipart always uses an
identiy encoding (i.e. no encoding).
Calling this directly is not a good idea, but supported for compatibility
TODO: Validate that preamble and epilogue are valid for requested encoding | [
"Returns",
"a",
"body",
"encoded",
"using",
"transfer_encoding",
".",
"Multipart",
"always",
"uses",
"an",
"identiy",
"encoding",
"(",
"i",
".",
"e",
".",
"no",
"encoding",
")",
".",
"Calling",
"this",
"directly",
"is",
"not",
"a",
"good",
"idea",
"but",
... | fb53fb369eb2bf0494ac70675970c90cdcc3f495 | https://github.com/mikel/mail/blob/fb53fb369eb2bf0494ac70675970c90cdcc3f495/lib/mail/body.rb#L144-L172 | train | Returns the encoded representation of the message. | [
30522,
13366,
12359,
1006,
4651,
1035,
17181,
1027,
9152,
2140,
1007,
2065,
4800,
19362,
2102,
1029,
2969,
1012,
4066,
1035,
3033,
999,
12359,
1035,
3033,
1027,
3033,
1012,
4949,
1063,
1064,
1052,
1064,
1052,
1012,
12359,
1065,
1006,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | activesupport/lib/active_support/core_ext/date_and_time/calculations.rb | DateAndTime.Calculations.days_to_week_start | def days_to_week_start(start_day = Date.beginning_of_week)
start_day_number = DAYS_INTO_WEEK.fetch(start_day)
(wday - start_day_number) % 7
end | ruby | def days_to_week_start(start_day = Date.beginning_of_week)
start_day_number = DAYS_INTO_WEEK.fetch(start_day)
(wday - start_day_number) % 7
end | [
"def",
"days_to_week_start",
"(",
"start_day",
"=",
"Date",
".",
"beginning_of_week",
")",
"start_day_number",
"=",
"DAYS_INTO_WEEK",
".",
"fetch",
"(",
"start_day",
")",
"(",
"wday",
"-",
"start_day_number",
")",
"%",
"7",
"end"
] | Returns the number of days to the start of the week on the given day.
Week is assumed to start on +start_day+, default is
+Date.beginning_of_week+ or +config.beginning_of_week+ when set. | [
"Returns",
"the",
"number",
"of",
"days",
"to",
"the",
"start",
"of",
"the",
"week",
"on",
"the",
"given",
"day",
".",
"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#L265-L268 | train | returns the start of the week | [
30522,
13366,
2420,
1035,
2000,
1035,
2733,
1035,
2707,
1006,
2707,
1035,
2154,
1027,
3058,
1012,
2927,
1035,
1997,
1035,
2733,
1007,
2707,
1035,
2154,
1035,
2193,
1027,
2420,
1035,
2046,
1035,
2733,
1012,
18584,
1006,
2707,
1035,
2154,
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_event_grid/lib/2019-02-01-preview/generated/azure_mgmt_event_grid/topics.rb | Azure::EventGrid::Mgmt::V2019_02_01_preview.Topics.delete | def delete(resource_group_name, topic_name, custom_headers:nil)
response = delete_async(resource_group_name, topic_name, custom_headers:custom_headers).value!
nil
end | ruby | def delete(resource_group_name, topic_name, custom_headers:nil)
response = delete_async(resource_group_name, topic_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"delete",
"(",
"resource_group_name",
",",
"topic_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_async",
"(",
"resource_group_name",
",",
"topic_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"nil",
"end"
] | 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#L184-L187 | train | Deletes a topic. | [
30522,
13366,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8476,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
8476,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
daddyz/phonelib | lib/phonelib/phone_analyzer_helper.rb | Phonelib.PhoneAnalyzerHelper.phone_match_data? | def phone_match_data?(phone, data, possible = false)
country_code = "#{data[Core::COUNTRY_CODE]}"
inter_prefix = "(#{data[Core::INTERNATIONAL_PREFIX]})?"
return unless phone.match cr("^0{2}?#{inter_prefix}#{country_code}")
type = possible ? Core::POSSIBLE_PATTERN : Core::VALID_PATTERN
phone.match full_regex_for_data(data, type, false)
end | ruby | def phone_match_data?(phone, data, possible = false)
country_code = "#{data[Core::COUNTRY_CODE]}"
inter_prefix = "(#{data[Core::INTERNATIONAL_PREFIX]})?"
return unless phone.match cr("^0{2}?#{inter_prefix}#{country_code}")
type = possible ? Core::POSSIBLE_PATTERN : Core::VALID_PATTERN
phone.match full_regex_for_data(data, type, false)
end | [
"def",
"phone_match_data?",
"(",
"phone",
",",
"data",
",",
"possible",
"=",
"false",
")",
"country_code",
"=",
"\"#{data[Core::COUNTRY_CODE]}\"",
"inter_prefix",
"=",
"\"(#{data[Core::INTERNATIONAL_PREFIX]})?\"",
"return",
"unless",
"phone",
".",
"match",
"cr",
"(",
... | Check if phone match country data
==== Attributes
* +phone+ - phone number for parsing
* +data+ - country data | [
"Check",
"if",
"phone",
"match",
"country",
"data"
] | aa0023eab7c896b71275bf342bc7f49735cbdbbf | https://github.com/daddyz/phonelib/blob/aa0023eab7c896b71275bf342bc7f49735cbdbbf/lib/phonelib/phone_analyzer_helper.rb#L134-L141 | train | Returns true if the phone matches the data | [
30522,
13366,
3042,
1035,
2674,
1035,
2951,
1029,
1006,
3042,
1010,
2951,
1010,
2825,
1027,
6270,
1007,
2406,
1035,
3642,
1027,
1000,
1001,
1063,
2951,
1031,
4563,
1024,
1024,
2406,
1035,
3642,
1033,
1065,
1000,
6970,
1035,
17576,
1027,
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/2016-08-10/generated/azure_mgmt_recovery_services_site_recovery/replication_storage_classification_mappings.rb | Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10.ReplicationStorageClassificationMappings.create | def create(fabric_name, storage_classification_name, storage_classification_mapping_name, pairing_input, custom_headers:nil)
response = create_async(fabric_name, storage_classification_name, storage_classification_mapping_name, pairing_input, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create(fabric_name, storage_classification_name, storage_classification_mapping_name, pairing_input, custom_headers:nil)
response = create_async(fabric_name, storage_classification_name, storage_classification_mapping_name, pairing_input, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create",
"(",
"fabric_name",
",",
"storage_classification_name",
",",
"storage_classification_mapping_name",
",",
"pairing_input",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_async",
"(",
"fabric_name",
",",
"storage_classification_name",
",",... | Create storage classification mapping.
The operation to create a storage classification mapping.
@param fabric_name [String] Fabric name.
@param storage_classification_name [String] Storage classification name.
@param storage_classification_mapping_name [String] Storage classification
mapping name.
@param pairing_input [StorageClassificationMappingInput] Pairing input.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [StorageClassificationMapping] operation results. | [
"Create",
"storage",
"classification",
"mapping",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_recovery_services_site_recovery/lib/2016-08-10/generated/azure_mgmt_recovery_services_site_recovery/replication_storage_classification_mappings.rb#L146-L149 | train | Creates a new cluster classification mapping. | [
30522,
13366,
3443,
1006,
8313,
1035,
2171,
1010,
5527,
1035,
5579,
1035,
2171,
1010,
5527,
1035,
5579,
1035,
12375,
1035,
2171,
1010,
22778,
1035,
7953,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3443,
1035,
2004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
piotrmurach/github | lib/github_api/pagination.rb | Github.Pagination.auto_paginate | def auto_paginate(auto=false)
if (current_api.auto_pagination? || auto) && self.body.is_a?(Array)
resources_bodies = []
each_page { |resource| resources_bodies += resource.body }
self.body = resources_bodies
end
self
end | ruby | def auto_paginate(auto=false)
if (current_api.auto_pagination? || auto) && self.body.is_a?(Array)
resources_bodies = []
each_page { |resource| resources_bodies += resource.body }
self.body = resources_bodies
end
self
end | [
"def",
"auto_paginate",
"(",
"auto",
"=",
"false",
")",
"if",
"(",
"current_api",
".",
"auto_pagination?",
"||",
"auto",
")",
"&&",
"self",
".",
"body",
".",
"is_a?",
"(",
"Array",
")",
"resources_bodies",
"=",
"[",
"]",
"each_page",
"{",
"|",
"resource"... | Iterate over results set pages by automatically calling `next_page`
until all pages are exhausted. Caution needs to be exercised when
using this feature - 100 pages iteration will perform 100 API calls.
By default this is off. You can set it on the client, individual API
instances or just per given request. | [
"Iterate",
"over",
"results",
"set",
"pages",
"by",
"automatically",
"calling",
"next_page",
"until",
"all",
"pages",
"are",
"exhausted",
".",
"Caution",
"needs",
"to",
"be",
"exercised",
"when",
"using",
"this",
"feature",
"-",
"100",
"pages",
"iteration",
"w... | 8702452c66bea33c9388550aed9e9974f76aaef1 | https://github.com/piotrmurach/github/blob/8702452c66bea33c9388550aed9e9974f76aaef1/lib/github_api/pagination.rb#L28-L35 | train | auto_paginate the body of the resource | [
30522,
13366,
8285,
1035,
6643,
20876,
2618,
1006,
8285,
1027,
6270,
1007,
2065,
1006,
2783,
1035,
17928,
1012,
8285,
1035,
6643,
20876,
3508,
1029,
1064,
1064,
8285,
1007,
1004,
1004,
2969,
1012,
2303,
1012,
2003,
1035,
1037,
1029,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
square/connect-ruby-sdk | lib/square_connect/api/inventory_api.rb | SquareConnect.InventoryApi.retrieve_inventory_adjustment | def retrieve_inventory_adjustment(adjustment_id, opts = {})
data, _status_code, _headers = retrieve_inventory_adjustment_with_http_info(adjustment_id, opts)
return data
end | ruby | def retrieve_inventory_adjustment(adjustment_id, opts = {})
data, _status_code, _headers = retrieve_inventory_adjustment_with_http_info(adjustment_id, opts)
return data
end | [
"def",
"retrieve_inventory_adjustment",
"(",
"adjustment_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"retrieve_inventory_adjustment_with_http_info",
"(",
"adjustment_id",
",",
"opts",
")",
"return",
"data",
"end"
] | RetrieveInventoryAdjustment
Returns the [InventoryAdjustment](#type-inventoryadjustment) object with the provided `adjustment_id`.
@param adjustment_id ID of the [InventoryAdjustment](#type-inventoryadjustment) to retrieve.
@param [Hash] opts the optional parameters
@return [RetrieveInventoryAdjustmentResponse] | [
"RetrieveInventoryAdjustment",
"Returns",
"the",
"[",
"InventoryAdjustment",
"]",
"(",
"#type",
"-",
"inventoryadjustment",
")",
"object",
"with",
"the",
"provided",
"adjustment_id",
"."
] | 798eb9ded716f23b9f1518386f1c311a34bca8bf | https://github.com/square/connect-ruby-sdk/blob/798eb9ded716f23b9f1518386f1c311a34bca8bf/lib/square_connect/api/inventory_api.rb#L190-L193 | train | RetrieveInventoryAdjustment Returns an array of Admission objects for an Admission. | [
30522,
13366,
12850,
1035,
12612,
1035,
19037,
1006,
19037,
1035,
8909,
1010,
23569,
2015,
1027,
1063,
1065,
1007,
2951,
1010,
1035,
3570,
1035,
3642,
1010,
1035,
20346,
2015,
1027,
12850,
1035,
12612,
1035,
19037,
1035,
2007,
1035,
8299,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-iam/lib/aws-sdk-iam/role.rb | Aws::IAM.Role.detach_policy | def detach_policy(options = {})
options = options.merge(role_name: @name)
resp = @client.detach_role_policy(options)
resp.data
end | ruby | def detach_policy(options = {})
options = options.merge(role_name: @name)
resp = @client.detach_role_policy(options)
resp.data
end | [
"def",
"detach_policy",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"=",
"options",
".",
"merge",
"(",
"role_name",
":",
"@name",
")",
"resp",
"=",
"@client",
".",
"detach_role_policy",
"(",
"options",
")",
"resp",
".",
"data",
"end"
] | @example Request syntax with placeholder values
role.detach_policy({
policy_arn: "arnType", # required
})
@param [Hash] options ({})
@option options [required, String] :policy_arn
The Amazon Resource Name (ARN) of the IAM policy you want to detach.
For more information about ARNs, see [Amazon Resource Names (ARNs) and
AWS Service Namespaces][1] in the *AWS General Reference*.
[1]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
@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/role.rb#L308-L312 | train | Detach policy from role | [
30522,
13366,
20010,
6776,
1035,
3343,
1006,
7047,
1027,
1063,
1065,
1007,
7047,
1027,
7047,
1012,
13590,
1006,
2535,
1035,
2171,
1024,
1030,
2171,
1007,
24501,
2361,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/rails | actionpack/lib/action_controller/metal/request_forgery_protection.rb | ActionController.RequestForgeryProtection.verify_authenticity_token | def verify_authenticity_token # :doc:
mark_for_same_origin_verification!
if !verified_request?
if logger && log_warning_on_csrf_failure
if valid_request_origin?
logger.warn "Can't verify CSRF token authenticity."
else
logger.warn "HTTP Origin header (#{request.origin}) didn't match request.base_url (#{request.base_url})"
end
end
handle_unverified_request
end
end | ruby | def verify_authenticity_token # :doc:
mark_for_same_origin_verification!
if !verified_request?
if logger && log_warning_on_csrf_failure
if valid_request_origin?
logger.warn "Can't verify CSRF token authenticity."
else
logger.warn "HTTP Origin header (#{request.origin}) didn't match request.base_url (#{request.base_url})"
end
end
handle_unverified_request
end
end | [
"def",
"verify_authenticity_token",
"# :doc:",
"mark_for_same_origin_verification!",
"if",
"!",
"verified_request?",
"if",
"logger",
"&&",
"log_warning_on_csrf_failure",
"if",
"valid_request_origin?",
"logger",
".",
"warn",
"\"Can't verify CSRF token authenticity.\"",
"else",
"lo... | The actual before_action that is used to verify the CSRF token.
Don't override this directly. Provide your own forgery protection
strategy instead. If you override, you'll disable same-origin
<tt><script></tt> verification.
Lean on the protect_from_forgery declaration to mark which actions are
due for same-origin request verification. If protect_from_forgery is
enabled on an action, this before_action flags its after_action to
verify that JavaScript responses are for XHR requests, ensuring they
follow the browser's same-origin policy. | [
"The",
"actual",
"before_action",
"that",
"is",
"used",
"to",
"verify",
"the",
"CSRF",
"token",
".",
"Don",
"t",
"override",
"this",
"directly",
".",
"Provide",
"your",
"own",
"forgery",
"protection",
"strategy",
"instead",
".",
"If",
"you",
"override",
"you... | 85a8bc644be69908f05740a5886ec19cd3679df5 | https://github.com/rails/rails/blob/85a8bc644be69908f05740a5886ec19cd3679df5/actionpack/lib/action_controller/metal/request_forgery_protection.rb#L233-L246 | train | Verify the CSRF token for the current request. | [
30522,
13366,
20410,
1035,
21452,
1035,
19204,
1001,
1024,
9986,
1024,
2928,
1035,
2005,
1035,
2168,
1035,
4761,
1035,
22616,
999,
2065,
999,
20119,
1035,
5227,
1029,
2065,
8833,
4590,
1004,
1004,
8833,
1035,
5432,
1035,
2006,
1035,
20116,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
puppetlabs/puppet | lib/puppet/pops/visitor.rb | Puppet::Pops.Visitor.visit_this_class | def visit_this_class(receiver, clazz, args)
raise "Visitor Error: Too few arguments passed. min = #{@min_args}" unless args.length >= @min_args
if @max_args
raise "Visitor Error: Too many arguments passed. max = #{@max_args}" unless args.length <= @max_args
end
if method_name = @cache[clazz]
return receiver.send(method_name, clazz, *args)
else
clazz.ancestors().each do |ancestor|
name = ancestor.name
next if name.nil?
method_name = :"#{@message}_#{name.split(DOUBLE_COLON).last}"
next unless receiver.respond_to?(method_name, true)
@cache[clazz] = method_name
return receiver.send(method_name, clazz, *args)
end
end
raise "Visitor Error: the configured receiver (#{receiver.class}) can't handle instance of: #{clazz}"
end | ruby | def visit_this_class(receiver, clazz, args)
raise "Visitor Error: Too few arguments passed. min = #{@min_args}" unless args.length >= @min_args
if @max_args
raise "Visitor Error: Too many arguments passed. max = #{@max_args}" unless args.length <= @max_args
end
if method_name = @cache[clazz]
return receiver.send(method_name, clazz, *args)
else
clazz.ancestors().each do |ancestor|
name = ancestor.name
next if name.nil?
method_name = :"#{@message}_#{name.split(DOUBLE_COLON).last}"
next unless receiver.respond_to?(method_name, true)
@cache[clazz] = method_name
return receiver.send(method_name, clazz, *args)
end
end
raise "Visitor Error: the configured receiver (#{receiver.class}) can't handle instance of: #{clazz}"
end | [
"def",
"visit_this_class",
"(",
"receiver",
",",
"clazz",
",",
"args",
")",
"raise",
"\"Visitor Error: Too few arguments passed. min = #{@min_args}\"",
"unless",
"args",
".",
"length",
">=",
"@min_args",
"if",
"@max_args",
"raise",
"\"Visitor Error: Too many arguments passed.... | Visit an explicit receiver | [
"Visit",
"an",
"explicit",
"receiver"
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/pops/visitor.rb#L55-L73 | train | Visit the receiver class. | [
30522,
13366,
3942,
1035,
2023,
1035,
2465,
1006,
8393,
1010,
18856,
10936,
2480,
1010,
12098,
5620,
1007,
5333,
1000,
10367,
7561,
1024,
2205,
2261,
9918,
2979,
1012,
8117,
1027,
1001,
1063,
1030,
8117,
1035,
12098,
5620,
1065,
1000,
4983,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_sql/lib/2018-06-01-preview/generated/azure_mgmt_sql/instance_pools.rb | Azure::SQL::Mgmt::V2018_06_01_preview.InstancePools.delete | def delete(resource_group_name, instance_pool_name, custom_headers:nil)
response = delete_async(resource_group_name, instance_pool_name, custom_headers:custom_headers).value!
nil
end | ruby | def delete(resource_group_name, instance_pool_name, custom_headers:nil)
response = delete_async(resource_group_name, instance_pool_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"delete",
"(",
"resource_group_name",
",",
"instance_pool_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_async",
"(",
"resource_group_name",
",",
"instance_pool_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"nil",... | Deletes an instance pool
@param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param instance_pool_name [String] The name of the instance pool to be
deleted
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request. | [
"Deletes",
"an",
"instance",
"pool"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_sql/lib/2018-06-01-preview/generated/azure_mgmt_sql/instance_pools.rb#L189-L192 | train | Deletes the specified instance pool. | [
30522,
13366,
3972,
12870,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
6013,
1035,
4770,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
3972,
12870,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
samvera/hyrax | app/presenters/hyrax/fixity_status_presenter.rb | Hyrax.FixityStatusPresenter.render_file_set_status | def render_file_set_status
@file_set_status ||=
if relevant_log_records.empty?
"Fixity checks have not yet been run on this object"
elsif failing_checks.empty?
content_tag("span", "passed", class: "label label-success") + ' ' + render_existing_check_summary
else
content_tag("span", "FAIL", class: "label label-danger") + ' ' + render_existing_check_summary + render_failed_compact
end
end | ruby | def render_file_set_status
@file_set_status ||=
if relevant_log_records.empty?
"Fixity checks have not yet been run on this object"
elsif failing_checks.empty?
content_tag("span", "passed", class: "label label-success") + ' ' + render_existing_check_summary
else
content_tag("span", "FAIL", class: "label label-danger") + ' ' + render_existing_check_summary + render_failed_compact
end
end | [
"def",
"render_file_set_status",
"@file_set_status",
"||=",
"if",
"relevant_log_records",
".",
"empty?",
"\"Fixity checks have not yet been run on this object\"",
"elsif",
"failing_checks",
".",
"empty?",
"content_tag",
"(",
"\"span\"",
",",
"\"passed\"",
",",
"class",
":",
... | Note this takes a file_set_id NOT a FileSet, easy use from either solr
or AF object.
Returns a html_safe string communicating fixity status checks,
possibly on multiple files/versions. | [
"Note",
"this",
"takes",
"a",
"file_set_id",
"NOT",
"a",
"FileSet",
"easy",
"use",
"from",
"either",
"solr",
"or",
"AF",
"object",
".",
"Returns",
"a",
"html_safe",
"string",
"communicating",
"fixity",
"status",
"checks",
"possibly",
"on",
"multiple",
"files",... | e2b4f56e829a53b1f11296324736e9d5b8c9ee5f | https://github.com/samvera/hyrax/blob/e2b4f56e829a53b1f11296324736e9d5b8c9ee5f/app/presenters/hyrax/fixity_status_presenter.rb#L22-L31 | train | Renders the file set status | [
30522,
13366,
17552,
1035,
5371,
1035,
2275,
1035,
3570,
1030,
5371,
1035,
2275,
1035,
3570,
1064,
1064,
1027,
2065,
7882,
1035,
8833,
1035,
2636,
1012,
4064,
1029,
1000,
8081,
3012,
14148,
2031,
2025,
2664,
2042,
2448,
2006,
2023,
4874,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
daddyz/phonelib | lib/phonelib/phone_formatter.rb | Phonelib.PhoneFormatter.international | def international(formatted = true, prefix = '+')
prefix = formatted if formatted.is_a?(String)
return nil if sanitized.empty?
return "#{prefix}#{country_prefix_or_not}#{sanitized}" unless valid?
return country_code + @national_number unless formatted
fmt = @data[country][:format]
national = @national_number
if (matches = @national_number.match(cr(fmt[Core::PATTERN])))
fmt = fmt[:intl_format] || fmt[:format]
national = fmt.gsub(/\$\d/) { |el| matches[el[1].to_i] } unless fmt == 'NA'
end
"#{prefix}#{country_code} #{national}"
end | ruby | def international(formatted = true, prefix = '+')
prefix = formatted if formatted.is_a?(String)
return nil if sanitized.empty?
return "#{prefix}#{country_prefix_or_not}#{sanitized}" unless valid?
return country_code + @national_number unless formatted
fmt = @data[country][:format]
national = @national_number
if (matches = @national_number.match(cr(fmt[Core::PATTERN])))
fmt = fmt[:intl_format] || fmt[:format]
national = fmt.gsub(/\$\d/) { |el| matches[el[1].to_i] } unless fmt == 'NA'
end
"#{prefix}#{country_code} #{national}"
end | [
"def",
"international",
"(",
"formatted",
"=",
"true",
",",
"prefix",
"=",
"'+'",
")",
"prefix",
"=",
"formatted",
"if",
"formatted",
".",
"is_a?",
"(",
"String",
")",
"return",
"nil",
"if",
"sanitized",
".",
"empty?",
"return",
"\"#{prefix}#{country_prefix_or... | Returns e164 formatted phone number. Method can receive single string parameter that will be defined as prefix
@param formatted [Boolean] whether to return numbers only or formatted
@param prefix [String] prefix to be placed before the number, "+" by default
@return [String] formatted international number | [
"Returns",
"e164",
"formatted",
"phone",
"number",
".",
"Method",
"can",
"receive",
"single",
"string",
"parameter",
"that",
"will",
"be",
"defined",
"as",
"prefix"
] | aa0023eab7c896b71275bf342bc7f49735cbdbbf | https://github.com/daddyz/phonelib/blob/aa0023eab7c896b71275bf342bc7f49735cbdbbf/lib/phonelib/phone_formatter.rb#L43-L57 | train | Returns the international number. | [
30522,
13366,
2248,
1006,
4289,
3064,
1027,
2995,
1010,
17576,
1027,
1005,
1009,
1005,
1007,
17576,
1027,
4289,
3064,
2065,
4289,
3064,
1012,
2003,
1035,
1037,
1029,
1006,
5164,
1007,
2709,
9152,
2140,
2065,
2624,
25090,
5422,
1012,
4064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
getsentry/raven-ruby | lib/raven/event.rb | Raven.Event.calculate_real_ip_from_rack | def calculate_real_ip_from_rack
Utils::RealIp.new(
:remote_addr => context.rack_env["REMOTE_ADDR"],
:client_ip => context.rack_env["HTTP_CLIENT_IP"],
:real_ip => context.rack_env["HTTP_X_REAL_IP"],
:forwarded_for => context.rack_env["HTTP_X_FORWARDED_FOR"]
).calculate_ip
end | ruby | def calculate_real_ip_from_rack
Utils::RealIp.new(
:remote_addr => context.rack_env["REMOTE_ADDR"],
:client_ip => context.rack_env["HTTP_CLIENT_IP"],
:real_ip => context.rack_env["HTTP_X_REAL_IP"],
:forwarded_for => context.rack_env["HTTP_X_FORWARDED_FOR"]
).calculate_ip
end | [
"def",
"calculate_real_ip_from_rack",
"Utils",
"::",
"RealIp",
".",
"new",
"(",
":remote_addr",
"=>",
"context",
".",
"rack_env",
"[",
"\"REMOTE_ADDR\"",
"]",
",",
":client_ip",
"=>",
"context",
".",
"rack_env",
"[",
"\"HTTP_CLIENT_IP\"",
"]",
",",
":real_ip",
"... | When behind a proxy (or if the user is using a proxy), we can't use
REMOTE_ADDR to determine the Event IP, and must use other headers instead. | [
"When",
"behind",
"a",
"proxy",
"(",
"or",
"if",
"the",
"user",
"is",
"using",
"a",
"proxy",
")",
"we",
"can",
"t",
"use",
"REMOTE_ADDR",
"to",
"determine",
"the",
"Event",
"IP",
"and",
"must",
"use",
"other",
"headers",
"instead",
"."
] | 729c22f9284939695f14822683bff1a0b72502bd | https://github.com/getsentry/raven-ruby/blob/729c22f9284939695f14822683bff1a0b72502bd/lib/raven/event.rb#L224-L231 | train | Calculate the real ip from the rack_env | [
30522,
13366,
18422,
1035,
2613,
1035,
12997,
1035,
2013,
1035,
14513,
21183,
12146,
1024,
1024,
2613,
11514,
1012,
2047,
1006,
1024,
6556,
1035,
5587,
2099,
1027,
1028,
6123,
1012,
14513,
1035,
4372,
2615,
1031,
1000,
6556,
1035,
5587,
209... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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_as_lazy | def list_worker_pool_instance_metrics_as_lazy(resource_group_name, name, worker_pool_name, instance, details:nil, filter:nil, custom_headers:nil)
response = list_worker_pool_instance_metrics_async(resource_group_name, name, worker_pool_name, instance, details:details, filter:filter, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_worker_pool_instance_metrics_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | ruby | def list_worker_pool_instance_metrics_as_lazy(resource_group_name, name, worker_pool_name, instance, details:nil, filter:nil, custom_headers:nil)
response = list_worker_pool_instance_metrics_async(resource_group_name, name, worker_pool_name, instance, details:details, filter:filter, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_worker_pool_instance_metrics_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end | [
"def",
"list_worker_pool_instance_metrics_as_lazy",
"(",
"resource_group_name",
",",
"name",
",",
"worker_pool_name",
",",
"instance",
",",
"details",
":",
"nil",
",",
"filter",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_worker_pool_i... | 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 resource_group_name [String] Name of the resource group to which the
resource belongs.
@param name [String] Name of the App Service Environment.
@param worker_pool_name [String] Name of the worker pool.
@param instance [String] Name of the instance in the worker pool.
@param details [Boolean] Specify <code>true</code> to include instance
details. The default is <code>false</code>.
@param filter [String] Return only usages/metrics specified in the filter.
Filter conforms to odata syntax. Example: $filter=(name.value eq 'Metric1' or
name.value eq 'Metric2') and startTime eq 2014-01-01T00:00:00Z and endTime eq
2014-12-31T23:59:59Z and timeGrain eq duration'[Hour|Minute|Day]'.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ResourceMetricCollection] which provide lazy access to pages of the
response. | [
"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#L7890-L7899 | train | Gets metrics for a worker pool instance. | [
30522,
13366,
2862,
1035,
7309,
1035,
4770,
1035,
6013,
1035,
12046,
2015,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2171,
1010,
7309,
1035,
4770,
1035,
2171,
1010,
6013,
1010,
4751,
1024,
9152,
2140,
1010,
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... |
github-changelog-generator/github-changelog-generator | lib/github_changelog_generator/generator/section.rb | GitHubChangelogGenerator.Section.get_string_for_issue | def get_string_for_issue(issue)
encapsulated_title = encapsulate_string issue["title"]
title_with_number = "#{encapsulated_title} [\\##{issue['number']}](#{issue['html_url']})"
title_with_number = "#{title_with_number}#{line_labels_for(issue)}" if @options[:issue_line_labels].present?
line = issue_line_with_user(title_with_number, issue)
issue_line_with_body(line, issue)
end | ruby | def get_string_for_issue(issue)
encapsulated_title = encapsulate_string issue["title"]
title_with_number = "#{encapsulated_title} [\\##{issue['number']}](#{issue['html_url']})"
title_with_number = "#{title_with_number}#{line_labels_for(issue)}" if @options[:issue_line_labels].present?
line = issue_line_with_user(title_with_number, issue)
issue_line_with_body(line, issue)
end | [
"def",
"get_string_for_issue",
"(",
"issue",
")",
"encapsulated_title",
"=",
"encapsulate_string",
"issue",
"[",
"\"title\"",
"]",
"title_with_number",
"=",
"\"#{encapsulated_title} [\\\\##{issue['number']}](#{issue['html_url']})\"",
"title_with_number",
"=",
"\"#{title_with_number... | Parse issue and generate single line formatted issue line.
Example output:
- Add coveralls integration [\#223](https://github.com/github-changelog-generator/github-changelog-generator/pull/223) (@github-changelog-generator)
@param [Hash] issue Fetched issue from GitHub
@return [String] Markdown-formatted single issue | [
"Parse",
"issue",
"and",
"generate",
"single",
"line",
"formatted",
"issue",
"line",
"."
] | f18c64b5cc0d7473b059275b88385ac11ca8b564 | https://github.com/github-changelog-generator/github-changelog-generator/blob/f18c64b5cc0d7473b059275b88385ac11ca8b564/lib/github_changelog_generator/generator/section.rb#L48-L55 | train | Returns the string for an issue | [
30522,
13366,
2131,
1035,
5164,
1035,
2005,
1035,
3277,
1006,
3277,
1007,
4372,
17695,
23722,
4383,
1035,
2516,
30524,
3277,
1031,
1005,
16129,
1035,
24471,
2140,
1005,
1033,
1065,
1007,
1000,
2516,
1035,
2007,
1035,
2193,
1027,
1000,
1001,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
bblimke/webmock | lib/webmock/api.rb | WebMock.API.anythingize_lonely_keys | def anythingize_lonely_keys(*args)
hash = args.last.class == Hash ? args.delete_at(-1) : {}
args.each { | arg | hash[arg] = WebMock::Matchers::AnyArgMatcher.new(nil) }
hash
end | ruby | def anythingize_lonely_keys(*args)
hash = args.last.class == Hash ? args.delete_at(-1) : {}
args.each { | arg | hash[arg] = WebMock::Matchers::AnyArgMatcher.new(nil) }
hash
end | [
"def",
"anythingize_lonely_keys",
"(",
"*",
"args",
")",
"hash",
"=",
"args",
".",
"last",
".",
"class",
"==",
"Hash",
"?",
"args",
".",
"delete_at",
"(",
"-",
"1",
")",
":",
"{",
"}",
"args",
".",
"each",
"{",
"|",
"arg",
"|",
"hash",
"[",
"arg"... | this is a based on RSpec::Mocks::ArgumentMatchers#anythingize_lonely_keys | [
"this",
"is",
"a",
"based",
"on",
"RSpec",
"::",
"Mocks",
"::",
"ArgumentMatchers#anythingize_lonely_keys"
] | c0bcc09af372286cd110ec4159112ce583007951 | https://github.com/bblimke/webmock/blob/c0bcc09af372286cd110ec4159112ce583007951/lib/webmock/api.rb#L102-L106 | train | Returns a hash of any keys that are not a hash. | [
30522,
13366,
2505,
4697,
1035,
9479,
1035,
6309,
1006,
1008,
12098,
5620,
1007,
23325,
1027,
12098,
5620,
1012,
2197,
1012,
2465,
1027,
1027,
23325,
1029,
12098,
5620,
1012,
3972,
12870,
1035,
2012,
1006,
1011,
1015,
1007,
1024,
1063,
1065... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_service_fabric/lib/6.3.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb | Azure::ServiceFabric::V6_3_0_9.ServiceFabricClientAPIs.get_replicas | def get_replicas(application_resource_name, service_resource_name, custom_headers:nil)
response = get_replicas_async(application_resource_name, service_resource_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_replicas(application_resource_name, service_resource_name, custom_headers:nil)
response = get_replicas_async(application_resource_name, service_resource_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_replicas",
"(",
"application_resource_name",
",",
"service_resource_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_replicas_async",
"(",
"application_resource_name",
",",
"service_resource_name",
",",
"custom_headers",
":custom_headers",
")... | Gets replicas of a given service in an application resource.
Gets the information about all replicas of a given service of an application.
The information includes the runtime properties of the replica instance.
@param application_resource_name [String] Service Fabric application resource
name.
@param service_resource_name [String] Service Fabric service resource name.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [PagedServiceResourceReplicaDescriptionList] operation results. | [
"Gets",
"replicas",
"of",
"a",
"given",
"service",
"in",
"an",
"application",
"resource",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_service_fabric/lib/6.3.0.9/generated/azure_service_fabric/service_fabric_client_apis.rb#L29830-L29833 | train | Gets the number of replicas of the service resource. | [
30522,
13366,
2131,
1035,
15059,
2015,
1006,
4646,
1035,
7692,
1035,
2171,
1010,
2326,
1035,
7692,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
15059,
2015,
1035,
2004,
6038,
2278,
1006,
4646,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/channel.rb | Discordrb.Channel.pins | def pins
msgs = API::Channel.pinned_messages(@bot.token, @id)
JSON.parse(msgs).map { |msg| Message.new(msg, @bot) }
end | ruby | def pins
msgs = API::Channel.pinned_messages(@bot.token, @id)
JSON.parse(msgs).map { |msg| Message.new(msg, @bot) }
end | [
"def",
"pins",
"msgs",
"=",
"API",
"::",
"Channel",
".",
"pinned_messages",
"(",
"@bot",
".",
"token",
",",
"@id",
")",
"JSON",
".",
"parse",
"(",
"msgs",
")",
".",
"map",
"{",
"|",
"msg",
"|",
"Message",
".",
"new",
"(",
"msg",
",",
"@bot",
")",... | Requests all pinned messages in a channel.
@return [Array<Message>] the received messages. | [
"Requests",
"all",
"pinned",
"messages",
"in",
"a",
"channel",
"."
] | 764298a1ff0be69a1853b510d736f21c2b91a2fe | https://github.com/meew0/discordrb/blob/764298a1ff0be69a1853b510d736f21c2b91a2fe/lib/discordrb/data/channel.rb#L556-L559 | train | Returns an array of all the pinned messages for this channel. | [
30522,
13366,
16300,
5796,
5620,
1027,
17928,
1024,
1024,
3149,
1012,
11807,
1035,
7696,
1006,
1030,
28516,
1012,
19204,
1010,
1030,
8909,
1007,
1046,
3385,
1012,
11968,
3366,
1006,
5796,
5620,
1007,
1012,
4949,
1063,
1064,
5796,
2290,
1064... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
randym/axlsx | lib/axlsx/stylesheet/gradient_fill.rb | Axlsx.GradientFill.to_xml_string | def to_xml_string(str = '')
str << '<gradientFill '
serialized_attributes str
str << '>'
@stop.each { |s| s.to_xml_string(str) }
str << '</gradientFill>'
end | ruby | def to_xml_string(str = '')
str << '<gradientFill '
serialized_attributes str
str << '>'
@stop.each { |s| s.to_xml_string(str) }
str << '</gradientFill>'
end | [
"def",
"to_xml_string",
"(",
"str",
"=",
"''",
")",
"str",
"<<",
"'<gradientFill '",
"serialized_attributes",
"str",
"str",
"<<",
"'>'",
"@stop",
".",
"each",
"{",
"|",
"s",
"|",
"s",
".",
"to_xml_string",
"(",
"str",
")",
"}",
"str",
"<<",
"'</gradientF... | Serializes the object
@param [String] str
@return [String] | [
"Serializes",
"the",
"object"
] | c593a08b2a929dac7aa8dc418b55e26b4c49dc34 | https://github.com/randym/axlsx/blob/c593a08b2a929dac7aa8dc418b55e26b4c49dc34/lib/axlsx/stylesheet/gradient_fill.rb#L95-L101 | train | Serialize the gradientFill object to a string. | [
30522,
13366,
2000,
1035,
20950,
1035,
5164,
1006,
2358,
2099,
1027,
1005,
1005,
1007,
2358,
2099,
1026,
1026,
1005,
1026,
17978,
8873,
3363,
1005,
27289,
1035,
12332,
2358,
2099,
2358,
2099,
1026,
1026,
1005,
1028,
1005,
1030,
2644,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
rails/sprockets | lib/sprockets/source_map_utils.rb | Sprockets.SourceMapUtils.decode_source_map | def decode_source_map(map)
return nil unless map
mappings, sources, names = [], [], []
if map["sections"]
map["sections"].each do |s|
mappings += decode_source_map(s["map"])[:mappings].each do |m|
m[:generated][0] += s["offset"]["line"]
m[:generated][1] += s["offset"]["column"]
end
sources |= s["map"]["sources"]
names |= s["map"]["names"]
end
else
mappings = decode_vlq_mappings(map["mappings"], sources: map["sources"], names: map["names"])
sources = map["sources"]
names = map["names"]
end
{
version: 3,
file: map["file"],
mappings: mappings,
sources: sources,
names: names
}
end | ruby | def decode_source_map(map)
return nil unless map
mappings, sources, names = [], [], []
if map["sections"]
map["sections"].each do |s|
mappings += decode_source_map(s["map"])[:mappings].each do |m|
m[:generated][0] += s["offset"]["line"]
m[:generated][1] += s["offset"]["column"]
end
sources |= s["map"]["sources"]
names |= s["map"]["names"]
end
else
mappings = decode_vlq_mappings(map["mappings"], sources: map["sources"], names: map["names"])
sources = map["sources"]
names = map["names"]
end
{
version: 3,
file: map["file"],
mappings: mappings,
sources: sources,
names: names
}
end | [
"def",
"decode_source_map",
"(",
"map",
")",
"return",
"nil",
"unless",
"map",
"mappings",
",",
"sources",
",",
"names",
"=",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
"if",
"map",
"[",
"\"sections\"",
"]",
"map",
"[",
"\"sections\"",
"]",
".",
"each",... | Public: Decompress source map
Example:
decode_source_map(map)
# => {
version: 3,
file: "..",
mappings: [
{ source: "..", generated: [0, 0], original: [0, 0], name: ".."}, ..
],
sources: [..],
names: [..]
}
map - Source map hash (v3 spec)
Returns an uncompressed source map hash | [
"Public",
":",
"Decompress",
"source",
"map"
] | 9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd | https://github.com/rails/sprockets/blob/9e3f0d8e98c44f57e67bc138db87bb8469bf5ddd/lib/sprockets/source_map_utils.rb#L192-L217 | train | Decode a source map | [
30522,
13366,
21933,
3207,
1035,
3120,
1035,
4949,
1006,
4949,
1007,
2709,
9152,
2140,
4983,
4949,
12375,
2015,
1010,
4216,
1010,
3415,
1027,
1031,
1033,
1010,
1031,
1033,
1010,
1031,
1033,
2065,
4949,
1031,
1000,
5433,
1000,
1033,
4949,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
puppetlabs/puppet | lib/puppet/util/windows/service.rb | Puppet::Util::Windows.Service.services | def services
services = {}
open_scm(SC_MANAGER_ENUMERATE_SERVICE) do |scm|
size_required = 0
services_returned = 0
FFI::MemoryPointer.new(:dword) do |bytes_pointer|
FFI::MemoryPointer.new(:dword) do |svcs_ret_ptr|
FFI::MemoryPointer.new(:dword) do |resume_ptr|
resume_ptr.write_dword(0)
# Fetch the bytes of memory required to be allocated
# for QueryServiceConfigW to return succesfully. This
# is done by sending NULL and 0 for the pointer and size
# respectively, letting the command fail, then reading the
# value of pcbBytesNeeded
#
# return value will be false from this call, since it's designed
# to fail. Just ignore it
EnumServicesStatusExW(
scm,
:SC_ENUM_PROCESS_INFO,
ALL_SERVICE_TYPES,
SERVICE_STATE_ALL,
FFI::Pointer::NULL,
0,
bytes_pointer,
svcs_ret_ptr,
resume_ptr,
FFI::Pointer::NULL
)
size_required = bytes_pointer.read_dword
FFI::MemoryPointer.new(size_required) do |buffer_ptr|
resume_ptr.write_dword(0)
svcs_ret_ptr.write_dword(0)
success = EnumServicesStatusExW(
scm,
:SC_ENUM_PROCESS_INFO,
ALL_SERVICE_TYPES,
SERVICE_STATE_ALL,
buffer_ptr,
buffer_ptr.size,
bytes_pointer,
svcs_ret_ptr,
resume_ptr,
FFI::Pointer::NULL
)
if success == FFI::WIN32_FALSE
raise Puppet::Util::Windows::Error.new(_("Failed to fetch services"))
end
# Now that the buffer is populated with services
# we pull the data from memory using pointer arithmetic:
# the number of services returned by the function is
# available to be read from svcs_ret_ptr, and we iterate
# that many times moving the cursor pointer the length of
# ENUM_SERVICE_STATUS_PROCESSW.size. This should iterate
# over the buffer and extract each struct.
services_returned = svcs_ret_ptr.read_dword
cursor_ptr = FFI::Pointer.new(ENUM_SERVICE_STATUS_PROCESSW, buffer_ptr)
0.upto(services_returned - 1) do |index|
service = ENUM_SERVICE_STATUS_PROCESSW.new(cursor_ptr[index])
services[service[:lpServiceName].read_arbitrary_wide_string_up_to(SERVICENAME_MAX)] = {
:display_name => service[:lpDisplayName].read_arbitrary_wide_string_up_to(SERVICENAME_MAX),
:service_status_process => service[:ServiceStatusProcess]
}
end
end # buffer_ptr
end # resume_ptr
end # scvs_ret_ptr
end # bytes_ptr
end # open_scm
services
end | ruby | def services
services = {}
open_scm(SC_MANAGER_ENUMERATE_SERVICE) do |scm|
size_required = 0
services_returned = 0
FFI::MemoryPointer.new(:dword) do |bytes_pointer|
FFI::MemoryPointer.new(:dword) do |svcs_ret_ptr|
FFI::MemoryPointer.new(:dword) do |resume_ptr|
resume_ptr.write_dword(0)
# Fetch the bytes of memory required to be allocated
# for QueryServiceConfigW to return succesfully. This
# is done by sending NULL and 0 for the pointer and size
# respectively, letting the command fail, then reading the
# value of pcbBytesNeeded
#
# return value will be false from this call, since it's designed
# to fail. Just ignore it
EnumServicesStatusExW(
scm,
:SC_ENUM_PROCESS_INFO,
ALL_SERVICE_TYPES,
SERVICE_STATE_ALL,
FFI::Pointer::NULL,
0,
bytes_pointer,
svcs_ret_ptr,
resume_ptr,
FFI::Pointer::NULL
)
size_required = bytes_pointer.read_dword
FFI::MemoryPointer.new(size_required) do |buffer_ptr|
resume_ptr.write_dword(0)
svcs_ret_ptr.write_dword(0)
success = EnumServicesStatusExW(
scm,
:SC_ENUM_PROCESS_INFO,
ALL_SERVICE_TYPES,
SERVICE_STATE_ALL,
buffer_ptr,
buffer_ptr.size,
bytes_pointer,
svcs_ret_ptr,
resume_ptr,
FFI::Pointer::NULL
)
if success == FFI::WIN32_FALSE
raise Puppet::Util::Windows::Error.new(_("Failed to fetch services"))
end
# Now that the buffer is populated with services
# we pull the data from memory using pointer arithmetic:
# the number of services returned by the function is
# available to be read from svcs_ret_ptr, and we iterate
# that many times moving the cursor pointer the length of
# ENUM_SERVICE_STATUS_PROCESSW.size. This should iterate
# over the buffer and extract each struct.
services_returned = svcs_ret_ptr.read_dword
cursor_ptr = FFI::Pointer.new(ENUM_SERVICE_STATUS_PROCESSW, buffer_ptr)
0.upto(services_returned - 1) do |index|
service = ENUM_SERVICE_STATUS_PROCESSW.new(cursor_ptr[index])
services[service[:lpServiceName].read_arbitrary_wide_string_up_to(SERVICENAME_MAX)] = {
:display_name => service[:lpDisplayName].read_arbitrary_wide_string_up_to(SERVICENAME_MAX),
:service_status_process => service[:ServiceStatusProcess]
}
end
end # buffer_ptr
end # resume_ptr
end # scvs_ret_ptr
end # bytes_ptr
end # open_scm
services
end | [
"def",
"services",
"services",
"=",
"{",
"}",
"open_scm",
"(",
"SC_MANAGER_ENUMERATE_SERVICE",
")",
"do",
"|",
"scm",
"|",
"size_required",
"=",
"0",
"services_returned",
"=",
"0",
"FFI",
"::",
"MemoryPointer",
".",
"new",
"(",
":dword",
")",
"do",
"|",
"b... | enumerate over all services in all states and return them as a hash
@return [Hash] a hash containing services:
{ 'service name' => {
'display_name' => 'display name',
'service_status_process' => SERVICE_STATUS_PROCESS struct
}
} | [
"enumerate",
"over",
"all",
"services",
"in",
"all",
"states",
"and",
"return",
"them",
"as",
"a",
"hash"
] | 4baeed97cbb7571ddc6635f0a24debe2e8b22cd3 | https://github.com/puppetlabs/puppet/blob/4baeed97cbb7571ddc6635f0a24debe2e8b22cd3/lib/puppet/util/windows/service.rb#L441-L511 | train | Get the list of services that are available in the service manager. | [
30522,
13366,
2578,
2578,
1027,
1063,
1065,
2330,
1035,
8040,
2213,
1006,
8040,
1035,
3208,
1035,
4372,
17897,
11657,
1035,
2326,
1007,
2079,
1064,
8040,
2213,
1064,
2946,
1035,
3223,
1027,
1014,
2578,
1035,
2513,
1027,
1014,
21461,
2072,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
palkan/logidze | lib/logidze/versioned_association.rb | Logidze.VersionedAssociation.load_target | def load_target
target = super
return unless target
return target if inversed
time = owner.logidze_requested_ts
if target.is_a? Array
target.map! do |object|
object.at(time: time)
end.compact!
else
target.at!(time: time)
end
target
end | ruby | def load_target
target = super
return unless target
return target if inversed
time = owner.logidze_requested_ts
if target.is_a? Array
target.map! do |object|
object.at(time: time)
end.compact!
else
target.at!(time: time)
end
target
end | [
"def",
"load_target",
"target",
"=",
"super",
"return",
"unless",
"target",
"return",
"target",
"if",
"inversed",
"time",
"=",
"owner",
".",
"logidze_requested_ts",
"if",
"target",
".",
"is_a?",
"Array",
"target",
".",
"map!",
"do",
"|",
"object",
"|",
"obje... | rubocop: disable Metrics/MethodLength, Metrics/AbcSize | [
"rubocop",
":",
"disable",
"Metrics",
"/",
"MethodLength",
"Metrics",
"/",
"AbcSize"
] | ffa0f793cb9c6fab96fa67a285341ca9aaa7ded8 | https://github.com/palkan/logidze/blob/ffa0f793cb9c6fab96fa67a285341ca9aaa7ded8/lib/logidze/versioned_association.rb#L16-L32 | train | Load the target object from the database. | [
30522,
13366,
7170,
1035,
4539,
4539,
1027,
3565,
2709,
4983,
4539,
2709,
4539,
2065,
19262,
2094,
2051,
1027,
3954,
1012,
8833,
3593,
4371,
1035,
7303,
1035,
24529,
2065,
4539,
1012,
2003,
1035,
1037,
1029,
9140,
4539,
1012,
4949,
999,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
mongodb/mongoid | lib/mongoid/traversable.rb | Mongoid.Traversable.collect_children | def collect_children
children = []
embedded_relations.each_pair do |name, association|
without_autobuild do
child = send(name)
Array.wrap(child).each do |doc|
children.push(doc)
children.concat(doc._children)
end if child
end
end
children
end | ruby | def collect_children
children = []
embedded_relations.each_pair do |name, association|
without_autobuild do
child = send(name)
Array.wrap(child).each do |doc|
children.push(doc)
children.concat(doc._children)
end if child
end
end
children
end | [
"def",
"collect_children",
"children",
"=",
"[",
"]",
"embedded_relations",
".",
"each_pair",
"do",
"|",
"name",
",",
"association",
"|",
"without_autobuild",
"do",
"child",
"=",
"send",
"(",
"name",
")",
"Array",
".",
"wrap",
"(",
"child",
")",
".",
"each... | Collect all the children of this document.
@example Collect all the children.
document.collect_children
@return [ Array<Document> ] The children.
@since 2.4.0 | [
"Collect",
"all",
"the",
"children",
"of",
"this",
"document",
"."
] | 56976e32610f4c2450882b0bfe14da099f0703f4 | https://github.com/mongodb/mongoid/blob/56976e32610f4c2450882b0bfe14da099f0703f4/lib/mongoid/traversable.rb#L42-L54 | train | Collect the children of the document | [
30522,
13366,
8145,
1035,
2336,
2336,
1027,
1031,
1033,
11157,
1035,
4262,
1012,
2169,
1035,
3940,
2079,
1064,
2171,
1010,
2523,
1064,
2302,
1035,
8285,
8569,
4014,
2094,
2079,
2775,
1027,
4604,
1006,
2171,
1007,
9140,
1012,
10236,
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... |
danger/danger | lib/danger/danger_core/plugins/dangerfile_messaging_plugin.rb | Danger.DangerfileMessagingPlugin.markdown | def markdown(*markdowns, **options)
file = options.fetch(:file, nil)
line = options.fetch(:line, nil)
markdowns.flatten.each do |markdown|
@markdowns << Markdown.new(markdown, file, line)
end
end | ruby | def markdown(*markdowns, **options)
file = options.fetch(:file, nil)
line = options.fetch(:line, nil)
markdowns.flatten.each do |markdown|
@markdowns << Markdown.new(markdown, file, line)
end
end | [
"def",
"markdown",
"(",
"*",
"markdowns",
",",
"**",
"options",
")",
"file",
"=",
"options",
".",
"fetch",
"(",
":file",
",",
"nil",
")",
"line",
"=",
"options",
".",
"fetch",
"(",
":line",
",",
"nil",
")",
"markdowns",
".",
"flatten",
".",
"each",
... | @!group Core
Print markdown to below the table
@param [String, Array<String>] message
The markdown based message to be printed below the table
@param [String] file
Optional. Path to the file that the message is for.
@param [String] line
Optional. The line in the file to present the message in.
@return [void] | [
"@!group",
"Core",
"Print",
"markdown",
"to",
"below",
"the",
"table"
] | 0d6d09f2d949c287fe75202d947374042b0679f4 | https://github.com/danger/danger/blob/0d6d09f2d949c287fe75202d947374042b0679f4/lib/danger/danger_core/plugins/dangerfile_messaging_plugin.rb#L98-L105 | train | Add markdowns to the list of markdowns | [
30522,
13366,
2928,
7698,
1006,
1008,
2928,
7698,
2015,
1010,
1008,
1008,
7047,
1007,
5371,
1027,
7047,
1012,
18584,
1006,
1024,
5371,
1010,
9152,
2140,
1007,
2240,
1027,
7047,
1012,
18584,
1006,
1024,
2240,
1010,
9152,
2140,
1007,
2928,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2016-06-01/generated/azure_mgmt_network/network_interfaces.rb | Azure::Network::Mgmt::V2016_06_01.NetworkInterfaces.get_effective_route_table_async | def get_effective_route_table_async(resource_group_name, network_interface_name, custom_headers:nil)
# Send request
promise = begin_get_effective_route_table_async(resource_group_name, network_interface_name, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Network::Mgmt::V2016_06_01::Models::EffectiveRouteListResult.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | ruby | def get_effective_route_table_async(resource_group_name, network_interface_name, custom_headers:nil)
# Send request
promise = begin_get_effective_route_table_async(resource_group_name, network_interface_name, custom_headers:custom_headers)
promise = promise.then do |response|
# Defining deserialization method.
deserialize_method = lambda do |parsed_response|
result_mapper = Azure::Network::Mgmt::V2016_06_01::Models::EffectiveRouteListResult.mapper()
parsed_response = @client.deserialize(result_mapper, parsed_response)
end
# Waiting for response.
@client.get_long_running_operation_result(response, deserialize_method)
end
promise
end | [
"def",
"get_effective_route_table_async",
"(",
"resource_group_name",
",",
"network_interface_name",
",",
"custom_headers",
":",
"nil",
")",
"# Send request",
"promise",
"=",
"begin_get_effective_route_table_async",
"(",
"resource_group_name",
",",
"network_interface_name",
","... | @param resource_group_name [String] The name of the resource group.
@param network_interface_name [String] The name of the network interface.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Concurrent::Promise] promise which provides async access to http
response. | [
"@param",
"resource_group_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"resource",
"group",
".",
"@param",
"network_interface_name",
"[",
"String",
"]",
"The",
"name",
"of",
"the",
"network",
"interface",
".",
"@param",
"custom_headers",
"[",
"Hash",
... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2016-06-01/generated/azure_mgmt_network/network_interfaces.rb#L717-L733 | train | Gets the effective route table for a network interface. | [
30522,
13366,
2131,
1035,
4621,
1035,
2799,
1035,
2795,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2897,
1035,
8278,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
1001,
4604,
5227,
4872,
1027,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_customvisionprediction/lib/3.0/generated/azure_cognitiveservices_customvisionprediction/customvisionprediction_client.rb | Azure::CognitiveServices::Customvisionprediction::V3_0.CustomvisionpredictionClient.classify_image_url_with_no_store | def classify_image_url_with_no_store(project_id, published_name, image_url, application:nil, custom_headers:nil)
response = classify_image_url_with_no_store_async(project_id, published_name, image_url, application:application, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def classify_image_url_with_no_store(project_id, published_name, image_url, application:nil, custom_headers:nil)
response = classify_image_url_with_no_store_async(project_id, published_name, image_url, application:application, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"classify_image_url_with_no_store",
"(",
"project_id",
",",
"published_name",
",",
"image_url",
",",
"application",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"classify_image_url_with_no_store_async",
"(",
"project_id",
",",
"published_n... | Classify an image url without saving the result.
@param project_id The project id.
@param published_name [String] Specifies the name of the model to evaluate
against.
@param image_url [ImageUrl] An {Iris.Web.Api.Models.ImageUrl} that contains
the url of the image to be evaluated.
@param application [String] Optional. Specifies the name of application using
the endpoint.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [ImagePrediction] operation results. | [
"Classify",
"an",
"image",
"url",
"without",
"saving",
"the",
"result",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_customvisionprediction/lib/3.0/generated/azure_cognitiveservices_customvisionprediction/customvisionprediction_client.rb#L362-L365 | train | Classifies an image url with a given name. | [
30522,
13366,
26268,
1035,
3746,
1035,
24471,
2140,
1035,
2007,
1035,
2053,
1035,
3573,
1006,
2622,
1035,
8909,
1010,
2405,
1035,
2171,
1010,
3746,
1035,
24471,
2140,
1010,
4646,
1024,
9152,
2140,
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_stor_simple8000_series/lib/2017-06-01/generated/azure_mgmt_stor_simple8000_series/device_settings.rb | Azure::StorSimple8000Series::Mgmt::V2017_06_01.DeviceSettings.begin_update_security_settings | def begin_update_security_settings(device_name, parameters, resource_group_name, manager_name, custom_headers:nil)
response = begin_update_security_settings_async(device_name, parameters, resource_group_name, manager_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def begin_update_security_settings(device_name, parameters, resource_group_name, manager_name, custom_headers:nil)
response = begin_update_security_settings_async(device_name, parameters, resource_group_name, manager_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"begin_update_security_settings",
"(",
"device_name",
",",
"parameters",
",",
"resource_group_name",
",",
"manager_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"begin_update_security_settings_async",
"(",
"device_name",
",",
"parameters",
",",
... | Patch Security properties of the specified device name.
@param device_name [String] The device name
@param parameters [SecuritySettingsPatch] The security settings properties to
be patched.
@param resource_group_name [String] The resource group name
@param manager_name [String] The manager name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [SecuritySettings] operation results. | [
"Patch",
"Security",
"properties",
"of",
"the",
"specified",
"device",
"name",
"."
] | 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#L873-L876 | train | Updates security settings of the specified device. | [
30522,
13366,
4088,
1035,
10651,
1035,
3036,
1035,
10906,
1006,
5080,
1035,
2171,
1010,
11709,
1010,
7692,
1035,
2177,
1035,
2171,
1010,
3208,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
4088,
1035,
10651,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Azure/azure-sdk-for-ruby | management/azure_mgmt_service_bus/lib/2017-04-01/generated/azure_mgmt_service_bus/disaster_recovery_configs.rb | Azure::ServiceBus::Mgmt::V2017_04_01.DisasterRecoveryConfigs.list | def list(resource_group_name, namespace_name, custom_headers:nil)
first_page = list_as_lazy(resource_group_name, namespace_name, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list(resource_group_name, namespace_name, custom_headers:nil)
first_page = list_as_lazy(resource_group_name, namespace_name, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_as_lazy",
"(",
"resource_group_name",
",",
"namespace_name",
",",
"custom_headers",
":custom_headers",
")",
"first_page",
".",
"get_all_i... | Gets all Alias(Disaster Recovery configurations)
@param resource_group_name [String] Name of the Resource group within the
Azure subscription.
@param namespace_name [String] The namespace name
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [Array<ArmDisasterRecovery>] operation results. | [
"Gets",
"all",
"Alias",
"(",
"Disaster",
"Recovery",
"configurations",
")"
] | 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/disaster_recovery_configs.rb#L148-L151 | train | Gets all the items in a namespace. | [
30522,
13366,
2862,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
3415,
15327,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
2034,
1035,
3931,
1027,
2862,
1035,
2004,
1035,
13971,
1006,
7692,
1035,
2177,
1035,
2171,
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... |
SamSaffron/memory_profiler | lib/memory_profiler/reporter.rb | MemoryProfiler.Reporter.object_list | def object_list(generation)
rvalue_size = GC::INTERNAL_CONSTANTS[:RVALUE_SIZE]
helper = Helpers.new
result = StatHash.new.compare_by_identity
ObjectSpace.each_object do |obj|
next unless ObjectSpace.allocation_generation(obj) == generation
file = ObjectSpace.allocation_sourcefile(obj) || "(no name)"
next if @ignore_files && @ignore_files =~ file
next if @allow_files && !(@allow_files =~ file)
klass = obj.class rescue nil
unless Class === klass
# attempt to determine the true Class when .class returns something other than a Class
klass = Kernel.instance_method(:class).bind(obj).call
end
next if @trace && !trace.include?(klass)
begin
line = ObjectSpace.allocation_sourceline(obj)
location = helper.lookup_location(file, line)
class_name = helper.lookup_class_name(klass)
gem = helper.guess_gem(file)
# we do memsize first to avoid freezing as a side effect and shifting
# storage to the new frozen string, this happens on @hash[s] in lookup_string
memsize = ObjectSpace.memsize_of(obj)
string = klass == String ? helper.lookup_string(obj) : nil
# compensate for API bug
memsize = rvalue_size if memsize > 100_000_000_000
result[obj.__id__] = MemoryProfiler::Stat.new(class_name, gem, file, location, memsize, string)
rescue
# give up if any any error occurs inspecting the object
end
end
result
end | ruby | def object_list(generation)
rvalue_size = GC::INTERNAL_CONSTANTS[:RVALUE_SIZE]
helper = Helpers.new
result = StatHash.new.compare_by_identity
ObjectSpace.each_object do |obj|
next unless ObjectSpace.allocation_generation(obj) == generation
file = ObjectSpace.allocation_sourcefile(obj) || "(no name)"
next if @ignore_files && @ignore_files =~ file
next if @allow_files && !(@allow_files =~ file)
klass = obj.class rescue nil
unless Class === klass
# attempt to determine the true Class when .class returns something other than a Class
klass = Kernel.instance_method(:class).bind(obj).call
end
next if @trace && !trace.include?(klass)
begin
line = ObjectSpace.allocation_sourceline(obj)
location = helper.lookup_location(file, line)
class_name = helper.lookup_class_name(klass)
gem = helper.guess_gem(file)
# we do memsize first to avoid freezing as a side effect and shifting
# storage to the new frozen string, this happens on @hash[s] in lookup_string
memsize = ObjectSpace.memsize_of(obj)
string = klass == String ? helper.lookup_string(obj) : nil
# compensate for API bug
memsize = rvalue_size if memsize > 100_000_000_000
result[obj.__id__] = MemoryProfiler::Stat.new(class_name, gem, file, location, memsize, string)
rescue
# give up if any any error occurs inspecting the object
end
end
result
end | [
"def",
"object_list",
"(",
"generation",
")",
"rvalue_size",
"=",
"GC",
"::",
"INTERNAL_CONSTANTS",
"[",
":RVALUE_SIZE",
"]",
"helper",
"=",
"Helpers",
".",
"new",
"result",
"=",
"StatHash",
".",
"new",
".",
"compare_by_identity",
"ObjectSpace",
".",
"each_objec... | Iterates through objects in memory of a given generation.
Stores results along with meta data of objects collected. | [
"Iterates",
"through",
"objects",
"in",
"memory",
"of",
"a",
"given",
"generation",
".",
"Stores",
"results",
"along",
"with",
"meta",
"data",
"of",
"objects",
"collected",
"."
] | bd87ff68559623d12c827800ee795475db4d5b8b | https://github.com/SamSaffron/memory_profiler/blob/bd87ff68559623d12c827800ee795475db4d5b8b/lib/memory_profiler/reporter.rb#L88-L129 | train | Returns a hash of all the objects in the given generation. | [
30522,
13366,
4874,
1035,
2862,
1006,
4245,
1007,
27634,
2389,
5657,
1035,
2946,
1027,
1043,
2278,
1024,
1024,
4722,
1035,
5377,
2015,
1031,
1024,
27634,
2389,
5657,
1035,
2946,
1033,
2393,
2121,
1027,
2393,
2545,
1012,
2047,
2765,
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/2018-07-01/generated/azure_mgmt_network/express_route_cross_connection_peerings.rb | Azure::Network::Mgmt::V2018_07_01.ExpressRouteCrossConnectionPeerings.begin_create_or_update_with_http_info | def begin_create_or_update_with_http_info(resource_group_name, cross_connection_name, peering_name, peering_parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, cross_connection_name, peering_name, peering_parameters, custom_headers:custom_headers).value!
end | ruby | def begin_create_or_update_with_http_info(resource_group_name, cross_connection_name, peering_name, peering_parameters, custom_headers:nil)
begin_create_or_update_async(resource_group_name, cross_connection_name, peering_name, peering_parameters, custom_headers:custom_headers).value!
end | [
"def",
"begin_create_or_update_with_http_info",
"(",
"resource_group_name",
",",
"cross_connection_name",
",",
"peering_name",
",",
"peering_parameters",
",",
"custom_headers",
":",
"nil",
")",
"begin_create_or_update_async",
"(",
"resource_group_name",
",",
"cross_connection_n... | Creates or updates a peering in the specified ExpressRouteCrossConnection.
@param resource_group_name [String] The name of the resource group.
@param cross_connection_name [String] The name of the
ExpressRouteCrossConnection.
@param peering_name [String] The name of the peering.
@param peering_parameters [ExpressRouteCrossConnectionPeering] Parameters
supplied to the create or update ExpressRouteCrossConnection 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",
"ExpressRouteCrossConnection",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-07-01/generated/azure_mgmt_network/express_route_cross_connection_peerings.rb#L435-L437 | train | Creates or updates a peering in the specified ExpressRouteCrossConnection. | [
30522,
13366,
4088,
1035,
3443,
1035,
2030,
1035,
10651,
1035,
2007,
1035,
8299,
1035,
18558,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
2892,
1035,
4434,
1035,
2171,
1010,
16740,
1035,
2171,
1010,
16740,
1035,
11709,
1010,
7661,
1035,
20346... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jeremytregunna/ruby-trello | lib/trello/checklist.rb | Trello.Checklist.save | def save
return update! if id
from_response(client.post("/checklists", {
name: name,
idCard: card_id
}))
end | ruby | def save
return update! if id
from_response(client.post("/checklists", {
name: name,
idCard: card_id
}))
end | [
"def",
"save",
"return",
"update!",
"if",
"id",
"from_response",
"(",
"client",
".",
"post",
"(",
"\"/checklists\"",
",",
"{",
"name",
":",
"name",
",",
"idCard",
":",
"card_id",
"}",
")",
")",
"end"
] | Save a record. | [
"Save",
"a",
"record",
"."
] | ad79c9d8152ad5395b3b61c43170908f1912bfb2 | https://github.com/jeremytregunna/ruby-trello/blob/ad79c9d8152ad5395b3b61c43170908f1912bfb2/lib/trello/checklist.rb#L68-L75 | train | Save the checklist object | [
30522,
13366,
3828,
2709,
10651,
999,
2065,
8909,
2013,
1035,
3433,
1006,
7396,
1012,
2695,
1006,
1000,
1013,
4638,
27103,
1000,
1010,
1063,
2171,
1024,
2171,
1010,
8909,
11522,
1024,
4003,
1035,
8909,
1065,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
aws/aws-sdk-ruby | gems/aws-sdk-iam/lib/aws-sdk-iam/resource.rb | Aws::IAM.Resource.roles | def roles(options = {})
batches = Enumerator.new do |y|
resp = @client.list_roles(options)
resp.each_page do |page|
batch = []
page.data.roles.each do |r|
batch << Role.new(
name: r.role_name,
data: r,
client: @client
)
end
y.yield(batch)
end
end
Role::Collection.new(batches)
end | ruby | def roles(options = {})
batches = Enumerator.new do |y|
resp = @client.list_roles(options)
resp.each_page do |page|
batch = []
page.data.roles.each do |r|
batch << Role.new(
name: r.role_name,
data: r,
client: @client
)
end
y.yield(batch)
end
end
Role::Collection.new(batches)
end | [
"def",
"roles",
"(",
"options",
"=",
"{",
"}",
")",
"batches",
"=",
"Enumerator",
".",
"new",
"do",
"|",
"y",
"|",
"resp",
"=",
"@client",
".",
"list_roles",
"(",
"options",
")",
"resp",
".",
"each_page",
"do",
"|",
"page",
"|",
"batch",
"=",
"[",
... | @example Request syntax with placeholder values
roles = iam.roles({
path_prefix: "pathPrefixType",
})
@param [Hash] options ({})
@option options [String] :path_prefix
The path prefix for filtering the results. For example, the prefix
`/application_abc/component_xyz/` gets all roles whose path starts
with `/application_abc/component_xyz/`.
This parameter is optional. If it is not included, it defaults to a
slash (/), listing all roles. This parameter allows (through its
[regex pattern][1]) a string of characters consisting of either a
forward slash (/) by itself or a string that must begin and end with
forward slashes. In addition, it can contain any ASCII character from
the ! (\\u0021) through the DEL character (\\u007F), including most
punctuation characters, digits, and upper and lowercased letters.
[1]: http://wikipedia.org/wiki/regex
@return [Role::Collection] | [
"@example",
"Request",
"syntax",
"with",
"placeholder",
"values"
] | e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d | https://github.com/aws/aws-sdk-ruby/blob/e28b8d320ddf7b6ee0161bdd9d00fb786d99b63d/gems/aws-sdk-iam/lib/aws-sdk-iam/resource.rb#L999-L1015 | train | Get a list of all the roles in the cluster | [
30522,
13366,
4395,
1006,
7047,
1027,
1063,
1065,
1007,
14108,
2229,
1027,
4372,
17897,
16259,
1012,
2047,
2079,
1064,
1061,
1064,
24501,
2361,
1027,
1030,
7396,
1012,
2862,
1035,
4395,
1006,
7047,
1007,
24501,
2361,
1012,
2169,
1035,
3931,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/2016-06-27-preview/generated/azure_mgmt_container_registry/registries.rb | Azure::ContainerRegistry::Mgmt::V2016_06_27_preview.Registries.get_credentials | def get_credentials(resource_group_name, registry_name, custom_headers:nil)
response = get_credentials_async(resource_group_name, registry_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_credentials(resource_group_name, registry_name, custom_headers:nil)
response = get_credentials_async(resource_group_name, registry_name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_credentials",
"(",
"resource_group_name",
",",
"registry_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_credentials_async",
"(",
"resource_group_name",
",",
"registry_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
... | Gets the administrator login credentials for the specified container
registry.
@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 custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return [RegistryCredentials] operation results. | [
"Gets",
"the",
"administrator",
"login",
"credentials",
"for",
"the",
"specified",
"container",
"registry",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_container_registry/lib/2016-06-27-preview/generated/azure_mgmt_container_registry/registries.rb#L718-L721 | train | Gets the credentials for the specified container registry. | [
30522,
13366,
2131,
1035,
22496,
1006,
7692,
1035,
2177,
1035,
2171,
1010,
15584,
1035,
2171,
1010,
7661,
1035,
20346,
2015,
1024,
9152,
2140,
1007,
3433,
1027,
2131,
1035,
22496,
1035,
2004,
6038,
2278,
1006,
7692,
1035,
2177,
1035,
2171,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
etewiah/property_web_builder | app/models/pwb/website.rb | Pwb.Website.style_settings_from_preset= | def style_settings_from_preset=(preset_style_name)
preset_style = Pwb::PresetStyle.where(name: preset_style_name).first
if preset_style
style_variables_for_theme["vic"] = preset_style.attributes.as_json
end
end | ruby | def style_settings_from_preset=(preset_style_name)
preset_style = Pwb::PresetStyle.where(name: preset_style_name).first
if preset_style
style_variables_for_theme["vic"] = preset_style.attributes.as_json
end
end | [
"def",
"style_settings_from_preset",
"=",
"(",
"preset_style_name",
")",
"preset_style",
"=",
"Pwb",
"::",
"PresetStyle",
".",
"where",
"(",
"name",
":",
"preset_style_name",
")",
".",
"first",
"if",
"preset_style",
"style_variables_for_theme",
"[",
"\"vic\"",
"]",
... | allow setting of styles to a preset config from admin UI | [
"allow",
"setting",
"of",
"styles",
"to",
"a",
"preset",
"config",
"from",
"admin",
"UI"
] | fba4e6d4ffa7bc1f4d3b50dfa5a6a9fbfee23f21 | https://github.com/etewiah/property_web_builder/blob/fba4e6d4ffa7bc1f4d3b50dfa5a6a9fbfee23f21/app/models/pwb/website.rb#L172-L177 | train | Get the style settings from a preset style | [
30522,
13366,
2806,
1035,
10906,
1035,
2013,
1035,
3653,
13462,
1027,
1006,
3653,
13462,
1035,
2806,
1035,
2171,
1007,
3653,
13462,
1035,
2806,
1027,
1052,
2860,
2497,
1024,
1024,
3653,
13462,
21756,
2571,
1012,
2073,
1006,
2171,
1024,
3653... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.