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
partition
stringclasses
1 value
SciRuby/daru-view
lib/daru/view/adapters/highcharts/display.rb
LazyHighCharts.HighChart.extract_export_code_iruby
def extract_export_code_iruby( placeholder=random_canvas_id, export_type='png', file_name='chart' ) js = '' js << "\n <script>" js << "\n (function() {" js << "\n \tvar chartDom = document.getElementById('#{placeholder}');" js << "\n \tvar chart = Highcharts.charts[Highcharts.att...
ruby
def extract_export_code_iruby( placeholder=random_canvas_id, export_type='png', file_name='chart' ) js = '' js << "\n <script>" js << "\n (function() {" js << "\n \tvar chartDom = document.getElementById('#{placeholder}');" js << "\n \tvar chart = Highcharts.charts[Highcharts.att...
[ "def", "extract_export_code_iruby", "(", "placeholder", "=", "random_canvas_id", ",", "export_type", "=", "'png'", ",", "file_name", "=", "'chart'", ")", "js", "=", "''", "js", "<<", "\"\\n <script>\"", "js", "<<", "\"\\n (function() {\"", "js", "<<", "\"\\n \\tva...
Returns the script to export the chart in different formats in IRuby notebook @param (see #extract_export_code) @return [String] the script to export the chart in IRuby notebook
[ "Returns", "the", "script", "to", "export", "the", "chart", "in", "different", "formats", "in", "IRuby", "notebook" ]
7662fae07a2f339d9600c1dda263b8e409fc5592
https://github.com/SciRuby/daru-view/blob/7662fae07a2f339d9600c1dda263b8e409fc5592/lib/daru/view/adapters/highcharts/display.rb#L229-L245
train
chef/omnibus-ctl
lib/omnibus-ctl.rb
Omnibus.Ctl.get_all_commands_hash
def get_all_commands_hash without_categories = {} category_command_map.each do |category, commands| without_categories.merge!(commands) end command_map.merge(without_categories) end
ruby
def get_all_commands_hash without_categories = {} category_command_map.each do |category, commands| without_categories.merge!(commands) end command_map.merge(without_categories) end
[ "def", "get_all_commands_hash", "without_categories", "=", "{", "}", "category_command_map", ".", "each", "do", "|", "category", ",", "commands", "|", "without_categories", ".", "merge!", "(", "commands", ")", "end", "command_map", ".", "merge", "(", "without_cate...
merges category_command_map and command_map, removing categories
[ "merges", "category_command_map", "and", "command_map", "removing", "categories" ]
e160156deaa0afc037748b10d1c9ef0a5be97dc1
https://github.com/chef/omnibus-ctl/blob/e160156deaa0afc037748b10d1c9ef0a5be97dc1/lib/omnibus-ctl.rb#L173-L179
train
chef/omnibus-ctl
lib/omnibus-ctl.rb
Omnibus.Ctl.run_sv_command_for_service
def run_sv_command_for_service(sv_cmd, service_name) if service_enabled?(service_name) status = run_command("#{base_path}/init/#{service_name} #{sv_cmd}") status.exitstatus else log "#{service_name} disabled" if sv_cmd == "status" && verbose 0 end end
ruby
def run_sv_command_for_service(sv_cmd, service_name) if service_enabled?(service_name) status = run_command("#{base_path}/init/#{service_name} #{sv_cmd}") status.exitstatus else log "#{service_name} disabled" if sv_cmd == "status" && verbose 0 end end
[ "def", "run_sv_command_for_service", "(", "sv_cmd", ",", "service_name", ")", "if", "service_enabled?", "(", "service_name", ")", "status", "=", "run_command", "(", "\"#{base_path}/init/#{service_name} #{sv_cmd}\"", ")", "status", ".", "exitstatus", "else", "log", "\"#{...
run an sv command for a specific service name
[ "run", "an", "sv", "command", "for", "a", "specific", "service", "name" ]
e160156deaa0afc037748b10d1c9ef0a5be97dc1
https://github.com/chef/omnibus-ctl/blob/e160156deaa0afc037748b10d1c9ef0a5be97dc1/lib/omnibus-ctl.rb#L363-L371
train
chef/omnibus-ctl
lib/omnibus-ctl.rb
Omnibus.Ctl.parse_options
def parse_options(args) args.select do |option| case option when "--quiet", "-q" @quiet = true false when "--verbose", "-v" @verbose = true false end end end
ruby
def parse_options(args) args.select do |option| case option when "--quiet", "-q" @quiet = true false when "--verbose", "-v" @verbose = true false end end end
[ "def", "parse_options", "(", "args", ")", "args", ".", "select", "do", "|", "option", "|", "case", "option", "when", "\"--quiet\"", ",", "\"-q\"", "@quiet", "=", "true", "false", "when", "\"--verbose\"", ",", "\"-v\"", "@verbose", "=", "true", "false", "en...
Set global options and remove them from the args list we pass into commands.
[ "Set", "global", "options", "and", "remove", "them", "from", "the", "args", "list", "we", "pass", "into", "commands", "." ]
e160156deaa0afc037748b10d1c9ef0a5be97dc1
https://github.com/chef/omnibus-ctl/blob/e160156deaa0afc037748b10d1c9ef0a5be97dc1/lib/omnibus-ctl.rb#L651-L662
train
chef/omnibus-ctl
lib/omnibus-ctl.rb
Omnibus.Ctl.retrieve_command
def retrieve_command(command_to_run) if command_map.has_key?(command_to_run) command_map[command_to_run] else command = nil category_command_map.each do |category, commands| command = commands[command_to_run] if commands.has_key?(command_to_run) end # return...
ruby
def retrieve_command(command_to_run) if command_map.has_key?(command_to_run) command_map[command_to_run] else command = nil category_command_map.each do |category, commands| command = commands[command_to_run] if commands.has_key?(command_to_run) end # return...
[ "def", "retrieve_command", "(", "command_to_run", ")", "if", "command_map", ".", "has_key?", "(", "command_to_run", ")", "command_map", "[", "command_to_run", "]", "else", "command", "=", "nil", "category_command_map", ".", "each", "do", "|", "category", ",", "c...
retrieves the commmand from either the command_map or the category_command_map, if the command is not found return nil
[ "retrieves", "the", "commmand", "from", "either", "the", "command_map", "or", "the", "category_command_map", "if", "the", "command", "is", "not", "found", "return", "nil" ]
e160156deaa0afc037748b10d1c9ef0a5be97dc1
https://github.com/chef/omnibus-ctl/blob/e160156deaa0afc037748b10d1c9ef0a5be97dc1/lib/omnibus-ctl.rb#L672-L683
train
chef/omnibus-ctl
lib/omnibus-ctl.rb
Omnibus.Ctl.run
def run(args) # Ensure Omnibus related binaries are in the PATH ENV["PATH"] = [File.join(base_path, "bin"), File.join(base_path, "embedded","bin"), ENV['PATH']].join(":") command_to_run = args[0] ## when --help is run as the command itself, we need to ...
ruby
def run(args) # Ensure Omnibus related binaries are in the PATH ENV["PATH"] = [File.join(base_path, "bin"), File.join(base_path, "embedded","bin"), ENV['PATH']].join(":") command_to_run = args[0] ## when --help is run as the command itself, we need to ...
[ "def", "run", "(", "args", ")", "ENV", "[", "\"PATH\"", "]", "=", "[", "File", ".", "join", "(", "base_path", ",", "\"bin\"", ")", ",", "File", ".", "join", "(", "base_path", ",", "\"embedded\"", ",", "\"bin\"", ")", ",", "ENV", "[", "'PATH'", "]",...
Previously this would exit immediately with the provided exit code; however this would prevent post-run hooks from continuing Instead, we'll just track whether a an exit was requested and use that to determine how we exit from 'run'
[ "Previously", "this", "would", "exit", "immediately", "with", "the", "provided", "exit", "code", ";", "however", "this", "would", "prevent", "post", "-", "run", "hooks", "from", "continuing", "Instead", "we", "ll", "just", "track", "whether", "a", "an", "exi...
e160156deaa0afc037748b10d1c9ef0a5be97dc1
https://github.com/chef/omnibus-ctl/blob/e160156deaa0afc037748b10d1c9ef0a5be97dc1/lib/omnibus-ctl.rb#L689-L764
train
chef/omnibus-ctl
lib/omnibus-ctl.rb
Omnibus.Ctl.status_post_hook
def status_post_hook(service = nil) if service.nil? log_external_service_header external_services.each_key do |service_name| status = send(to_method_name("external_status_#{service_name}"), :sparse) log status end else # Request verbose status if the servi...
ruby
def status_post_hook(service = nil) if service.nil? log_external_service_header external_services.each_key do |service_name| status = send(to_method_name("external_status_#{service_name}"), :sparse) log status end else # Request verbose status if the servi...
[ "def", "status_post_hook", "(", "service", "=", "nil", ")", "if", "service", ".", "nil?", "log_external_service_header", "external_services", ".", "each_key", "do", "|", "service_name", "|", "status", "=", "send", "(", "to_method_name", "(", "\"external_status_#{ser...
Status gets its own hook because each externalized service will have its own things to do in order to report status. As above, we may also include an output header to show that we're reporting on external services. Your callback for this function should be in the form 'external_status_#{service_name}(detail_level...
[ "Status", "gets", "its", "own", "hook", "because", "each", "externalized", "service", "will", "have", "its", "own", "things", "to", "do", "in", "order", "to", "report", "status", ".", "As", "above", "we", "may", "also", "include", "an", "output", "header",...
e160156deaa0afc037748b10d1c9ef0a5be97dc1
https://github.com/chef/omnibus-ctl/blob/e160156deaa0afc037748b10d1c9ef0a5be97dc1/lib/omnibus-ctl.rb#L834-L848
train
algolia/algoliasearch-client-ruby
lib/algolia/client.rb
Algolia.Client.enable_rate_limit_forward
def enable_rate_limit_forward(admin_api_key, end_user_ip, rate_limit_api_key) headers[Protocol::HEADER_API_KEY] = admin_api_key headers[Protocol::HEADER_FORWARDED_IP] = end_user_ip headers[Protocol::HEADER_FORWARDED_API_KEY] = rate_limit_api_key end
ruby
def enable_rate_limit_forward(admin_api_key, end_user_ip, rate_limit_api_key) headers[Protocol::HEADER_API_KEY] = admin_api_key headers[Protocol::HEADER_FORWARDED_IP] = end_user_ip headers[Protocol::HEADER_FORWARDED_API_KEY] = rate_limit_api_key end
[ "def", "enable_rate_limit_forward", "(", "admin_api_key", ",", "end_user_ip", ",", "rate_limit_api_key", ")", "headers", "[", "Protocol", "::", "HEADER_API_KEY", "]", "=", "admin_api_key", "headers", "[", "Protocol", "::", "HEADER_FORWARDED_IP", "]", "=", "end_user_ip...
Allow to use IP rate limit when you have a proxy between end-user and Algolia. This option will set the X-Forwarded-For HTTP header with the client IP and the X-Forwarded-API-Key with the API Key having rate limits. @param admin_api_key the admin API Key you can find in your dashboard @param end_user_ip the end use...
[ "Allow", "to", "use", "IP", "rate", "limit", "when", "you", "have", "a", "proxy", "between", "end", "-", "user", "and", "Algolia", ".", "This", "option", "will", "set", "the", "X", "-", "Forwarded", "-", "For", "HTTP", "header", "with", "the", "client"...
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/client.rb#L85-L89
train
algolia/algoliasearch-client-ruby
lib/algolia/client.rb
Algolia.Client.multiple_queries
def multiple_queries(queries, options = nil, strategy = nil) if options.is_a?(Hash) index_name_key = options.delete(:index_name_key) || options.delete('index_name_key') strategy = options.delete(:strategy) || options.delete('strategy') request_options = options.delete(:request_options) || ...
ruby
def multiple_queries(queries, options = nil, strategy = nil) if options.is_a?(Hash) index_name_key = options.delete(:index_name_key) || options.delete('index_name_key') strategy = options.delete(:strategy) || options.delete('strategy') request_options = options.delete(:request_options) || ...
[ "def", "multiple_queries", "(", "queries", ",", "options", "=", "nil", ",", "strategy", "=", "nil", ")", "if", "options", ".", "is_a?", "(", "Hash", ")", "index_name_key", "=", "options", ".", "delete", "(", ":index_name_key", ")", "||", "options", ".", ...
This method allows to query multiple indexes with one API call @param queries the array of hash representing the query and associated index name @param options - accepts those keys: - index_name_key the name of the key used to fetch the index_name (:index_name by default) - strategy define the strategy applied...
[ "This", "method", "allows", "to", "query", "multiple", "indexes", "with", "one", "API", "call" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/client.rb#L121-L144
train
algolia/algoliasearch-client-ruby
lib/algolia/client.rb
Algolia.Client.move_index
def move_index(src_index, dst_index, request_options = {}) request = { 'operation' => 'move', 'destination' => dst_index } post(Protocol.index_operation_uri(src_index), request.to_json, :write, request_options) end
ruby
def move_index(src_index, dst_index, request_options = {}) request = { 'operation' => 'move', 'destination' => dst_index } post(Protocol.index_operation_uri(src_index), request.to_json, :write, request_options) end
[ "def", "move_index", "(", "src_index", ",", "dst_index", ",", "request_options", "=", "{", "}", ")", "request", "=", "{", "'operation'", "=>", "'move'", ",", "'destination'", "=>", "dst_index", "}", "post", "(", "Protocol", ".", "index_operation_uri", "(", "...
Move an existing index. @param src_index the name of index to copy. @param dst_index the new index name that will contains a copy of srcIndexName (destination will be overriten if it already exist). @param request_options contains extra parameters to send with your query
[ "Move", "an", "existing", "index", "." ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/client.rb#L177-L180
train
algolia/algoliasearch-client-ruby
lib/algolia/client.rb
Algolia.Client.move_index!
def move_index!(src_index, dst_index, request_options = {}) res = move_index(src_index, dst_index, request_options) wait_task(dst_index, res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
ruby
def move_index!(src_index, dst_index, request_options = {}) res = move_index(src_index, dst_index, request_options) wait_task(dst_index, res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
[ "def", "move_index!", "(", "src_index", ",", "dst_index", ",", "request_options", "=", "{", "}", ")", "res", "=", "move_index", "(", "src_index", ",", "dst_index", ",", "request_options", ")", "wait_task", "(", "dst_index", ",", "res", "[", "'taskID'", "]", ...
Move an existing index and wait until the move has been processed @param src_index the name of index to copy. @param dst_index the new index name that will contains a copy of srcIndexName (destination will be overriten if it already exist). @param request_options contains extra parameters to send with your query
[ "Move", "an", "existing", "index", "and", "wait", "until", "the", "move", "has", "been", "processed" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/client.rb#L189-L193
train
algolia/algoliasearch-client-ruby
lib/algolia/client.rb
Algolia.Client.copy_index
def copy_index(src_index, dst_index, scope = nil, request_options = {}) request = { 'operation' => 'copy', 'destination' => dst_index } request['scope'] = scope unless scope.nil? post(Protocol.index_operation_uri(src_index), request.to_json, :write, request_options) end
ruby
def copy_index(src_index, dst_index, scope = nil, request_options = {}) request = { 'operation' => 'copy', 'destination' => dst_index } request['scope'] = scope unless scope.nil? post(Protocol.index_operation_uri(src_index), request.to_json, :write, request_options) end
[ "def", "copy_index", "(", "src_index", ",", "dst_index", ",", "scope", "=", "nil", ",", "request_options", "=", "{", "}", ")", "request", "=", "{", "'operation'", "=>", "'copy'", ",", "'destination'", "=>", "dst_index", "}", "request", "[", "'scope'", "]",...
Copy an existing index. @param src_index the name of index to copy. @param dst_index the new index name that will contains a copy of srcIndexName (destination will be overriten if it already exist). @param scope the optional list of scopes to copy (all if not specified). @param request_options contains extra param...
[ "Copy", "an", "existing", "index", "." ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/client.rb#L203-L207
train
algolia/algoliasearch-client-ruby
lib/algolia/client.rb
Algolia.Client.copy_index!
def copy_index!(src_index, dst_index, scope = nil, request_options = {}) res = copy_index(src_index, dst_index, scope, request_options) wait_task(dst_index, res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
ruby
def copy_index!(src_index, dst_index, scope = nil, request_options = {}) res = copy_index(src_index, dst_index, scope, request_options) wait_task(dst_index, res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
[ "def", "copy_index!", "(", "src_index", ",", "dst_index", ",", "scope", "=", "nil", ",", "request_options", "=", "{", "}", ")", "res", "=", "copy_index", "(", "src_index", ",", "dst_index", ",", "scope", ",", "request_options", ")", "wait_task", "(", "dst_...
Copy an existing index and wait until the copy has been processed. @param src_index the name of index to copy. @param dst_index the new index name that will contains a copy of srcIndexName (destination will be overriten if it already exist). @param scope the optional list of scopes to copy (all if not specified). ...
[ "Copy", "an", "existing", "index", "and", "wait", "until", "the", "copy", "has", "been", "processed", "." ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/client.rb#L217-L221
train
algolia/algoliasearch-client-ruby
lib/algolia/client.rb
Algolia.Client.copy_settings!
def copy_settings!(src_index, dst_index, request_options = {}) res = copy_settings(src_index, dst_index, request_options) wait_task(dst_index, res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
ruby
def copy_settings!(src_index, dst_index, request_options = {}) res = copy_settings(src_index, dst_index, request_options) wait_task(dst_index, res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
[ "def", "copy_settings!", "(", "src_index", ",", "dst_index", ",", "request_options", "=", "{", "}", ")", "res", "=", "copy_settings", "(", "src_index", ",", "dst_index", ",", "request_options", ")", "wait_task", "(", "dst_index", ",", "res", "[", "'taskID'", ...
Copy an existing index settings and wait until the copy has been processed. @param src_index the name of index to copy. @param dst_index the new index name that will contains a copy of srcIndexName settings (destination settings will be overriten if it already exist). @param request_options contains extra parameter...
[ "Copy", "an", "existing", "index", "settings", "and", "wait", "until", "the", "copy", "has", "been", "processed", "." ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/client.rb#L241-L245
train
algolia/algoliasearch-client-ruby
lib/algolia/client.rb
Algolia.Client.copy_synonyms!
def copy_synonyms!(src_index, dst_index, request_options = {}) res = copy_synonyms(src_index, dst_index, request_options) wait_task(dst_index, res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
ruby
def copy_synonyms!(src_index, dst_index, request_options = {}) res = copy_synonyms(src_index, dst_index, request_options) wait_task(dst_index, res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
[ "def", "copy_synonyms!", "(", "src_index", ",", "dst_index", ",", "request_options", "=", "{", "}", ")", "res", "=", "copy_synonyms", "(", "src_index", ",", "dst_index", ",", "request_options", ")", "wait_task", "(", "dst_index", ",", "res", "[", "'taskID'", ...
Copy an existing index synonyms and wait until the copy has been processed. @param src_index the name of index to copy. @param dst_index the new index name that will contains a copy of srcIndexName synonyms (destination synonyms will be overriten if it already exist). @param request_options contains extra parameter...
[ "Copy", "an", "existing", "index", "synonyms", "and", "wait", "until", "the", "copy", "has", "been", "processed", "." ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/client.rb#L265-L269
train
algolia/algoliasearch-client-ruby
lib/algolia/client.rb
Algolia.Client.copy_rules!
def copy_rules!(src_index, dst_index, request_options = {}) res = copy_rules(src_index, dst_index, request_options) wait_task(dst_index, res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
ruby
def copy_rules!(src_index, dst_index, request_options = {}) res = copy_rules(src_index, dst_index, request_options) wait_task(dst_index, res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
[ "def", "copy_rules!", "(", "src_index", ",", "dst_index", ",", "request_options", "=", "{", "}", ")", "res", "=", "copy_rules", "(", "src_index", ",", "dst_index", ",", "request_options", ")", "wait_task", "(", "dst_index", ",", "res", "[", "'taskID'", "]", ...
Copy an existing index rules and wait until the copy has been processed. @param src_index the name of index to copy. @param dst_index the new index name that will contains a copy of srcIndexName rules (destination rules will be overriten if it already exist). @param request_options contains extra parameters to send...
[ "Copy", "an", "existing", "index", "rules", "and", "wait", "until", "the", "copy", "has", "been", "processed", "." ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/client.rb#L289-L293
train
algolia/algoliasearch-client-ruby
lib/algolia/client.rb
Algolia.Client.get_logs
def get_logs(options = nil, length = nil, type = nil) if options.is_a?(Hash) offset = options.delete('offset') || options.delete(:offset) length = options.delete('length') || options.delete(:length) type = options.delete('type') || options.delete(:type) request_options = options.de...
ruby
def get_logs(options = nil, length = nil, type = nil) if options.is_a?(Hash) offset = options.delete('offset') || options.delete(:offset) length = options.delete('length') || options.delete(:length) type = options.delete('type') || options.delete(:type) request_options = options.de...
[ "def", "get_logs", "(", "options", "=", "nil", ",", "length", "=", "nil", ",", "type", "=", "nil", ")", "if", "options", ".", "is_a?", "(", "Hash", ")", "offset", "=", "options", ".", "delete", "(", "'offset'", ")", "||", "options", ".", "delete", ...
Return last logs entries. @param options - accepts those keys: - offset Specify the first entry to retrieve (0-based, 0 is the most recent log entry) - Default = 0 - length Specify the maximum number of entries to retrieve starting at offset. Maximum allowed value: 1000 - Default = 10 - type Type of log entr...
[ "Return", "last", "logs", "entries", "." ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/client.rb#L322-L338
train
algolia/algoliasearch-client-ruby
lib/algolia/client.rb
Algolia.Client.batch!
def batch!(operations, request_options = {}) res = batch(operations, request_options) res['taskID'].each do |index, taskID| wait_task(index, taskID, WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) end end
ruby
def batch!(operations, request_options = {}) res = batch(operations, request_options) res['taskID'].each do |index, taskID| wait_task(index, taskID, WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) end end
[ "def", "batch!", "(", "operations", ",", "request_options", "=", "{", "}", ")", "res", "=", "batch", "(", "operations", ",", "request_options", ")", "res", "[", "'taskID'", "]", ".", "each", "do", "|", "index", ",", "taskID", "|", "wait_task", "(", "in...
Send a batch request targeting multiple indices and wait the end of the indexing
[ "Send", "a", "batch", "request", "targeting", "multiple", "indices", "and", "wait", "the", "end", "of", "the", "indexing" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/client.rb#L475-L480
train
algolia/algoliasearch-client-ruby
lib/algolia/client.rb
Algolia.Client.get_task_status
def get_task_status(index_name, taskID, request_options = {}) get(Protocol.task_uri(index_name, taskID), :read, request_options)['status'] end
ruby
def get_task_status(index_name, taskID, request_options = {}) get(Protocol.task_uri(index_name, taskID), :read, request_options)['status'] end
[ "def", "get_task_status", "(", "index_name", ",", "taskID", ",", "request_options", "=", "{", "}", ")", "get", "(", "Protocol", ".", "task_uri", "(", "index_name", ",", "taskID", ")", ",", ":read", ",", "request_options", ")", "[", "'status'", "]", "end" ]
Check the status of a task on the server. All server task are asynchronous and you can check the status of a task with this method. @param index_name the index name owning the taskID @param taskID the id of the task returned by server @param request_options contains extra parameters to send with your query
[ "Check", "the", "status", "of", "a", "task", "on", "the", "server", ".", "All", "server", "task", "are", "asynchronous", "and", "you", "can", "check", "the", "status", "of", "a", "task", "with", "this", "method", "." ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/client.rb#L490-L492
train
algolia/algoliasearch-client-ruby
lib/algolia/client.rb
Algolia.Client.request
def request(uri, method, data = nil, type = :write, request_options = {}) exceptions = [] connect_timeout = @connect_timeout send_timeout = if type == :search @search_timeout elsif type == :batch type = :write @batch_timeout else @send_timeout end ...
ruby
def request(uri, method, data = nil, type = :write, request_options = {}) exceptions = [] connect_timeout = @connect_timeout send_timeout = if type == :search @search_timeout elsif type == :batch type = :write @batch_timeout else @send_timeout end ...
[ "def", "request", "(", "uri", ",", "method", ",", "data", "=", "nil", ",", "type", "=", ":write", ",", "request_options", "=", "{", "}", ")", "exceptions", "=", "[", "]", "connect_timeout", "=", "@connect_timeout", "send_timeout", "=", "if", "type", "=="...
Perform an HTTP request for the given uri and method with common basic response handling. Will raise a AlgoliaProtocolError if the response has an error status code, and will return the parsed JSON body on success, if there is one.
[ "Perform", "an", "HTTP", "request", "for", "the", "given", "uri", "and", "method", "with", "common", "basic", "response", "handling", ".", "Will", "raise", "a", "AlgoliaProtocolError", "if", "the", "response", "has", "an", "error", "status", "code", "and", "...
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/client.rb#L566-L603
train
algolia/algoliasearch-client-ruby
lib/algolia/client.rb
Algolia.Client.thread_local_hosts
def thread_local_hosts(read) thread_hosts_key = read ? "algolia_search_hosts_#{application_id}" : "algolia_hosts_#{application_id}" Thread.current[thread_hosts_key] ||= (read ? search_hosts : hosts).each_with_index.map do |host, i| client = HTTPClient.new client.ssl_config.ssl_version = @ssl...
ruby
def thread_local_hosts(read) thread_hosts_key = read ? "algolia_search_hosts_#{application_id}" : "algolia_hosts_#{application_id}" Thread.current[thread_hosts_key] ||= (read ? search_hosts : hosts).each_with_index.map do |host, i| client = HTTPClient.new client.ssl_config.ssl_version = @ssl...
[ "def", "thread_local_hosts", "(", "read", ")", "thread_hosts_key", "=", "read", "?", "\"algolia_search_hosts_#{application_id}\"", ":", "\"algolia_hosts_#{application_id}\"", "Thread", ".", "current", "[", "thread_hosts_key", "]", "||=", "(", "read", "?", "search_hosts", ...
This method returns a thread-local array of sessions
[ "This", "method", "returns", "a", "thread", "-", "local", "array", "of", "sessions" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/client.rb#L626-L653
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.delete!
def delete!(request_options = {}) res = delete(request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
ruby
def delete!(request_options = {}) res = delete(request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
[ "def", "delete!", "(", "request_options", "=", "{", "}", ")", "res", "=", "delete", "(", "request_options", ")", "wait_task", "(", "res", "[", "'taskID'", "]", ",", "WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY", ",", "request_options", ")", "res", "end" ]
Delete an index and wait until the deletion has been processed @param request_options contains extra parameters to send with your query return an hash of the form { "deletedAt" => "2013-01-18T15:33:13.556Z", "taskID" => "42" }
[ "Delete", "an", "index", "and", "wait", "until", "the", "deletion", "has", "been", "processed" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L33-L37
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.add_object
def add_object(object, objectID = nil, request_options = {}) check_object(object) if objectID.nil? || objectID.to_s.empty? client.post(Protocol.index_uri(name), object.to_json, :write, request_options) else client.put(Protocol.object_uri(name, objectID), object.to_json, :write, request...
ruby
def add_object(object, objectID = nil, request_options = {}) check_object(object) if objectID.nil? || objectID.to_s.empty? client.post(Protocol.index_uri(name), object.to_json, :write, request_options) else client.put(Protocol.object_uri(name, objectID), object.to_json, :write, request...
[ "def", "add_object", "(", "object", ",", "objectID", "=", "nil", ",", "request_options", "=", "{", "}", ")", "check_object", "(", "object", ")", "if", "objectID", ".", "nil?", "||", "objectID", ".", "to_s", ".", "empty?", "client", ".", "post", "(", "P...
Add an object in this index @param object the object to add to the index. The object is represented by an associative array @param objectID (optional) an objectID you want to attribute to this object (if the attribute already exist the old object will be overridden) @param request_options contains extra paramet...
[ "Add", "an", "object", "in", "this", "index" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L49-L56
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.add_object!
def add_object!(object, objectID = nil, request_options = {}) res = add_object(object, objectID, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
ruby
def add_object!(object, objectID = nil, request_options = {}) res = add_object(object, objectID, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
[ "def", "add_object!", "(", "object", ",", "objectID", "=", "nil", ",", "request_options", "=", "{", "}", ")", "res", "=", "add_object", "(", "object", ",", "objectID", ",", "request_options", ")", "wait_task", "(", "res", "[", "'taskID'", "]", ",", "WAIT...
Add an object in this index and wait end of indexing @param object the object to add to the index. The object is represented by an associative array @param objectID (optional) an objectID you want to attribute to this object (if the attribute already exist the old object will be overridden) @param Request optio...
[ "Add", "an", "object", "in", "this", "index", "and", "wait", "end", "of", "indexing" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L67-L71
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.add_objects!
def add_objects!(objects, request_options = {}) res = add_objects(objects, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
ruby
def add_objects!(objects, request_options = {}) res = add_objects(objects, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
[ "def", "add_objects!", "(", "objects", ",", "request_options", "=", "{", "}", ")", "res", "=", "add_objects", "(", "objects", ",", "request_options", ")", "wait_task", "(", "res", "[", "'taskID'", "]", ",", "WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY", ",", "request_op...
Add several objects in this index and wait end of indexing @param objects the array of objects to add inside the index. Each object is represented by an associative array @param request_options contains extra parameters to send with your query
[ "Add", "several", "objects", "in", "this", "index", "and", "wait", "end", "of", "indexing" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L91-L95
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.search
def search(query, params = {}, request_options = {}) encoded_params = Hash[params.map { |k, v| [k.to_s, v.is_a?(Array) ? v.to_json : v] }] encoded_params[:query] = query client.post(Protocol.search_post_uri(name), { :params => Protocol.to_query(encoded_params) }.to_json, :search, request_options) ...
ruby
def search(query, params = {}, request_options = {}) encoded_params = Hash[params.map { |k, v| [k.to_s, v.is_a?(Array) ? v.to_json : v] }] encoded_params[:query] = query client.post(Protocol.search_post_uri(name), { :params => Protocol.to_query(encoded_params) }.to_json, :search, request_options) ...
[ "def", "search", "(", "query", ",", "params", "=", "{", "}", ",", "request_options", "=", "{", "}", ")", "encoded_params", "=", "Hash", "[", "params", ".", "map", "{", "|", "k", ",", "v", "|", "[", "k", ".", "to_s", ",", "v", ".", "is_a?", "(",...
Search inside the index @param query the full text query @param args (optional) if set, contains an associative array with query parameters: - page: (integer) Pagination parameter used to select the page to retrieve. Page is zero-based and defaults to 0. Thus, to retrieve the 10th page you need t...
[ "Search", "inside", "the", "index" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L161-L165
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.browse
def browse(page_or_query_parameters = nil, hits_per_page = nil, request_options = {}, &block) params = {} if page_or_query_parameters.is_a?(Hash) params.merge!(page_or_query_parameters) else params[:page] = page_or_query_parameters unless page_or_query_parameters.nil? end i...
ruby
def browse(page_or_query_parameters = nil, hits_per_page = nil, request_options = {}, &block) params = {} if page_or_query_parameters.is_a?(Hash) params.merge!(page_or_query_parameters) else params[:page] = page_or_query_parameters unless page_or_query_parameters.nil? end i...
[ "def", "browse", "(", "page_or_query_parameters", "=", "nil", ",", "hits_per_page", "=", "nil", ",", "request_options", "=", "{", "}", ",", "&", "block", ")", "params", "=", "{", "}", "if", "page_or_query_parameters", ".", "is_a?", "(", "Hash", ")", "param...
Browse all index content @param queryParameters The hash of query parameters to use to browse To browse from a specific cursor, just add a ":cursor" parameters @param queryParameters An optional second parameters hash here for backward-compatibility (which will be merged with the first) @par...
[ "Browse", "all", "index", "content" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L203-L223
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.browse_from
def browse_from(cursor, hits_per_page = 1000, request_options = {}) client.post(Protocol.browse_uri(name), { :cursor => cursor, :hitsPerPage => hits_per_page }.to_json, :read, request_options) end
ruby
def browse_from(cursor, hits_per_page = 1000, request_options = {}) client.post(Protocol.browse_uri(name), { :cursor => cursor, :hitsPerPage => hits_per_page }.to_json, :read, request_options) end
[ "def", "browse_from", "(", "cursor", ",", "hits_per_page", "=", "1000", ",", "request_options", "=", "{", "}", ")", "client", ".", "post", "(", "Protocol", ".", "browse_uri", "(", "name", ")", ",", "{", ":cursor", "=>", "cursor", ",", ":hitsPerPage", "=>...
Browse a single page from a specific cursor @param request_options contains extra parameters to send with your query
[ "Browse", "a", "single", "page", "from", "a", "specific", "cursor" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L230-L232
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.get_object
def get_object(objectID, attributes_to_retrieve = nil, request_options = {}) attributes_to_retrieve = attributes_to_retrieve.join(',') if attributes_to_retrieve.is_a?(Array) if attributes_to_retrieve.nil? client.get(Protocol.object_uri(name, objectID, nil), :read, request_options) else ...
ruby
def get_object(objectID, attributes_to_retrieve = nil, request_options = {}) attributes_to_retrieve = attributes_to_retrieve.join(',') if attributes_to_retrieve.is_a?(Array) if attributes_to_retrieve.nil? client.get(Protocol.object_uri(name, objectID, nil), :read, request_options) else ...
[ "def", "get_object", "(", "objectID", ",", "attributes_to_retrieve", "=", "nil", ",", "request_options", "=", "{", "}", ")", "attributes_to_retrieve", "=", "attributes_to_retrieve", ".", "join", "(", "','", ")", "if", "attributes_to_retrieve", ".", "is_a?", "(", ...
Get an object from this index @param objectID the unique identifier of the object to retrieve @param attributes_to_retrieve (optional) if set, contains the list of attributes to retrieve as an array of strings of a string separated by "," @param request_options contains extra parameters to send with your query
[ "Get", "an", "object", "from", "this", "index" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L241-L248
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.get_objects
def get_objects(objectIDs, attributes_to_retrieve = nil, request_options = {}) attributes_to_retrieve = attributes_to_retrieve.join(',') if attributes_to_retrieve.is_a?(Array) requests = objectIDs.map do |objectID| req = { :indexName => name, :objectID => objectID.to_s } req[:attributesToRet...
ruby
def get_objects(objectIDs, attributes_to_retrieve = nil, request_options = {}) attributes_to_retrieve = attributes_to_retrieve.join(',') if attributes_to_retrieve.is_a?(Array) requests = objectIDs.map do |objectID| req = { :indexName => name, :objectID => objectID.to_s } req[:attributesToRet...
[ "def", "get_objects", "(", "objectIDs", ",", "attributes_to_retrieve", "=", "nil", ",", "request_options", "=", "{", "}", ")", "attributes_to_retrieve", "=", "attributes_to_retrieve", ".", "join", "(", "','", ")", "if", "attributes_to_retrieve", ".", "is_a?", "(",...
Get a list of objects from this index @param objectIDs the array of unique identifier of the objects to retrieve @param attributes_to_retrieve (optional) if set, contains the list of attributes to retrieve as an array of strings of a string separated by "," @param request_options contains extra parameters to send w...
[ "Get", "a", "list", "of", "objects", "from", "this", "index" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L257-L265
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.save_object
def save_object(object, objectID = nil, request_options = {}) client.put(Protocol.object_uri(name, get_objectID(object, objectID)), object.to_json, :write, request_options) end
ruby
def save_object(object, objectID = nil, request_options = {}) client.put(Protocol.object_uri(name, get_objectID(object, objectID)), object.to_json, :write, request_options) end
[ "def", "save_object", "(", "object", ",", "objectID", "=", "nil", ",", "request_options", "=", "{", "}", ")", "client", ".", "put", "(", "Protocol", ".", "object_uri", "(", "name", ",", "get_objectID", "(", "object", ",", "objectID", ")", ")", ",", "ob...
Override the content of an object @param object the object to save @param objectID the associated objectID, if nil 'object' must contain an 'objectID' key @param request_options contains extra parameters to send with your query
[ "Override", "the", "content", "of", "an", "object" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L297-L299
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.save_object!
def save_object!(object, objectID = nil, request_options = {}) res = save_object(object, objectID, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
ruby
def save_object!(object, objectID = nil, request_options = {}) res = save_object(object, objectID, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
[ "def", "save_object!", "(", "object", ",", "objectID", "=", "nil", ",", "request_options", "=", "{", "}", ")", "res", "=", "save_object", "(", "object", ",", "objectID", ",", "request_options", ")", "wait_task", "(", "res", "[", "'taskID'", "]", ",", "WA...
Override the content of object and wait end of indexing @param object the object to save @param objectID the associated objectID, if nil 'object' must contain an 'objectID' key @param request_options contains extra parameters to send with your query
[ "Override", "the", "content", "of", "object", "and", "wait", "end", "of", "indexing" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L308-L312
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.save_objects!
def save_objects!(objects, request_options = {}) res = save_objects(objects, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
ruby
def save_objects!(objects, request_options = {}) res = save_objects(objects, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
[ "def", "save_objects!", "(", "objects", ",", "request_options", "=", "{", "}", ")", "res", "=", "save_objects", "(", "objects", ",", "request_options", ")", "wait_task", "(", "res", "[", "'taskID'", "]", ",", "WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY", ",", "request_...
Override the content of several objects and wait end of indexing @param objects the array of objects to save, each object must contain an objectID attribute @param request_options contains extra parameters to send with your query
[ "Override", "the", "content", "of", "several", "objects", "and", "wait", "end", "of", "indexing" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L330-L334
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.replace_all_objects
def replace_all_objects(objects, request_options = {}) safe = request_options[:safe] || request_options['safe'] || false request_options.delete(:safe) request_options.delete('safe') tmp_index = @client.init_index(@name + '_tmp_' + rand(10000000).to_s) responses = [] scope = ['sett...
ruby
def replace_all_objects(objects, request_options = {}) safe = request_options[:safe] || request_options['safe'] || false request_options.delete(:safe) request_options.delete('safe') tmp_index = @client.init_index(@name + '_tmp_' + rand(10000000).to_s) responses = [] scope = ['sett...
[ "def", "replace_all_objects", "(", "objects", ",", "request_options", "=", "{", "}", ")", "safe", "=", "request_options", "[", ":safe", "]", "||", "request_options", "[", "'safe'", "]", "||", "false", "request_options", ".", "delete", "(", ":safe", ")", "req...
Override the current objects by the given array of objects and wait end of indexing. Settings, synonyms and query rules are untouched. The objects are replaced without any downtime. @param objects the array of objects to save @param request_options contains extra parameters to send with your query
[ "Override", "the", "current", "objects", "by", "the", "given", "array", "of", "objects", "and", "wait", "end", "of", "indexing", ".", "Settings", "synonyms", "and", "query", "rules", "are", "untouched", ".", "The", "objects", "are", "replaced", "without", "a...
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L343-L394
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.partial_update_objects
def partial_update_objects(objects, create_if_not_exits = true, request_options = {}) if create_if_not_exits batch(build_batch('partialUpdateObject', objects, true), request_options) else batch(build_batch('partialUpdateObjectNoCreate', objects, true), request_options) end end
ruby
def partial_update_objects(objects, create_if_not_exits = true, request_options = {}) if create_if_not_exits batch(build_batch('partialUpdateObject', objects, true), request_options) else batch(build_batch('partialUpdateObjectNoCreate', objects, true), request_options) end end
[ "def", "partial_update_objects", "(", "objects", ",", "create_if_not_exits", "=", "true", ",", "request_options", "=", "{", "}", ")", "if", "create_if_not_exits", "batch", "(", "build_batch", "(", "'partialUpdateObject'", ",", "objects", ",", "true", ")", ",", "...
Partially override the content of several objects @param objects an array of objects to update (each object must contains a objectID attribute) @param create_if_not_exits a boolean, if true create the objects if they don't exist @param request_options contains extra parameters to send with your query
[ "Partially", "override", "the", "content", "of", "several", "objects" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L425-L431
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.partial_update_objects!
def partial_update_objects!(objects, create_if_not_exits = true, request_options = {}) res = partial_update_objects(objects, create_if_not_exits, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
ruby
def partial_update_objects!(objects, create_if_not_exits = true, request_options = {}) res = partial_update_objects(objects, create_if_not_exits, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
[ "def", "partial_update_objects!", "(", "objects", ",", "create_if_not_exits", "=", "true", ",", "request_options", "=", "{", "}", ")", "res", "=", "partial_update_objects", "(", "objects", ",", "create_if_not_exits", ",", "request_options", ")", "wait_task", "(", ...
Partially override the content of several objects and wait end of indexing @param objects an array of objects to update (each object must contains a objectID attribute) @param create_if_not_exits a boolean, if true create the objects if they don't exist @param request_options contains extra parameters to send with ...
[ "Partially", "override", "the", "content", "of", "several", "objects", "and", "wait", "end", "of", "indexing" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L440-L444
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.delete_object
def delete_object(objectID, request_options = {}) raise ArgumentError.new('objectID must not be blank') if objectID.nil? || objectID == '' client.delete(Protocol.object_uri(name, objectID), :write, request_options) end
ruby
def delete_object(objectID, request_options = {}) raise ArgumentError.new('objectID must not be blank') if objectID.nil? || objectID == '' client.delete(Protocol.object_uri(name, objectID), :write, request_options) end
[ "def", "delete_object", "(", "objectID", ",", "request_options", "=", "{", "}", ")", "raise", "ArgumentError", ".", "new", "(", "'objectID must not be blank'", ")", "if", "objectID", ".", "nil?", "||", "objectID", "==", "''", "client", ".", "delete", "(", "P...
Delete an object from the index @param objectID the unique identifier of object to delete @param request_options contains extra parameters to send with your query
[ "Delete", "an", "object", "from", "the", "index" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L466-L469
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.delete_object!
def delete_object!(objectID, request_options = {}) res = delete_object(objectID, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
ruby
def delete_object!(objectID, request_options = {}) res = delete_object(objectID, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
[ "def", "delete_object!", "(", "objectID", ",", "request_options", "=", "{", "}", ")", "res", "=", "delete_object", "(", "objectID", ",", "request_options", ")", "wait_task", "(", "res", "[", "'taskID'", "]", ",", "WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY", ",", "requ...
Delete an object from the index and wait end of indexing @param objectID the unique identifier of object to delete @param request_options contains extra parameters to send with your query
[ "Delete", "an", "object", "from", "the", "index", "and", "wait", "end", "of", "indexing" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L477-L481
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.delete_objects
def delete_objects(objects, request_options = {}) check_array(objects) batch(build_batch('deleteObject', objects.map { |objectID| { :objectID => objectID } }, false), request_options) end
ruby
def delete_objects(objects, request_options = {}) check_array(objects) batch(build_batch('deleteObject', objects.map { |objectID| { :objectID => objectID } }, false), request_options) end
[ "def", "delete_objects", "(", "objects", ",", "request_options", "=", "{", "}", ")", "check_array", "(", "objects", ")", "batch", "(", "build_batch", "(", "'deleteObject'", ",", "objects", ".", "map", "{", "|", "objectID", "|", "{", ":objectID", "=>", "obj...
Delete several objects @param objects an array of objectIDs @param request_options contains extra parameters to send with your query
[ "Delete", "several", "objects" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L489-L492
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.delete_objects!
def delete_objects!(objects, request_options = {}) res = delete_objects(objects, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
ruby
def delete_objects!(objects, request_options = {}) res = delete_objects(objects, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
[ "def", "delete_objects!", "(", "objects", ",", "request_options", "=", "{", "}", ")", "res", "=", "delete_objects", "(", "objects", ",", "request_options", ")", "wait_task", "(", "res", "[", "'taskID'", "]", ",", "WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY", ",", "requ...
Delete several objects and wait end of indexing @param objects an array of objectIDs @param request_options contains extra parameters to send with your query
[ "Delete", "several", "objects", "and", "wait", "end", "of", "indexing" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L500-L504
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.delete_by_query
def delete_by_query(query, params = nil, request_options = {}) raise ArgumentError.new('query cannot be nil, use the `clear` method to wipe the entire index') if query.nil? && params.nil? params = sanitized_delete_by_query_params(params) params[:query] = query params[:hitsPerPage] = 1000 ...
ruby
def delete_by_query(query, params = nil, request_options = {}) raise ArgumentError.new('query cannot be nil, use the `clear` method to wipe the entire index') if query.nil? && params.nil? params = sanitized_delete_by_query_params(params) params[:query] = query params[:hitsPerPage] = 1000 ...
[ "def", "delete_by_query", "(", "query", ",", "params", "=", "nil", ",", "request_options", "=", "{", "}", ")", "raise", "ArgumentError", ".", "new", "(", "'query cannot be nil, use the `clear` method to wipe the entire index'", ")", "if", "query", ".", "nil?", "&&",...
Delete all objects matching a query This method retrieves all objects synchronously but deletes in batch asynchronously @param query the query string @param params the optional query parameters @param request_options contains extra parameters to send with your query
[ "Delete", "all", "objects", "matching", "a", "query", "This", "method", "retrieves", "all", "objects", "synchronously", "but", "deletes", "in", "batch", "asynchronously" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L515-L538
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.delete_by_query!
def delete_by_query!(query, params = nil, request_options = {}) res = delete_by_query(query, params, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) if res res end
ruby
def delete_by_query!(query, params = nil, request_options = {}) res = delete_by_query(query, params, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) if res res end
[ "def", "delete_by_query!", "(", "query", ",", "params", "=", "nil", ",", "request_options", "=", "{", "}", ")", "res", "=", "delete_by_query", "(", "query", ",", "params", ",", "request_options", ")", "wait_task", "(", "res", "[", "'taskID'", "]", ",", "...
Delete all objects matching a query and wait end of indexing @param query the query string @param params the optional query parameters @param request_options contains extra parameters to send with your query
[ "Delete", "all", "objects", "matching", "a", "query", "and", "wait", "end", "of", "indexing" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L547-L551
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.clear!
def clear!(request_options = {}) res = clear(request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
ruby
def clear!(request_options = {}) res = clear(request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
[ "def", "clear!", "(", "request_options", "=", "{", "}", ")", "res", "=", "clear", "(", "request_options", ")", "wait_task", "(", "res", "[", "'taskID'", "]", ",", "WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY", ",", "request_options", ")", "res", "end" ]
Delete the index content and wait end of indexing
[ "Delete", "the", "index", "content", "and", "wait", "end", "of", "indexing" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L591-L595
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.set_settings
def set_settings(new_settings, options = {}, request_options = {}) client.put(Protocol.settings_uri(name, options), new_settings.to_json, :write, request_options) end
ruby
def set_settings(new_settings, options = {}, request_options = {}) client.put(Protocol.settings_uri(name, options), new_settings.to_json, :write, request_options) end
[ "def", "set_settings", "(", "new_settings", ",", "options", "=", "{", "}", ",", "request_options", "=", "{", "}", ")", "client", ".", "put", "(", "Protocol", ".", "settings_uri", "(", "name", ",", "options", ")", ",", "new_settings", ".", "to_json", ",",...
Set settings for this index
[ "Set", "settings", "for", "this", "index" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L601-L603
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.set_settings!
def set_settings!(new_settings, options = {}, request_options = {}) res = set_settings(new_settings, options, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
ruby
def set_settings!(new_settings, options = {}, request_options = {}) res = set_settings(new_settings, options, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
[ "def", "set_settings!", "(", "new_settings", ",", "options", "=", "{", "}", ",", "request_options", "=", "{", "}", ")", "res", "=", "set_settings", "(", "new_settings", ",", "options", ",", "request_options", ")", "wait_task", "(", "res", "[", "'taskID'", ...
Set settings for this index and wait end of indexing
[ "Set", "settings", "for", "this", "index", "and", "wait", "end", "of", "indexing" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L608-L612
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.get_settings
def get_settings(options = {}, request_options = {}) options['getVersion'] = 2 if !options[:getVersion] && !options['getVersion'] client.get(Protocol.settings_uri(name, options).to_s, :read, request_options) end
ruby
def get_settings(options = {}, request_options = {}) options['getVersion'] = 2 if !options[:getVersion] && !options['getVersion'] client.get(Protocol.settings_uri(name, options).to_s, :read, request_options) end
[ "def", "get_settings", "(", "options", "=", "{", "}", ",", "request_options", "=", "{", "}", ")", "options", "[", "'getVersion'", "]", "=", "2", "if", "!", "options", "[", ":getVersion", "]", "&&", "!", "options", "[", "'getVersion'", "]", "client", "....
Get settings of this index
[ "Get", "settings", "of", "this", "index" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L617-L620
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.get_api_key
def get_api_key(key, request_options = {}) client.get(Protocol.index_key_uri(name, key), :read, request_options) end
ruby
def get_api_key(key, request_options = {}) client.get(Protocol.index_key_uri(name, key), :read, request_options) end
[ "def", "get_api_key", "(", "key", ",", "request_options", "=", "{", "}", ")", "client", ".", "get", "(", "Protocol", ".", "index_key_uri", "(", "name", ",", "key", ")", ",", ":read", ",", "request_options", ")", "end" ]
Get ACL of a user key Deprecated: Please us `client.get_api_key` instead.
[ "Get", "ACL", "of", "a", "user", "key" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L634-L636
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.delete_api_key
def delete_api_key(key, request_options = {}) client.delete(Protocol.index_key_uri(name, key), :write, request_options) end
ruby
def delete_api_key(key, request_options = {}) client.delete(Protocol.index_key_uri(name, key), :write, request_options) end
[ "def", "delete_api_key", "(", "key", ",", "request_options", "=", "{", "}", ")", "client", ".", "delete", "(", "Protocol", ".", "index_key_uri", "(", "name", ",", "key", ")", ",", ":write", ",", "request_options", ")", "end" ]
Delete an existing user key Deprecated: Please use `client.delete_api_key` instead
[ "Delete", "an", "existing", "user", "key" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L723-L725
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.batch
def batch(request, request_options = {}) client.post(Protocol.batch_uri(name), request.to_json, :batch, request_options) end
ruby
def batch(request, request_options = {}) client.post(Protocol.batch_uri(name), request.to_json, :batch, request_options) end
[ "def", "batch", "(", "request", ",", "request_options", "=", "{", "}", ")", "client", ".", "post", "(", "Protocol", ".", "batch_uri", "(", "name", ")", ",", "request", ".", "to_json", ",", ":batch", ",", "request_options", ")", "end" ]
Send a batch request
[ "Send", "a", "batch", "request" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L730-L732
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.batch!
def batch!(request, request_options = {}) res = batch(request, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
ruby
def batch!(request, request_options = {}) res = batch(request, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
[ "def", "batch!", "(", "request", ",", "request_options", "=", "{", "}", ")", "res", "=", "batch", "(", "request", ",", "request_options", ")", "wait_task", "(", "res", "[", "'taskID'", "]", ",", "WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY", ",", "request_options", ")...
Send a batch request and wait the end of the indexing
[ "Send", "a", "batch", "request", "and", "wait", "the", "end", "of", "the", "indexing" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L737-L741
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.search_for_facet_values
def search_for_facet_values(facet_name, facet_query, search_parameters = {}, request_options = {}) params = search_parameters.clone params['facetQuery'] = facet_query client.post(Protocol.search_facet_uri(name, facet_name), params.to_json, :read, request_options) end
ruby
def search_for_facet_values(facet_name, facet_query, search_parameters = {}, request_options = {}) params = search_parameters.clone params['facetQuery'] = facet_query client.post(Protocol.search_facet_uri(name, facet_name), params.to_json, :read, request_options) end
[ "def", "search_for_facet_values", "(", "facet_name", ",", "facet_query", ",", "search_parameters", "=", "{", "}", ",", "request_options", "=", "{", "}", ")", "params", "=", "search_parameters", ".", "clone", "params", "[", "'facetQuery'", "]", "=", "facet_query"...
Search for facet values @param facet_name Name of the facet to search. It must have been declared in the index's`attributesForFaceting` setting with the `searchable()` modifier. @param facet_query Text to search for in the facet's values @param search_parameters An optional query to take extra search paramet...
[ "Search", "for", "facet", "values" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L754-L758
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.search_disjunctive_faceting
def search_disjunctive_faceting(query, disjunctive_facets, params = {}, refinements = {}, request_options = {}) raise ArgumentError.new('Argument "disjunctive_facets" must be a String or an Array') unless disjunctive_facets.is_a?(String) || disjunctive_facets.is_a?(Array) raise ArgumentError.new('Argument "...
ruby
def search_disjunctive_faceting(query, disjunctive_facets, params = {}, refinements = {}, request_options = {}) raise ArgumentError.new('Argument "disjunctive_facets" must be a String or an Array') unless disjunctive_facets.is_a?(String) || disjunctive_facets.is_a?(Array) raise ArgumentError.new('Argument "...
[ "def", "search_disjunctive_faceting", "(", "query", ",", "disjunctive_facets", ",", "params", "=", "{", "}", ",", "refinements", "=", "{", "}", ",", "request_options", "=", "{", "}", ")", "raise", "ArgumentError", ".", "new", "(", "'Argument \"disjunctive_facets...
Perform a search with disjunctive facets generating as many queries as number of disjunctive facets @param query the query @param disjunctive_facets the array of disjunctive facets @param params a hash representing the regular query parameters @param refinements a hash ("string" -> ["array", "of", "refined", "valu...
[ "Perform", "a", "search", "with", "disjunctive", "facets", "generating", "as", "many", "queries", "as", "number", "of", "disjunctive", "facets" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L773-L849
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.get_synonym
def get_synonym(objectID, request_options = {}) client.get(Protocol.synonym_uri(name, objectID), :read, request_options) end
ruby
def get_synonym(objectID, request_options = {}) client.get(Protocol.synonym_uri(name, objectID), :read, request_options) end
[ "def", "get_synonym", "(", "objectID", ",", "request_options", "=", "{", "}", ")", "client", ".", "get", "(", "Protocol", ".", "synonym_uri", "(", "name", ",", "objectID", ")", ",", ":read", ",", "request_options", ")", "end" ]
Get a synonym @param objectID the synonym objectID @param request_options contains extra parameters to send with your query
[ "Get", "a", "synonym" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L886-L888
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.delete_synonym!
def delete_synonym!(objectID, forward_to_replicas = false, request_options = {}) res = delete_synonym(objectID, forward_to_replicas, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
ruby
def delete_synonym!(objectID, forward_to_replicas = false, request_options = {}) res = delete_synonym(objectID, forward_to_replicas, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
[ "def", "delete_synonym!", "(", "objectID", ",", "forward_to_replicas", "=", "false", ",", "request_options", "=", "{", "}", ")", "res", "=", "delete_synonym", "(", "objectID", ",", "forward_to_replicas", ",", "request_options", ")", "wait_task", "(", "res", "[",...
Delete a synonym and wait the end of indexing @param objectID the synonym objectID @param forward_to_replicas should we forward the delete to replica indices @param request_options contains extra parameters to send with your query
[ "Delete", "a", "synonym", "and", "wait", "the", "end", "of", "indexing" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L908-L912
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.save_synonym
def save_synonym(objectID, synonym, forward_to_replicas = false, request_options = {}) client.put("#{Protocol.synonym_uri(name, objectID)}?forwardToReplicas=#{forward_to_replicas}", synonym.to_json, :write, request_options) end
ruby
def save_synonym(objectID, synonym, forward_to_replicas = false, request_options = {}) client.put("#{Protocol.synonym_uri(name, objectID)}?forwardToReplicas=#{forward_to_replicas}", synonym.to_json, :write, request_options) end
[ "def", "save_synonym", "(", "objectID", ",", "synonym", ",", "forward_to_replicas", "=", "false", ",", "request_options", "=", "{", "}", ")", "client", ".", "put", "(", "\"#{Protocol.synonym_uri(name, objectID)}?forwardToReplicas=#{forward_to_replicas}\"", ",", "synonym",...
Save a synonym @param objectID the synonym objectID @param synonym the synonym @param forward_to_replicas should we forward the delete to replica indices @param request_options contains extra parameters to send with your query
[ "Save", "a", "synonym" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L922-L924
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.save_synonym!
def save_synonym!(objectID, synonym, forward_to_replicas = false, request_options = {}) res = save_synonym(objectID, synonym, forward_to_replicas, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
ruby
def save_synonym!(objectID, synonym, forward_to_replicas = false, request_options = {}) res = save_synonym(objectID, synonym, forward_to_replicas, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
[ "def", "save_synonym!", "(", "objectID", ",", "synonym", ",", "forward_to_replicas", "=", "false", ",", "request_options", "=", "{", "}", ")", "res", "=", "save_synonym", "(", "objectID", ",", "synonym", ",", "forward_to_replicas", ",", "request_options", ")", ...
Save a synonym and wait the end of indexing @param objectID the synonym objectID @param synonym the synonym @param forward_to_replicas should we forward the delete to replica indices @param request_options contains extra parameters to send with your query
[ "Save", "a", "synonym", "and", "wait", "the", "end", "of", "indexing" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L934-L938
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.clear_synonyms!
def clear_synonyms!(forward_to_replicas = false, request_options = {}) res = clear_synonyms(forward_to_replicas, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
ruby
def clear_synonyms!(forward_to_replicas = false, request_options = {}) res = clear_synonyms(forward_to_replicas, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
[ "def", "clear_synonyms!", "(", "forward_to_replicas", "=", "false", ",", "request_options", "=", "{", "}", ")", "res", "=", "clear_synonyms", "(", "forward_to_replicas", ",", "request_options", ")", "wait_task", "(", "res", "[", "'taskID'", "]", ",", "WAIT_TASK_...
Clear all synonyms and wait the end of indexing @param forward_to_replicas should we forward the delete to replica indices @param request_options contains extra parameters to send with your query
[ "Clear", "all", "synonyms", "and", "wait", "the", "end", "of", "indexing" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L956-L960
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.replace_all_synonyms
def replace_all_synonyms(synonyms, request_options = {}) forward_to_replicas = request_options[:forwardToReplicas] || request_options['forwardToReplicas'] || false batch_synonyms(synonyms, forward_to_replicas, true, request_options) end
ruby
def replace_all_synonyms(synonyms, request_options = {}) forward_to_replicas = request_options[:forwardToReplicas] || request_options['forwardToReplicas'] || false batch_synonyms(synonyms, forward_to_replicas, true, request_options) end
[ "def", "replace_all_synonyms", "(", "synonyms", ",", "request_options", "=", "{", "}", ")", "forward_to_replicas", "=", "request_options", "[", ":forwardToReplicas", "]", "||", "request_options", "[", "'forwardToReplicas'", "]", "||", "false", "batch_synonyms", "(", ...
Replace synonyms in the index by the given array of synonyms @param synonyms the array of synonyms to add @param request_options contains extra parameters to send with your query
[ "Replace", "synonyms", "in", "the", "index", "by", "the", "given", "array", "of", "synonyms" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L994-L997
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.replace_all_synonyms!
def replace_all_synonyms!(synonyms, request_options = {}) res = replace_all_synonyms(synonyms, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
ruby
def replace_all_synonyms!(synonyms, request_options = {}) res = replace_all_synonyms(synonyms, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
[ "def", "replace_all_synonyms!", "(", "synonyms", ",", "request_options", "=", "{", "}", ")", "res", "=", "replace_all_synonyms", "(", "synonyms", ",", "request_options", ")", "wait_task", "(", "res", "[", "'taskID'", "]", ",", "WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY", ...
Replace synonyms in the index by the given array of synonyms and wait the end of indexing @param synonyms the array of synonyms to add @param request_options contains extra parameters to send with your query
[ "Replace", "synonyms", "in", "the", "index", "by", "the", "given", "array", "of", "synonyms", "and", "wait", "the", "end", "of", "indexing" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L1005-L1009
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.export_synonyms
def export_synonyms(hits_per_page = 100, request_options = {}, &_block) res = [] page = 0 loop do curr = search_synonyms('', { :hitsPerPage => hits_per_page, :page => page }, request_options)['hits'] curr.each do |synonym| res << synonym yield synonym if block_given...
ruby
def export_synonyms(hits_per_page = 100, request_options = {}, &_block) res = [] page = 0 loop do curr = search_synonyms('', { :hitsPerPage => hits_per_page, :page => page }, request_options)['hits'] curr.each do |synonym| res << synonym yield synonym if block_given...
[ "def", "export_synonyms", "(", "hits_per_page", "=", "100", ",", "request_options", "=", "{", "}", ",", "&", "_block", ")", "res", "=", "[", "]", "page", "=", "0", "loop", "do", "curr", "=", "search_synonyms", "(", "''", ",", "{", ":hitsPerPage", "=>",...
Export the full list of synonyms Accepts an optional block to which it will pass each synonym Also returns an array with all the synonyms @param hits_per_page Amount of synonyms to retrieve on each internal request - Optional - Default: 100 @param request_options contains extra parameters to send with your query -...
[ "Export", "the", "full", "list", "of", "synonyms", "Accepts", "an", "optional", "block", "to", "which", "it", "will", "pass", "each", "synonym", "Also", "returns", "an", "array", "with", "all", "the", "synonyms" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L1019-L1032
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.get_rule
def get_rule(objectID, request_options = {}) client.get(Protocol.rule_uri(name, objectID), :read, request_options) end
ruby
def get_rule(objectID, request_options = {}) client.get(Protocol.rule_uri(name, objectID), :read, request_options) end
[ "def", "get_rule", "(", "objectID", ",", "request_options", "=", "{", "}", ")", "client", ".", "get", "(", "Protocol", ".", "rule_uri", "(", "name", ",", "objectID", ")", ",", ":read", ",", "request_options", ")", "end" ]
Get a rule @param objectID the rule objectID @param request_options contains extra parameters to send with your query
[ "Get", "a", "rule" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L1062-L1064
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.delete_rule!
def delete_rule!(objectID, forward_to_replicas = false, request_options = {}) res = delete_rule(objectID, forward_to_replicas, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) return res end
ruby
def delete_rule!(objectID, forward_to_replicas = false, request_options = {}) res = delete_rule(objectID, forward_to_replicas, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) return res end
[ "def", "delete_rule!", "(", "objectID", ",", "forward_to_replicas", "=", "false", ",", "request_options", "=", "{", "}", ")", "res", "=", "delete_rule", "(", "objectID", ",", "forward_to_replicas", ",", "request_options", ")", "wait_task", "(", "res", "[", "'t...
Delete a rule and wait the end of indexing @param objectID the rule objectID @param forward_to_replicas should we forward the delete to replica indices @param request_options contains extra parameters to send with your query
[ "Delete", "a", "rule", "and", "wait", "the", "end", "of", "indexing" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L1084-L1088
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.save_rule
def save_rule(objectID, rule, forward_to_replicas = false, request_options = {}) raise ArgumentError.new('objectID must not be blank') if objectID.nil? || objectID == '' client.put("#{Protocol.rule_uri(name, objectID)}?forwardToReplicas=#{forward_to_replicas}", rule.to_json, :write, request_options) end
ruby
def save_rule(objectID, rule, forward_to_replicas = false, request_options = {}) raise ArgumentError.new('objectID must not be blank') if objectID.nil? || objectID == '' client.put("#{Protocol.rule_uri(name, objectID)}?forwardToReplicas=#{forward_to_replicas}", rule.to_json, :write, request_options) end
[ "def", "save_rule", "(", "objectID", ",", "rule", ",", "forward_to_replicas", "=", "false", ",", "request_options", "=", "{", "}", ")", "raise", "ArgumentError", ".", "new", "(", "'objectID must not be blank'", ")", "if", "objectID", ".", "nil?", "||", "object...
Save a rule @param objectID the rule objectID @param rule the rule @param forward_to_replicas should we forward the delete to replica indices @param request_options contains extra parameters to send with your query
[ "Save", "a", "rule" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L1098-L1101
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.save_rule!
def save_rule!(objectID, rule, forward_to_replicas = false, request_options = {}) res = save_rule(objectID, rule, forward_to_replicas, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) return res end
ruby
def save_rule!(objectID, rule, forward_to_replicas = false, request_options = {}) res = save_rule(objectID, rule, forward_to_replicas, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) return res end
[ "def", "save_rule!", "(", "objectID", ",", "rule", ",", "forward_to_replicas", "=", "false", ",", "request_options", "=", "{", "}", ")", "res", "=", "save_rule", "(", "objectID", ",", "rule", ",", "forward_to_replicas", ",", "request_options", ")", "wait_task"...
Save a rule and wait the end of indexing @param objectID the rule objectID @param rule the rule @param forward_to_replicas should we forward the delete to replica indices @param request_options contains extra parameters to send with your query
[ "Save", "a", "rule", "and", "wait", "the", "end", "of", "indexing" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L1111-L1115
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.clear_rules!
def clear_rules!(forward_to_replicas = false, request_options = {}) res = clear_rules(forward_to_replicas, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) return res end
ruby
def clear_rules!(forward_to_replicas = false, request_options = {}) res = clear_rules(forward_to_replicas, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) return res end
[ "def", "clear_rules!", "(", "forward_to_replicas", "=", "false", ",", "request_options", "=", "{", "}", ")", "res", "=", "clear_rules", "(", "forward_to_replicas", ",", "request_options", ")", "wait_task", "(", "res", "[", "'taskID'", "]", ",", "WAIT_TASK_DEFAUL...
Clear all rules and wait the end of indexing @param forward_to_replicas should we forward the delete to replica indices @param request_options contains extra parameters to send with your query
[ "Clear", "all", "rules", "and", "wait", "the", "end", "of", "indexing" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L1133-L1137
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.replace_all_rules
def replace_all_rules(rules, request_options = {}) forward_to_replicas = request_options[:forwardToReplicas] || request_options['forwardToReplicas'] || false batch_rules(rules, forward_to_replicas, true, request_options) end
ruby
def replace_all_rules(rules, request_options = {}) forward_to_replicas = request_options[:forwardToReplicas] || request_options['forwardToReplicas'] || false batch_rules(rules, forward_to_replicas, true, request_options) end
[ "def", "replace_all_rules", "(", "rules", ",", "request_options", "=", "{", "}", ")", "forward_to_replicas", "=", "request_options", "[", ":forwardToReplicas", "]", "||", "request_options", "[", "'forwardToReplicas'", "]", "||", "false", "batch_rules", "(", "rules",...
Replace rules in the index by the given array of rules @param rules the array of rules to add @param request_options contains extra parameters to send with your query
[ "Replace", "rules", "in", "the", "index", "by", "the", "given", "array", "of", "rules" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L1171-L1174
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.replace_all_rules!
def replace_all_rules!(rules, request_options = {}) res = replace_all_rules(rules, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
ruby
def replace_all_rules!(rules, request_options = {}) res = replace_all_rules(rules, request_options) wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options) res end
[ "def", "replace_all_rules!", "(", "rules", ",", "request_options", "=", "{", "}", ")", "res", "=", "replace_all_rules", "(", "rules", ",", "request_options", ")", "wait_task", "(", "res", "[", "'taskID'", "]", ",", "WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY", ",", "re...
Replace rules in the index by the given array of rules and wait the end of indexing @param rules the array of rules to add @param request_options contains extra parameters to send with your query
[ "Replace", "rules", "in", "the", "index", "by", "the", "given", "array", "of", "rules", "and", "wait", "the", "end", "of", "indexing" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L1182-L1186
train
algolia/algoliasearch-client-ruby
lib/algolia/index.rb
Algolia.Index.export_rules
def export_rules(hits_per_page = 100, request_options = {}, &_block) res = [] page = 0 loop do curr = search_rules('', { :hits_per_page => hits_per_page, :page => page }, request_options)['hits'] curr.each do |rule| res << rule yield rule if block_given? end...
ruby
def export_rules(hits_per_page = 100, request_options = {}, &_block) res = [] page = 0 loop do curr = search_rules('', { :hits_per_page => hits_per_page, :page => page }, request_options)['hits'] curr.each do |rule| res << rule yield rule if block_given? end...
[ "def", "export_rules", "(", "hits_per_page", "=", "100", ",", "request_options", "=", "{", "}", ",", "&", "_block", ")", "res", "=", "[", "]", "page", "=", "0", "loop", "do", "curr", "=", "search_rules", "(", "''", ",", "{", ":hits_per_page", "=>", "...
Export the full list of rules Accepts an optional block to which it will pass each rule Also returns an array with all the rules @param hits_per_page Amount of rules to retrieve on each internal request - Optional - Default: 100 @param request_options contains extra parameters to send with your query - Optional
[ "Export", "the", "full", "list", "of", "rules", "Accepts", "an", "optional", "block", "to", "which", "it", "will", "pass", "each", "rule", "Also", "returns", "an", "array", "with", "all", "the", "rules" ]
5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b
https://github.com/algolia/algoliasearch-client-ruby/blob/5292cd9b1029f879e4e0257a3e89d0dc9ad0df3b/lib/algolia/index.rb#L1196-L1209
train
goco-inc/graphql-activerecord
lib/graphql/models/attribute_loader.rb
GraphQL::Models.AttributeLoader.hash_to_condition
def hash_to_condition(table, hash) conditions = hash.map do |attr, value| if value.is_a?(Array) && value.size > 1 table[attr].in(value) elsif value.is_a?(Array) table[attr].eq(value[0]) else table[attr].eq(value) end end conditions.reduce ...
ruby
def hash_to_condition(table, hash) conditions = hash.map do |attr, value| if value.is_a?(Array) && value.size > 1 table[attr].in(value) elsif value.is_a?(Array) table[attr].eq(value[0]) else table[attr].eq(value) end end conditions.reduce ...
[ "def", "hash_to_condition", "(", "table", ",", "hash", ")", "conditions", "=", "hash", ".", "map", "do", "|", "attr", ",", "value", "|", "if", "value", ".", "is_a?", "(", "Array", ")", "&&", "value", ".", "size", ">", "1", "table", "[", "attr", "]"...
Converts a hash into arel conditions
[ "Converts", "a", "hash", "into", "arel", "conditions" ]
2567f558fda3f7dadafe62b845e18cc307c9dd34
https://github.com/goco-inc/graphql-activerecord/blob/2567f558fda3f7dadafe62b845e18cc307c9dd34/lib/graphql/models/attribute_loader.rb#L71-L83
train
activerecord-hackery/squeel
lib/squeel/dsl.rb
Squeel.DSL.method_missing
def method_missing(method_id, *args) super if method_id == :to_ary if args.empty? Nodes::Stub.new method_id elsif (args.size == 1) && (Class === args[0]) Nodes::Join.new(method_id, InnerJoin, args[0]) else Nodes::Function.new method_id, args end end
ruby
def method_missing(method_id, *args) super if method_id == :to_ary if args.empty? Nodes::Stub.new method_id elsif (args.size == 1) && (Class === args[0]) Nodes::Join.new(method_id, InnerJoin, args[0]) else Nodes::Function.new method_id, args end end
[ "def", "method_missing", "(", "method_id", ",", "*", "args", ")", "super", "if", "method_id", "==", ":to_ary", "if", "args", ".", "empty?", "Nodes", "::", "Stub", ".", "new", "method_id", "elsif", "(", "args", ".", "size", "==", "1", ")", "&&", "(", ...
Node generation inside DSL blocks. @overload node_name Creates a Stub. Method calls chained from this Stub will determine what type of node we eventually end up with. @return [Nodes::Stub] A stub with the name of the method @overload node_name(klass) Creates a Join with a polymorphic class matching the g...
[ "Node", "generation", "inside", "DSL", "blocks", "." ]
5542266d502db8022e14105f9dfb455a79d6fc4a
https://github.com/activerecord-hackery/squeel/blob/5542266d502db8022e14105f9dfb455a79d6fc4a/lib/squeel/dsl.rb#L107-L117
train
markevans/dragonfly
lib/dragonfly/job.rb
Dragonfly.Job.initialize_copy
def initialize_copy(other) @steps = other.steps.map do |step| step.class.new(self, *step.args) end @content = other.content.dup @url_attributes = other.url_attributes.dup end
ruby
def initialize_copy(other) @steps = other.steps.map do |step| step.class.new(self, *step.args) end @content = other.content.dup @url_attributes = other.url_attributes.dup end
[ "def", "initialize_copy", "(", "other", ")", "@steps", "=", "other", ".", "steps", ".", "map", "do", "|", "step", "|", "step", ".", "class", ".", "new", "(", "self", ",", "*", "step", ".", "args", ")", "end", "@content", "=", "other", ".", "content...
Used by 'dup' and 'clone'
[ "Used", "by", "dup", "and", "clone" ]
2516f24557dc32c4ab147db7c878c5be3f5e57f0
https://github.com/markevans/dragonfly/blob/2516f24557dc32c4ab147db7c878c5be3f5e57f0/lib/dragonfly/job.rb#L90-L96
train
markevans/dragonfly
lib/dragonfly/content.rb
Dragonfly.Content.update
def update(obj, meta=nil) meta ||= {} self.temp_object = TempObject.new(obj, meta['name']) self.meta['name'] ||= temp_object.name if temp_object.name clear_analyser_cache add_meta(obj.meta) if obj.respond_to?(:meta) add_meta(meta) self end
ruby
def update(obj, meta=nil) meta ||= {} self.temp_object = TempObject.new(obj, meta['name']) self.meta['name'] ||= temp_object.name if temp_object.name clear_analyser_cache add_meta(obj.meta) if obj.respond_to?(:meta) add_meta(meta) self end
[ "def", "update", "(", "obj", ",", "meta", "=", "nil", ")", "meta", "||=", "{", "}", "self", ".", "temp_object", "=", "TempObject", ".", "new", "(", "obj", ",", "meta", "[", "'name'", "]", ")", "self", ".", "meta", "[", "'name'", "]", "||=", "temp...
Update the content @param obj [String, Pathname, Tempfile, File, Content, TempObject] can be any of these types @param meta [Hash] - should be json-like, i.e. contain no types other than String, Number, Boolean @return [Content] self
[ "Update", "the", "content" ]
2516f24557dc32c4ab147db7c878c5be3f5e57f0
https://github.com/markevans/dragonfly/blob/2516f24557dc32c4ab147db7c878c5be3f5e57f0/lib/dragonfly/content.rb#L114-L122
train
markevans/dragonfly
lib/dragonfly/content.rb
Dragonfly.Content.shell_eval
def shell_eval(opts={}) should_escape = opts[:escape] != false command = yield(should_escape ? shell.escape(path) : path) run command, :escape => should_escape end
ruby
def shell_eval(opts={}) should_escape = opts[:escape] != false command = yield(should_escape ? shell.escape(path) : path) run command, :escape => should_escape end
[ "def", "shell_eval", "(", "opts", "=", "{", "}", ")", "should_escape", "=", "opts", "[", ":escape", "]", "!=", "false", "command", "=", "yield", "(", "should_escape", "?", "shell", ".", "escape", "(", "path", ")", ":", "path", ")", "run", "command", ...
Analyse the content using a shell command @param opts [Hash] passing :escape => false doesn't shell-escape each word @example content.shell_eval do |path| "file --mime-type #{path}" end # ===> "beach.jpg: image/jpeg"
[ "Analyse", "the", "content", "using", "a", "shell", "command" ]
2516f24557dc32c4ab147db7c878c5be3f5e57f0
https://github.com/markevans/dragonfly/blob/2516f24557dc32c4ab147db7c878c5be3f5e57f0/lib/dragonfly/content.rb#L138-L142
train
markevans/dragonfly
lib/dragonfly/content.rb
Dragonfly.Content.shell_generate
def shell_generate(opts={}) ext = opts[:ext] || self.ext should_escape = opts[:escape] != false tempfile = Utils.new_tempfile(ext) new_path = should_escape ? shell.escape(tempfile.path) : tempfile.path command = yield(new_path) run(command, :escape => should_escape) update(temp...
ruby
def shell_generate(opts={}) ext = opts[:ext] || self.ext should_escape = opts[:escape] != false tempfile = Utils.new_tempfile(ext) new_path = should_escape ? shell.escape(tempfile.path) : tempfile.path command = yield(new_path) run(command, :escape => should_escape) update(temp...
[ "def", "shell_generate", "(", "opts", "=", "{", "}", ")", "ext", "=", "opts", "[", ":ext", "]", "||", "self", ".", "ext", "should_escape", "=", "opts", "[", ":escape", "]", "!=", "false", "tempfile", "=", "Utils", ".", "new_tempfile", "(", "ext", ")"...
Set the content using a shell command @param opts [Hash] :ext sets the file extension of the new path and :escape => false doesn't shell-escape each word @example content.shell_generate do |path| "/usr/local/bin/generate_text gumfry -o #{path}" end @return [Content] self
[ "Set", "the", "content", "using", "a", "shell", "command" ]
2516f24557dc32c4ab147db7c878c5be3f5e57f0
https://github.com/markevans/dragonfly/blob/2516f24557dc32c4ab147db7c878c5be3f5e57f0/lib/dragonfly/content.rb#L151-L159
train
dwbutler/logstash-logger
lib/logstash-logger/multi_logger.rb
LogStashLogger.MultiLogger.method_missing
def method_missing(name, *args, &block) @loggers.each do |logger| if logger.respond_to?(name) logger.send(name, args, &block) end end end
ruby
def method_missing(name, *args, &block) @loggers.each do |logger| if logger.respond_to?(name) logger.send(name, args, &block) end end end
[ "def", "method_missing", "(", "name", ",", "*", "args", ",", "&", "block", ")", "@loggers", ".", "each", "do", "|", "logger", "|", "if", "logger", ".", "respond_to?", "(", "name", ")", "logger", ".", "send", "(", "name", ",", "args", ",", "&", "blo...
Any method not defined on standard Logger class, just send it on to anyone who will listen
[ "Any", "method", "not", "defined", "on", "standard", "Logger", "class", "just", "send", "it", "on", "to", "anyone", "who", "will", "listen" ]
b8f5403c44150f10d15b01133f8b6d1e9eb31806
https://github.com/dwbutler/logstash-logger/blob/b8f5403c44150f10d15b01133f8b6d1e9eb31806/lib/logstash-logger/multi_logger.rb#L70-L76
train
dwbutler/logstash-logger
lib/logstash-logger/buffer.rb
LogStashLogger.Buffer.buffer_initialize
def buffer_initialize(options={}) if ! self.class.method_defined?(:flush) raise ArgumentError, "Any class including Stud::Buffer must define a flush() method." end @buffer_config = { :max_items => options[:max_items] || 50, :max_interval => options[:max_interval] || 5, ...
ruby
def buffer_initialize(options={}) if ! self.class.method_defined?(:flush) raise ArgumentError, "Any class including Stud::Buffer must define a flush() method." end @buffer_config = { :max_items => options[:max_items] || 50, :max_interval => options[:max_interval] || 5, ...
[ "def", "buffer_initialize", "(", "options", "=", "{", "}", ")", "if", "!", "self", ".", "class", ".", "method_defined?", "(", ":flush", ")", "raise", "ArgumentError", ",", "\"Any class including Stud::Buffer must define a flush() method.\"", "end", "@buffer_config", "...
Initialize the buffer. Call directly from your constructor if you wish to set some non-default options. Otherwise buffer_initialize will be called automatically during the first buffer_receive call. Options: * :max_items, Max number of items to buffer before flushing. Default 50. * :max_interval, Max number of ...
[ "Initialize", "the", "buffer", "." ]
b8f5403c44150f10d15b01133f8b6d1e9eb31806
https://github.com/dwbutler/logstash-logger/blob/b8f5403c44150f10d15b01133f8b6d1e9eb31806/lib/logstash-logger/buffer.rb#L85-L107
train
dwbutler/logstash-logger
lib/logstash-logger/buffer.rb
LogStashLogger.Buffer.buffer_receive
def buffer_receive(event, group=nil) buffer_initialize if ! @buffer_state # block if we've accumulated too many events while buffer_full? do on_full_buffer_receive( :pending => @buffer_state[:pending_count], :outgoing => @buffer_state[:outgoing_count] ) if @buffer_...
ruby
def buffer_receive(event, group=nil) buffer_initialize if ! @buffer_state # block if we've accumulated too many events while buffer_full? do on_full_buffer_receive( :pending => @buffer_state[:pending_count], :outgoing => @buffer_state[:outgoing_count] ) if @buffer_...
[ "def", "buffer_receive", "(", "event", ",", "group", "=", "nil", ")", "buffer_initialize", "if", "!", "@buffer_state", "while", "buffer_full?", "do", "on_full_buffer_receive", "(", ":pending", "=>", "@buffer_state", "[", ":pending_count", "]", ",", ":outgoing", "=...
Save an event for later delivery Events are grouped by the (optional) group parameter you provide. Groups of events, plus the group name, are later passed to +flush+. This call will block if +:max_items+ has been reached. @see Stud::Buffer The overview has more information on grouping and flushing. @param even...
[ "Save", "an", "event", "for", "later", "delivery" ]
b8f5403c44150f10d15b01133f8b6d1e9eb31806
https://github.com/dwbutler/logstash-logger/blob/b8f5403c44150f10d15b01133f8b6d1e9eb31806/lib/logstash-logger/buffer.rb#L157-L182
train
dwbutler/logstash-logger
lib/logstash-logger/buffer.rb
LogStashLogger.Buffer.buffer_flush
def buffer_flush(options={}) force = options[:force] || options[:final] final = options[:final] # final flush will wait for lock, so we are sure to flush out all buffered events if options[:final] @buffer_state[:flush_mutex].lock elsif ! @buffer_state[:flush_mutex].try_lock # fail...
ruby
def buffer_flush(options={}) force = options[:force] || options[:final] final = options[:final] # final flush will wait for lock, so we are sure to flush out all buffered events if options[:final] @buffer_state[:flush_mutex].lock elsif ! @buffer_state[:flush_mutex].try_lock # fail...
[ "def", "buffer_flush", "(", "options", "=", "{", "}", ")", "force", "=", "options", "[", ":force", "]", "||", "options", "[", ":final", "]", "final", "=", "options", "[", ":final", "]", "if", "options", "[", ":final", "]", "@buffer_state", "[", ":flush...
Try to flush events. Returns immediately if flushing is not necessary/possible at the moment: * :max_items have not been accumulated * :max_interval seconds have not elapased since the last flush * another flush is in progress <code>buffer_flush(:force => true)</code> will cause a flush to occur even if +:max_i...
[ "Try", "to", "flush", "events", "." ]
b8f5403c44150f10d15b01133f8b6d1e9eb31806
https://github.com/dwbutler/logstash-logger/blob/b8f5403c44150f10d15b01133f8b6d1e9eb31806/lib/logstash-logger/buffer.rb#L202-L284
train
dkubb/axiom
lib/axiom/relation.rb
Axiom.Relation.each
def each return to_enum unless block_given? seen = {} tuples.each do |tuple| tuple = Tuple.coerce(header, tuple) yield seen[tuple] = tuple unless seen.key?(tuple) end self end
ruby
def each return to_enum unless block_given? seen = {} tuples.each do |tuple| tuple = Tuple.coerce(header, tuple) yield seen[tuple] = tuple unless seen.key?(tuple) end self end
[ "def", "each", "return", "to_enum", "unless", "block_given?", "seen", "=", "{", "}", "tuples", ".", "each", "do", "|", "tuple", "|", "tuple", "=", "Tuple", ".", "coerce", "(", "header", ",", "tuple", ")", "yield", "seen", "[", "tuple", "]", "=", "tup...
Iterate over each tuple in the set @example relation = Relation.new(header, tuples) relation.each { |tuple| ... } @yield [tuple] @yieldparam [Tuple] tuple each tuple in the set @return [self] @api public
[ "Iterate", "over", "each", "tuple", "in", "the", "set" ]
2476a75ed04d8a86d7a4dd30b306bac7fe2e8edc
https://github.com/dkubb/axiom/blob/2476a75ed04d8a86d7a4dd30b306bac7fe2e8edc/lib/axiom/relation.rb#L120-L128
train
dkubb/axiom
lib/axiom/relation.rb
Axiom.Relation.replace
def replace(other) other = coerce(other) delete(difference(other)).insert(other.difference(self)) end
ruby
def replace(other) other = coerce(other) delete(difference(other)).insert(other.difference(self)) end
[ "def", "replace", "(", "other", ")", "other", "=", "coerce", "(", "other", ")", "delete", "(", "difference", "(", "other", ")", ")", ".", "insert", "(", "other", ".", "difference", "(", "self", ")", ")", "end" ]
Return a relation that represents a replacement of a relation Delete the tuples from the relation that are not in the other relation, then insert only new tuples. @example replacement = relation.delete(other) @param [Enumerable] other @return [Relation::Operation::Insertion] @api public
[ "Return", "a", "relation", "that", "represents", "a", "replacement", "of", "a", "relation" ]
2476a75ed04d8a86d7a4dd30b306bac7fe2e8edc
https://github.com/dkubb/axiom/blob/2476a75ed04d8a86d7a4dd30b306bac7fe2e8edc/lib/axiom/relation.rb#L143-L146
train
dkubb/axiom
lib/axiom/support/aliasable.rb
Axiom.Aliasable.define_inheritable_alias_method
def define_inheritable_alias_method(new_method, original_method) define_method(new_method) do |*args, &block| public_send(original_method, *args, &block) end end
ruby
def define_inheritable_alias_method(new_method, original_method) define_method(new_method) do |*args, &block| public_send(original_method, *args, &block) end end
[ "def", "define_inheritable_alias_method", "(", "new_method", ",", "original_method", ")", "define_method", "(", "new_method", ")", "do", "|", "*", "args", ",", "&", "block", "|", "public_send", "(", "original_method", ",", "*", "args", ",", "&", "block", ")", ...
Create a new method alias for the original method @param [Symbol] new_method @param [Symbol] original_method @return [undefined] @api private
[ "Create", "a", "new", "method", "alias", "for", "the", "original", "method" ]
2476a75ed04d8a86d7a4dd30b306bac7fe2e8edc
https://github.com/dkubb/axiom/blob/2476a75ed04d8a86d7a4dd30b306bac7fe2e8edc/lib/axiom/support/aliasable.rb#L35-L39
train
dkubb/axiom
lib/axiom/tuple.rb
Axiom.Tuple.extend
def extend(header, extensions) join( header, extensions.map { |extension| Function.extract_value(extension, self) } ) end
ruby
def extend(header, extensions) join( header, extensions.map { |extension| Function.extract_value(extension, self) } ) end
[ "def", "extend", "(", "header", ",", "extensions", ")", "join", "(", "header", ",", "extensions", ".", "map", "{", "|", "extension", "|", "Function", ".", "extract_value", "(", "extension", ",", "self", ")", "}", ")", "end" ]
Extend a tuple with function results @example new_tuple = tuple.extend(header, [func1, func2]) @param [Header] header the attributes to include in the tuple @param [Array<Object>] extensions the functions to extend the tuple with @return [Tuple] @api public
[ "Extend", "a", "tuple", "with", "function", "results" ]
2476a75ed04d8a86d7a4dd30b306bac7fe2e8edc
https://github.com/dkubb/axiom/blob/2476a75ed04d8a86d7a4dd30b306bac7fe2e8edc/lib/axiom/tuple.rb#L94-L99
train
dkubb/axiom
lib/axiom/tuple.rb
Axiom.Tuple.predicate
def predicate header.reduce(Function::Proposition::Tautology.instance) do |predicate, attribute| predicate.and(attribute.eq(attribute.call(self))) end end
ruby
def predicate header.reduce(Function::Proposition::Tautology.instance) do |predicate, attribute| predicate.and(attribute.eq(attribute.call(self))) end end
[ "def", "predicate", "header", ".", "reduce", "(", "Function", "::", "Proposition", "::", "Tautology", ".", "instance", ")", "do", "|", "predicate", ",", "attribute", "|", "predicate", ".", "and", "(", "attribute", ".", "eq", "(", "attribute", ".", "call", ...
Return the predicate matching the tuple @return [Function] @api private
[ "Return", "the", "predicate", "matching", "the", "tuple" ]
2476a75ed04d8a86d7a4dd30b306bac7fe2e8edc
https://github.com/dkubb/axiom/blob/2476a75ed04d8a86d7a4dd30b306bac7fe2e8edc/lib/axiom/tuple.rb#L137-L141
train
jasonlong/geo_pattern
lib/geo_pattern/geo_pattern_task.rb
GeoPattern.GeoPatternTask.run_task
def run_task(_verbose) data.each do |path, string| opts = {} path = File.expand_path(path) if string.is_a?(Hash) input = string[:input] opts[:patterns] = string[:patterns] if string.key? :patterns opts[:color] = string[:color] if string.key...
ruby
def run_task(_verbose) data.each do |path, string| opts = {} path = File.expand_path(path) if string.is_a?(Hash) input = string[:input] opts[:patterns] = string[:patterns] if string.key? :patterns opts[:color] = string[:color] if string.key...
[ "def", "run_task", "(", "_verbose", ")", "data", ".", "each", "do", "|", "path", ",", "string", "|", "opts", "=", "{", "}", "path", "=", "File", ".", "expand_path", "(", "path", ")", "if", "string", ".", "is_a?", "(", "Hash", ")", "input", "=", "...
Create a new geo pattern task @param [Hash] data The data which should be used to generate patterns @param [Array] allowed_patterns The allowed_patterns @see RakeTask For other arguments accepted @private
[ "Create", "a", "new", "geo", "pattern", "task" ]
62d3222c7394f0f02ab7f4705219d616c5a72b7e
https://github.com/jasonlong/geo_pattern/blob/62d3222c7394f0f02ab7f4705219d616c5a72b7e/lib/geo_pattern/geo_pattern_task.rb#L37-L57
train
jasonlong/geo_pattern
lib/geo_pattern/rake_task.rb
GeoPattern.RakeTask.include
def include(modules) modules = Array(modules) modules.each { |m| self.class.include m } end
ruby
def include(modules) modules = Array(modules) modules.each { |m| self.class.include m } end
[ "def", "include", "(", "modules", ")", "modules", "=", "Array", "(", "modules", ")", "modules", ".", "each", "{", "|", "m", "|", "self", ".", "class", ".", "include", "m", "}", "end" ]
Include module in instance
[ "Include", "module", "in", "instance" ]
62d3222c7394f0f02ab7f4705219d616c5a72b7e
https://github.com/jasonlong/geo_pattern/blob/62d3222c7394f0f02ab7f4705219d616c5a72b7e/lib/geo_pattern/rake_task.rb#L101-L105
train
kontena/kontena
cli/lib/kontena/cli/master/login_command.rb
Kontena::Cli::Master.LoginCommand.authentication_path
def authentication_path(local_port: nil, invite_code: nil, expires_in: nil, remote: false) auth_url_params = {} if remote auth_url_params[:redirect_uri] = "/code" elsif local_port auth_url_params[:redirect_uri] = "http://localhost:#{local_port}/cb" else raise ArgumentErro...
ruby
def authentication_path(local_port: nil, invite_code: nil, expires_in: nil, remote: false) auth_url_params = {} if remote auth_url_params[:redirect_uri] = "/code" elsif local_port auth_url_params[:redirect_uri] = "http://localhost:#{local_port}/cb" else raise ArgumentErro...
[ "def", "authentication_path", "(", "local_port", ":", "nil", ",", "invite_code", ":", "nil", ",", "expires_in", ":", "nil", ",", "remote", ":", "false", ")", "auth_url_params", "=", "{", "}", "if", "remote", "auth_url_params", "[", ":redirect_uri", "]", "=",...
Build a path for master authentication @param local_port [Fixnum] tcp port where localhost webserver is listening @param invite_code [String] an invitation code generated when user was invited @param expires_in [Fixnum] expiration time for the requested access token @param remote [Boolean] true when performing a l...
[ "Build", "a", "path", "for", "master", "authentication" ]
5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7
https://github.com/kontena/kontena/blob/5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7/cli/lib/kontena/cli/master/login_command.rb#L126-L138
train
kontena/kontena
cli/lib/kontena/cli/master/login_command.rb
Kontena::Cli::Master.LoginCommand.authentication_url_from_master
def authentication_url_from_master(master_url, auth_params) client = Kontena::Client.new(master_url) vspinner "Sending authentication request to receive an authorization URL" do response = client.request( http_method: :get, path: authentication_path(auth_params), expect...
ruby
def authentication_url_from_master(master_url, auth_params) client = Kontena::Client.new(master_url) vspinner "Sending authentication request to receive an authorization URL" do response = client.request( http_method: :get, path: authentication_path(auth_params), expect...
[ "def", "authentication_url_from_master", "(", "master_url", ",", "auth_params", ")", "client", "=", "Kontena", "::", "Client", ".", "new", "(", "master_url", ")", "vspinner", "\"Sending authentication request to receive an authorization URL\"", "do", "response", "=", "cli...
Request a redirect to the authentication url from master @param master_url [String] master root url @param auth_params [Hash] auth parameters (keyword arguments of #authentication_path) @return [String] url to begin authentication web flow
[ "Request", "a", "redirect", "to", "the", "authentication", "url", "from", "master" ]
5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7
https://github.com/kontena/kontena/blob/5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7/cli/lib/kontena/cli/master/login_command.rb#L145-L165
train
kontena/kontena
cli/lib/kontena/cli/master/login_command.rb
Kontena::Cli::Master.LoginCommand.select_a_server
def select_a_server(name, url) # no url, no name, try to use current master if url.nil? && name.nil? if config.current_master return config.current_master else exit_with_error 'URL not specified and current master not selected' end end if name && url ...
ruby
def select_a_server(name, url) # no url, no name, try to use current master if url.nil? && name.nil? if config.current_master return config.current_master else exit_with_error 'URL not specified and current master not selected' end end if name && url ...
[ "def", "select_a_server", "(", "name", ",", "url", ")", "if", "url", ".", "nil?", "&&", "name", ".", "nil?", "if", "config", ".", "current_master", "return", "config", ".", "current_master", "else", "exit_with_error", "'URL not specified and current master not selec...
Figure out or create a server based on url or name. No name or url provided: try to use current_master A name provided with --name but no url defined: try to find a server by name from config An URL starting with 'http' provided: try to find a server by url from config An URL not starting with 'http' provided: try...
[ "Figure", "out", "or", "create", "a", "server", "based", "on", "url", "or", "name", "." ]
5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7
https://github.com/kontena/kontena/blob/5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7/cli/lib/kontena/cli/master/login_command.rb#L273-L328
train
kontena/kontena
agent/lib/kontena/network_adapters/weave.rb
Kontena::NetworkAdapters.Weave.ensure_exposed
def ensure_exposed(cidr) # configure new address # these will be added alongside any existing addresses if @executor_pool.expose(cidr) info "Exposed host node at cidr=#{cidr}" else error "Failed to expose host node at cidr=#{cidr}" end # cleanup any old addresses ...
ruby
def ensure_exposed(cidr) # configure new address # these will be added alongside any existing addresses if @executor_pool.expose(cidr) info "Exposed host node at cidr=#{cidr}" else error "Failed to expose host node at cidr=#{cidr}" end # cleanup any old addresses ...
[ "def", "ensure_exposed", "(", "cidr", ")", "if", "@executor_pool", ".", "expose", "(", "cidr", ")", "info", "\"Exposed host node at cidr=#{cidr}\"", "else", "error", "\"Failed to expose host node at cidr=#{cidr}\"", "end", "@executor_pool", ".", "ps", "(", "'weave:expose'...
Ensure that the host weave bridge is exposed using the given CIDR address, and only the given CIDR address @param [String] cidr '10.81.0.X/16'
[ "Ensure", "that", "the", "host", "weave", "bridge", "is", "exposed", "using", "the", "given", "CIDR", "address", "and", "only", "the", "given", "CIDR", "address" ]
5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7
https://github.com/kontena/kontena/blob/5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7/agent/lib/kontena/network_adapters/weave.rb#L162-L180
train
kontena/kontena
agent/lib/kontena/network_adapters/weave.rb
Kontena::NetworkAdapters.Weave.get_containers
def get_containers containers = { } @executor_pool.ps() do |id, mac, *cidrs| next if id == 'weave:expose' containers[id] = cidrs end containers end
ruby
def get_containers containers = { } @executor_pool.ps() do |id, mac, *cidrs| next if id == 'weave:expose' containers[id] = cidrs end containers end
[ "def", "get_containers", "containers", "=", "{", "}", "@executor_pool", ".", "ps", "(", ")", "do", "|", "id", ",", "mac", ",", "*", "cidrs", "|", "next", "if", "id", "==", "'weave:expose'", "containers", "[", "id", "]", "=", "cidrs", "end", "containers...
Inspect current state of attached containers @return [Hash<String, String>] container_id[0..12] => [overlay_cidr]
[ "Inspect", "current", "state", "of", "attached", "containers" ]
5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7
https://github.com/kontena/kontena/blob/5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7/agent/lib/kontena/network_adapters/weave.rb#L285-L295
train
kontena/kontena
agent/lib/kontena/network_adapters/weave.rb
Kontena::NetworkAdapters.Weave.migrate_container
def migrate_container(container_id, cidr, attached_cidrs) # first remove any existing addresses # this is required, since weave will not attach if the address already exists, but with a different netmask attached_cidrs.each do |attached_cidr| if cidr != attached_cidr warn "Migrate co...
ruby
def migrate_container(container_id, cidr, attached_cidrs) # first remove any existing addresses # this is required, since weave will not attach if the address already exists, but with a different netmask attached_cidrs.each do |attached_cidr| if cidr != attached_cidr warn "Migrate co...
[ "def", "migrate_container", "(", "container_id", ",", "cidr", ",", "attached_cidrs", ")", "attached_cidrs", ".", "each", "do", "|", "attached_cidr", "|", "if", "cidr", "!=", "attached_cidr", "warn", "\"Migrate container=#{container_id} from cidr=#{attached_cidr}\"", "@exe...
Attach container to weave with given CIDR address, first detaching any existing mismatching addresses @param [String] container_id @param [String] overlay_cidr '10.81.X.Y/16' @param [Array<String>] migrate_cidrs ['10.81.X.Y/19']
[ "Attach", "container", "to", "weave", "with", "given", "CIDR", "address", "first", "detaching", "any", "existing", "mismatching", "addresses" ]
5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7
https://github.com/kontena/kontena/blob/5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7/agent/lib/kontena/network_adapters/weave.rb#L312-L324
train
kontena/kontena
agent/lib/kontena/network_adapters/weave.rb
Kontena::NetworkAdapters.Weave.remove_container
def remove_container(container_id, overlay_network, overlay_cidr) info "Remove container=#{container_id} from network=#{overlay_network} at cidr=#{overlay_cidr}" @ipam_client.release_address(overlay_network, overlay_cidr) rescue IpamError => error # Cleanup will take care of these later on ...
ruby
def remove_container(container_id, overlay_network, overlay_cidr) info "Remove container=#{container_id} from network=#{overlay_network} at cidr=#{overlay_cidr}" @ipam_client.release_address(overlay_network, overlay_cidr) rescue IpamError => error # Cleanup will take care of these later on ...
[ "def", "remove_container", "(", "container_id", ",", "overlay_network", ",", "overlay_cidr", ")", "info", "\"Remove container=#{container_id} from network=#{overlay_network} at cidr=#{overlay_cidr}\"", "@ipam_client", ".", "release_address", "(", "overlay_network", ",", "overlay_ci...
Remove container from weave network @param [String] container_id may not exist anymore @param [Hash] labels Docker container labels
[ "Remove", "container", "from", "weave", "network" ]
5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7
https://github.com/kontena/kontena/blob/5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7/agent/lib/kontena/network_adapters/weave.rb#L330-L337
train
kontena/kontena
agent/lib/kontena/workers/weave_worker.rb
Kontena::Workers.WeaveWorker.start_container
def start_container(container) overlay_cidr = container.overlay_cidr if overlay_cidr wait_weave_running? register_container_dns(container) if container.service_container? attach_overlay(container) else debug "skip start for container=#{container.name} without overlay_c...
ruby
def start_container(container) overlay_cidr = container.overlay_cidr if overlay_cidr wait_weave_running? register_container_dns(container) if container.service_container? attach_overlay(container) else debug "skip start for container=#{container.name} without overlay_c...
[ "def", "start_container", "(", "container", ")", "overlay_cidr", "=", "container", ".", "overlay_cidr", "if", "overlay_cidr", "wait_weave_running?", "register_container_dns", "(", "container", ")", "if", "container", ".", "service_container?", "attach_overlay", "(", "co...
Ensure weave network for container @param [Docker::Container] container
[ "Ensure", "weave", "network", "for", "container" ]
5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7
https://github.com/kontena/kontena/blob/5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7/agent/lib/kontena/workers/weave_worker.rb#L86-L102
train
kontena/kontena
cli/lib/kontena/plugin_manager.rb
Kontena.PluginManager.init
def init ENV["GEM_HOME"] = Common.install_dir Gem.paths = ENV Common.use_dummy_ui unless Kontena.debug? plugins true end
ruby
def init ENV["GEM_HOME"] = Common.install_dir Gem.paths = ENV Common.use_dummy_ui unless Kontena.debug? plugins true end
[ "def", "init", "ENV", "[", "\"GEM_HOME\"", "]", "=", "Common", ".", "install_dir", "Gem", ".", "paths", "=", "ENV", "Common", ".", "use_dummy_ui", "unless", "Kontena", ".", "debug?", "plugins", "true", "end" ]
Initialize plugin manager
[ "Initialize", "plugin", "manager" ]
5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7
https://github.com/kontena/kontena/blob/5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7/cli/lib/kontena/plugin_manager.rb#L11-L17
train
kontena/kontena
agent/lib/kontena/logging.rb
Kontena.Logging.debug
def debug(message = nil, &block) logger.add(Logger::DEBUG, message, self.logging_prefix, &block) end
ruby
def debug(message = nil, &block) logger.add(Logger::DEBUG, message, self.logging_prefix, &block) end
[ "def", "debug", "(", "message", "=", "nil", ",", "&", "block", ")", "logger", ".", "add", "(", "Logger", "::", "DEBUG", ",", "message", ",", "self", ".", "logging_prefix", ",", "&", "block", ")", "end" ]
Send a debug message @param message [String] @yield optionally set the message using a block
[ "Send", "a", "debug", "message" ]
5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7
https://github.com/kontena/kontena/blob/5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7/agent/lib/kontena/logging.rb#L32-L34
train
kontena/kontena
agent/lib/kontena/logging.rb
Kontena.Logging.info
def info(message = nil, &block) logger.add(Logger::INFO, message, self.logging_prefix, &block) end
ruby
def info(message = nil, &block) logger.add(Logger::INFO, message, self.logging_prefix, &block) end
[ "def", "info", "(", "message", "=", "nil", ",", "&", "block", ")", "logger", ".", "add", "(", "Logger", "::", "INFO", ",", "message", ",", "self", ".", "logging_prefix", ",", "&", "block", ")", "end" ]
Send a info message @param message [String] @yield optionally set the message using a block
[ "Send", "a", "info", "message" ]
5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7
https://github.com/kontena/kontena/blob/5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7/agent/lib/kontena/logging.rb#L39-L41
train
kontena/kontena
agent/lib/kontena/logging.rb
Kontena.Logging.warn
def warn(message = nil, &block) logger.add(Logger::WARN, message, self.logging_prefix, &block) end
ruby
def warn(message = nil, &block) logger.add(Logger::WARN, message, self.logging_prefix, &block) end
[ "def", "warn", "(", "message", "=", "nil", ",", "&", "block", ")", "logger", ".", "add", "(", "Logger", "::", "WARN", ",", "message", ",", "self", ".", "logging_prefix", ",", "&", "block", ")", "end" ]
Send a warning message @param message [String] @yield optionally set the message using a block
[ "Send", "a", "warning", "message" ]
5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7
https://github.com/kontena/kontena/blob/5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7/agent/lib/kontena/logging.rb#L46-L48
train
kontena/kontena
agent/lib/kontena/logging.rb
Kontena.Logging.error
def error(message = nil, &block) logger.add(Logger::ERROR, message, self.logging_prefix, &block) end
ruby
def error(message = nil, &block) logger.add(Logger::ERROR, message, self.logging_prefix, &block) end
[ "def", "error", "(", "message", "=", "nil", ",", "&", "block", ")", "logger", ".", "add", "(", "Logger", "::", "ERROR", ",", "message", ",", "self", ".", "logging_prefix", ",", "&", "block", ")", "end" ]
Send an error message @param message [String] @yield optionally set the message using a block
[ "Send", "an", "error", "message" ]
5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7
https://github.com/kontena/kontena/blob/5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7/agent/lib/kontena/logging.rb#L53-L55
train
kontena/kontena
server/lib/mutations/command_errors.rb
Mutations.Command.add_error
def add_error(key, error, message = nil) if error.is_a? Symbol error = ErrorAtom.new(key, error, message: message) elsif error.is_a?(Mutations::ErrorAtom) || error.is_a?(Mutations::ErrorArray) || error.is_a?(Mutations::ErrorHash) else raise ArgumentError.new("Invalid error of kind #{e...
ruby
def add_error(key, error, message = nil) if error.is_a? Symbol error = ErrorAtom.new(key, error, message: message) elsif error.is_a?(Mutations::ErrorAtom) || error.is_a?(Mutations::ErrorArray) || error.is_a?(Mutations::ErrorHash) else raise ArgumentError.new("Invalid error of kind #{e...
[ "def", "add_error", "(", "key", ",", "error", ",", "message", "=", "nil", ")", "if", "error", ".", "is_a?", "Symbol", "error", "=", "ErrorAtom", ".", "new", "(", "key", ",", "error", ",", "message", ":", "message", ")", "elsif", "error", ".", "is_a?"...
Add error for a key @param key [Symbol] :foo @param key [String] 'foo.bar' @param error [Symbol] :not_found @param error [Mutations:ErrorAtom, Mutations::ErrorArray, Mutations::ErrorHash]
[ "Add", "error", "for", "a", "key" ]
5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7
https://github.com/kontena/kontena/blob/5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7/server/lib/mutations/command_errors.rb#L13-L31
train
kontena/kontena
cli/lib/kontena/cli/helpers/exec_helper.rb
Kontena::Cli::Helpers.ExecHelper.websocket_exec_write_thread
def websocket_exec_write_thread(ws, tty: nil) Thread.new do begin if tty console_height, console_width = TTY::Screen.size websocket_exec_write(ws, 'tty_size' => { width: console_width, height: console_height }) end read_stdin(...
ruby
def websocket_exec_write_thread(ws, tty: nil) Thread.new do begin if tty console_height, console_width = TTY::Screen.size websocket_exec_write(ws, 'tty_size' => { width: console_width, height: console_height }) end read_stdin(...
[ "def", "websocket_exec_write_thread", "(", "ws", ",", "tty", ":", "nil", ")", "Thread", ".", "new", "do", "begin", "if", "tty", "console_height", ",", "console_width", "=", "TTY", "::", "Screen", ".", "size", "websocket_exec_write", "(", "ws", ",", "'tty_siz...
Start thread to read from stdin, and write to websocket. Closes websocket on stdin read errors. @param ws [Kontena::Websocket::Client] @param tty [Boolean] @return [Thread]
[ "Start", "thread", "to", "read", "from", "stdin", "and", "write", "to", "websocket", ".", "Closes", "websocket", "on", "stdin", "read", "errors", "." ]
5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7
https://github.com/kontena/kontena/blob/5cb5b4457895985231ac88e78c8cbc5a8ffb5ec7/cli/lib/kontena/cli/helpers/exec_helper.rb#L107-L126
train