id int32 0 24.9k | repo stringlengths 5 58 | path stringlengths 9 168 | func_name stringlengths 9 130 | original_string stringlengths 66 10.5k | language stringclasses 1
value | code stringlengths 66 10.5k | code_tokens list | docstring stringlengths 8 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 94 266 |
|---|---|---|---|---|---|---|---|---|---|---|---|
13,200 | mongodb/mongo-ruby-driver | lib/mongo/collection.rb | Mongo.Collection.update_one | def update_one(filter, update, options = {})
find(filter, options).update_one(update, options)
end | ruby | def update_one(filter, update, options = {})
find(filter, options).update_one(update, options)
end | [
"def",
"update_one",
"(",
"filter",
",",
"update",
",",
"options",
"=",
"{",
"}",
")",
"find",
"(",
"filter",
",",
"options",
")",
".",
"update_one",
"(",
"update",
",",
"options",
")",
"end"
] | Update a single document in the collection.
@example Update a single document in the collection.
collection.update_one({ name: 'test'}, '$set' => { name: 'test1'})
@param [ Hash ] filter The filter to use.
@param [ Hash ] update The update statement.
@param [ Hash ] options The options.
@option options [ tru... | [
"Update",
"a",
"single",
"document",
"in",
"the",
"collection",
"."
] | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/collection.rb#L663-L665 |
13,201 | mongodb/mongo-ruby-driver | lib/mongo/collection.rb | Mongo.Collection.find_one_and_update | def find_one_and_update(filter, update, options = {})
find(filter, options).find_one_and_update(update, options)
end | ruby | def find_one_and_update(filter, update, options = {})
find(filter, options).find_one_and_update(update, options)
end | [
"def",
"find_one_and_update",
"(",
"filter",
",",
"update",
",",
"options",
"=",
"{",
"}",
")",
"find",
"(",
"filter",
",",
"options",
")",
".",
"find_one_and_update",
"(",
"update",
",",
"options",
")",
"end"
] | Finds a single document via findAndModify and updates it, returning the original doc unless
otherwise specified.
@example Find a document and update it, returning the original.
collection.find_one_and_update({ name: 'test' }, { "$set" => { name: 'test1' }})
@example Find a document and update it, returning the ... | [
"Finds",
"a",
"single",
"document",
"via",
"findAndModify",
"and",
"updates",
"it",
"returning",
"the",
"original",
"doc",
"unless",
"otherwise",
"specified",
"."
] | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/collection.rb#L725-L727 |
13,202 | mongodb/mongo-ruby-driver | lib/mongo/collection.rb | Mongo.Collection.find_one_and_replace | def find_one_and_replace(filter, replacement, options = {})
find(filter, options).find_one_and_update(replacement, options)
end | ruby | def find_one_and_replace(filter, replacement, options = {})
find(filter, options).find_one_and_update(replacement, options)
end | [
"def",
"find_one_and_replace",
"(",
"filter",
",",
"replacement",
",",
"options",
"=",
"{",
"}",
")",
"find",
"(",
"filter",
",",
"options",
")",
".",
"find_one_and_update",
"(",
"replacement",
",",
"options",
")",
"end"
] | Finds a single document and replaces it, returning the original doc unless
otherwise specified.
@example Find a document and replace it, returning the original.
collection.find_one_and_replace({ name: 'test' }, { name: 'test1' })
@example Find a document and replace it, returning the new document.
collection... | [
"Finds",
"a",
"single",
"document",
"and",
"replaces",
"it",
"returning",
"the",
"original",
"doc",
"unless",
"otherwise",
"specified",
"."
] | dca26d0870cb3386fad9ccc1d17228097c1fe1c8 | https://github.com/mongodb/mongo-ruby-driver/blob/dca26d0870cb3386fad9ccc1d17228097c1fe1c8/lib/mongo/collection.rb#L759-L761 |
13,203 | Katello/katello | app/controllers/katello/application_controller.rb | Katello.ApplicationController.render_bad_parameters | def render_bad_parameters(*args)
default_message = if request.xhr?
_('Invalid parameters sent in the request for this operation. Please contact a system administrator.')
else
_('Invalid parameters sent. You may have mistyped the address. ... | ruby | def render_bad_parameters(*args)
default_message = if request.xhr?
_('Invalid parameters sent in the request for this operation. Please contact a system administrator.')
else
_('Invalid parameters sent. You may have mistyped the address. ... | [
"def",
"render_bad_parameters",
"(",
"*",
"args",
")",
"default_message",
"=",
"if",
"request",
".",
"xhr?",
"_",
"(",
"'Invalid parameters sent in the request for this operation. Please contact a system administrator.'",
")",
"else",
"_",
"(",
"'Invalid parameters sent. You ma... | render bad params to user
@overload render_bad_parameters()
render bad_parameters with `default_message` and status `400`
@overload render_bad_parameters(message)
render bad_parameters with `message` and status `400`
@param [String] message
@overload render_bad_parameters(error)
render bad_parameters wit... | [
"render",
"bad",
"params",
"to",
"user"
] | a1c9280067607999cae43bab89b53ba870856b76 | https://github.com/Katello/katello/blob/a1c9280067607999cae43bab89b53ba870856b76/app/controllers/katello/application_controller.rb#L100-L132 |
13,204 | Katello/katello | app/controllers/katello/api/v2/sync_controller.rb | Katello.Api::V2::SyncController.find_object | def find_object
if params.key?(:product_id)
@obj = find_product
elsif params.key?(:repository_id)
@obj = find_repository
else
fail HttpErrors::NotFound, N_("Couldn't find subject of synchronization") if @obj.nil?
end
@obj
end | ruby | def find_object
if params.key?(:product_id)
@obj = find_product
elsif params.key?(:repository_id)
@obj = find_repository
else
fail HttpErrors::NotFound, N_("Couldn't find subject of synchronization") if @obj.nil?
end
@obj
end | [
"def",
"find_object",
"if",
"params",
".",
"key?",
"(",
":product_id",
")",
"@obj",
"=",
"find_product",
"elsif",
"params",
".",
"key?",
"(",
":repository_id",
")",
"@obj",
"=",
"find_repository",
"else",
"fail",
"HttpErrors",
"::",
"NotFound",
",",
"N_",
"(... | used in unit tests | [
"used",
"in",
"unit",
"tests"
] | a1c9280067607999cae43bab89b53ba870856b76 | https://github.com/Katello/katello/blob/a1c9280067607999cae43bab89b53ba870856b76/app/controllers/katello/api/v2/sync_controller.rb#L16-L25 |
13,205 | Katello/katello | app/models/katello/kt_environment.rb | Katello.KTEnvironment.insert_successor | def insert_successor(create_params, path)
self.class.transaction do
new_successor = self.class.create!(create_params)
if library?
if path
old_successor = path.first
old_successor.prior = new_successor
end
save_successor new_successor
el... | ruby | def insert_successor(create_params, path)
self.class.transaction do
new_successor = self.class.create!(create_params)
if library?
if path
old_successor = path.first
old_successor.prior = new_successor
end
save_successor new_successor
el... | [
"def",
"insert_successor",
"(",
"create_params",
",",
"path",
")",
"self",
".",
"class",
".",
"transaction",
"do",
"new_successor",
"=",
"self",
".",
"class",
".",
"create!",
"(",
"create_params",
")",
"if",
"library?",
"if",
"path",
"old_successor",
"=",
"p... | creates new env from create_params with self as a prior | [
"creates",
"new",
"env",
"from",
"create_params",
"with",
"self",
"as",
"a",
"prior"
] | a1c9280067607999cae43bab89b53ba870856b76 | https://github.com/Katello/katello/blob/a1c9280067607999cae43bab89b53ba870856b76/app/models/katello/kt_environment.rb#L104-L123 |
13,206 | Katello/katello | app/models/katello/kt_environment.rb | Katello.KTEnvironment.full_path | def full_path
p = self
until p.prior.nil? || p.prior.library
p = p.prior
end
p.prior.nil? ? p.path : [p.prior] + p.path
end | ruby | def full_path
p = self
until p.prior.nil? || p.prior.library
p = p.prior
end
p.prior.nil? ? p.path : [p.prior] + p.path
end | [
"def",
"full_path",
"p",
"=",
"self",
"until",
"p",
".",
"prior",
".",
"nil?",
"||",
"p",
".",
"prior",
".",
"library",
"p",
"=",
"p",
".",
"prior",
"end",
"p",
".",
"prior",
".",
"nil?",
"?",
"p",
".",
"path",
":",
"[",
"p",
".",
"prior",
"]... | Unlike path which only gives the path from this environment going forward
Get the full path, that is go to the HEAD of the path this environment is on
and then give me that entire path | [
"Unlike",
"path",
"which",
"only",
"gives",
"the",
"path",
"from",
"this",
"environment",
"going",
"forward",
"Get",
"the",
"full",
"path",
"that",
"is",
"go",
"to",
"the",
"HEAD",
"of",
"the",
"path",
"this",
"environment",
"is",
"on",
"and",
"then",
"g... | a1c9280067607999cae43bab89b53ba870856b76 | https://github.com/Katello/katello/blob/a1c9280067607999cae43bab89b53ba870856b76/app/models/katello/kt_environment.rb#L196-L202 |
13,207 | Katello/katello | app/helpers/katello/hosts_and_hostgroups_helper.rb | Katello.HostsAndHostgroupsHelper.content_options | def content_options(host, selected_id, object_type, options = {})
include_blank = options.fetch(:include_blank, nil)
include_blank = '<option></option>' if include_blank == true #check for true specifically
orgs = relevant_organizations(host)
all_options = []
orgs.each do |org|
con... | ruby | def content_options(host, selected_id, object_type, options = {})
include_blank = options.fetch(:include_blank, nil)
include_blank = '<option></option>' if include_blank == true #check for true specifically
orgs = relevant_organizations(host)
all_options = []
orgs.each do |org|
con... | [
"def",
"content_options",
"(",
"host",
",",
"selected_id",
",",
"object_type",
",",
"options",
"=",
"{",
"}",
")",
"include_blank",
"=",
"options",
".",
"fetch",
"(",
":include_blank",
",",
"nil",
")",
"include_blank",
"=",
"'<option></option>'",
"if",
"includ... | Generic method to provide a list of options in the UI | [
"Generic",
"method",
"to",
"provide",
"a",
"list",
"of",
"options",
"in",
"the",
"UI"
] | a1c9280067607999cae43bab89b53ba870856b76 | https://github.com/Katello/katello/blob/a1c9280067607999cae43bab89b53ba870856b76/app/helpers/katello/hosts_and_hostgroups_helper.rb#L105-L132 |
13,208 | Katello/katello | app/controllers/katello/sync_management_controller.rb | Katello.SyncManagementController.sync_repos | def sync_repos(repo_ids)
collected = []
repos = Repository.where(:id => repo_ids).syncable
repos.each do |repo|
if latest_task(repo).try(:state) != 'running'
ForemanTasks.async_task(::Actions::Katello::Repository::Sync, repo)
end
collected << format_sync_progress(repo... | ruby | def sync_repos(repo_ids)
collected = []
repos = Repository.where(:id => repo_ids).syncable
repos.each do |repo|
if latest_task(repo).try(:state) != 'running'
ForemanTasks.async_task(::Actions::Katello::Repository::Sync, repo)
end
collected << format_sync_progress(repo... | [
"def",
"sync_repos",
"(",
"repo_ids",
")",
"collected",
"=",
"[",
"]",
"repos",
"=",
"Repository",
".",
"where",
"(",
":id",
"=>",
"repo_ids",
")",
".",
"syncable",
"repos",
".",
"each",
"do",
"|",
"repo",
"|",
"if",
"latest_task",
"(",
"repo",
")",
... | loop through checkbox list of products and sync | [
"loop",
"through",
"checkbox",
"list",
"of",
"products",
"and",
"sync"
] | a1c9280067607999cae43bab89b53ba870856b76 | https://github.com/Katello/katello/blob/a1c9280067607999cae43bab89b53ba870856b76/app/controllers/katello/sync_management_controller.rb#L62-L72 |
13,209 | Katello/katello | app/models/katello/repository.rb | Katello.Repository.dynflow_handled_last_sync? | def dynflow_handled_last_sync?(pulp_task_id)
task = ForemanTasks::Task::DynflowTask.for_action(::Actions::Katello::Repository::Sync).
for_resource(self).order(:started_at).last
return task && task.main_action.pulp_task_id == pulp_task_id
end | ruby | def dynflow_handled_last_sync?(pulp_task_id)
task = ForemanTasks::Task::DynflowTask.for_action(::Actions::Katello::Repository::Sync).
for_resource(self).order(:started_at).last
return task && task.main_action.pulp_task_id == pulp_task_id
end | [
"def",
"dynflow_handled_last_sync?",
"(",
"pulp_task_id",
")",
"task",
"=",
"ForemanTasks",
"::",
"Task",
"::",
"DynflowTask",
".",
"for_action",
"(",
"::",
"Actions",
"::",
"Katello",
"::",
"Repository",
"::",
"Sync",
")",
".",
"for_resource",
"(",
"self",
")... | Returns true if the pulp_task_id was triggered by the last synchronization
action for the repository. Dynflow action handles the synchronization
by it's own so no need to synchronize it again in this callback. Since the
callbacks are run just after synchronization is finished, it should be enough
to check for the l... | [
"Returns",
"true",
"if",
"the",
"pulp_task_id",
"was",
"triggered",
"by",
"the",
"last",
"synchronization",
"action",
"for",
"the",
"repository",
".",
"Dynflow",
"action",
"handles",
"the",
"synchronization",
"by",
"it",
"s",
"own",
"so",
"no",
"need",
"to",
... | a1c9280067607999cae43bab89b53ba870856b76 | https://github.com/Katello/katello/blob/a1c9280067607999cae43bab89b53ba870856b76/app/models/katello/repository.rb#L342-L346 |
13,210 | Katello/katello | app/models/katello/repository.rb | Katello.Repository.destroyable? | def destroyable?
if self.environment.try(:library?) && self.content_view.default?
if self.environment.organization.being_deleted?
return true
elsif self.custom? && self.deletable?
return true
elsif !self.custom? && self.redhat_deletable?
return true
el... | ruby | def destroyable?
if self.environment.try(:library?) && self.content_view.default?
if self.environment.organization.being_deleted?
return true
elsif self.custom? && self.deletable?
return true
elsif !self.custom? && self.redhat_deletable?
return true
el... | [
"def",
"destroyable?",
"if",
"self",
".",
"environment",
".",
"try",
"(",
":library?",
")",
"&&",
"self",
".",
"content_view",
".",
"default?",
"if",
"self",
".",
"environment",
".",
"organization",
".",
"being_deleted?",
"return",
"true",
"elsif",
"self",
"... | deleteable? is already taken by the authorization mixin | [
"deleteable?",
"is",
"already",
"taken",
"by",
"the",
"authorization",
"mixin"
] | a1c9280067607999cae43bab89b53ba870856b76 | https://github.com/Katello/katello/blob/a1c9280067607999cae43bab89b53ba870856b76/app/models/katello/repository.rb#L575-L591 |
13,211 | Katello/katello | app/models/katello/content_view.rb | Katello.ContentView.component_ids= | def component_ids=(component_version_ids_to_set)
content_view_components.destroy_all
component_version_ids_to_set.each do |content_view_version_id|
cvv = ContentViewVersion.find(content_view_version_id)
content_view_components.build(:content_view_version => cvv,
... | ruby | def component_ids=(component_version_ids_to_set)
content_view_components.destroy_all
component_version_ids_to_set.each do |content_view_version_id|
cvv = ContentViewVersion.find(content_view_version_id)
content_view_components.build(:content_view_version => cvv,
... | [
"def",
"component_ids",
"=",
"(",
"component_version_ids_to_set",
")",
"content_view_components",
".",
"destroy_all",
"component_version_ids_to_set",
".",
"each",
"do",
"|",
"content_view_version_id",
"|",
"cvv",
"=",
"ContentViewVersion",
".",
"find",
"(",
"content_view_... | Warning this call wipes out existing associations
And replaces them with the component version ids passed in. | [
"Warning",
"this",
"call",
"wipes",
"out",
"existing",
"associations",
"And",
"replaces",
"them",
"with",
"the",
"component",
"version",
"ids",
"passed",
"in",
"."
] | a1c9280067607999cae43bab89b53ba870856b76 | https://github.com/Katello/katello/blob/a1c9280067607999cae43bab89b53ba870856b76/app/models/katello/content_view.rb#L119-L127 |
13,212 | Katello/katello | app/models/katello/content_view.rb | Katello.ContentView.all_version_library_instances | def all_version_library_instances
all_repos = all_version_repos.where(:library_instance_id => nil).pluck("#{Katello::Repository.table_name}.id")
all_repos += all_version_repos.pluck(:library_instance_id)
Repository.where(:id => all_repos)
end | ruby | def all_version_library_instances
all_repos = all_version_repos.where(:library_instance_id => nil).pluck("#{Katello::Repository.table_name}.id")
all_repos += all_version_repos.pluck(:library_instance_id)
Repository.where(:id => all_repos)
end | [
"def",
"all_version_library_instances",
"all_repos",
"=",
"all_version_repos",
".",
"where",
"(",
":library_instance_id",
"=>",
"nil",
")",
".",
"pluck",
"(",
"\"#{Katello::Repository.table_name}.id\"",
")",
"all_repos",
"+=",
"all_version_repos",
".",
"pluck",
"(",
":l... | get the library instances of all repos within this view | [
"get",
"the",
"library",
"instances",
"of",
"all",
"repos",
"within",
"this",
"view"
] | a1c9280067607999cae43bab89b53ba870856b76 | https://github.com/Katello/katello/blob/a1c9280067607999cae43bab89b53ba870856b76/app/models/katello/content_view.rb#L367-L371 |
13,213 | Katello/katello | app/models/katello/content_view.rb | Katello.ContentView.add_environment | def add_environment(env, version)
if self.content_view_environments.where(:environment_id => env.id).empty?
label = generate_cp_environment_label(env)
ContentViewEnvironment.create!(:name => label,
:label => label,
:cp_i... | ruby | def add_environment(env, version)
if self.content_view_environments.where(:environment_id => env.id).empty?
label = generate_cp_environment_label(env)
ContentViewEnvironment.create!(:name => label,
:label => label,
:cp_i... | [
"def",
"add_environment",
"(",
"env",
",",
"version",
")",
"if",
"self",
".",
"content_view_environments",
".",
"where",
"(",
":environment_id",
"=>",
"env",
".",
"id",
")",
".",
"empty?",
"label",
"=",
"generate_cp_environment_label",
"(",
"env",
")",
"Conten... | Associate an environment with this content view. This can occur whenever
a version of the view is promoted to an environment. It is necessary for
candlepin to become aware that the view is available for consumers. | [
"Associate",
"an",
"environment",
"with",
"this",
"content",
"view",
".",
"This",
"can",
"occur",
"whenever",
"a",
"version",
"of",
"the",
"view",
"is",
"promoted",
"to",
"an",
"environment",
".",
"It",
"is",
"necessary",
"for",
"candlepin",
"to",
"become",
... | a1c9280067607999cae43bab89b53ba870856b76 | https://github.com/Katello/katello/blob/a1c9280067607999cae43bab89b53ba870856b76/app/models/katello/content_view.rb#L463-L474 |
13,214 | Katello/katello | app/models/katello/content_view.rb | Katello.ContentView.remove_environment | def remove_environment(env)
# Do not remove the content view environment, if there is still a view
# version in the environment.
if self.versions.in_environment(env).blank?
view_env = self.content_view_environments.where(:environment_id => env.id)
view_env.first.destroy unless view_env... | ruby | def remove_environment(env)
# Do not remove the content view environment, if there is still a view
# version in the environment.
if self.versions.in_environment(env).blank?
view_env = self.content_view_environments.where(:environment_id => env.id)
view_env.first.destroy unless view_env... | [
"def",
"remove_environment",
"(",
"env",
")",
"# Do not remove the content view environment, if there is still a view",
"# version in the environment.",
"if",
"self",
".",
"versions",
".",
"in_environment",
"(",
"env",
")",
".",
"blank?",
"view_env",
"=",
"self",
".",
"co... | Unassociate an environment from this content view. This can occur whenever
a view is deleted from an environment. It is necessary to make candlepin
aware that the view is no longer available for consumers. | [
"Unassociate",
"an",
"environment",
"from",
"this",
"content",
"view",
".",
"This",
"can",
"occur",
"whenever",
"a",
"view",
"is",
"deleted",
"from",
"an",
"environment",
".",
"It",
"is",
"necessary",
"to",
"make",
"candlepin",
"aware",
"that",
"the",
"view"... | a1c9280067607999cae43bab89b53ba870856b76 | https://github.com/Katello/katello/blob/a1c9280067607999cae43bab89b53ba870856b76/app/models/katello/content_view.rb#L479-L486 |
13,215 | Katello/katello | app/models/katello/pulp_sync_status.rb | Katello.PulpSyncProgress.format_errors | def format_errors(details)
errors = {messages: [], details: []}
if details && !details.key?(:finished_count)
details.each do |step, report|
if step == "content"
parse_content(report, errors)
else
parse_generic(report, errors)
end
end
... | ruby | def format_errors(details)
errors = {messages: [], details: []}
if details && !details.key?(:finished_count)
details.each do |step, report|
if step == "content"
parse_content(report, errors)
else
parse_generic(report, errors)
end
end
... | [
"def",
"format_errors",
"(",
"details",
")",
"errors",
"=",
"{",
"messages",
":",
"[",
"]",
",",
"details",
":",
"[",
"]",
"}",
"if",
"details",
"&&",
"!",
"details",
".",
"key?",
"(",
":finished_count",
")",
"details",
".",
"each",
"do",
"|",
"step"... | Possible formats coming from pulp
We ignore this case:
{'finished_count' => {}}
We extract from this case:
{'content' => {'error' => ''},
'errata' => {'error' => ''},
'packages' => {'error' => ''},
'metadata' => {'error_details => ''}
} | [
"Possible",
"formats",
"coming",
"from",
"pulp"
] | a1c9280067607999cae43bab89b53ba870856b76 | https://github.com/Katello/katello/blob/a1c9280067607999cae43bab89b53ba870856b76/app/models/katello/pulp_sync_status.rb#L68-L82 |
13,216 | 3scale/3scale_toolbox | lib/3scale_toolbox/configuration.rb | ThreeScaleToolbox.Configuration.read | def read
@store.transaction(true) do
@store.roots.each_with_object({}) do |key, obj|
obj[key] = @store[key]
end
end
end | ruby | def read
@store.transaction(true) do
@store.roots.each_with_object({}) do |key, obj|
obj[key] = @store[key]
end
end
end | [
"def",
"read",
"@store",
".",
"transaction",
"(",
"true",
")",
"do",
"@store",
".",
"roots",
".",
"each_with_object",
"(",
"{",
"}",
")",
"do",
"|",
"key",
",",
"obj",
"|",
"obj",
"[",
"key",
"]",
"=",
"@store",
"[",
"key",
"]",
"end",
"end",
"en... | returns copy of data stored | [
"returns",
"copy",
"of",
"data",
"stored"
] | aeb19add0ae2348788b0b21f641bf88bf7003ea3 | https://github.com/3scale/3scale_toolbox/blob/aeb19add0ae2348788b0b21f641bf88bf7003ea3/lib/3scale_toolbox/configuration.rb#L27-L33 |
13,217 | 3scale/3scale_toolbox | lib/3scale_toolbox/remotes.rb | ThreeScaleToolbox.Remotes.update | def update
config.update(:remotes) do |rmts|
yield(rmts || {}).tap do |new_rmts|
raise_invalid unless validate(new_rmts)
end
end
end | ruby | def update
config.update(:remotes) do |rmts|
yield(rmts || {}).tap do |new_rmts|
raise_invalid unless validate(new_rmts)
end
end
end | [
"def",
"update",
"config",
".",
"update",
"(",
":remotes",
")",
"do",
"|",
"rmts",
"|",
"yield",
"(",
"rmts",
"||",
"{",
"}",
")",
".",
"tap",
"do",
"|",
"new_rmts",
"|",
"raise_invalid",
"unless",
"validate",
"(",
"new_rmts",
")",
"end",
"end",
"end... | Update remotes
Perform validation | [
"Update",
"remotes",
"Perform",
"validation"
] | aeb19add0ae2348788b0b21f641bf88bf7003ea3 | https://github.com/3scale/3scale_toolbox/blob/aeb19add0ae2348788b0b21f641bf88bf7003ea3/lib/3scale_toolbox/remotes.rb#L66-L72 |
13,218 | appsignal/rdkafka-ruby | lib/rdkafka/consumer.rb | Rdkafka.Consumer.subscribe | def subscribe(*topics)
# Create topic partition list with topics and no partition set
tpl = TopicPartitionList.new_native_tpl(topics.length)
topics.each do |topic|
Rdkafka::Bindings.rd_kafka_topic_partition_list_add(
tpl,
topic,
-1
)
end
# Sub... | ruby | def subscribe(*topics)
# Create topic partition list with topics and no partition set
tpl = TopicPartitionList.new_native_tpl(topics.length)
topics.each do |topic|
Rdkafka::Bindings.rd_kafka_topic_partition_list_add(
tpl,
topic,
-1
)
end
# Sub... | [
"def",
"subscribe",
"(",
"*",
"topics",
")",
"# Create topic partition list with topics and no partition set",
"tpl",
"=",
"TopicPartitionList",
".",
"new_native_tpl",
"(",
"topics",
".",
"length",
")",
"topics",
".",
"each",
"do",
"|",
"topic",
"|",
"Rdkafka",
"::"... | Subscribe to one or more topics letting Kafka handle partition assignments.
@param topics [Array<String>] One or more topic names
@raise [RdkafkaError] When subscribing fails
@return [nil] | [
"Subscribe",
"to",
"one",
"or",
"more",
"topics",
"letting",
"Kafka",
"handle",
"partition",
"assignments",
"."
] | 87b3e0ddae5ea576847cb67228fcea06ec2a24d6 | https://github.com/appsignal/rdkafka-ruby/blob/87b3e0ddae5ea576847cb67228fcea06ec2a24d6/lib/rdkafka/consumer.rb#L31-L47 |
13,219 | appsignal/rdkafka-ruby | lib/rdkafka/consumer.rb | Rdkafka.Consumer.unsubscribe | def unsubscribe
response = Rdkafka::Bindings.rd_kafka_unsubscribe(@native_kafka)
if response != 0
raise Rdkafka::RdkafkaError.new(response)
end
end | ruby | def unsubscribe
response = Rdkafka::Bindings.rd_kafka_unsubscribe(@native_kafka)
if response != 0
raise Rdkafka::RdkafkaError.new(response)
end
end | [
"def",
"unsubscribe",
"response",
"=",
"Rdkafka",
"::",
"Bindings",
".",
"rd_kafka_unsubscribe",
"(",
"@native_kafka",
")",
"if",
"response",
"!=",
"0",
"raise",
"Rdkafka",
"::",
"RdkafkaError",
".",
"new",
"(",
"response",
")",
"end",
"end"
] | Unsubscribe from all subscribed topics.
@raise [RdkafkaError] When unsubscribing fails
@return [nil] | [
"Unsubscribe",
"from",
"all",
"subscribed",
"topics",
"."
] | 87b3e0ddae5ea576847cb67228fcea06ec2a24d6 | https://github.com/appsignal/rdkafka-ruby/blob/87b3e0ddae5ea576847cb67228fcea06ec2a24d6/lib/rdkafka/consumer.rb#L54-L59 |
13,220 | appsignal/rdkafka-ruby | lib/rdkafka/consumer.rb | Rdkafka.Consumer.pause | def pause(list)
unless list.is_a?(TopicPartitionList)
raise TypeError.new("list has to be a TopicPartitionList")
end
tpl = list.to_native_tpl
response = Rdkafka::Bindings.rd_kafka_pause_partitions(@native_kafka, tpl)
if response != 0
list = TopicPartitionList.from_native_t... | ruby | def pause(list)
unless list.is_a?(TopicPartitionList)
raise TypeError.new("list has to be a TopicPartitionList")
end
tpl = list.to_native_tpl
response = Rdkafka::Bindings.rd_kafka_pause_partitions(@native_kafka, tpl)
if response != 0
list = TopicPartitionList.from_native_t... | [
"def",
"pause",
"(",
"list",
")",
"unless",
"list",
".",
"is_a?",
"(",
"TopicPartitionList",
")",
"raise",
"TypeError",
".",
"new",
"(",
"\"list has to be a TopicPartitionList\"",
")",
"end",
"tpl",
"=",
"list",
".",
"to_native_tpl",
"response",
"=",
"Rdkafka",
... | Pause producing or consumption for the provided list of partitions
@param list [TopicPartitionList] The topic with partitions to pause
@raise [RdkafkaTopicPartitionListError] When pausing subscription fails.
@return [nil] | [
"Pause",
"producing",
"or",
"consumption",
"for",
"the",
"provided",
"list",
"of",
"partitions"
] | 87b3e0ddae5ea576847cb67228fcea06ec2a24d6 | https://github.com/appsignal/rdkafka-ruby/blob/87b3e0ddae5ea576847cb67228fcea06ec2a24d6/lib/rdkafka/consumer.rb#L68-L79 |
13,221 | appsignal/rdkafka-ruby | lib/rdkafka/consumer.rb | Rdkafka.Consumer.resume | def resume(list)
unless list.is_a?(TopicPartitionList)
raise TypeError.new("list has to be a TopicPartitionList")
end
tpl = list.to_native_tpl
response = Rdkafka::Bindings.rd_kafka_resume_partitions(@native_kafka, tpl)
if response != 0
raise Rdkafka::RdkafkaError.new(respon... | ruby | def resume(list)
unless list.is_a?(TopicPartitionList)
raise TypeError.new("list has to be a TopicPartitionList")
end
tpl = list.to_native_tpl
response = Rdkafka::Bindings.rd_kafka_resume_partitions(@native_kafka, tpl)
if response != 0
raise Rdkafka::RdkafkaError.new(respon... | [
"def",
"resume",
"(",
"list",
")",
"unless",
"list",
".",
"is_a?",
"(",
"TopicPartitionList",
")",
"raise",
"TypeError",
".",
"new",
"(",
"\"list has to be a TopicPartitionList\"",
")",
"end",
"tpl",
"=",
"list",
".",
"to_native_tpl",
"response",
"=",
"Rdkafka",... | Resume producing consumption for the provided list of partitions
@param list [TopicPartitionList] The topic with partitions to pause
@raise [RdkafkaError] When resume subscription fails.
@return [nil] | [
"Resume",
"producing",
"consumption",
"for",
"the",
"provided",
"list",
"of",
"partitions"
] | 87b3e0ddae5ea576847cb67228fcea06ec2a24d6 | https://github.com/appsignal/rdkafka-ruby/blob/87b3e0ddae5ea576847cb67228fcea06ec2a24d6/lib/rdkafka/consumer.rb#L88-L97 |
13,222 | appsignal/rdkafka-ruby | lib/rdkafka/consumer.rb | Rdkafka.Consumer.subscription | def subscription
tpl = FFI::MemoryPointer.new(:pointer)
response = Rdkafka::Bindings.rd_kafka_subscription(@native_kafka, tpl)
if response != 0
raise Rdkafka::RdkafkaError.new(response)
end
tpl = tpl.read(:pointer).tap { |it| it.autorelease = false }
begin
Rdkafka::C... | ruby | def subscription
tpl = FFI::MemoryPointer.new(:pointer)
response = Rdkafka::Bindings.rd_kafka_subscription(@native_kafka, tpl)
if response != 0
raise Rdkafka::RdkafkaError.new(response)
end
tpl = tpl.read(:pointer).tap { |it| it.autorelease = false }
begin
Rdkafka::C... | [
"def",
"subscription",
"tpl",
"=",
"FFI",
"::",
"MemoryPointer",
".",
"new",
"(",
":pointer",
")",
"response",
"=",
"Rdkafka",
"::",
"Bindings",
".",
"rd_kafka_subscription",
"(",
"@native_kafka",
",",
"tpl",
")",
"if",
"response",
"!=",
"0",
"raise",
"Rdkaf... | Return the current subscription to topics and partitions
@raise [RdkafkaError] When getting the subscription fails.
@return [TopicPartitionList] | [
"Return",
"the",
"current",
"subscription",
"to",
"topics",
"and",
"partitions"
] | 87b3e0ddae5ea576847cb67228fcea06ec2a24d6 | https://github.com/appsignal/rdkafka-ruby/blob/87b3e0ddae5ea576847cb67228fcea06ec2a24d6/lib/rdkafka/consumer.rb#L104-L117 |
13,223 | appsignal/rdkafka-ruby | lib/rdkafka/consumer.rb | Rdkafka.Consumer.assign | def assign(list)
unless list.is_a?(TopicPartitionList)
raise TypeError.new("list has to be a TopicPartitionList")
end
tpl = list.to_native_tpl
response = Rdkafka::Bindings.rd_kafka_assign(@native_kafka, tpl)
if response != 0
raise Rdkafka::RdkafkaError.new(response, "Error ... | ruby | def assign(list)
unless list.is_a?(TopicPartitionList)
raise TypeError.new("list has to be a TopicPartitionList")
end
tpl = list.to_native_tpl
response = Rdkafka::Bindings.rd_kafka_assign(@native_kafka, tpl)
if response != 0
raise Rdkafka::RdkafkaError.new(response, "Error ... | [
"def",
"assign",
"(",
"list",
")",
"unless",
"list",
".",
"is_a?",
"(",
"TopicPartitionList",
")",
"raise",
"TypeError",
".",
"new",
"(",
"\"list has to be a TopicPartitionList\"",
")",
"end",
"tpl",
"=",
"list",
".",
"to_native_tpl",
"response",
"=",
"Rdkafka",... | Atomic assignment of partitions to consume
@param list [TopicPartitionList] The topic with partitions to assign
@raise [RdkafkaError] When assigning fails | [
"Atomic",
"assignment",
"of",
"partitions",
"to",
"consume"
] | 87b3e0ddae5ea576847cb67228fcea06ec2a24d6 | https://github.com/appsignal/rdkafka-ruby/blob/87b3e0ddae5ea576847cb67228fcea06ec2a24d6/lib/rdkafka/consumer.rb#L124-L133 |
13,224 | appsignal/rdkafka-ruby | lib/rdkafka/consumer.rb | Rdkafka.Consumer.committed | def committed(list=nil, timeout_ms=1200)
if list.nil?
list = assignment
elsif !list.is_a?(TopicPartitionList)
raise TypeError.new("list has to be nil or a TopicPartitionList")
end
tpl = list.to_native_tpl
response = Rdkafka::Bindings.rd_kafka_committed(@native_kafka, tpl, t... | ruby | def committed(list=nil, timeout_ms=1200)
if list.nil?
list = assignment
elsif !list.is_a?(TopicPartitionList)
raise TypeError.new("list has to be nil or a TopicPartitionList")
end
tpl = list.to_native_tpl
response = Rdkafka::Bindings.rd_kafka_committed(@native_kafka, tpl, t... | [
"def",
"committed",
"(",
"list",
"=",
"nil",
",",
"timeout_ms",
"=",
"1200",
")",
"if",
"list",
".",
"nil?",
"list",
"=",
"assignment",
"elsif",
"!",
"list",
".",
"is_a?",
"(",
"TopicPartitionList",
")",
"raise",
"TypeError",
".",
"new",
"(",
"\"list has... | Return the current committed offset per partition for this consumer group.
The offset field of each requested partition will either be set to stored offset or to -1001 in case there was no stored offset for that partition.
@param list [TopicPartitionList, nil] The topic with partitions to get the offsets for or nil ... | [
"Return",
"the",
"current",
"committed",
"offset",
"per",
"partition",
"for",
"this",
"consumer",
"group",
".",
"The",
"offset",
"field",
"of",
"each",
"requested",
"partition",
"will",
"either",
"be",
"set",
"to",
"stored",
"offset",
"or",
"to",
"-",
"1001"... | 87b3e0ddae5ea576847cb67228fcea06ec2a24d6 | https://github.com/appsignal/rdkafka-ruby/blob/87b3e0ddae5ea576847cb67228fcea06ec2a24d6/lib/rdkafka/consumer.rb#L165-L177 |
13,225 | appsignal/rdkafka-ruby | lib/rdkafka/consumer.rb | Rdkafka.Consumer.store_offset | def store_offset(message)
# rd_kafka_offset_store is one of the few calls that does not support
# a string as the topic, so create a native topic for it.
native_topic = Rdkafka::Bindings.rd_kafka_topic_new(
@native_kafka,
message.topic,
nil
)
response = Rdkafka::Bin... | ruby | def store_offset(message)
# rd_kafka_offset_store is one of the few calls that does not support
# a string as the topic, so create a native topic for it.
native_topic = Rdkafka::Bindings.rd_kafka_topic_new(
@native_kafka,
message.topic,
nil
)
response = Rdkafka::Bin... | [
"def",
"store_offset",
"(",
"message",
")",
"# rd_kafka_offset_store is one of the few calls that does not support",
"# a string as the topic, so create a native topic for it.",
"native_topic",
"=",
"Rdkafka",
"::",
"Bindings",
".",
"rd_kafka_topic_new",
"(",
"@native_kafka",
",",
... | Store offset of a message to be used in the next commit of this consumer
When using this `enable.auto.offset.store` should be set to `false` in the config.
@param message [Rdkafka::Consumer::Message] The message which offset will be stored
@raise [RdkafkaError] When storing the offset fails
@return [nil] | [
"Store",
"offset",
"of",
"a",
"message",
"to",
"be",
"used",
"in",
"the",
"next",
"commit",
"of",
"this",
"consumer"
] | 87b3e0ddae5ea576847cb67228fcea06ec2a24d6 | https://github.com/appsignal/rdkafka-ruby/blob/87b3e0ddae5ea576847cb67228fcea06ec2a24d6/lib/rdkafka/consumer.rb#L263-L283 |
13,226 | appsignal/rdkafka-ruby | lib/rdkafka/consumer.rb | Rdkafka.Consumer.commit | def commit(list=nil, async=false)
if !list.nil? && !list.is_a?(TopicPartitionList)
raise TypeError.new("list has to be nil or a TopicPartitionList")
end
tpl = if list
list.to_native_tpl
else
nil
end
response = Rdkafka::Bindings.rd_kafka... | ruby | def commit(list=nil, async=false)
if !list.nil? && !list.is_a?(TopicPartitionList)
raise TypeError.new("list has to be nil or a TopicPartitionList")
end
tpl = if list
list.to_native_tpl
else
nil
end
response = Rdkafka::Bindings.rd_kafka... | [
"def",
"commit",
"(",
"list",
"=",
"nil",
",",
"async",
"=",
"false",
")",
"if",
"!",
"list",
".",
"nil?",
"&&",
"!",
"list",
".",
"is_a?",
"(",
"TopicPartitionList",
")",
"raise",
"TypeError",
".",
"new",
"(",
"\"list has to be nil or a TopicPartitionList\"... | Commit the current offsets of this consumer
@param list [TopicPartitionList,nil] The topic with partitions to commit
@param async [Boolean] Whether to commit async or wait for the commit to finish
@raise [RdkafkaError] When comitting fails
@return [nil] | [
"Commit",
"the",
"current",
"offsets",
"of",
"this",
"consumer"
] | 87b3e0ddae5ea576847cb67228fcea06ec2a24d6 | https://github.com/appsignal/rdkafka-ruby/blob/87b3e0ddae5ea576847cb67228fcea06ec2a24d6/lib/rdkafka/consumer.rb#L293-L306 |
13,227 | appsignal/rdkafka-ruby | lib/rdkafka/consumer.rb | Rdkafka.Consumer.poll | def poll(timeout_ms)
message_ptr = Rdkafka::Bindings.rd_kafka_consumer_poll(@native_kafka, timeout_ms)
if message_ptr.null?
nil
else
# Create struct wrapper
native_message = Rdkafka::Bindings::Message.new(message_ptr)
# Raise error if needed
if native_message[:e... | ruby | def poll(timeout_ms)
message_ptr = Rdkafka::Bindings.rd_kafka_consumer_poll(@native_kafka, timeout_ms)
if message_ptr.null?
nil
else
# Create struct wrapper
native_message = Rdkafka::Bindings::Message.new(message_ptr)
# Raise error if needed
if native_message[:e... | [
"def",
"poll",
"(",
"timeout_ms",
")",
"message_ptr",
"=",
"Rdkafka",
"::",
"Bindings",
".",
"rd_kafka_consumer_poll",
"(",
"@native_kafka",
",",
"timeout_ms",
")",
"if",
"message_ptr",
".",
"null?",
"nil",
"else",
"# Create struct wrapper",
"native_message",
"=",
... | Poll for the next message on one of the subscribed topics
@param timeout_ms [Integer] Timeout of this poll
@raise [RdkafkaError] When polling fails
@return [Message, nil] A message or nil if there was no new message within the timeout | [
"Poll",
"for",
"the",
"next",
"message",
"on",
"one",
"of",
"the",
"subscribed",
"topics"
] | 87b3e0ddae5ea576847cb67228fcea06ec2a24d6 | https://github.com/appsignal/rdkafka-ruby/blob/87b3e0ddae5ea576847cb67228fcea06ec2a24d6/lib/rdkafka/consumer.rb#L315-L334 |
13,228 | appsignal/rdkafka-ruby | lib/rdkafka/config.rb | Rdkafka.Config.consumer | def consumer
opaque = Opaque.new
config = native_config(opaque)
if @consumer_rebalance_listener
opaque.consumer_rebalance_listener = @consumer_rebalance_listener
Rdkafka::Bindings.rd_kafka_conf_set_rebalance_cb(config, Rdkafka::Bindings::RebalanceCallback)
end
kafka = nat... | ruby | def consumer
opaque = Opaque.new
config = native_config(opaque)
if @consumer_rebalance_listener
opaque.consumer_rebalance_listener = @consumer_rebalance_listener
Rdkafka::Bindings.rd_kafka_conf_set_rebalance_cb(config, Rdkafka::Bindings::RebalanceCallback)
end
kafka = nat... | [
"def",
"consumer",
"opaque",
"=",
"Opaque",
".",
"new",
"config",
"=",
"native_config",
"(",
"opaque",
")",
"if",
"@consumer_rebalance_listener",
"opaque",
".",
"consumer_rebalance_listener",
"=",
"@consumer_rebalance_listener",
"Rdkafka",
"::",
"Bindings",
".",
"rd_k... | Create a consumer with this configuration.
@raise [ConfigError] When the configuration contains invalid options
@raise [ClientCreationError] When the native client cannot be created
@return [Consumer] The created consumer | [
"Create",
"a",
"consumer",
"with",
"this",
"configuration",
"."
] | 87b3e0ddae5ea576847cb67228fcea06ec2a24d6 | https://github.com/appsignal/rdkafka-ruby/blob/87b3e0ddae5ea576847cb67228fcea06ec2a24d6/lib/rdkafka/config.rb#L110-L126 |
13,229 | appsignal/rdkafka-ruby | lib/rdkafka/config.rb | Rdkafka.Config.producer | def producer
# Create opaque
opaque = Opaque.new
# Create Kafka config
config = native_config(opaque)
# Set callback to receive delivery reports on config
Rdkafka::Bindings.rd_kafka_conf_set_dr_msg_cb(config, Rdkafka::Bindings::DeliveryCallback)
# Return producer with Kafka cli... | ruby | def producer
# Create opaque
opaque = Opaque.new
# Create Kafka config
config = native_config(opaque)
# Set callback to receive delivery reports on config
Rdkafka::Bindings.rd_kafka_conf_set_dr_msg_cb(config, Rdkafka::Bindings::DeliveryCallback)
# Return producer with Kafka cli... | [
"def",
"producer",
"# Create opaque",
"opaque",
"=",
"Opaque",
".",
"new",
"# Create Kafka config",
"config",
"=",
"native_config",
"(",
"opaque",
")",
"# Set callback to receive delivery reports on config",
"Rdkafka",
"::",
"Bindings",
".",
"rd_kafka_conf_set_dr_msg_cb",
"... | Create a producer with this configuration.
@raise [ConfigError] When the configuration contains invalid options
@raise [ClientCreationError] When the native client cannot be created
@return [Producer] The created producer | [
"Create",
"a",
"producer",
"with",
"this",
"configuration",
"."
] | 87b3e0ddae5ea576847cb67228fcea06ec2a24d6 | https://github.com/appsignal/rdkafka-ruby/blob/87b3e0ddae5ea576847cb67228fcea06ec2a24d6/lib/rdkafka/config.rb#L134-L145 |
13,230 | appsignal/rdkafka-ruby | lib/rdkafka/config.rb | Rdkafka.Config.native_config | def native_config(opaque=nil)
Rdkafka::Bindings.rd_kafka_conf_new.tap do |config|
# Create config
@config_hash.merge(REQUIRED_CONFIG).each do |key, value|
error_buffer = FFI::MemoryPointer.from_string(" " * 256)
result = Rdkafka::Bindings.rd_kafka_conf_set(
config,
... | ruby | def native_config(opaque=nil)
Rdkafka::Bindings.rd_kafka_conf_new.tap do |config|
# Create config
@config_hash.merge(REQUIRED_CONFIG).each do |key, value|
error_buffer = FFI::MemoryPointer.from_string(" " * 256)
result = Rdkafka::Bindings.rd_kafka_conf_set(
config,
... | [
"def",
"native_config",
"(",
"opaque",
"=",
"nil",
")",
"Rdkafka",
"::",
"Bindings",
".",
"rd_kafka_conf_new",
".",
"tap",
"do",
"|",
"config",
"|",
"# Create config",
"@config_hash",
".",
"merge",
"(",
"REQUIRED_CONFIG",
")",
".",
"each",
"do",
"|",
"key",
... | This method is only intented to be used to create a client,
using it in another way will leak memory. | [
"This",
"method",
"is",
"only",
"intented",
"to",
"be",
"used",
"to",
"create",
"a",
"client",
"using",
"it",
"in",
"another",
"way",
"will",
"leak",
"memory",
"."
] | 87b3e0ddae5ea576847cb67228fcea06ec2a24d6 | https://github.com/appsignal/rdkafka-ruby/blob/87b3e0ddae5ea576847cb67228fcea06ec2a24d6/lib/rdkafka/config.rb#L160-L194 |
13,231 | puppetlabs/pdk | lib/pdk/util.rb | PDK.Util.find_upwards | def find_upwards(target, start_dir = nil)
previous = nil
current = File.expand_path(start_dir || Dir.pwd)
until !File.directory?(current) || current == previous
filename = File.join(current, target)
return filename if File.file?(filename)
previous = current
current = ... | ruby | def find_upwards(target, start_dir = nil)
previous = nil
current = File.expand_path(start_dir || Dir.pwd)
until !File.directory?(current) || current == previous
filename = File.join(current, target)
return filename if File.file?(filename)
previous = current
current = ... | [
"def",
"find_upwards",
"(",
"target",
",",
"start_dir",
"=",
"nil",
")",
"previous",
"=",
"nil",
"current",
"=",
"File",
".",
"expand_path",
"(",
"start_dir",
"||",
"Dir",
".",
"pwd",
")",
"until",
"!",
"File",
".",
"directory?",
"(",
"current",
")",
"... | Searches upwards from current working directory for the given target file.
@param target [String] Name of file to search for.
@param start_dir [String] Directory to start searching from, defaults to Dir.pwd
@return [String, nil] Fully qualified path to the given target file if found,
nil if the target file coul... | [
"Searches",
"upwards",
"from",
"current",
"working",
"directory",
"for",
"the",
"given",
"target",
"file",
"."
] | 0d864aff62ffef04b5104addf399d0476afd71e7 | https://github.com/puppetlabs/pdk/blob/0d864aff62ffef04b5104addf399d0476afd71e7/lib/pdk/util.rb#L28-L38 |
13,232 | puppetlabs/pdk | lib/pdk/util.rb | PDK.Util.make_tmpdir_name | def make_tmpdir_name(base)
t = Time.now.strftime('%Y%m%d')
name = "#{base}#{t}-#{Process.pid}-#{rand(0x100000000).to_s(36)}"
File.join(Dir.tmpdir, name)
end | ruby | def make_tmpdir_name(base)
t = Time.now.strftime('%Y%m%d')
name = "#{base}#{t}-#{Process.pid}-#{rand(0x100000000).to_s(36)}"
File.join(Dir.tmpdir, name)
end | [
"def",
"make_tmpdir_name",
"(",
"base",
")",
"t",
"=",
"Time",
".",
"now",
".",
"strftime",
"(",
"'%Y%m%d'",
")",
"name",
"=",
"\"#{base}#{t}-#{Process.pid}-#{rand(0x100000000).to_s(36)}\"",
"File",
".",
"join",
"(",
"Dir",
".",
"tmpdir",
",",
"name",
")",
"en... | Generate a name for a temporary directory.
@param base [String] A string to base the name generation off.
@return [String] The temporary directory path. | [
"Generate",
"a",
"name",
"for",
"a",
"temporary",
"directory",
"."
] | 0d864aff62ffef04b5104addf399d0476afd71e7 | https://github.com/puppetlabs/pdk/blob/0d864aff62ffef04b5104addf399d0476afd71e7/lib/pdk/util.rb#L46-L50 |
13,233 | puppetlabs/pdk | lib/pdk/util.rb | PDK.Util.canonical_path | def canonical_path(path)
if Gem.win_platform?
unless File.exist?(path)
raise PDK::CLI::FatalError, _("Cannot resolve a full path to '%{path}', as it does not currently exist.") % { path: path }
end
PDK::Util::Windows::File.get_long_pathname(path)
else
File.expand_pa... | ruby | def canonical_path(path)
if Gem.win_platform?
unless File.exist?(path)
raise PDK::CLI::FatalError, _("Cannot resolve a full path to '%{path}', as it does not currently exist.") % { path: path }
end
PDK::Util::Windows::File.get_long_pathname(path)
else
File.expand_pa... | [
"def",
"canonical_path",
"(",
"path",
")",
"if",
"Gem",
".",
"win_platform?",
"unless",
"File",
".",
"exist?",
"(",
"path",
")",
"raise",
"PDK",
"::",
"CLI",
"::",
"FatalError",
",",
"_",
"(",
"\"Cannot resolve a full path to '%{path}', as it does not currently exis... | Return an expanded, absolute path
@param path [String] Existing path that may not be canonical
@return [String] Canonical path | [
"Return",
"an",
"expanded",
"absolute",
"path"
] | 0d864aff62ffef04b5104addf399d0476afd71e7 | https://github.com/puppetlabs/pdk/blob/0d864aff62ffef04b5104addf399d0476afd71e7/lib/pdk/util.rb#L58-L67 |
13,234 | puppetlabs/pdk | lib/pdk/util.rb | PDK.Util.cachedir | def cachedir
if Gem.win_platform?
File.join(ENV['LOCALAPPDATA'], 'PDK', 'cache')
else
File.join(Dir.home, '.pdk', 'cache')
end
end | ruby | def cachedir
if Gem.win_platform?
File.join(ENV['LOCALAPPDATA'], 'PDK', 'cache')
else
File.join(Dir.home, '.pdk', 'cache')
end
end | [
"def",
"cachedir",
"if",
"Gem",
".",
"win_platform?",
"File",
".",
"join",
"(",
"ENV",
"[",
"'LOCALAPPDATA'",
"]",
",",
"'PDK'",
",",
"'cache'",
")",
"else",
"File",
".",
"join",
"(",
"Dir",
".",
"home",
",",
"'.pdk'",
",",
"'cache'",
")",
"end",
"en... | Returns the fully qualified path to a per-user PDK cachedir.
@return [String] Fully qualified path to per-user PDK cachedir. | [
"Returns",
"the",
"fully",
"qualified",
"path",
"to",
"a",
"per",
"-",
"user",
"PDK",
"cachedir",
"."
] | 0d864aff62ffef04b5104addf399d0476afd71e7 | https://github.com/puppetlabs/pdk/blob/0d864aff62ffef04b5104addf399d0476afd71e7/lib/pdk/util.rb#L100-L106 |
13,235 | puppetlabs/pdk | lib/pdk/util.rb | PDK.Util.module_root | def module_root
metadata_path = find_upwards('metadata.json')
if metadata_path
File.dirname(metadata_path)
elsif in_module_root?
Dir.pwd
else
nil
end
end | ruby | def module_root
metadata_path = find_upwards('metadata.json')
if metadata_path
File.dirname(metadata_path)
elsif in_module_root?
Dir.pwd
else
nil
end
end | [
"def",
"module_root",
"metadata_path",
"=",
"find_upwards",
"(",
"'metadata.json'",
")",
"if",
"metadata_path",
"File",
".",
"dirname",
"(",
"metadata_path",
")",
"elsif",
"in_module_root?",
"Dir",
".",
"pwd",
"else",
"nil",
"end",
"end"
] | Returns path to the root of the module being worked on.
@return [String, nil] Fully qualified base path to module, or nil if
the current working dir does not appear to be within a module. | [
"Returns",
"path",
"to",
"the",
"root",
"of",
"the",
"module",
"being",
"worked",
"on",
"."
] | 0d864aff62ffef04b5104addf399d0476afd71e7 | https://github.com/puppetlabs/pdk/blob/0d864aff62ffef04b5104addf399d0476afd71e7/lib/pdk/util.rb#L113-L122 |
13,236 | puppetlabs/pdk | lib/pdk/util.rb | PDK.Util.find_valid_json_in | def find_valid_json_in(text, opts = {})
break_on_first = opts.key?(:break_on_first) ? opts[:break_on_first] : true
json_result = break_on_first ? nil : []
text.scan(%r{\{(?:[^{}]|(?:\g<0>))*\}}x) do |str|
begin
if break_on_first
json_result = JSON.parse(str)
... | ruby | def find_valid_json_in(text, opts = {})
break_on_first = opts.key?(:break_on_first) ? opts[:break_on_first] : true
json_result = break_on_first ? nil : []
text.scan(%r{\{(?:[^{}]|(?:\g<0>))*\}}x) do |str|
begin
if break_on_first
json_result = JSON.parse(str)
... | [
"def",
"find_valid_json_in",
"(",
"text",
",",
"opts",
"=",
"{",
"}",
")",
"break_on_first",
"=",
"opts",
".",
"key?",
"(",
":break_on_first",
")",
"?",
"opts",
"[",
":break_on_first",
"]",
":",
"true",
"json_result",
"=",
"break_on_first",
"?",
"nil",
":"... | Iterate through possible JSON documents until we find one that is valid.
@param [String] text the text in which to find a JSON document
@param [Hash] opts options
@option opts [Boolean] :break_on_first Whether or not to break after valid JSON is found, defaults to true
@return [Hash, Array<Hash>, nil] subset of t... | [
"Iterate",
"through",
"possible",
"JSON",
"documents",
"until",
"we",
"find",
"one",
"that",
"is",
"valid",
"."
] | 0d864aff62ffef04b5104addf399d0476afd71e7 | https://github.com/puppetlabs/pdk/blob/0d864aff62ffef04b5104addf399d0476afd71e7/lib/pdk/util.rb#L165-L184 |
13,237 | puppetlabs/pdk | lib/pdk/util.rb | PDK.Util.targets_relative_to_pwd | def targets_relative_to_pwd(targets)
targets.map do |t|
if Pathname.new(t).absolute?
Pathname.new(t).relative_path_from(Pathname.pwd)
else
t
end
end
end | ruby | def targets_relative_to_pwd(targets)
targets.map do |t|
if Pathname.new(t).absolute?
Pathname.new(t).relative_path_from(Pathname.pwd)
else
t
end
end
end | [
"def",
"targets_relative_to_pwd",
"(",
"targets",
")",
"targets",
".",
"map",
"do",
"|",
"t",
"|",
"if",
"Pathname",
".",
"new",
"(",
"t",
")",
".",
"absolute?",
"Pathname",
".",
"new",
"(",
"t",
")",
".",
"relative_path_from",
"(",
"Pathname",
".",
"p... | Returns the targets' paths relative to the working directory
@return [Array<String>] The absolute or path to the target | [
"Returns",
"the",
"targets",
"paths",
"relative",
"to",
"the",
"working",
"directory"
] | 0d864aff62ffef04b5104addf399d0476afd71e7 | https://github.com/puppetlabs/pdk/blob/0d864aff62ffef04b5104addf399d0476afd71e7/lib/pdk/util.rb#L190-L198 |
13,238 | puppetlabs/pdk | lib/pdk/report.rb | PDK.Report.write_junit | def write_junit(target = self.class.default_target)
# Open a File Object for IO if target is a string containing a filename or path
target = File.open(target, 'w') if target.is_a? String
document = REXML::Document.new
document << REXML::XMLDecl.new
testsuites = REXML::Element.new('testsui... | ruby | def write_junit(target = self.class.default_target)
# Open a File Object for IO if target is a string containing a filename or path
target = File.open(target, 'w') if target.is_a? String
document = REXML::Document.new
document << REXML::XMLDecl.new
testsuites = REXML::Element.new('testsui... | [
"def",
"write_junit",
"(",
"target",
"=",
"self",
".",
"class",
".",
"default_target",
")",
"# Open a File Object for IO if target is a string containing a filename or path",
"target",
"=",
"File",
".",
"open",
"(",
"target",
",",
"'w'",
")",
"if",
"target",
".",
"i... | Renders the report as a JUnit XML document.
@param target [#write] an IO object that the report will be written to.
Defaults to PDK::Report.default_target. | [
"Renders",
"the",
"report",
"as",
"a",
"JUnit",
"XML",
"document",
"."
] | 0d864aff62ffef04b5104addf399d0476afd71e7 | https://github.com/puppetlabs/pdk/blob/0d864aff62ffef04b5104addf399d0476afd71e7/lib/pdk/report.rb#L50-L84 |
13,239 | puppetlabs/pdk | lib/pdk/report.rb | PDK.Report.write_text | def write_text(target = self.class.default_target)
# Open a File Object for IO if target is a string containing a filename or path
target = File.open(target, 'w') if target.is_a? String
coverage_report = nil
events.each do |_tool, tool_events|
tool_events.each do |event|
if ev... | ruby | def write_text(target = self.class.default_target)
# Open a File Object for IO if target is a string containing a filename or path
target = File.open(target, 'w') if target.is_a? String
coverage_report = nil
events.each do |_tool, tool_events|
tool_events.each do |event|
if ev... | [
"def",
"write_text",
"(",
"target",
"=",
"self",
".",
"class",
".",
"default_target",
")",
"# Open a File Object for IO if target is a string containing a filename or path",
"target",
"=",
"File",
".",
"open",
"(",
"target",
",",
"'w'",
")",
"if",
"target",
".",
"is... | Renders the report as plain text.
This report is designed for interactive use by a human and so excludes
all passing events in order to be consise.
@param target [#write] an IO object that the report will be written to.
Defaults to PDK::Report.default_target. | [
"Renders",
"the",
"report",
"as",
"plain",
"text",
"."
] | 0d864aff62ffef04b5104addf399d0476afd71e7 | https://github.com/puppetlabs/pdk/blob/0d864aff62ffef04b5104addf399d0476afd71e7/lib/pdk/report.rb#L93-L110 |
13,240 | puppetlabs/pdk | lib/pdk/answer_file.rb | PDK.AnswerFile.update! | def update!(new_answers = {})
unless new_answers.is_a?(Hash)
raise PDK::CLI::FatalError, _('Answer file can be updated only with a Hash')
end
answers.merge!(new_answers)
save_to_disk
end | ruby | def update!(new_answers = {})
unless new_answers.is_a?(Hash)
raise PDK::CLI::FatalError, _('Answer file can be updated only with a Hash')
end
answers.merge!(new_answers)
save_to_disk
end | [
"def",
"update!",
"(",
"new_answers",
"=",
"{",
"}",
")",
"unless",
"new_answers",
".",
"is_a?",
"(",
"Hash",
")",
"raise",
"PDK",
"::",
"CLI",
"::",
"FatalError",
",",
"_",
"(",
"'Answer file can be updated only with a Hash'",
")",
"end",
"answers",
".",
"m... | Update the stored answers in memory and then save them to disk.
@param new_answers [Hash{String => Object}] The new questions and answers
to be merged into the existing answers.
@raise [PDK::CLI::FatalError] if the new answers are not provided as
a Hash.
@raise (see #save_to_disk) | [
"Update",
"the",
"stored",
"answers",
"in",
"memory",
"and",
"then",
"save",
"them",
"to",
"disk",
"."
] | 0d864aff62ffef04b5104addf399d0476afd71e7 | https://github.com/puppetlabs/pdk/blob/0d864aff62ffef04b5104addf399d0476afd71e7/lib/pdk/answer_file.rb#L57-L65 |
13,241 | puppetlabs/pdk | lib/pdk/answer_file.rb | PDK.AnswerFile.read_from_disk | def read_from_disk
return {} if !File.file?(answer_file_path) || File.zero?(answer_file_path)
unless File.readable?(answer_file_path)
raise PDK::CLI::FatalError, _("Unable to open '%{file}' for reading") % {
file: answer_file_path,
}
end
answers = JSON.parse(File.read... | ruby | def read_from_disk
return {} if !File.file?(answer_file_path) || File.zero?(answer_file_path)
unless File.readable?(answer_file_path)
raise PDK::CLI::FatalError, _("Unable to open '%{file}' for reading") % {
file: answer_file_path,
}
end
answers = JSON.parse(File.read... | [
"def",
"read_from_disk",
"return",
"{",
"}",
"if",
"!",
"File",
".",
"file?",
"(",
"answer_file_path",
")",
"||",
"File",
".",
"zero?",
"(",
"answer_file_path",
")",
"unless",
"File",
".",
"readable?",
"(",
"answer_file_path",
")",
"raise",
"PDK",
"::",
"C... | Read existing answers into memory from the answer file on disk.
@raise [PDK::CLI::FatalError] If the answer file exists but can not be
read.
@return [Hash{String => Object}] The existing questions and answers. | [
"Read",
"existing",
"answers",
"into",
"memory",
"from",
"the",
"answer",
"file",
"on",
"disk",
"."
] | 0d864aff62ffef04b5104addf399d0476afd71e7 | https://github.com/puppetlabs/pdk/blob/0d864aff62ffef04b5104addf399d0476afd71e7/lib/pdk/answer_file.rb#L82-L105 |
13,242 | puppetlabs/pdk | lib/pdk/answer_file.rb | PDK.AnswerFile.save_to_disk | def save_to_disk
FileUtils.mkdir_p(File.dirname(answer_file_path))
write_file(answer_file_path, JSON.pretty_generate(answers))
rescue SystemCallError, IOError => e
raise PDK::CLI::FatalError, _("Unable to write '%{file}': %{msg}") % {
file: answer_file_path,
msg: e.message,
... | ruby | def save_to_disk
FileUtils.mkdir_p(File.dirname(answer_file_path))
write_file(answer_file_path, JSON.pretty_generate(answers))
rescue SystemCallError, IOError => e
raise PDK::CLI::FatalError, _("Unable to write '%{file}': %{msg}") % {
file: answer_file_path,
msg: e.message,
... | [
"def",
"save_to_disk",
"FileUtils",
".",
"mkdir_p",
"(",
"File",
".",
"dirname",
"(",
"answer_file_path",
")",
")",
"write_file",
"(",
"answer_file_path",
",",
"JSON",
".",
"pretty_generate",
"(",
"answers",
")",
")",
"rescue",
"SystemCallError",
",",
"IOError",... | Save the in memory answer set to the answer file on disk.
@raise [PDK::CLI::FatalError] if the answer file can not be written to. | [
"Save",
"the",
"in",
"memory",
"answer",
"set",
"to",
"the",
"answer",
"file",
"on",
"disk",
"."
] | 0d864aff62ffef04b5104addf399d0476afd71e7 | https://github.com/puppetlabs/pdk/blob/0d864aff62ffef04b5104addf399d0476afd71e7/lib/pdk/answer_file.rb#L110-L119 |
13,243 | puppetlabs/pdk | lib/pdk/template_file.rb | PDK.TemplateFile.template_content | def template_content
if File.file?(@template_file) && File.readable?(@template_file)
return File.read(@template_file)
end
raise ArgumentError, _("'%{template}' is not a readable file") % { template: @template_file }
end | ruby | def template_content
if File.file?(@template_file) && File.readable?(@template_file)
return File.read(@template_file)
end
raise ArgumentError, _("'%{template}' is not a readable file") % { template: @template_file }
end | [
"def",
"template_content",
"if",
"File",
".",
"file?",
"(",
"@template_file",
")",
"&&",
"File",
".",
"readable?",
"(",
"@template_file",
")",
"return",
"File",
".",
"read",
"(",
"@template_file",
")",
"end",
"raise",
"ArgumentError",
",",
"_",
"(",
"\"'%{te... | Reads the content of the template file into memory.
@return [String] The content of the template file.
@raise [ArgumentError] If the template file does not exist or can not be
read.
@api private | [
"Reads",
"the",
"content",
"of",
"the",
"template",
"file",
"into",
"memory",
"."
] | 0d864aff62ffef04b5104addf399d0476afd71e7 | https://github.com/puppetlabs/pdk/blob/0d864aff62ffef04b5104addf399d0476afd71e7/lib/pdk/template_file.rb#L63-L69 |
13,244 | puppetlabs/pdk | lib/pdk/template_file.rb | PDK.TemplateFile.render_erb | def render_erb
renderer = ERB.new(template_content, nil, '-')
renderer.filename = @template_file
renderer.result(binding)
end | ruby | def render_erb
renderer = ERB.new(template_content, nil, '-')
renderer.filename = @template_file
renderer.result(binding)
end | [
"def",
"render_erb",
"renderer",
"=",
"ERB",
".",
"new",
"(",
"template_content",
",",
"nil",
",",
"'-'",
")",
"renderer",
".",
"filename",
"=",
"@template_file",
"renderer",
".",
"result",
"(",
"binding",
")",
"end"
] | Renders the content of the template file as an ERB template.
@return [String] The rendered template.
@raise (see #template_content)
@api private | [
"Renders",
"the",
"content",
"of",
"the",
"template",
"file",
"as",
"an",
"ERB",
"template",
"."
] | 0d864aff62ffef04b5104addf399d0476afd71e7 | https://github.com/puppetlabs/pdk/blob/0d864aff62ffef04b5104addf399d0476afd71e7/lib/pdk/template_file.rb#L78-L82 |
13,245 | flavorjones/loofah | lib/loofah/scrubber.rb | Loofah.Scrubber.append_attribute | def append_attribute(node, attribute, value)
current_value = node.get_attribute(attribute) || ''
current_values = current_value.split(/\s+/)
updated_value = current_values | [value]
node.set_attribute(attribute, updated_value.join(' '))
end | ruby | def append_attribute(node, attribute, value)
current_value = node.get_attribute(attribute) || ''
current_values = current_value.split(/\s+/)
updated_value = current_values | [value]
node.set_attribute(attribute, updated_value.join(' '))
end | [
"def",
"append_attribute",
"(",
"node",
",",
"attribute",
",",
"value",
")",
"current_value",
"=",
"node",
".",
"get_attribute",
"(",
"attribute",
")",
"||",
"''",
"current_values",
"=",
"current_value",
".",
"split",
"(",
"/",
"\\s",
"/",
")",
"updated_valu... | If the attribute is not set, add it
If the attribute is set, don't overwrite the existing value | [
"If",
"the",
"attribute",
"is",
"not",
"set",
"add",
"it",
"If",
"the",
"attribute",
"is",
"set",
"don",
"t",
"overwrite",
"the",
"existing",
"value"
] | 49f178941f10a97aa6441e71fae704a81cc3a731 | https://github.com/flavorjones/loofah/blob/49f178941f10a97aa6441e71fae704a81cc3a731/lib/loofah/scrubber.rb#L93-L98 |
13,246 | flavorjones/loofah | lib/loofah/instance_methods.rb | Loofah.TextBehavior.text | def text(options={})
result = serialize_root.children.inner_text rescue ""
if options[:encode_special_chars] == false
result # possibly dangerous if rendered in a browser
else
encode_special_chars result
end
end | ruby | def text(options={})
result = serialize_root.children.inner_text rescue ""
if options[:encode_special_chars] == false
result # possibly dangerous if rendered in a browser
else
encode_special_chars result
end
end | [
"def",
"text",
"(",
"options",
"=",
"{",
"}",
")",
"result",
"=",
"serialize_root",
".",
"children",
".",
"inner_text",
"rescue",
"\"\"",
"if",
"options",
"[",
":encode_special_chars",
"]",
"==",
"false",
"result",
"# possibly dangerous if rendered in a browser",
... | Returns a plain-text version of the markup contained by the document,
with HTML entities encoded.
This method is significantly faster than #to_text, but isn't
clever about whitespace around block elements.
Loofah.document("<h1>Title</h1><div>Content</div>").text
# => "TitleContent"
By default, the re... | [
"Returns",
"a",
"plain",
"-",
"text",
"version",
"of",
"the",
"markup",
"contained",
"by",
"the",
"document",
"with",
"HTML",
"entities",
"encoded",
"."
] | 49f178941f10a97aa6441e71fae704a81cc3a731 | https://github.com/flavorjones/loofah/blob/49f178941f10a97aa6441e71fae704a81cc3a731/lib/loofah/instance_methods.rb#L94-L101 |
13,247 | commander-rb/commander | lib/commander/command.rb | Commander.Command.option | def option(*args, &block)
switches, description = Runner.separate_switches_from_description(*args)
proc = block || option_proc(switches)
@options << {
args: args,
proc: proc,
switches: switches,
description: description,
}
end | ruby | def option(*args, &block)
switches, description = Runner.separate_switches_from_description(*args)
proc = block || option_proc(switches)
@options << {
args: args,
proc: proc,
switches: switches,
description: description,
}
end | [
"def",
"option",
"(",
"*",
"args",
",",
"&",
"block",
")",
"switches",
",",
"description",
"=",
"Runner",
".",
"separate_switches_from_description",
"(",
"args",
")",
"proc",
"=",
"block",
"||",
"option_proc",
"(",
"switches",
")",
"@options",
"<<",
"{",
"... | Add an option.
Options are parsed via OptionParser so view it
for additional usage documentation. A block may optionally be
passed to handle the option, otherwise the _options_ struct seen below
contains the results of this option. This handles common formats such as:
-h, --help options.help ... | [
"Add",
"an",
"option",
"."
] | 332047c14948225462fe60042eed23adfb996d68 | https://github.com/commander-rb/commander/blob/332047c14948225462fe60042eed23adfb996d68/lib/commander/command.rb#L107-L116 |
13,248 | commander-rb/commander | lib/commander/command.rb | Commander.Command.call | def call(args = [])
object, meth = @when_called[0, 2]
meth ||= :call
options = proxy_option_struct
case object
when Proc then object.call(args, options)
when Class then meth != :call ? object.new.send(meth, args, options) : object.new(args, options)
else object.send(meth, args... | ruby | def call(args = [])
object, meth = @when_called[0, 2]
meth ||= :call
options = proxy_option_struct
case object
when Proc then object.call(args, options)
when Class then meth != :call ? object.new.send(meth, args, options) : object.new(args, options)
else object.send(meth, args... | [
"def",
"call",
"(",
"args",
"=",
"[",
"]",
")",
"object",
",",
"meth",
"=",
"@when_called",
"[",
"0",
",",
"2",
"]",
"meth",
"||=",
":call",
"options",
"=",
"proxy_option_struct",
"case",
"object",
"when",
"Proc",
"then",
"object",
".",
"call",
"(",
... | Call the commands when_called block with _args_. | [
"Call",
"the",
"commands",
"when_called",
"block",
"with",
"_args_",
"."
] | 332047c14948225462fe60042eed23adfb996d68 | https://github.com/commander-rb/commander/blob/332047c14948225462fe60042eed23adfb996d68/lib/commander/command.rb#L176-L186 |
13,249 | commander-rb/commander | lib/commander/runner.rb | Commander.Runner.run! | def run!
trace = @always_trace || false
require_program :version, :description
trap('INT') { abort program(:int_message) } if program(:int_message)
trap('INT') { program(:int_block).call } if program(:int_block)
global_option('-h', '--help', 'Display help documentation') do
args = ... | ruby | def run!
trace = @always_trace || false
require_program :version, :description
trap('INT') { abort program(:int_message) } if program(:int_message)
trap('INT') { program(:int_block).call } if program(:int_block)
global_option('-h', '--help', 'Display help documentation') do
args = ... | [
"def",
"run!",
"trace",
"=",
"@always_trace",
"||",
"false",
"require_program",
":version",
",",
":description",
"trap",
"(",
"'INT'",
")",
"{",
"abort",
"program",
"(",
":int_message",
")",
"}",
"if",
"program",
"(",
":int_message",
")",
"trap",
"(",
"'INT'... | Run command parsing and execution process. | [
"Run",
"command",
"parsing",
"and",
"execution",
"process",
"."
] | 332047c14948225462fe60042eed23adfb996d68 | https://github.com/commander-rb/commander/blob/332047c14948225462fe60042eed23adfb996d68/lib/commander/runner.rb#L50-L87 |
13,250 | commander-rb/commander | lib/commander/runner.rb | Commander.Runner.program | def program(key, *args, &block)
if key == :help && !args.empty?
@program[:help] ||= {}
@program[:help][args.first] = args.at(1)
elsif key == :help_formatter && !args.empty?
@program[key] = (@help_formatter_aliases[args.first] || args.first)
elsif block
@program[key] = b... | ruby | def program(key, *args, &block)
if key == :help && !args.empty?
@program[:help] ||= {}
@program[:help][args.first] = args.at(1)
elsif key == :help_formatter && !args.empty?
@program[key] = (@help_formatter_aliases[args.first] || args.first)
elsif block
@program[key] = b... | [
"def",
"program",
"(",
"key",
",",
"*",
"args",
",",
"&",
"block",
")",
"if",
"key",
"==",
":help",
"&&",
"!",
"args",
".",
"empty?",
"@program",
"[",
":help",
"]",
"||=",
"{",
"}",
"@program",
"[",
":help",
"]",
"[",
"args",
".",
"first",
"]",
... | Assign program information.
=== Examples
# Set data
program :name, 'Commander'
program :version, Commander::VERSION
program :description, 'Commander utility program.'
program :help, 'Copyright', '2008 TJ Holowaychuk'
program :help, 'Anything', 'You want'
program :int_message 'Bye bye!'
progra... | [
"Assign",
"program",
"information",
"."
] | 332047c14948225462fe60042eed23adfb996d68 | https://github.com/commander-rb/commander/blob/332047c14948225462fe60042eed23adfb996d68/lib/commander/runner.rb#L141-L155 |
13,251 | commander-rb/commander | lib/commander/runner.rb | Commander.Runner.alias_command | def alias_command(alias_name, name, *args)
@commands[alias_name.to_s] = command name
@aliases[alias_name.to_s] = args
end | ruby | def alias_command(alias_name, name, *args)
@commands[alias_name.to_s] = command name
@aliases[alias_name.to_s] = args
end | [
"def",
"alias_command",
"(",
"alias_name",
",",
"name",
",",
"*",
"args",
")",
"@commands",
"[",
"alias_name",
".",
"to_s",
"]",
"=",
"command",
"name",
"@aliases",
"[",
"alias_name",
".",
"to_s",
"]",
"=",
"args",
"end"
] | Alias command _name_ with _alias_name_. Optionally _args_ may be passed
as if they were being passed straight to the original command via the command-line. | [
"Alias",
"command",
"_name_",
"with",
"_alias_name_",
".",
"Optionally",
"_args_",
"may",
"be",
"passed",
"as",
"if",
"they",
"were",
"being",
"passed",
"straight",
"to",
"the",
"original",
"command",
"via",
"the",
"command",
"-",
"line",
"."
] | 332047c14948225462fe60042eed23adfb996d68 | https://github.com/commander-rb/commander/blob/332047c14948225462fe60042eed23adfb996d68/lib/commander/runner.rb#L194-L197 |
13,252 | commander-rb/commander | lib/commander/runner.rb | Commander.Runner.args_without_command_name | def args_without_command_name
removed = []
parts = command_name_from_args.split rescue []
@args.dup.delete_if do |arg|
removed << arg if parts.include?(arg) && !removed.include?(arg)
end
end | ruby | def args_without_command_name
removed = []
parts = command_name_from_args.split rescue []
@args.dup.delete_if do |arg|
removed << arg if parts.include?(arg) && !removed.include?(arg)
end
end | [
"def",
"args_without_command_name",
"removed",
"=",
"[",
"]",
"parts",
"=",
"command_name_from_args",
".",
"split",
"rescue",
"[",
"]",
"@args",
".",
"dup",
".",
"delete_if",
"do",
"|",
"arg",
"|",
"removed",
"<<",
"arg",
"if",
"parts",
".",
"include?",
"(... | Return arguments without the command name. | [
"Return",
"arguments",
"without",
"the",
"command",
"name",
"."
] | 332047c14948225462fe60042eed23adfb996d68 | https://github.com/commander-rb/commander/blob/332047c14948225462fe60042eed23adfb996d68/lib/commander/runner.rb#L263-L269 |
13,253 | commander-rb/commander | lib/commander/runner.rb | Commander.Runner.remove_global_options | def remove_global_options(options, args)
# TODO: refactor with flipflop, please TJ ! have time to refactor me !
options.each do |option|
switches = option[:switches].dup
next if switches.empty?
if (switch_has_arg = switches.any? { |s| s =~ /[ =]/ })
switches.map! { |s| s[0... | ruby | def remove_global_options(options, args)
# TODO: refactor with flipflop, please TJ ! have time to refactor me !
options.each do |option|
switches = option[:switches].dup
next if switches.empty?
if (switch_has_arg = switches.any? { |s| s =~ /[ =]/ })
switches.map! { |s| s[0... | [
"def",
"remove_global_options",
"(",
"options",
",",
"args",
")",
"# TODO: refactor with flipflop, please TJ ! have time to refactor me !",
"options",
".",
"each",
"do",
"|",
"option",
"|",
"switches",
"=",
"option",
"[",
":switches",
"]",
".",
"dup",
"next",
"if",
... | Removes global _options_ from _args_. This prevents an invalid
option error from occurring when options are parsed
again for the command. | [
"Removes",
"global",
"_options_",
"from",
"_args_",
".",
"This",
"prevents",
"an",
"invalid",
"option",
"error",
"from",
"occurring",
"when",
"options",
"are",
"parsed",
"again",
"for",
"the",
"command",
"."
] | 332047c14948225462fe60042eed23adfb996d68 | https://github.com/commander-rb/commander/blob/332047c14948225462fe60042eed23adfb996d68/lib/commander/runner.rb#L330-L355 |
13,254 | commander-rb/commander | lib/commander/runner.rb | Commander.Runner.parse_global_options | def parse_global_options
parser = options.inject(OptionParser.new) do |options, option|
options.on(*option[:args], &global_option_proc(option[:switches], &option[:proc]))
end
options = @args.dup
begin
parser.parse!(options)
rescue OptionParser::InvalidOption => e
#... | ruby | def parse_global_options
parser = options.inject(OptionParser.new) do |options, option|
options.on(*option[:args], &global_option_proc(option[:switches], &option[:proc]))
end
options = @args.dup
begin
parser.parse!(options)
rescue OptionParser::InvalidOption => e
#... | [
"def",
"parse_global_options",
"parser",
"=",
"options",
".",
"inject",
"(",
"OptionParser",
".",
"new",
")",
"do",
"|",
"options",
",",
"option",
"|",
"options",
".",
"on",
"(",
"option",
"[",
":args",
"]",
",",
"global_option_proc",
"(",
"option",
"[",
... | Parse global command options. | [
"Parse",
"global",
"command",
"options",
"."
] | 332047c14948225462fe60042eed23adfb996d68 | https://github.com/commander-rb/commander/blob/332047c14948225462fe60042eed23adfb996d68/lib/commander/runner.rb#L374-L387 |
13,255 | commander-rb/commander | lib/commander/runner.rb | Commander.Runner.require_program | def require_program(*keys)
keys.each do |key|
fail CommandError, "program #{key} required" if program(key).nil? || program(key).empty?
end
end | ruby | def require_program(*keys)
keys.each do |key|
fail CommandError, "program #{key} required" if program(key).nil? || program(key).empty?
end
end | [
"def",
"require_program",
"(",
"*",
"keys",
")",
"keys",
".",
"each",
"do",
"|",
"key",
"|",
"fail",
"CommandError",
",",
"\"program #{key} required\"",
"if",
"program",
"(",
"key",
")",
".",
"nil?",
"||",
"program",
"(",
"key",
")",
".",
"empty?",
"end"... | Raises a CommandError when the program any of the _keys_ are not present, or empty. | [
"Raises",
"a",
"CommandError",
"when",
"the",
"program",
"any",
"of",
"the",
"_keys_",
"are",
"not",
"present",
"or",
"empty",
"."
] | 332047c14948225462fe60042eed23adfb996d68 | https://github.com/commander-rb/commander/blob/332047c14948225462fe60042eed23adfb996d68/lib/commander/runner.rb#L407-L411 |
13,256 | commander-rb/commander | lib/commander/runner.rb | Commander.Runner.run_active_command | def run_active_command
require_valid_command
if alias? command_name_from_args
active_command.run(*(@aliases[command_name_from_args.to_s] + args_without_command_name))
else
active_command.run(*args_without_command_name)
end
end | ruby | def run_active_command
require_valid_command
if alias? command_name_from_args
active_command.run(*(@aliases[command_name_from_args.to_s] + args_without_command_name))
else
active_command.run(*args_without_command_name)
end
end | [
"def",
"run_active_command",
"require_valid_command",
"if",
"alias?",
"command_name_from_args",
"active_command",
".",
"run",
"(",
"(",
"@aliases",
"[",
"command_name_from_args",
".",
"to_s",
"]",
"+",
"args_without_command_name",
")",
")",
"else",
"active_command",
"."... | Run the active command. | [
"Run",
"the",
"active",
"command",
"."
] | 332047c14948225462fe60042eed23adfb996d68 | https://github.com/commander-rb/commander/blob/332047c14948225462fe60042eed23adfb996d68/lib/commander/runner.rb#L441-L448 |
13,257 | commander-rb/commander | lib/commander/user_interaction.rb | Commander.UI.ask_editor | def ask_editor(input = nil, preferred_editor = nil)
editor = available_editor preferred_editor
program = Commander::Runner.instance.program(:name).downcase rescue 'commander'
tmpfile = Tempfile.new program
begin
tmpfile.write input if input
tmpfile.close
system("#{editor}... | ruby | def ask_editor(input = nil, preferred_editor = nil)
editor = available_editor preferred_editor
program = Commander::Runner.instance.program(:name).downcase rescue 'commander'
tmpfile = Tempfile.new program
begin
tmpfile.write input if input
tmpfile.close
system("#{editor}... | [
"def",
"ask_editor",
"(",
"input",
"=",
"nil",
",",
"preferred_editor",
"=",
"nil",
")",
"editor",
"=",
"available_editor",
"preferred_editor",
"program",
"=",
"Commander",
"::",
"Runner",
".",
"instance",
".",
"program",
"(",
":name",
")",
".",
"downcase",
... | Prompt an editor for input. Optionally supply initial
_input_ which is written to the editor.
_preferred_editor_ can be hinted.
=== Examples
ask_editor # => prompts EDITOR with no input
ask_editor('foo') # => prompts EDITOR with default text of 'foo'
ask_editor('foo', 'mate -w') #... | [
"Prompt",
"an",
"editor",
"for",
"input",
".",
"Optionally",
"supply",
"initial",
"_input_",
"which",
"is",
"written",
"to",
"the",
"editor",
"."
] | 332047c14948225462fe60042eed23adfb996d68 | https://github.com/commander-rb/commander/blob/332047c14948225462fe60042eed23adfb996d68/lib/commander/user_interaction.rb#L258-L269 |
13,258 | commander-rb/commander | lib/commander/user_interaction.rb | Commander.UI.enable_paging | def enable_paging
return unless $stdout.tty?
return unless Process.respond_to? :fork
read, write = IO.pipe
# Kernel.fork is not supported on all platforms and configurations.
# As of Ruby 1.9, `Process.respond_to? :fork` should return false on
# configurations that don't support it,... | ruby | def enable_paging
return unless $stdout.tty?
return unless Process.respond_to? :fork
read, write = IO.pipe
# Kernel.fork is not supported on all platforms and configurations.
# As of Ruby 1.9, `Process.respond_to? :fork` should return false on
# configurations that don't support it,... | [
"def",
"enable_paging",
"return",
"unless",
"$stdout",
".",
"tty?",
"return",
"unless",
"Process",
".",
"respond_to?",
":fork",
"read",
",",
"write",
"=",
"IO",
".",
"pipe",
"# Kernel.fork is not supported on all platforms and configurations.",
"# As of Ruby 1.9, `Process.r... | Enable paging of output after called. | [
"Enable",
"paging",
"of",
"output",
"after",
"called",
"."
] | 332047c14948225462fe60042eed23adfb996d68 | https://github.com/commander-rb/commander/blob/332047c14948225462fe60042eed23adfb996d68/lib/commander/user_interaction.rb#L274-L304 |
13,259 | commander-rb/commander | lib/commander/user_interaction.rb | Commander.UI.progress | def progress(arr, options = {})
bar = ProgressBar.new arr.length, options
bar.show
arr.each { |v| bar.increment yield(v) }
end | ruby | def progress(arr, options = {})
bar = ProgressBar.new arr.length, options
bar.show
arr.each { |v| bar.increment yield(v) }
end | [
"def",
"progress",
"(",
"arr",
",",
"options",
"=",
"{",
"}",
")",
"bar",
"=",
"ProgressBar",
".",
"new",
"arr",
".",
"length",
",",
"options",
"bar",
".",
"show",
"arr",
".",
"each",
"{",
"|",
"v",
"|",
"bar",
".",
"increment",
"yield",
"(",
"v"... | Output progress while iterating _arr_.
=== Examples
uris = %w( http://vision-media.ca http://google.com )
progress uris, :format => "Remaining: :time_remaining" do |uri|
res = open uri
end | [
"Output",
"progress",
"while",
"iterating",
"_arr_",
"."
] | 332047c14948225462fe60042eed23adfb996d68 | https://github.com/commander-rb/commander/blob/332047c14948225462fe60042eed23adfb996d68/lib/commander/user_interaction.rb#L317-L321 |
13,260 | commander-rb/commander | lib/commander/user_interaction.rb | Commander.UI.replace_tokens | def replace_tokens(str, hash) #:nodoc:
hash.inject(str) do |string, (key, value)|
string.gsub ":#{key}", value.to_s
end
end | ruby | def replace_tokens(str, hash) #:nodoc:
hash.inject(str) do |string, (key, value)|
string.gsub ":#{key}", value.to_s
end
end | [
"def",
"replace_tokens",
"(",
"str",
",",
"hash",
")",
"#:nodoc:",
"hash",
".",
"inject",
"(",
"str",
")",
"do",
"|",
"string",
",",
"(",
"key",
",",
"value",
")",
"|",
"string",
".",
"gsub",
"\":#{key}\"",
",",
"value",
".",
"to_s",
"end",
"end"
] | Substitute _hash_'s keys with their associated values in _str_. | [
"Substitute",
"_hash_",
"s",
"keys",
"with",
"their",
"associated",
"values",
"in",
"_str_",
"."
] | 332047c14948225462fe60042eed23adfb996d68 | https://github.com/commander-rb/commander/blob/332047c14948225462fe60042eed23adfb996d68/lib/commander/user_interaction.rb#L371-L375 |
13,261 | tongueroo/ufo | lib/ufo/tasks/register.rb | Ufo.Tasks::Register.rubyize_format | def rubyize_format(original_data)
data = original_data.to_snake_keys.deep_symbolize_keys
definitions = data[:container_definitions]
definitions.each_with_index do |definition, i|
next unless definition[:log_configuration]
options = definition[:log_configuration][:options]
next... | ruby | def rubyize_format(original_data)
data = original_data.to_snake_keys.deep_symbolize_keys
definitions = data[:container_definitions]
definitions.each_with_index do |definition, i|
next unless definition[:log_configuration]
options = definition[:log_configuration][:options]
next... | [
"def",
"rubyize_format",
"(",
"original_data",
")",
"data",
"=",
"original_data",
".",
"to_snake_keys",
".",
"deep_symbolize_keys",
"definitions",
"=",
"data",
"[",
":container_definitions",
"]",
"definitions",
".",
"each_with_index",
"do",
"|",
"definition",
",",
"... | The ruby aws-sdk expects symbols for keys and AWS docs for the task
definition uses json camelCase for the keys. This method transforms
the keys to the expected ruby aws-sdk format.
One quirk is that the logConfiguration options casing should not be
transformed. | [
"The",
"ruby",
"aws",
"-",
"sdk",
"expects",
"symbols",
"for",
"keys",
"and",
"AWS",
"docs",
"for",
"the",
"task",
"definition",
"uses",
"json",
"camelCase",
"for",
"the",
"keys",
".",
"This",
"method",
"transforms",
"the",
"keys",
"to",
"the",
"expected",... | 16ac3dad28edcab2693c0e7d89a1971aca65b8f9 | https://github.com/tongueroo/ufo/blob/16ac3dad28edcab2693c0e7d89a1971aca65b8f9/lib/ufo/tasks/register.rb#L68-L85 |
13,262 | tongueroo/ufo | lib/ufo/ps.rb | Ufo.Ps.display_scale_help | def display_scale_help
return if service.running_count >= service.desired_count
events = service["events"][0..3] # only check most recent 4 messages
error_event = events.find do |e|
e.message =~ /was unable to place a task/
end
return unless error_event
puts "There is an is... | ruby | def display_scale_help
return if service.running_count >= service.desired_count
events = service["events"][0..3] # only check most recent 4 messages
error_event = events.find do |e|
e.message =~ /was unable to place a task/
end
return unless error_event
puts "There is an is... | [
"def",
"display_scale_help",
"return",
"if",
"service",
".",
"running_count",
">=",
"service",
".",
"desired_count",
"events",
"=",
"service",
"[",
"\"events\"",
"]",
"[",
"0",
"..",
"3",
"]",
"# only check most recent 4 messages",
"error_event",
"=",
"events",
".... | If the running count less than the desired account yet, check the events
and show a message with helpful debugging information. | [
"If",
"the",
"running",
"count",
"less",
"than",
"the",
"desired",
"account",
"yet",
"check",
"the",
"events",
"and",
"show",
"a",
"message",
"with",
"helpful",
"debugging",
"information",
"."
] | 16ac3dad28edcab2693c0e7d89a1971aca65b8f9 | https://github.com/tongueroo/ufo/blob/16ac3dad28edcab2693c0e7d89a1971aca65b8f9/lib/ufo/ps.rb#L70-L84 |
13,263 | tongueroo/ufo | lib/ufo/setting.rb | Ufo.Setting.ufo_env | def ufo_env
settings = YAML.load_file("#{Ufo.root}/.ufo/settings.yml")
env = settings.find do |_env, section|
section ||= {}
ENV['AWS_PROFILE'] && ENV['AWS_PROFILE'] == section['aws_profile']
end
ufo_env = env.first if env
ufo_env = ENV['UFO_ENV'] if ENV['UFO_ENV'] # highe... | ruby | def ufo_env
settings = YAML.load_file("#{Ufo.root}/.ufo/settings.yml")
env = settings.find do |_env, section|
section ||= {}
ENV['AWS_PROFILE'] && ENV['AWS_PROFILE'] == section['aws_profile']
end
ufo_env = env.first if env
ufo_env = ENV['UFO_ENV'] if ENV['UFO_ENV'] # highe... | [
"def",
"ufo_env",
"settings",
"=",
"YAML",
".",
"load_file",
"(",
"\"#{Ufo.root}/.ufo/settings.yml\"",
")",
"env",
"=",
"settings",
".",
"find",
"do",
"|",
"_env",
",",
"section",
"|",
"section",
"||=",
"{",
"}",
"ENV",
"[",
"'AWS_PROFILE'",
"]",
"&&",
"EN... | Resovles infinite problem since Ufo.env can be determined from UFO_ENV or settings.yml files.
When ufo is determined from settings it should not called Ufo.env since that in turn calls
Settings.new.data which can then cause an infinite loop. | [
"Resovles",
"infinite",
"problem",
"since",
"Ufo",
".",
"env",
"can",
"be",
"determined",
"from",
"UFO_ENV",
"or",
"settings",
".",
"yml",
"files",
".",
"When",
"ufo",
"is",
"determined",
"from",
"settings",
"it",
"should",
"not",
"called",
"Ufo",
".",
"en... | 16ac3dad28edcab2693c0e7d89a1971aca65b8f9 | https://github.com/tongueroo/ufo/blob/16ac3dad28edcab2693c0e7d89a1971aca65b8f9/lib/ufo/setting.rb#L38-L48 |
13,264 | tongueroo/ufo | lib/ufo/dsl.rb | Ufo.DSL.evaluate_template_definitions | def evaluate_template_definitions
source_code = IO.read(@template_definitions_path)
begin
instance_eval(source_code, @template_definitions_path)
rescue Exception => e
if e.class == SystemExit # allow exit to happen normally
raise
else
task_definition_error(e... | ruby | def evaluate_template_definitions
source_code = IO.read(@template_definitions_path)
begin
instance_eval(source_code, @template_definitions_path)
rescue Exception => e
if e.class == SystemExit # allow exit to happen normally
raise
else
task_definition_error(e... | [
"def",
"evaluate_template_definitions",
"source_code",
"=",
"IO",
".",
"read",
"(",
"@template_definitions_path",
")",
"begin",
"instance_eval",
"(",
"source_code",
",",
"@template_definitions_path",
")",
"rescue",
"Exception",
"=>",
"e",
"if",
"e",
".",
"class",
"=... | All we're doing at this point is saving blocks of code into memory
The instance_eval provides the task_definition and helper methods as they are part
of this class. | [
"All",
"we",
"re",
"doing",
"at",
"this",
"point",
"is",
"saving",
"blocks",
"of",
"code",
"into",
"memory",
"The",
"instance_eval",
"provides",
"the",
"task_definition",
"and",
"helper",
"methods",
"as",
"they",
"are",
"part",
"of",
"this",
"class",
"."
] | 16ac3dad28edcab2693c0e7d89a1971aca65b8f9 | https://github.com/tongueroo/ufo/blob/16ac3dad28edcab2693c0e7d89a1971aca65b8f9/lib/ufo/dsl.rb#L25-L38 |
13,265 | tongueroo/ufo | lib/ufo/dsl.rb | Ufo.DSL.task_definition_error | def task_definition_error(e)
error_info = e.backtrace.first
path, line_no, _ = error_info.split(':')
line_no = line_no.to_i
puts "Error evaluating #{path}:".color(:red)
puts e.message
puts "Here's the line in #{path} with the error:\n\n"
contents = IO.read(path)
content_... | ruby | def task_definition_error(e)
error_info = e.backtrace.first
path, line_no, _ = error_info.split(':')
line_no = line_no.to_i
puts "Error evaluating #{path}:".color(:red)
puts e.message
puts "Here's the line in #{path} with the error:\n\n"
contents = IO.read(path)
content_... | [
"def",
"task_definition_error",
"(",
"e",
")",
"error_info",
"=",
"e",
".",
"backtrace",
".",
"first",
"path",
",",
"line_no",
",",
"_",
"=",
"error_info",
".",
"split",
"(",
"':'",
")",
"line_no",
"=",
"line_no",
".",
"to_i",
"puts",
"\"Error evaluating #... | Prints out a user friendly task_definition error message | [
"Prints",
"out",
"a",
"user",
"friendly",
"task_definition",
"error",
"message"
] | 16ac3dad28edcab2693c0e7d89a1971aca65b8f9 | https://github.com/tongueroo/ufo/blob/16ac3dad28edcab2693c0e7d89a1971aca65b8f9/lib/ufo/dsl.rb#L41-L62 |
13,266 | tongueroo/ufo | lib/ufo/stack.rb | Ufo.Stack.template_body | def template_body
custom_template = "#{Ufo.root}/.ufo/settings/cfn/stack.yml"
path = if File.exist?(custom_template)
custom_template
else
# built-in default
File.expand_path("../cfn/stack.yml", File.dirname(__FILE__))
end
RenderMeP... | ruby | def template_body
custom_template = "#{Ufo.root}/.ufo/settings/cfn/stack.yml"
path = if File.exist?(custom_template)
custom_template
else
# built-in default
File.expand_path("../cfn/stack.yml", File.dirname(__FILE__))
end
RenderMeP... | [
"def",
"template_body",
"custom_template",
"=",
"\"#{Ufo.root}/.ufo/settings/cfn/stack.yml\"",
"path",
"=",
"if",
"File",
".",
"exist?",
"(",
"custom_template",
")",
"custom_template",
"else",
"# built-in default",
"File",
".",
"expand_path",
"(",
"\"../cfn/stack.yml\"",
... | do not memoize template_body it can change for a rename retry | [
"do",
"not",
"memoize",
"template_body",
"it",
"can",
"change",
"for",
"a",
"rename",
"retry"
] | 16ac3dad28edcab2693c0e7d89a1971aca65b8f9 | https://github.com/tongueroo/ufo/blob/16ac3dad28edcab2693c0e7d89a1971aca65b8f9/lib/ufo/stack.rb#L73-L82 |
13,267 | tongueroo/ufo | lib/ufo/stack.rb | Ufo.Stack.save_template | def save_template
path = "/tmp/ufo/#{@stack_name}/stack.yml"
FileUtils.mkdir_p(File.dirname(path))
IO.write(path, template_body)
puts "Generated template saved at: #{path}"
path = "/tmp/ufo/#{@stack_name}/parameters.yml"
IO.write(path, JSON.pretty_generate(parameters))
puts "G... | ruby | def save_template
path = "/tmp/ufo/#{@stack_name}/stack.yml"
FileUtils.mkdir_p(File.dirname(path))
IO.write(path, template_body)
puts "Generated template saved at: #{path}"
path = "/tmp/ufo/#{@stack_name}/parameters.yml"
IO.write(path, JSON.pretty_generate(parameters))
puts "G... | [
"def",
"save_template",
"path",
"=",
"\"/tmp/ufo/#{@stack_name}/stack.yml\"",
"FileUtils",
".",
"mkdir_p",
"(",
"File",
".",
"dirname",
"(",
"path",
")",
")",
"IO",
".",
"write",
"(",
"path",
",",
"template_body",
")",
"puts",
"\"Generated template saved at: #{path}... | Store template in tmp in case for debugging | [
"Store",
"template",
"in",
"tmp",
"in",
"case",
"for",
"debugging"
] | 16ac3dad28edcab2693c0e7d89a1971aca65b8f9 | https://github.com/tongueroo/ufo/blob/16ac3dad28edcab2693c0e7d89a1971aca65b8f9/lib/ufo/stack.rb#L167-L176 |
13,268 | tongueroo/ufo | lib/ufo/ship.rb | Ufo.Ship.stop_old_tasks | def stop_old_tasks
# only works when deployment is blocking
return unless @options[:wait]
Thread.new do
stop = Ufo::Stop.new(@service, @options.merge(mute: true))
while true
stop.log "checking for old tasks and waiting for 10 seconds"
stop.run
sleep 10
... | ruby | def stop_old_tasks
# only works when deployment is blocking
return unless @options[:wait]
Thread.new do
stop = Ufo::Stop.new(@service, @options.merge(mute: true))
while true
stop.log "checking for old tasks and waiting for 10 seconds"
stop.run
sleep 10
... | [
"def",
"stop_old_tasks",
"# only works when deployment is blocking",
"return",
"unless",
"@options",
"[",
":wait",
"]",
"Thread",
".",
"new",
"do",
"stop",
"=",
"Ufo",
"::",
"Stop",
".",
"new",
"(",
"@service",
",",
"@options",
".",
"merge",
"(",
"mute",
":",
... | Start a thread that will poll for ecs deployments and kill of tasks
in old deployments.
This must be done in a thread because the stack update process is blocking. | [
"Start",
"a",
"thread",
"that",
"will",
"poll",
"for",
"ecs",
"deployments",
"and",
"kill",
"of",
"tasks",
"in",
"old",
"deployments",
".",
"This",
"must",
"be",
"done",
"in",
"a",
"thread",
"because",
"the",
"stack",
"update",
"process",
"is",
"blocking",... | 16ac3dad28edcab2693c0e7d89a1971aca65b8f9 | https://github.com/tongueroo/ufo/blob/16ac3dad28edcab2693c0e7d89a1971aca65b8f9/lib/ufo/ship.rb#L40-L52 |
13,269 | tongueroo/ufo | lib/ufo/info.rb | Ufo.Info.load_balancer | def load_balancer(service)
load_balancer = service.load_balancers.first
return unless load_balancer
resp = elb.describe_target_groups(
target_group_arns: [load_balancer.target_group_arn]
)
target_group = resp.target_groups.first
load_balancer_arn = target_group.load_balancer... | ruby | def load_balancer(service)
load_balancer = service.load_balancers.first
return unless load_balancer
resp = elb.describe_target_groups(
target_group_arns: [load_balancer.target_group_arn]
)
target_group = resp.target_groups.first
load_balancer_arn = target_group.load_balancer... | [
"def",
"load_balancer",
"(",
"service",
")",
"load_balancer",
"=",
"service",
".",
"load_balancers",
".",
"first",
"return",
"unless",
"load_balancer",
"resp",
"=",
"elb",
".",
"describe_target_groups",
"(",
"target_group_arns",
":",
"[",
"load_balancer",
".",
"ta... | Passing in service so method can be used else where. | [
"Passing",
"in",
"service",
"so",
"method",
"can",
"be",
"used",
"else",
"where",
"."
] | 16ac3dad28edcab2693c0e7d89a1971aca65b8f9 | https://github.com/tongueroo/ufo/blob/16ac3dad28edcab2693c0e7d89a1971aca65b8f9/lib/ufo/info.rb#L17-L29 |
13,270 | tongueroo/ufo | lib/ufo/completer.rb | Ufo.Completer.all_commands | def all_commands
commands = @command_class.all_commands.reject do |k,v|
v.is_a?(Thor::HiddenCommand)
end
commands.keys
end | ruby | def all_commands
commands = @command_class.all_commands.reject do |k,v|
v.is_a?(Thor::HiddenCommand)
end
commands.keys
end | [
"def",
"all_commands",
"commands",
"=",
"@command_class",
".",
"all_commands",
".",
"reject",
"do",
"|",
"k",
",",
"v",
"|",
"v",
".",
"is_a?",
"(",
"Thor",
"::",
"HiddenCommand",
")",
"end",
"commands",
".",
"keys",
"end"
] | all top-level commands | [
"all",
"top",
"-",
"level",
"commands"
] | 16ac3dad28edcab2693c0e7d89a1971aca65b8f9 | https://github.com/tongueroo/ufo/blob/16ac3dad28edcab2693c0e7d89a1971aca65b8f9/lib/ufo/completer.rb#L119-L124 |
13,271 | tongueroo/ufo | lib/ufo/status.rb | Ufo.Status.run | def run
unless stack_exists?(@stack_name)
puts "The stack #{@stack_name.color(:green)} does not exist."
return
end
resp = cloudformation.describe_stacks(stack_name: @stack_name)
stack = resp.stacks.first
puts "The current status for the stack #{@stack_name.color(:green)} ... | ruby | def run
unless stack_exists?(@stack_name)
puts "The stack #{@stack_name.color(:green)} does not exist."
return
end
resp = cloudformation.describe_stacks(stack_name: @stack_name)
stack = resp.stacks.first
puts "The current status for the stack #{@stack_name.color(:green)} ... | [
"def",
"run",
"unless",
"stack_exists?",
"(",
"@stack_name",
")",
"puts",
"\"The stack #{@stack_name.color(:green)} does not exist.\"",
"return",
"end",
"resp",
"=",
"cloudformation",
".",
"describe_stacks",
"(",
"stack_name",
":",
"@stack_name",
")",
"stack",
"=",
"res... | used for the ufo status command | [
"used",
"for",
"the",
"ufo",
"status",
"command"
] | 16ac3dad28edcab2693c0e7d89a1971aca65b8f9 | https://github.com/tongueroo/ufo/blob/16ac3dad28edcab2693c0e7d89a1971aca65b8f9/lib/ufo/status.rb#L4-L28 |
13,272 | tongueroo/ufo | lib/ufo/task.rb | Ufo.Task.adjust_fargate_options | def adjust_fargate_options(options)
task_def = recent_task_definition
return options unless task_def[:network_mode] == "awsvpc"
awsvpc_conf = { subnets: network[:ecs_subnets] }
if task_def[:requires_compatibilities] == ["FARGATE"]
awsvpc_conf[:assign_public_ip] = "ENABLED"
optio... | ruby | def adjust_fargate_options(options)
task_def = recent_task_definition
return options unless task_def[:network_mode] == "awsvpc"
awsvpc_conf = { subnets: network[:ecs_subnets] }
if task_def[:requires_compatibilities] == ["FARGATE"]
awsvpc_conf[:assign_public_ip] = "ENABLED"
optio... | [
"def",
"adjust_fargate_options",
"(",
"options",
")",
"task_def",
"=",
"recent_task_definition",
"return",
"options",
"unless",
"task_def",
"[",
":network_mode",
"]",
"==",
"\"awsvpc\"",
"awsvpc_conf",
"=",
"{",
"subnets",
":",
"network",
"[",
":ecs_subnets",
"]",
... | adjust network_configuration based on fargate and network mode of awsvpc | [
"adjust",
"network_configuration",
"based",
"on",
"fargate",
"and",
"network",
"mode",
"of",
"awsvpc"
] | 16ac3dad28edcab2693c0e7d89a1971aca65b8f9 | https://github.com/tongueroo/ufo/blob/16ac3dad28edcab2693c0e7d89a1971aca65b8f9/lib/ufo/task.rb#L103-L115 |
13,273 | tongueroo/ufo | lib/ufo/task.rb | Ufo.Task.adjust_security_groups | def adjust_security_groups(options)
return options unless options[:network_configuration] &&
options[:network_configuration][:awsvpc_configuration]
awsvpc_conf = options[:network_configuration][:awsvpc_configuration]
security_groups = awsvpc_conf[:security_groups]
if [nil,... | ruby | def adjust_security_groups(options)
return options unless options[:network_configuration] &&
options[:network_configuration][:awsvpc_configuration]
awsvpc_conf = options[:network_configuration][:awsvpc_configuration]
security_groups = awsvpc_conf[:security_groups]
if [nil,... | [
"def",
"adjust_security_groups",
"(",
"options",
")",
"return",
"options",
"unless",
"options",
"[",
":network_configuration",
"]",
"&&",
"options",
"[",
":network_configuration",
"]",
"[",
":awsvpc_configuration",
"]",
"awsvpc_conf",
"=",
"options",
"[",
":network_co... | Ensures at least 1 security group is assigned if awsvpc_configuration
is provided. | [
"Ensures",
"at",
"least",
"1",
"security",
"group",
"is",
"assigned",
"if",
"awsvpc_configuration",
"is",
"provided",
"."
] | 16ac3dad28edcab2693c0e7d89a1971aca65b8f9 | https://github.com/tongueroo/ufo/blob/16ac3dad28edcab2693c0e7d89a1971aca65b8f9/lib/ufo/task.rb#L119-L139 |
13,274 | amatsuda/active_decorator | lib/active_decorator/decorator.rb | ActiveDecorator.Decorator.decorate_association | def decorate_association(owner, target)
owner.is_a?(ActiveDecorator::Decorated) ? decorate(target) : target
end | ruby | def decorate_association(owner, target)
owner.is_a?(ActiveDecorator::Decorated) ? decorate(target) : target
end | [
"def",
"decorate_association",
"(",
"owner",
",",
"target",
")",
"owner",
".",
"is_a?",
"(",
"ActiveDecorator",
"::",
"Decorated",
")",
"?",
"decorate",
"(",
"target",
")",
":",
"target",
"end"
] | Decorates AR model object's association only when the object was decorated.
Returns the association instance. | [
"Decorates",
"AR",
"model",
"object",
"s",
"association",
"only",
"when",
"the",
"object",
"was",
"decorated",
".",
"Returns",
"the",
"association",
"instance",
"."
] | e7cfa764e657ea8bbb4cbe92cb220ee67ebae58e | https://github.com/amatsuda/active_decorator/blob/e7cfa764e657ea8bbb4cbe92cb220ee67ebae58e/lib/active_decorator/decorator.rb#L61-L63 |
13,275 | amatsuda/active_decorator | lib/active_decorator/decorator.rb | ActiveDecorator.Decorator.decorator_for | def decorator_for(model_class)
return @@decorators[model_class] if @@decorators.key? model_class
decorator_name = "#{model_class.name}#{ActiveDecorator.config.decorator_suffix}"
d = Object.const_get decorator_name, false
unless Class === d
d.send :include, ActiveDecorator::Helpers
... | ruby | def decorator_for(model_class)
return @@decorators[model_class] if @@decorators.key? model_class
decorator_name = "#{model_class.name}#{ActiveDecorator.config.decorator_suffix}"
d = Object.const_get decorator_name, false
unless Class === d
d.send :include, ActiveDecorator::Helpers
... | [
"def",
"decorator_for",
"(",
"model_class",
")",
"return",
"@@decorators",
"[",
"model_class",
"]",
"if",
"@@decorators",
".",
"key?",
"model_class",
"decorator_name",
"=",
"\"#{model_class.name}#{ActiveDecorator.config.decorator_suffix}\"",
"d",
"=",
"Object",
".",
"cons... | Returns a decorator module for the given class.
Returns `nil` if no decorator module was found. | [
"Returns",
"a",
"decorator",
"module",
"for",
"the",
"given",
"class",
".",
"Returns",
"nil",
"if",
"no",
"decorator",
"module",
"was",
"found",
"."
] | e7cfa764e657ea8bbb4cbe92cb220ee67ebae58e | https://github.com/amatsuda/active_decorator/blob/e7cfa764e657ea8bbb4cbe92cb220ee67ebae58e/lib/active_decorator/decorator.rb#L68-L87 |
13,276 | Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2015-08-01/generated/azure_mgmt_web/app_service_certificate_orders.rb | Azure::Web::Mgmt::V2015_08_01.AppServiceCertificateOrders.delete | def delete(resource_group_name, certificate_order_name, custom_headers:nil)
response = delete_async(resource_group_name, certificate_order_name, custom_headers:custom_headers).value!
nil
end | ruby | def delete(resource_group_name, certificate_order_name, custom_headers:nil)
response = delete_async(resource_group_name, certificate_order_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"delete",
"(",
"resource_group_name",
",",
"certificate_order_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"delete_async",
"(",
"resource_group_name",
",",
"certificate_order_name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
... | Delete an existing certificate order.
Delete an existing certificate order.
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param certificate_order_name [String] Name of the certificate order.
@param custom_headers [Hash{String => String}] A hash of custom headers t... | [
"Delete",
"an",
"existing",
"certificate",
"order",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2015-08-01/generated/azure_mgmt_web/app_service_certificate_orders.rb#L473-L476 |
13,277 | Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2015-08-01/generated/azure_mgmt_web/app_service_certificate_orders.rb | Azure::Web::Mgmt::V2015_08_01.AppServiceCertificateOrders.resend_email | def resend_email(resource_group_name, certificate_order_name, custom_headers:nil)
response = resend_email_async(resource_group_name, certificate_order_name, custom_headers:custom_headers).value!
nil
end | ruby | def resend_email(resource_group_name, certificate_order_name, custom_headers:nil)
response = resend_email_async(resource_group_name, certificate_order_name, custom_headers:custom_headers).value!
nil
end | [
"def",
"resend_email",
"(",
"resource_group_name",
",",
"certificate_order_name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"resend_email_async",
"(",
"resource_group_name",
",",
"certificate_order_name",
",",
"custom_headers",
":custom_headers",
")",
".",
... | Resend certificate email.
Resend certificate email.
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param certificate_order_name [String] Name of the certificate order.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to th... | [
"Resend",
"certificate",
"email",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2015-08-01/generated/azure_mgmt_web/app_service_certificate_orders.rb#L1404-L1407 |
13,278 | Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2015-08-01/generated/azure_mgmt_web/app_service_certificate_orders.rb | Azure::Web::Mgmt::V2015_08_01.AppServiceCertificateOrders.retrieve_certificate_actions | def retrieve_certificate_actions(resource_group_name, name, custom_headers:nil)
response = retrieve_certificate_actions_async(resource_group_name, name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def retrieve_certificate_actions(resource_group_name, name, custom_headers:nil)
response = retrieve_certificate_actions_async(resource_group_name, name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"retrieve_certificate_actions",
"(",
"resource_group_name",
",",
"name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"retrieve_certificate_actions_async",
"(",
"resource_group_name",
",",
"name",
",",
"custom_headers",
":custom_headers",
")",
".",
"v... | Retrieve the list of certificate actions.
Retrieve the list of certificate actions.
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param name [String] Name of the certificate order.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will ... | [
"Retrieve",
"the",
"list",
"of",
"certificate",
"actions",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2015-08-01/generated/azure_mgmt_web/app_service_certificate_orders.rb#L1810-L1813 |
13,279 | Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2015-08-01/generated/azure_mgmt_web/app_service_certificate_orders.rb | Azure::Web::Mgmt::V2015_08_01.AppServiceCertificateOrders.retrieve_certificate_email_history | def retrieve_certificate_email_history(resource_group_name, name, custom_headers:nil)
response = retrieve_certificate_email_history_async(resource_group_name, name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def retrieve_certificate_email_history(resource_group_name, name, custom_headers:nil)
response = retrieve_certificate_email_history_async(resource_group_name, name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"retrieve_certificate_email_history",
"(",
"resource_group_name",
",",
"name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"retrieve_certificate_email_history_async",
"(",
"resource_group_name",
",",
"name",
",",
"custom_headers",
":custom_headers",
")",... | Retrieve email history.
Retrieve email history.
@param resource_group_name [String] Name of the resource group to which the
resource belongs.
@param name [String] Name of the certificate order.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@ret... | [
"Retrieve",
"email",
"history",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2015-08-01/generated/azure_mgmt_web/app_service_certificate_orders.rb#L1930-L1933 |
13,280 | Azure/azure-sdk-for-ruby | management/azure_mgmt_web/lib/2015-08-01/generated/azure_mgmt_web/app_service_certificate_orders.rb | Azure::Web::Mgmt::V2015_08_01.AppServiceCertificateOrders.list_by_resource_group_next | def list_by_resource_group_next(next_page_link, custom_headers:nil)
response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_by_resource_group_next(next_page_link, custom_headers:nil)
response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_by_resource_group_next",
"(",
"next_page_link",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_by_resource_group_next_async",
"(",
"next_page_link",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unle... | Get certificate orders in a resource group.
Get certificate orders in a resource group.
@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 [AppSe... | [
"Get",
"certificate",
"orders",
"in",
"a",
"resource",
"group",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_web/lib/2015-08-01/generated/azure_mgmt_web/app_service_certificate_orders.rb#L2403-L2406 |
13,281 | Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-12-01/generated/azure_mgmt_network/virtual_network_peerings.rb | Azure::Network::Mgmt::V2018_12_01.VirtualNetworkPeerings.get_with_http_info | def get_with_http_info(resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers:nil)
get_async(resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers:nil)
get_async(resource_group_name, virtual_network_name, virtual_network_peering_name, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"virtual_network_name",
",",
"virtual_network_peering_name",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"virtual_network_name",
",",
"virtual_network_peering_name",
",",
... | Gets the specified virtual network peering.
@param resource_group_name [String] The name of the resource group.
@param virtual_network_name [String] The name of the virtual network.
@param virtual_network_peering_name [String] The name of the virtual network
peering.
@param custom_headers [Hash{String => String}]... | [
"Gets",
"the",
"specified",
"virtual",
"network",
"peering",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-12-01/generated/azure_mgmt_network/virtual_network_peerings.rb#L95-L97 |
13,282 | Azure/azure-sdk-for-ruby | management/azure_mgmt_network/lib/2018-12-01/generated/azure_mgmt_network/virtual_network_peerings.rb | Azure::Network::Mgmt::V2018_12_01.VirtualNetworkPeerings.list | def list(resource_group_name, virtual_network_name, custom_headers:nil)
first_page = list_as_lazy(resource_group_name, virtual_network_name, custom_headers:custom_headers)
first_page.get_all_items
end | ruby | def list(resource_group_name, virtual_network_name, custom_headers:nil)
first_page = list_as_lazy(resource_group_name, virtual_network_name, custom_headers:custom_headers)
first_page.get_all_items
end | [
"def",
"list",
"(",
"resource_group_name",
",",
"virtual_network_name",
",",
"custom_headers",
":",
"nil",
")",
"first_page",
"=",
"list_as_lazy",
"(",
"resource_group_name",
",",
"virtual_network_name",
",",
"custom_headers",
":custom_headers",
")",
"first_page",
".",
... | Gets all virtual network peerings in a virtual network.
@param resource_group_name [String] The name of the resource group.
@param virtual_network_name [String] The name of the virtual network.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to the HTTP request.
@return... | [
"Gets",
"all",
"virtual",
"network",
"peerings",
"in",
"a",
"virtual",
"network",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_network/lib/2018-12-01/generated/azure_mgmt_network/virtual_network_peerings.rb#L223-L226 |
13,283 | Azure/azure-sdk-for-ruby | runtime/ms_rest_azure/lib/ms_rest_azure/azure_service_client.rb | MsRestAzure.AzureServiceClient.check_for_status_code_failure | def check_for_status_code_failure(azure_response)
fail MsRest::ValidationError, 'Azure response cannot be nil' if azure_response.nil?
fail MsRest::ValidationError, 'Azure response cannot have empty response object' if azure_response.response.nil?
fail MsRest::ValidationError, 'Azure response cannot ha... | ruby | def check_for_status_code_failure(azure_response)
fail MsRest::ValidationError, 'Azure response cannot be nil' if azure_response.nil?
fail MsRest::ValidationError, 'Azure response cannot have empty response object' if azure_response.response.nil?
fail MsRest::ValidationError, 'Azure response cannot ha... | [
"def",
"check_for_status_code_failure",
"(",
"azure_response",
")",
"fail",
"MsRest",
"::",
"ValidationError",
",",
"'Azure response cannot be nil'",
"if",
"azure_response",
".",
"nil?",
"fail",
"MsRest",
"::",
"ValidationError",
",",
"'Azure response cannot have empty respon... | Verifies for unexpected polling status code
@param azure_response [MsRestAzure::AzureOperationResponse] response from Azure service. | [
"Verifies",
"for",
"unexpected",
"polling",
"status",
"code"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/runtime/ms_rest_azure/lib/ms_rest_azure/azure_service_client.rb#L122-L133 |
13,284 | Azure/azure-sdk-for-ruby | runtime/ms_rest_azure/lib/ms_rest_azure/azure_service_client.rb | MsRestAzure.AzureServiceClient.update_state_from_get_resource_operation | def update_state_from_get_resource_operation(request, polling_state, custom_deserialization_block)
result = get_async_with_custom_deserialization(request, custom_deserialization_block)
fail AzureOperationError, 'The response from long running operation does not contain a body' if result.response.body.nil? ... | ruby | def update_state_from_get_resource_operation(request, polling_state, custom_deserialization_block)
result = get_async_with_custom_deserialization(request, custom_deserialization_block)
fail AzureOperationError, 'The response from long running operation does not contain a body' if result.response.body.nil? ... | [
"def",
"update_state_from_get_resource_operation",
"(",
"request",
",",
"polling_state",
",",
"custom_deserialization_block",
")",
"result",
"=",
"get_async_with_custom_deserialization",
"(",
"request",
",",
"custom_deserialization_block",
")",
"fail",
"AzureOperationError",
",... | Updates polling state based on location header for PUT HTTP requests.
@param request [MsRest::HttpOperationRequest] The url retrieve data from.
@param polling_state [MsRestAzure::PollingState] polling state to update.
@param custom_deserialization_block [Proc] custom deserialization method for parsing response. | [
"Updates",
"polling",
"state",
"based",
"on",
"location",
"header",
"for",
"PUT",
"HTTP",
"requests",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/runtime/ms_rest_azure/lib/ms_rest_azure/azure_service_client.rb#L141-L164 |
13,285 | Azure/azure-sdk-for-ruby | runtime/ms_rest_azure/lib/ms_rest_azure/azure_service_client.rb | MsRestAzure.AzureServiceClient.update_state_from_location_header | def update_state_from_location_header(request, polling_state, custom_deserialization_block, final_state_via = FinalStateVia::DEFAULT)
result = get_async_with_custom_deserialization(request, custom_deserialization_block)
polling_state.update_response(result.response)
polling_state.request = result.req... | ruby | def update_state_from_location_header(request, polling_state, custom_deserialization_block, final_state_via = FinalStateVia::DEFAULT)
result = get_async_with_custom_deserialization(request, custom_deserialization_block)
polling_state.update_response(result.response)
polling_state.request = result.req... | [
"def",
"update_state_from_location_header",
"(",
"request",
",",
"polling_state",
",",
"custom_deserialization_block",
",",
"final_state_via",
"=",
"FinalStateVia",
"::",
"DEFAULT",
")",
"result",
"=",
"get_async_with_custom_deserialization",
"(",
"request",
",",
"custom_de... | Updates polling state based on location header for HTTP requests.
@param request [MsRest::HttpOperationRequest] The url retrieve data from.
@param polling_state [MsRestAzure::PollingState] polling state to update.
@param custom_deserialization_block [Proc] custom deserialization method for parsing response.
@param ... | [
"Updates",
"polling",
"state",
"based",
"on",
"location",
"header",
"for",
"HTTP",
"requests",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/runtime/ms_rest_azure/lib/ms_rest_azure/azure_service_client.rb#L173-L198 |
13,286 | Azure/azure-sdk-for-ruby | runtime/ms_rest_azure/lib/ms_rest_azure/azure_service_client.rb | MsRestAzure.AzureServiceClient.update_state_from_azure_async_operation_header | def update_state_from_azure_async_operation_header(request, polling_state)
result = get_async_with_async_operation_deserialization(request)
fail AzureOperationError, 'The response from long running operation does not contain a body' if result.body.nil? || result.body.status.nil?
polling_state.status... | ruby | def update_state_from_azure_async_operation_header(request, polling_state)
result = get_async_with_async_operation_deserialization(request)
fail AzureOperationError, 'The response from long running operation does not contain a body' if result.body.nil? || result.body.status.nil?
polling_state.status... | [
"def",
"update_state_from_azure_async_operation_header",
"(",
"request",
",",
"polling_state",
")",
"result",
"=",
"get_async_with_async_operation_deserialization",
"(",
"request",
")",
"fail",
"AzureOperationError",
",",
"'The response from long running operation does not contain a ... | Updates polling state from Azure async operation header.
@param polling_state [MsRestAzure::PollingState] polling state. | [
"Updates",
"polling",
"state",
"from",
"Azure",
"async",
"operation",
"header",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/runtime/ms_rest_azure/lib/ms_rest_azure/azure_service_client.rb#L204-L216 |
13,287 | Azure/azure-sdk-for-ruby | management/azure_mgmt_recovery_services_site_recovery/lib/2016-08-10/generated/azure_mgmt_recovery_services_site_recovery/replication_alert_settings.rb | Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10.ReplicationAlertSettings.create | def create(alert_setting_name, request, custom_headers:nil)
response = create_async(alert_setting_name, request, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def create(alert_setting_name, request, custom_headers:nil)
response = create_async(alert_setting_name, request, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"create",
"(",
"alert_setting_name",
",",
"request",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"create_async",
"(",
"alert_setting_name",
",",
"request",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
... | Configures email notifications for this vault.
Create or update an email notification(alert) configuration.
@param alert_setting_name [String] The name of the email notification(alert)
configuration.
@param request [ConfigureAlertRequest] The input to configure the email
notification(alert).
@param custom_heade... | [
"Configures",
"email",
"notifications",
"for",
"this",
"vault",
"."
] | 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_alert_settings.rb#L137-L140 |
13,288 | Azure/azure-sdk-for-ruby | management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/record_sets.rb | Azure::PrivateDns::Mgmt::V2018_09_01.RecordSets.create_or_update_with_http_info | def create_or_update_with_http_info(resource_group_name, private_zone_name, record_type, relative_record_set_name, parameters, if_match:nil, if_none_match:nil, custom_headers:nil)
create_or_update_async(resource_group_name, private_zone_name, record_type, relative_record_set_name, parameters, if_match:if_match, i... | ruby | def create_or_update_with_http_info(resource_group_name, private_zone_name, record_type, relative_record_set_name, parameters, if_match:nil, if_none_match:nil, custom_headers:nil)
create_or_update_async(resource_group_name, private_zone_name, record_type, relative_record_set_name, parameters, if_match:if_match, i... | [
"def",
"create_or_update_with_http_info",
"(",
"resource_group_name",
",",
"private_zone_name",
",",
"record_type",
",",
"relative_record_set_name",
",",
"parameters",
",",
"if_match",
":",
"nil",
",",
"if_none_match",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")... | Creates or updates a record set within a Private DNS zone.
@param resource_group_name [String] The name of the resource group.
@param private_zone_name [String] The name of the Private DNS zone (without a
terminating dot).
@param record_type [RecordType] The type of DNS record in this record set.
Record sets of t... | [
"Creates",
"or",
"updates",
"a",
"record",
"set",
"within",
"a",
"Private",
"DNS",
"zone",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/record_sets.rb#L79-L81 |
13,289 | Azure/azure-sdk-for-ruby | management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/record_sets.rb | Azure::PrivateDns::Mgmt::V2018_09_01.RecordSets.list_with_http_info | def list_with_http_info(resource_group_name, private_zone_name, top:nil, recordsetnamesuffix:nil, custom_headers:nil)
list_async(resource_group_name, private_zone_name, top:top, recordsetnamesuffix:recordsetnamesuffix, custom_headers:custom_headers).value!
end | ruby | def list_with_http_info(resource_group_name, private_zone_name, top:nil, recordsetnamesuffix:nil, custom_headers:nil)
list_async(resource_group_name, private_zone_name, top:top, recordsetnamesuffix:recordsetnamesuffix, custom_headers:custom_headers).value!
end | [
"def",
"list_with_http_info",
"(",
"resource_group_name",
",",
"private_zone_name",
",",
"top",
":",
"nil",
",",
"recordsetnamesuffix",
":",
"nil",
",",
"custom_headers",
":",
"nil",
")",
"list_async",
"(",
"resource_group_name",
",",
"private_zone_name",
",",
"top"... | Lists all record sets in a Private DNS zone.
@param resource_group_name [String] The name of the resource group.
@param private_zone_name [String] The name of the Private DNS zone (without a
terminating dot).
@param top [Integer] The maximum number of record sets to return. If not
specified, returns up to 100 rec... | [
"Lists",
"all",
"record",
"sets",
"in",
"a",
"Private",
"DNS",
"zone",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_privatedns/lib/2018-09-01/generated/azure_mgmt_privatedns/record_sets.rb#L711-L713 |
13,290 | Azure/azure-sdk-for-ruby | management/azure_mgmt_postgresql/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/configurations.rb | Azure::Postgresql::Mgmt::V2017_12_01_preview.Configurations.get_with_http_info | def get_with_http_info(resource_group_name, server_name, configuration_name, custom_headers:nil)
get_async(resource_group_name, server_name, configuration_name, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, server_name, configuration_name, custom_headers:nil)
get_async(resource_group_name, server_name, configuration_name, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"server_name",
",",
"configuration_name",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"server_name",
",",
"configuration_name",
",",
"custom_headers",
":custom_headers"... | Gets information about a configuration of server.
@param resource_group_name [String] The name of the resource group that
contains the resource. You can obtain this value from the Azure Resource
Manager API or the portal.
@param server_name [String] The name of the server.
@param configuration_name [String] The n... | [
"Gets",
"information",
"about",
"a",
"configuration",
"of",
"server",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_postgresql/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/configurations.rb#L110-L112 |
13,291 | Azure/azure-sdk-for-ruby | management/azure_mgmt_storagesync/lib/2018-07-01/generated/azure_mgmt_storagesync/server_endpoints.rb | Azure::StorageSync::Mgmt::V2018_07_01.ServerEndpoints.get_with_http_info | def get_with_http_info(resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, custom_headers:nil)
get_async(resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, custom_headers:custom_headers).value!
end | ruby | def get_with_http_info(resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, custom_headers:nil)
get_async(resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, custom_headers:custom_headers).value!
end | [
"def",
"get_with_http_info",
"(",
"resource_group_name",
",",
"storage_sync_service_name",
",",
"sync_group_name",
",",
"server_endpoint_name",
",",
"custom_headers",
":",
"nil",
")",
"get_async",
"(",
"resource_group_name",
",",
"storage_sync_service_name",
",",
"sync_grou... | Get a ServerEndpoint.
@param resource_group_name [String] The name of the resource group. The name
is case insensitive.
@param storage_sync_service_name [String] Name of Storage Sync Service
resource.
@param sync_group_name [String] Name of Sync Group resource.
@param server_endpoint_name [String] Name of Server... | [
"Get",
"a",
"ServerEndpoint",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_storagesync/lib/2018-07-01/generated/azure_mgmt_storagesync/server_endpoints.rb#L165-L167 |
13,292 | Azure/azure-sdk-for-ruby | management/azure_mgmt_storagesync/lib/2018-07-01/generated/azure_mgmt_storagesync/server_endpoints.rb | Azure::StorageSync::Mgmt::V2018_07_01.ServerEndpoints.begin_delete_with_http_info | def begin_delete_with_http_info(resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, custom_headers:nil)
begin_delete_async(resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, custom_headers:custom_headers).value!
end | ruby | def begin_delete_with_http_info(resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, custom_headers:nil)
begin_delete_async(resource_group_name, storage_sync_service_name, sync_group_name, server_endpoint_name, custom_headers:custom_headers).value!
end | [
"def",
"begin_delete_with_http_info",
"(",
"resource_group_name",
",",
"storage_sync_service_name",
",",
"sync_group_name",
",",
"server_endpoint_name",
",",
"custom_headers",
":",
"nil",
")",
"begin_delete_async",
"(",
"resource_group_name",
",",
"storage_sync_service_name",
... | Delete a given ServerEndpoint.
@param resource_group_name [String] The name of the resource group. The name
is case insensitive.
@param storage_sync_service_name [String] Name of Storage Sync Service
resource.
@param sync_group_name [String] Name of Sync Group resource.
@param server_endpoint_name [String] Name ... | [
"Delete",
"a",
"given",
"ServerEndpoint",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_storagesync/lib/2018-07-01/generated/azure_mgmt_storagesync/server_endpoints.rb#L725-L727 |
13,293 | Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb | Azure::CognitiveServices::ComputerVision::V2_0.ComputerVisionClient.make_request_with_http_info | def make_request_with_http_info(method, path, options = {})
result = make_request_async(method, path, options).value!
result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
result
end | ruby | def make_request_with_http_info(method, path, options = {})
result = make_request_async(method, path, options).value!
result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
result
end | [
"def",
"make_request_with_http_info",
"(",
"method",
",",
"path",
",",
"options",
"=",
"{",
"}",
")",
"result",
"=",
"make_request_async",
"(",
"method",
",",
"path",
",",
"options",
")",
".",
"value!",
"result",
".",
"body",
"=",
"result",
".",
"response"... | Makes a request and returns the operation response.
@param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
@param path [String] the path, relative to {base_url}.
@param options [Hash{String=>String}] specifying any request options like :body.
@return [MsRestAzure::AzureOperation... | [
"Makes",
"a",
"request",
"and",
"returns",
"the",
"operation",
"response",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb#L85-L89 |
13,294 | Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb | Azure::CognitiveServices::ComputerVision::V2_0.ComputerVisionClient.make_request_async | def make_request_async(method, path, options = {})
fail ArgumentError, 'method is nil' if method.nil?
fail ArgumentError, 'path is nil' if path.nil?
request_url = options[:base_url] || @base_url
if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
@request_headers['Con... | ruby | def make_request_async(method, path, options = {})
fail ArgumentError, 'method is nil' if method.nil?
fail ArgumentError, 'path is nil' if path.nil?
request_url = options[:base_url] || @base_url
if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
@request_headers['Con... | [
"def",
"make_request_async",
"(",
"method",
",",
"path",
",",
"options",
"=",
"{",
"}",
")",
"fail",
"ArgumentError",
",",
"'method is nil'",
"if",
"method",
".",
"nil?",
"fail",
"ArgumentError",
",",
"'path is nil'",
"if",
"path",
".",
"nil?",
"request_url",
... | Makes a request asynchronously.
@param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
@param path [String] the path, relative to {base_url}.
@param options [Hash{String=>String}] specifying any request options like :body.
@return [Concurrent::Promise] Promise object which holds... | [
"Makes",
"a",
"request",
"asynchronously",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb#L98-L113 |
13,295 | Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb | Azure::CognitiveServices::ComputerVision::V2_0.ComputerVisionClient.get_text_operation_result | def get_text_operation_result(operation_id, custom_headers:nil)
response = get_text_operation_result_async(operation_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_text_operation_result(operation_id, custom_headers:nil)
response = get_text_operation_result_async(operation_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_text_operation_result",
"(",
"operation_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_text_operation_result_async",
"(",
"operation_id",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"... | This interface is used for getting text operation result. The URL to this
interface should be retrieved from 'Operation-Location' field returned from
Recognize Text interface.
@param operation_id [String] Id of the text operation returned in the
response of the 'Recognize Text'
@param custom_headers [Hash{String ... | [
"This",
"interface",
"is",
"used",
"for",
"getting",
"text",
"operation",
"result",
".",
"The",
"URL",
"to",
"this",
"interface",
"should",
"be",
"retrieved",
"from",
"Operation",
"-",
"Location",
"field",
"returned",
"from",
"Recognize",
"Text",
"interface",
... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb#L1491-L1494 |
13,296 | Azure/azure-sdk-for-ruby | data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb | Azure::CognitiveServices::ComputerVision::V2_0.ComputerVisionClient.get_read_operation_result | def get_read_operation_result(operation_id, custom_headers:nil)
response = get_read_operation_result_async(operation_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def get_read_operation_result(operation_id, custom_headers:nil)
response = get_read_operation_result_async(operation_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"get_read_operation_result",
"(",
"operation_id",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"get_read_operation_result_async",
"(",
"operation_id",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",
"unless",
"... | This interface is used for getting OCR results of Read operation. The URL to
this interface should be retrieved from "Operation-Location" field returned
from Batch Read File interface.
@param operation_id [String] Id of read operation returned in the response of
the "Batch Read File" interface.
@param custom_head... | [
"This",
"interface",
"is",
"used",
"for",
"getting",
"OCR",
"results",
"of",
"Read",
"operation",
".",
"The",
"URL",
"to",
"this",
"interface",
"should",
"be",
"retrieved",
"from",
"Operation",
"-",
"Location",
"field",
"returned",
"from",
"Batch",
"Read",
"... | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb#L1696-L1699 |
13,297 | Azure/azure-sdk-for-ruby | management/azure_mgmt_redis/lib/2017-02-01/generated/azure_mgmt_redis/redis.rb | Azure::Redis::Mgmt::V2017_02_01.Redis.update_with_http_info | def update_with_http_info(resource_group_name, name, parameters, custom_headers:nil)
update_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
end | ruby | def update_with_http_info(resource_group_name, name, parameters, custom_headers:nil)
update_async(resource_group_name, name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"update_with_http_info",
"(",
"resource_group_name",
",",
"name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"update_async",
"(",
"resource_group_name",
",",
"name",
",",
"parameters",
",",
"custom_headers",
":custom_headers",
")",
".",
"value... | Update an existing Redis cache.
@param resource_group_name [String] The name of the resource group.
@param name [String] The name of the Redis cache.
@param parameters [RedisUpdateParameters] Parameters supplied to the Update
Redis operation.
@param custom_headers [Hash{String => String}] A hash of custom headers... | [
"Update",
"an",
"existing",
"Redis",
"cache",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_redis/lib/2017-02-01/generated/azure_mgmt_redis/redis.rb#L100-L102 |
13,298 | Azure/azure-sdk-for-ruby | management/azure_mgmt_redis/lib/2017-02-01/generated/azure_mgmt_redis/redis.rb | Azure::Redis::Mgmt::V2017_02_01.Redis.list_keys | def list_keys(resource_group_name, name, custom_headers:nil)
response = list_keys_async(resource_group_name, name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | ruby | def list_keys(resource_group_name, name, custom_headers:nil)
response = list_keys_async(resource_group_name, name, custom_headers:custom_headers).value!
response.body unless response.nil?
end | [
"def",
"list_keys",
"(",
"resource_group_name",
",",
"name",
",",
"custom_headers",
":",
"nil",
")",
"response",
"=",
"list_keys_async",
"(",
"resource_group_name",
",",
"name",
",",
"custom_headers",
":custom_headers",
")",
".",
"value!",
"response",
".",
"body",... | Retrieve a Redis cache's access keys. This operation requires write
permission to the cache resource.
@param resource_group_name [String] The name of the resource group.
@param name [String] The name of the Redis cache.
@param custom_headers [Hash{String => String}] A hash of custom headers that
will be added to ... | [
"Retrieve",
"a",
"Redis",
"cache",
"s",
"access",
"keys",
".",
"This",
"operation",
"requires",
"write",
"permission",
"to",
"the",
"cache",
"resource",
"."
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_redis/lib/2017-02-01/generated/azure_mgmt_redis/redis.rb#L490-L493 |
13,299 | Azure/azure-sdk-for-ruby | management/azure_mgmt_redis/lib/2017-02-01/generated/azure_mgmt_redis/firewall_rules.rb | Azure::Redis::Mgmt::V2017_02_01.FirewallRules.create_or_update_with_http_info | def create_or_update_with_http_info(resource_group_name, cache_name, rule_name, parameters, custom_headers:nil)
create_or_update_async(resource_group_name, cache_name, rule_name, parameters, custom_headers:custom_headers).value!
end | ruby | def create_or_update_with_http_info(resource_group_name, cache_name, rule_name, parameters, custom_headers:nil)
create_or_update_async(resource_group_name, cache_name, rule_name, parameters, custom_headers:custom_headers).value!
end | [
"def",
"create_or_update_with_http_info",
"(",
"resource_group_name",
",",
"cache_name",
",",
"rule_name",
",",
"parameters",
",",
"custom_headers",
":",
"nil",
")",
"create_or_update_async",
"(",
"resource_group_name",
",",
"cache_name",
",",
"rule_name",
",",
"paramet... | Create or update a redis cache firewall rule
@param resource_group_name [String] The name of the resource group.
@param cache_name [String] The name of the Redis cache.
@param rule_name [String] The name of the firewall rule.
@param parameters [RedisFirewallRule] Parameters supplied to the create or
update redis ... | [
"Create",
"or",
"update",
"a",
"redis",
"cache",
"firewall",
"rule"
] | 78eedacf8f8cbd65c2d8a2af421405eaa4373d8e | https://github.com/Azure/azure-sdk-for-ruby/blob/78eedacf8f8cbd65c2d8a2af421405eaa4373d8e/management/azure_mgmt_redis/lib/2017-02-01/generated/azure_mgmt_redis/firewall_rules.rb#L147-L149 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.