id
int32 0
24.9k
| repo
stringlengths 5
58
| path
stringlengths 9
168
| func_name
stringlengths 9
130
| original_string
stringlengths 66
10.5k
| language
stringclasses 1
value | code
stringlengths 66
10.5k
| code_tokens
sequence | docstring
stringlengths 8
16k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 94
266
|
---|---|---|---|---|---|---|---|---|---|---|---|
3,300 | blythedunham/static_record_cache | lib/acts_as_static_record.rb | ActsAsStaticRecord.SingletonMethods.find_with_static_record | def find_with_static_record(*args)#:nodoc:
if scope(:find).nil? && args
if args.first.is_a?(Fixnum) &&
((args.length == 1 ||
(args[1].is_a?(Hash) && args[1].values.delete(nil).nil?)))
return static_record_cache[:primary_key][args.first]
elsif args.first == :all && args.length == 1
return static_record_cache[:primary_key].values
end
end
find_without_static_record(*args)
end | ruby | def find_with_static_record(*args)#:nodoc:
if scope(:find).nil? && args
if args.first.is_a?(Fixnum) &&
((args.length == 1 ||
(args[1].is_a?(Hash) && args[1].values.delete(nil).nil?)))
return static_record_cache[:primary_key][args.first]
elsif args.first == :all && args.length == 1
return static_record_cache[:primary_key].values
end
end
find_without_static_record(*args)
end | [
"def",
"find_with_static_record",
"(",
"*",
"args",
")",
"#:nodoc:",
"if",
"scope",
"(",
":find",
")",
".",
"nil?",
"&&",
"args",
"if",
"args",
".",
"first",
".",
"is_a?",
"(",
"Fixnum",
")",
"&&",
"(",
"(",
"args",
".",
"length",
"==",
"1",
"||",
"(",
"args",
"[",
"1",
"]",
".",
"is_a?",
"(",
"Hash",
")",
"&&",
"args",
"[",
"1",
"]",
".",
"values",
".",
"delete",
"(",
"nil",
")",
".",
"nil?",
")",
")",
")",
"return",
"static_record_cache",
"[",
":primary_key",
"]",
"[",
"args",
".",
"first",
"]",
"elsif",
"args",
".",
"first",
"==",
":all",
"&&",
"args",
".",
"length",
"==",
"1",
"return",
"static_record_cache",
"[",
":primary_key",
"]",
".",
"values",
"end",
"end",
"find_without_static_record",
"(",
"args",
")",
"end"
] | Perform find by searching through the static record cache
if only an id is specified | [
"Perform",
"find",
"by",
"searching",
"through",
"the",
"static",
"record",
"cache",
"if",
"only",
"an",
"id",
"is",
"specified"
] | 3c8226886a99128a776b5a81f27c7aab8f4ce529 | https://github.com/blythedunham/static_record_cache/blob/3c8226886a99128a776b5a81f27c7aab8f4ce529/lib/acts_as_static_record.rb#L345-L357 |
3,301 | blythedunham/static_record_cache | lib/acts_as_static_record.rb | ActsAsStaticRecord.SingletonMethods.calculate_with_static_record | def calculate_with_static_record(operation, column_name, options={})#:nodoc:
if scope(:find).nil? && !options.any?{ |k,v| k.to_s.downcase != 'distinct' }
key = "#{operation}_#{column_name}_#{options.none?{|k,v| v.blank? }}"
static_record_cache[:calc][key]||=
case operation.to_s
when 'count' then
#count the cache if we want all or the unique primary key
if ['all', '', '*', primary_key].include?(column_name.to_s)
static_record_cache[:primary_key].length
#otherwise compute the length of the output
else
static_records_for_calculation(column_name, options) {|records| records.length }
end
#compute the method directly on the result array
when 'sum', 'max', 'min' then
if columns_hash[column_name.to_s].try(:type) == :integer
static_records_for_calculation(column_name, options) {|records| records.send(operation).to_i }
end
end
return static_record_cache[:calc][key] if static_record_cache[:calc][key]
end
calculate_without_static_record(operation, column_name, options)
end | ruby | def calculate_with_static_record(operation, column_name, options={})#:nodoc:
if scope(:find).nil? && !options.any?{ |k,v| k.to_s.downcase != 'distinct' }
key = "#{operation}_#{column_name}_#{options.none?{|k,v| v.blank? }}"
static_record_cache[:calc][key]||=
case operation.to_s
when 'count' then
#count the cache if we want all or the unique primary key
if ['all', '', '*', primary_key].include?(column_name.to_s)
static_record_cache[:primary_key].length
#otherwise compute the length of the output
else
static_records_for_calculation(column_name, options) {|records| records.length }
end
#compute the method directly on the result array
when 'sum', 'max', 'min' then
if columns_hash[column_name.to_s].try(:type) == :integer
static_records_for_calculation(column_name, options) {|records| records.send(operation).to_i }
end
end
return static_record_cache[:calc][key] if static_record_cache[:calc][key]
end
calculate_without_static_record(operation, column_name, options)
end | [
"def",
"calculate_with_static_record",
"(",
"operation",
",",
"column_name",
",",
"options",
"=",
"{",
"}",
")",
"#:nodoc:",
"if",
"scope",
"(",
":find",
")",
".",
"nil?",
"&&",
"!",
"options",
".",
"any?",
"{",
"|",
"k",
",",
"v",
"|",
"k",
".",
"to_s",
".",
"downcase",
"!=",
"'distinct'",
"}",
"key",
"=",
"\"#{operation}_#{column_name}_#{options.none?{|k,v| v.blank? }}\"",
"static_record_cache",
"[",
":calc",
"]",
"[",
"key",
"]",
"||=",
"case",
"operation",
".",
"to_s",
"when",
"'count'",
"then",
"#count the cache if we want all or the unique primary key",
"if",
"[",
"'all'",
",",
"''",
",",
"'*'",
",",
"primary_key",
"]",
".",
"include?",
"(",
"column_name",
".",
"to_s",
")",
"static_record_cache",
"[",
":primary_key",
"]",
".",
"length",
"#otherwise compute the length of the output",
"else",
"static_records_for_calculation",
"(",
"column_name",
",",
"options",
")",
"{",
"|",
"records",
"|",
"records",
".",
"length",
"}",
"end",
"#compute the method directly on the result array",
"when",
"'sum'",
",",
"'max'",
",",
"'min'",
"then",
"if",
"columns_hash",
"[",
"column_name",
".",
"to_s",
"]",
".",
"try",
"(",
":type",
")",
"==",
":integer",
"static_records_for_calculation",
"(",
"column_name",
",",
"options",
")",
"{",
"|",
"records",
"|",
"records",
".",
"send",
"(",
"operation",
")",
".",
"to_i",
"}",
"end",
"end",
"return",
"static_record_cache",
"[",
":calc",
"]",
"[",
"key",
"]",
"if",
"static_record_cache",
"[",
":calc",
"]",
"[",
"key",
"]",
"end",
"calculate_without_static_record",
"(",
"operation",
",",
"column_name",
",",
"options",
")",
"end"
] | Override calculate to compute data in memory if possible
Only processes results if there is no scope and the no keys other than distinct | [
"Override",
"calculate",
"to",
"compute",
"data",
"in",
"memory",
"if",
"possible",
"Only",
"processes",
"results",
"if",
"there",
"is",
"no",
"scope",
"and",
"the",
"no",
"keys",
"other",
"than",
"distinct"
] | 3c8226886a99128a776b5a81f27c7aab8f4ce529 | https://github.com/blythedunham/static_record_cache/blob/3c8226886a99128a776b5a81f27c7aab8f4ce529/lib/acts_as_static_record.rb#L361-L388 |
3,302 | blythedunham/static_record_cache | lib/acts_as_static_record.rb | ActsAsStaticRecord.SingletonMethods.static_records_for_calculation | def static_records_for_calculation(column_name, options={}, &block)#:nodoc:
if columns_hash.has_key?(column_name.to_s)
records = static_record_cache[:primary_key].values.collect(&(column_name.to_sym)).compact
results = (options[:distinct]||options['distinct']) ? records.uniq : records
block ? yield(results) : results
else
nil
end
end | ruby | def static_records_for_calculation(column_name, options={}, &block)#:nodoc:
if columns_hash.has_key?(column_name.to_s)
records = static_record_cache[:primary_key].values.collect(&(column_name.to_sym)).compact
results = (options[:distinct]||options['distinct']) ? records.uniq : records
block ? yield(results) : results
else
nil
end
end | [
"def",
"static_records_for_calculation",
"(",
"column_name",
",",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"#:nodoc:",
"if",
"columns_hash",
".",
"has_key?",
"(",
"column_name",
".",
"to_s",
")",
"records",
"=",
"static_record_cache",
"[",
":primary_key",
"]",
".",
"values",
".",
"collect",
"(",
"(",
"column_name",
".",
"to_sym",
")",
")",
".",
"compact",
"results",
"=",
"(",
"options",
"[",
":distinct",
"]",
"||",
"options",
"[",
"'distinct'",
"]",
")",
"?",
"records",
".",
"uniq",
":",
"records",
"block",
"?",
"yield",
"(",
"results",
")",
":",
"results",
"else",
"nil",
"end",
"end"
] | Return the array of results to calculate if they are available | [
"Return",
"the",
"array",
"of",
"results",
"to",
"calculate",
"if",
"they",
"are",
"available"
] | 3c8226886a99128a776b5a81f27c7aab8f4ce529 | https://github.com/blythedunham/static_record_cache/blob/3c8226886a99128a776b5a81f27c7aab8f4ce529/lib/acts_as_static_record.rb#L391-L399 |
3,303 | blythedunham/static_record_cache | lib/acts_as_static_record.rb | ActsAsStaticRecord.SingletonMethods.initialize_static_record_cache | def initialize_static_record_cache#:nodoc:
return unless @static_record_cache.nil?
records = self.find_without_static_record(:all, acts_as_static_record_options[:find]||{})
@static_record_cache = records.inject({:primary_key => {}, :key => {}, :calc => {}}) do |cache, record|
cache[:primary_key][record.send(self.primary_key)] = record
if acts_as_static_record_options[:key]
cache[:key][record.send(acts_as_static_record_options[:key])] = record
end
cache
end
end | ruby | def initialize_static_record_cache#:nodoc:
return unless @static_record_cache.nil?
records = self.find_without_static_record(:all, acts_as_static_record_options[:find]||{})
@static_record_cache = records.inject({:primary_key => {}, :key => {}, :calc => {}}) do |cache, record|
cache[:primary_key][record.send(self.primary_key)] = record
if acts_as_static_record_options[:key]
cache[:key][record.send(acts_as_static_record_options[:key])] = record
end
cache
end
end | [
"def",
"initialize_static_record_cache",
"#:nodoc:",
"return",
"unless",
"@static_record_cache",
".",
"nil?",
"records",
"=",
"self",
".",
"find_without_static_record",
"(",
":all",
",",
"acts_as_static_record_options",
"[",
":find",
"]",
"||",
"{",
"}",
")",
"@static_record_cache",
"=",
"records",
".",
"inject",
"(",
"{",
":primary_key",
"=>",
"{",
"}",
",",
":key",
"=>",
"{",
"}",
",",
":calc",
"=>",
"{",
"}",
"}",
")",
"do",
"|",
"cache",
",",
"record",
"|",
"cache",
"[",
":primary_key",
"]",
"[",
"record",
".",
"send",
"(",
"self",
".",
"primary_key",
")",
"]",
"=",
"record",
"if",
"acts_as_static_record_options",
"[",
":key",
"]",
"cache",
"[",
":key",
"]",
"[",
"record",
".",
"send",
"(",
"acts_as_static_record_options",
"[",
":key",
"]",
")",
"]",
"=",
"record",
"end",
"cache",
"end",
"end"
] | Find all the record and initialize the cache | [
"Find",
"all",
"the",
"record",
"and",
"initialize",
"the",
"cache"
] | 3c8226886a99128a776b5a81f27c7aab8f4ce529 | https://github.com/blythedunham/static_record_cache/blob/3c8226886a99128a776b5a81f27c7aab8f4ce529/lib/acts_as_static_record.rb#L414-L424 |
3,304 | blythedunham/static_record_cache | lib/acts_as_static_record.rb | ActsAsStaticRecord.DefineFinderMethods.static_record_finder_method_name | def static_record_finder_method_name(finder, attributes)#:nodoc:
method_to_call = "find_in_static_record_cache(#{finder.inspect}, #{attributes.inspect})"
if attributes.length == 1
key_value = case attributes.keys.first.to_s
when self.primary_key then [:primary_key, attributes.values.first.to_i]
when acts_as_static_record_options[:key] then [:key, attributes.values.first.to_s]
end
method_to_call = "static_record_cache[#{key_value[0].inspect}][#{key_value[1].inspect}]" if key_value
end
method_to_call
end | ruby | def static_record_finder_method_name(finder, attributes)#:nodoc:
method_to_call = "find_in_static_record_cache(#{finder.inspect}, #{attributes.inspect})"
if attributes.length == 1
key_value = case attributes.keys.first.to_s
when self.primary_key then [:primary_key, attributes.values.first.to_i]
when acts_as_static_record_options[:key] then [:key, attributes.values.first.to_s]
end
method_to_call = "static_record_cache[#{key_value[0].inspect}][#{key_value[1].inspect}]" if key_value
end
method_to_call
end | [
"def",
"static_record_finder_method_name",
"(",
"finder",
",",
"attributes",
")",
"#:nodoc:",
"method_to_call",
"=",
"\"find_in_static_record_cache(#{finder.inspect}, #{attributes.inspect})\"",
"if",
"attributes",
".",
"length",
"==",
"1",
"key_value",
"=",
"case",
"attributes",
".",
"keys",
".",
"first",
".",
"to_s",
"when",
"self",
".",
"primary_key",
"then",
"[",
":primary_key",
",",
"attributes",
".",
"values",
".",
"first",
".",
"to_i",
"]",
"when",
"acts_as_static_record_options",
"[",
":key",
"]",
"then",
"[",
":key",
",",
"attributes",
".",
"values",
".",
"first",
".",
"to_s",
"]",
"end",
"method_to_call",
"=",
"\"static_record_cache[#{key_value[0].inspect}][#{key_value[1].inspect}]\"",
"if",
"key_value",
"end",
"method_to_call",
"end"
] | Retrieve the method name to call based on the attributes
Single attributes on primary key or the specified key call directly to the cache
All other methods iterate through the cache | [
"Retrieve",
"the",
"method",
"name",
"to",
"call",
"based",
"on",
"the",
"attributes",
"Single",
"attributes",
"on",
"primary",
"key",
"or",
"the",
"specified",
"key",
"call",
"directly",
"to",
"the",
"cache",
"All",
"other",
"methods",
"iterate",
"through",
"the",
"cache"
] | 3c8226886a99128a776b5a81f27c7aab8f4ce529 | https://github.com/blythedunham/static_record_cache/blob/3c8226886a99128a776b5a81f27c7aab8f4ce529/lib/acts_as_static_record.rb#L447-L458 |
3,305 | blythedunham/static_record_cache | lib/acts_as_static_record.rb | ActsAsStaticRecord.DefineFinderMethods.define_static_record_finder_method | def define_static_record_finder_method(method_id, finder, bang, attributes)#:nodoc:
method_to_call = static_record_finder_method_name(finder, attributes)
method_with_static_record = "#{method_id}_with_static_rc"
#override the method to search memory if there are no args
class_eval %{
def self.#{method_with_static_record}(*args)
if (args.dup.extract_options!).any?
#{method_id}_without_static_rc(*args)
else
result = #{method_to_call}
#{'result || raise(RecordNotFound, "Couldn\'t find #{name} with #{attributes.to_a.collect {|pair| "#{pair.first} = #{pair.second}"}.join(\', \')}")' if bang}
end
end
}, __FILE__, __LINE__
method_with_static_record
end | ruby | def define_static_record_finder_method(method_id, finder, bang, attributes)#:nodoc:
method_to_call = static_record_finder_method_name(finder, attributes)
method_with_static_record = "#{method_id}_with_static_rc"
#override the method to search memory if there are no args
class_eval %{
def self.#{method_with_static_record}(*args)
if (args.dup.extract_options!).any?
#{method_id}_without_static_rc(*args)
else
result = #{method_to_call}
#{'result || raise(RecordNotFound, "Couldn\'t find #{name} with #{attributes.to_a.collect {|pair| "#{pair.first} = #{pair.second}"}.join(\', \')}")' if bang}
end
end
}, __FILE__, __LINE__
method_with_static_record
end | [
"def",
"define_static_record_finder_method",
"(",
"method_id",
",",
"finder",
",",
"bang",
",",
"attributes",
")",
"#:nodoc:",
"method_to_call",
"=",
"static_record_finder_method_name",
"(",
"finder",
",",
"attributes",
")",
"method_with_static_record",
"=",
"\"#{method_id}_with_static_rc\"",
"#override the method to search memory if there are no args",
"class_eval",
"%{\n def self.#{method_with_static_record}(*args)\n if (args.dup.extract_options!).any?\n #{method_id}_without_static_rc(*args)\n else\n result = #{method_to_call}\n #{'result || raise(RecordNotFound, \"Couldn\\'t find #{name} with #{attributes.to_a.collect {|pair| \"#{pair.first} = #{pair.second}\"}.join(\\', \\')}\")' if bang}\n end\n end\n }",
",",
"__FILE__",
",",
"__LINE__",
"method_with_static_record",
"end"
] | Define the finder method on the class, and return the name of the method
Ex. find_by_id will define find_by_id_with_static_rc
The cache is searched if no additional arguments (:conditions, :joins, etc) are specified
If additional arguments do exist find_by_id_without_static_rc is invoked | [
"Define",
"the",
"finder",
"method",
"on",
"the",
"class",
"and",
"return",
"the",
"name",
"of",
"the",
"method",
"Ex",
".",
"find_by_id",
"will",
"define",
"find_by_id_with_static_rc"
] | 3c8226886a99128a776b5a81f27c7aab8f4ce529 | https://github.com/blythedunham/static_record_cache/blob/3c8226886a99128a776b5a81f27c7aab8f4ce529/lib/acts_as_static_record.rb#L465-L482 |
3,306 | blythedunham/static_record_cache | lib/acts_as_static_record.rb | ActsAsStaticRecord.DefineFinderMethods.method_missing | def method_missing(method_id, *arguments, &block)#:nodoc:
# If the missing method is XXX_without_static_rc, define XXX
# using the superclass ActiveRecord::Base method_missing then
# Finally, alias chain it to XXX_with_static_rc
if ((match = method_id.to_s.match(/(.*)_without_static_rc$/)) &&
(base_method_id = match[1]))
begin
return super(base_method_id, *arguments, &block)
ensure
define_static_rc_alias(base_method_id)
end
end
# If the missing method is a finder like find_by_name
# Define on the class then invoke find_by_name_with_static_rc
if match = ActiveRecord::DynamicFinderMatch.match(method_id)
attribute_names = match.attribute_names
if all_attributes_exists?(attribute_names) && match.finder?
attributes = construct_attributes_from_arguments(attribute_names, arguments)
method_name = define_static_record_finder_method(method_id, match.finder, match.bang?, attributes)
return self.send method_name, *arguments
end
end
#If nothing matches, invoke the super
super(method_id, *arguments, &block)
end | ruby | def method_missing(method_id, *arguments, &block)#:nodoc:
# If the missing method is XXX_without_static_rc, define XXX
# using the superclass ActiveRecord::Base method_missing then
# Finally, alias chain it to XXX_with_static_rc
if ((match = method_id.to_s.match(/(.*)_without_static_rc$/)) &&
(base_method_id = match[1]))
begin
return super(base_method_id, *arguments, &block)
ensure
define_static_rc_alias(base_method_id)
end
end
# If the missing method is a finder like find_by_name
# Define on the class then invoke find_by_name_with_static_rc
if match = ActiveRecord::DynamicFinderMatch.match(method_id)
attribute_names = match.attribute_names
if all_attributes_exists?(attribute_names) && match.finder?
attributes = construct_attributes_from_arguments(attribute_names, arguments)
method_name = define_static_record_finder_method(method_id, match.finder, match.bang?, attributes)
return self.send method_name, *arguments
end
end
#If nothing matches, invoke the super
super(method_id, *arguments, &block)
end | [
"def",
"method_missing",
"(",
"method_id",
",",
"*",
"arguments",
",",
"&",
"block",
")",
"#:nodoc:",
"# If the missing method is XXX_without_static_rc, define XXX",
"# using the superclass ActiveRecord::Base method_missing then",
"# Finally, alias chain it to XXX_with_static_rc",
"if",
"(",
"(",
"match",
"=",
"method_id",
".",
"to_s",
".",
"match",
"(",
"/",
"/",
")",
")",
"&&",
"(",
"base_method_id",
"=",
"match",
"[",
"1",
"]",
")",
")",
"begin",
"return",
"super",
"(",
"base_method_id",
",",
"arguments",
",",
"block",
")",
"ensure",
"define_static_rc_alias",
"(",
"base_method_id",
")",
"end",
"end",
"# If the missing method is a finder like find_by_name",
"# Define on the class then invoke find_by_name_with_static_rc",
"if",
"match",
"=",
"ActiveRecord",
"::",
"DynamicFinderMatch",
".",
"match",
"(",
"method_id",
")",
"attribute_names",
"=",
"match",
".",
"attribute_names",
"if",
"all_attributes_exists?",
"(",
"attribute_names",
")",
"&&",
"match",
".",
"finder?",
"attributes",
"=",
"construct_attributes_from_arguments",
"(",
"attribute_names",
",",
"arguments",
")",
"method_name",
"=",
"define_static_record_finder_method",
"(",
"method_id",
",",
"match",
".",
"finder",
",",
"match",
".",
"bang?",
",",
"attributes",
")",
"return",
"self",
".",
"send",
"method_name",
",",
"arguments",
"end",
"end",
"#If nothing matches, invoke the super",
"super",
"(",
"method_id",
",",
"arguments",
",",
"block",
")",
"end"
] | Method missing is overridden to use cache calls for finder methods | [
"Method",
"missing",
"is",
"overridden",
"to",
"use",
"cache",
"calls",
"for",
"finder",
"methods"
] | 3c8226886a99128a776b5a81f27c7aab8f4ce529 | https://github.com/blythedunham/static_record_cache/blob/3c8226886a99128a776b5a81f27c7aab8f4ce529/lib/acts_as_static_record.rb#L485-L512 |
3,307 | interconn-isp/bollettino | lib/bollettino/generator.rb | Bollettino.Generator.generate! | def generate!(slip, path)
image = MiniMagick::Image.open(File.expand_path('../../../assets/slip.png', __FILE__))
Bollettino::Renderer::Slip.render(image, slip)
image.write path
end | ruby | def generate!(slip, path)
image = MiniMagick::Image.open(File.expand_path('../../../assets/slip.png', __FILE__))
Bollettino::Renderer::Slip.render(image, slip)
image.write path
end | [
"def",
"generate!",
"(",
"slip",
",",
"path",
")",
"image",
"=",
"MiniMagick",
"::",
"Image",
".",
"open",
"(",
"File",
".",
"expand_path",
"(",
"'../../../assets/slip.png'",
",",
"__FILE__",
")",
")",
"Bollettino",
"::",
"Renderer",
"::",
"Slip",
".",
"render",
"(",
"image",
",",
"slip",
")",
"image",
".",
"write",
"path",
"end"
] | Initializes the generator.
@param options [Hash]
Generates the given slip.
@param slip [Bollettino::Slip]
@param path [String] | [
"Initializes",
"the",
"generator",
"."
] | adc43d0ba6d1a82da33ba2042f26e67c65e769ba | https://github.com/interconn-isp/bollettino/blob/adc43d0ba6d1a82da33ba2042f26e67c65e769ba/lib/bollettino/generator.rb#L23-L27 |
3,308 | drish/hyperb | lib/hyperb/compose/compose.rb | Hyperb.Compose.compose_down | def compose_down(params = {})
raise ArgumentError, 'Invalid arguments.' unless check_arguments(params, 'project')
path = '/compose/down'
query = {}
query[:project] = params[:project] if params.key?(:project)
query[:vol] = params[:vol] if params.key?(:vol)
query[:rmi] = params[:rmi] if params.key?(:rmi)
query[:rmorphans] = params[:rmorphans] if params.key?(:rmorphans)
Hyperb::Request.new(self, path, query, 'post').perform
end | ruby | def compose_down(params = {})
raise ArgumentError, 'Invalid arguments.' unless check_arguments(params, 'project')
path = '/compose/down'
query = {}
query[:project] = params[:project] if params.key?(:project)
query[:vol] = params[:vol] if params.key?(:vol)
query[:rmi] = params[:rmi] if params.key?(:rmi)
query[:rmorphans] = params[:rmorphans] if params.key?(:rmorphans)
Hyperb::Request.new(self, path, query, 'post').perform
end | [
"def",
"compose_down",
"(",
"params",
"=",
"{",
"}",
")",
"raise",
"ArgumentError",
",",
"'Invalid arguments.'",
"unless",
"check_arguments",
"(",
"params",
",",
"'project'",
")",
"path",
"=",
"'/compose/down'",
"query",
"=",
"{",
"}",
"query",
"[",
":project",
"]",
"=",
"params",
"[",
":project",
"]",
"if",
"params",
".",
"key?",
"(",
":project",
")",
"query",
"[",
":vol",
"]",
"=",
"params",
"[",
":vol",
"]",
"if",
"params",
".",
"key?",
"(",
":vol",
")",
"query",
"[",
":rmi",
"]",
"=",
"params",
"[",
":rmi",
"]",
"if",
"params",
".",
"key?",
"(",
":rmi",
")",
"query",
"[",
":rmorphans",
"]",
"=",
"params",
"[",
":rmorphans",
"]",
"if",
"params",
".",
"key?",
"(",
":rmorphans",
")",
"Hyperb",
"::",
"Request",
".",
"new",
"(",
"self",
",",
"path",
",",
"query",
",",
"'post'",
")",
".",
"perform",
"end"
] | stop and remove a compose project
@see https://docs.hyper.sh/Reference/API/2016-04-04%20[Ver.%201.23]/Compose/compose_down.html
@raise [Hyperb::Error::Unauthorized] raised when credentials are not valid.
@raise [Hyperb::Error::NotFound] raised ips are not found.
@returns [HTTP::Response::Body] a streamable response object
@param params [Hash] A customizable set of params.
@option params [String] :project project name
@option params [Boolean] :rmorphans rm containers for services not defined in the compose file
@option params [String] :rmi remove images, all/local
@option params [Boolean] :vol remove data volumes | [
"stop",
"and",
"remove",
"a",
"compose",
"project"
] | 637de68dc304d8d07470a771f499e33f227955f4 | https://github.com/drish/hyperb/blob/637de68dc304d8d07470a771f499e33f227955f4/lib/hyperb/compose/compose.rb#L27-L36 |
3,309 | drish/hyperb | lib/hyperb/compose/compose.rb | Hyperb.Compose.compose_create | def compose_create(params = {})
raise ArgumentError, 'Invalid arguments.' unless check_arguments(params, 'project')
path = '/compose/create'
query = {}
body = {}
query[:project] = params[:project] if params.key?(:project)
body[:serviceconfigs] = { 'M': {} } # inherited from libcompose
body[:serviceconfigs][:M] = params[:serviceconfigs]
params.delete(:serviceconfigs)
body.merge!(params)
Hyperb::Request.new(self, path, query, 'post', body).perform
end | ruby | def compose_create(params = {})
raise ArgumentError, 'Invalid arguments.' unless check_arguments(params, 'project')
path = '/compose/create'
query = {}
body = {}
query[:project] = params[:project] if params.key?(:project)
body[:serviceconfigs] = { 'M': {} } # inherited from libcompose
body[:serviceconfigs][:M] = params[:serviceconfigs]
params.delete(:serviceconfigs)
body.merge!(params)
Hyperb::Request.new(self, path, query, 'post', body).perform
end | [
"def",
"compose_create",
"(",
"params",
"=",
"{",
"}",
")",
"raise",
"ArgumentError",
",",
"'Invalid arguments.'",
"unless",
"check_arguments",
"(",
"params",
",",
"'project'",
")",
"path",
"=",
"'/compose/create'",
"query",
"=",
"{",
"}",
"body",
"=",
"{",
"}",
"query",
"[",
":project",
"]",
"=",
"params",
"[",
":project",
"]",
"if",
"params",
".",
"key?",
"(",
":project",
")",
"body",
"[",
":serviceconfigs",
"]",
"=",
"{",
"'M'",
":",
"{",
"}",
"}",
"# inherited from libcompose",
"body",
"[",
":serviceconfigs",
"]",
"[",
":M",
"]",
"=",
"params",
"[",
":serviceconfigs",
"]",
"params",
".",
"delete",
"(",
":serviceconfigs",
")",
"body",
".",
"merge!",
"(",
"params",
")",
"Hyperb",
"::",
"Request",
".",
"new",
"(",
"self",
",",
"path",
",",
"query",
",",
"'post'",
",",
"body",
")",
".",
"perform",
"end"
] | create a compose project
@see https://docs.hyper.sh/Reference/API/2016-04-04%20[Ver.%201.23]/
Compose/compose_create.html
@raise [Hyperb::Error::Unauthorized] raised when credentials are not valid.
@raise [Hyperb::Error::NotFound] raised ips are not found.
@returns [HTTP::Response::Body] a streamable response object
@param params [Hash] A customizable set of params.
@option params [String] :project project name
@option params [Hash] :serviceconfigs a hash representing a docker compose file services block
@option params [Hash] :networkconfigs
@option params [Hash] :volumeconfigs | [
"create",
"a",
"compose",
"project"
] | 637de68dc304d8d07470a771f499e33f227955f4 | https://github.com/drish/hyperb/blob/637de68dc304d8d07470a771f499e33f227955f4/lib/hyperb/compose/compose.rb#L102-L114 |
3,310 | peter-edge/jprotobuf_ruby | lib/jprotobuf/message.rb | JProtobuf.Message.write_to_string_io | def write_to_string_io(string_io)
java_proto.write_to(org.jruby.util.IOOutputStream.new(string_io))
nil
end | ruby | def write_to_string_io(string_io)
java_proto.write_to(org.jruby.util.IOOutputStream.new(string_io))
nil
end | [
"def",
"write_to_string_io",
"(",
"string_io",
")",
"java_proto",
".",
"write_to",
"(",
"org",
".",
"jruby",
".",
"util",
".",
"IOOutputStream",
".",
"new",
"(",
"string_io",
")",
")",
"nil",
"end"
] | Serialize the message to the given StringIO.
@return [nil] | [
"Serialize",
"the",
"message",
"to",
"the",
"given",
"StringIO",
"."
] | 764a39b82bea75654995002606b8fb72f830e4c0 | https://github.com/peter-edge/jprotobuf_ruby/blob/764a39b82bea75654995002606b8fb72f830e4c0/lib/jprotobuf/message.rb#L225-L228 |
3,311 | peter-edge/jprotobuf_ruby | lib/jprotobuf/message.rb | JProtobuf.Message.write_to_string | def write_to_string
string_io = StringIO.new.set_encoding(Encoding::BINARY)
write_to_string_io(string_io)
string_io.string
end | ruby | def write_to_string
string_io = StringIO.new.set_encoding(Encoding::BINARY)
write_to_string_io(string_io)
string_io.string
end | [
"def",
"write_to_string",
"string_io",
"=",
"StringIO",
".",
"new",
".",
"set_encoding",
"(",
"Encoding",
"::",
"BINARY",
")",
"write_to_string_io",
"(",
"string_io",
")",
"string_io",
".",
"string",
"end"
] | Serialize the message to a String.
@return [String] the serialized message, in a String | [
"Serialize",
"the",
"message",
"to",
"a",
"String",
"."
] | 764a39b82bea75654995002606b8fb72f830e4c0 | https://github.com/peter-edge/jprotobuf_ruby/blob/764a39b82bea75654995002606b8fb72f830e4c0/lib/jprotobuf/message.rb#L233-L237 |
3,312 | jaymcgavren/zyps | lib/zyps/actions.rb | Zyps.FaceAction.do | def do(actor, targets)
return if targets.empty?
actor.vector.pitch = Utility.find_angle(actor.location, random_target(targets).location)
end | ruby | def do(actor, targets)
return if targets.empty?
actor.vector.pitch = Utility.find_angle(actor.location, random_target(targets).location)
end | [
"def",
"do",
"(",
"actor",
",",
"targets",
")",
"return",
"if",
"targets",
".",
"empty?",
"actor",
".",
"vector",
".",
"pitch",
"=",
"Utility",
".",
"find_angle",
"(",
"actor",
".",
"location",
",",
"random_target",
"(",
"targets",
")",
".",
"location",
")",
"end"
] | Set the actor's heading to point directly at first target. | [
"Set",
"the",
"actor",
"s",
"heading",
"to",
"point",
"directly",
"at",
"first",
"target",
"."
] | 7fa9dc497abc30fe2d1a2a17e129628ffb0456fb | https://github.com/jaymcgavren/zyps/blob/7fa9dc497abc30fe2d1a2a17e129628ffb0456fb/lib/zyps/actions.rb#L62-L65 |
3,313 | jaymcgavren/zyps | lib/zyps/actions.rb | Zyps.ApproachAction.do | def do(actor, targets)
return if targets.empty?
#Apply thrust to the creature's movement vector, adjusted by elapsed time.
actor.vector += Vector.new(
delta,
Utility.find_angle(actor.location, random_target(targets).location)
)
end | ruby | def do(actor, targets)
return if targets.empty?
#Apply thrust to the creature's movement vector, adjusted by elapsed time.
actor.vector += Vector.new(
delta,
Utility.find_angle(actor.location, random_target(targets).location)
)
end | [
"def",
"do",
"(",
"actor",
",",
"targets",
")",
"return",
"if",
"targets",
".",
"empty?",
"#Apply thrust to the creature's movement vector, adjusted by elapsed time.",
"actor",
".",
"vector",
"+=",
"Vector",
".",
"new",
"(",
"delta",
",",
"Utility",
".",
"find_angle",
"(",
"actor",
".",
"location",
",",
"random_target",
"(",
"targets",
")",
".",
"location",
")",
")",
"end"
] | Accelerate toward the first target, but limited by rate. | [
"Accelerate",
"toward",
"the",
"first",
"target",
"but",
"limited",
"by",
"rate",
"."
] | 7fa9dc497abc30fe2d1a2a17e129628ffb0456fb | https://github.com/jaymcgavren/zyps/blob/7fa9dc497abc30fe2d1a2a17e129628ffb0456fb/lib/zyps/actions.rb#L110-L117 |
3,314 | jaymcgavren/zyps | lib/zyps/actions.rb | Zyps.DestroyAction.do | def do(actor, targets)
targets.each do |target|
target.environment.remove_object(target.identifier)
end
end | ruby | def do(actor, targets)
targets.each do |target|
target.environment.remove_object(target.identifier)
end
end | [
"def",
"do",
"(",
"actor",
",",
"targets",
")",
"targets",
".",
"each",
"do",
"|",
"target",
"|",
"target",
".",
"environment",
".",
"remove_object",
"(",
"target",
".",
"identifier",
")",
"end",
"end"
] | Remove the target from the environment. | [
"Remove",
"the",
"target",
"from",
"the",
"environment",
"."
] | 7fa9dc497abc30fe2d1a2a17e129628ffb0456fb | https://github.com/jaymcgavren/zyps/blob/7fa9dc497abc30fe2d1a2a17e129628ffb0456fb/lib/zyps/actions.rb#L138-L142 |
3,315 | jaymcgavren/zyps | lib/zyps/actions.rb | Zyps.TagAction.do | def do(actor, targets)
targets.each do |target|
target.tags << tag unless target.tags.include?(tag)
end
end | ruby | def do(actor, targets)
targets.each do |target|
target.tags << tag unless target.tags.include?(tag)
end
end | [
"def",
"do",
"(",
"actor",
",",
"targets",
")",
"targets",
".",
"each",
"do",
"|",
"target",
"|",
"target",
".",
"tags",
"<<",
"tag",
"unless",
"target",
".",
"tags",
".",
"include?",
"(",
"tag",
")",
"end",
"end"
] | Apply the given tag to the targets. | [
"Apply",
"the",
"given",
"tag",
"to",
"the",
"targets",
"."
] | 7fa9dc497abc30fe2d1a2a17e129628ffb0456fb | https://github.com/jaymcgavren/zyps/blob/7fa9dc497abc30fe2d1a2a17e129628ffb0456fb/lib/zyps/actions.rb#L168-L172 |
3,316 | jaymcgavren/zyps | lib/zyps/actions.rb | Zyps.BlendAction.do | def do(actor, targets)
actor.color.red += (@color.red - actor.color.red) * delta
actor.color.green += (@color.green - actor.color.green) * delta
actor.color.blue += (@color.blue - actor.color.blue) * delta
end | ruby | def do(actor, targets)
actor.color.red += (@color.red - actor.color.red) * delta
actor.color.green += (@color.green - actor.color.green) * delta
actor.color.blue += (@color.blue - actor.color.blue) * delta
end | [
"def",
"do",
"(",
"actor",
",",
"targets",
")",
"actor",
".",
"color",
".",
"red",
"+=",
"(",
"@color",
".",
"red",
"-",
"actor",
".",
"color",
".",
"red",
")",
"*",
"delta",
"actor",
".",
"color",
".",
"green",
"+=",
"(",
"@color",
".",
"green",
"-",
"actor",
".",
"color",
".",
"green",
")",
"*",
"delta",
"actor",
".",
"color",
".",
"blue",
"+=",
"(",
"@color",
".",
"blue",
"-",
"actor",
".",
"color",
".",
"blue",
")",
"*",
"delta",
"end"
] | Blend the actor's color with the assigned color. | [
"Blend",
"the",
"actor",
"s",
"color",
"with",
"the",
"assigned",
"color",
"."
] | 7fa9dc497abc30fe2d1a2a17e129628ffb0456fb | https://github.com/jaymcgavren/zyps/blob/7fa9dc497abc30fe2d1a2a17e129628ffb0456fb/lib/zyps/actions.rb#L193-L197 |
3,317 | jaymcgavren/zyps | lib/zyps/actions.rb | Zyps.PushAction.do | def do(actor, targets)
#Acceleration will be limited by elapsed time.
push_force = delta
targets.each do |target|
#Angle to target is also angle of push force.
push_angle = Utility.find_angle(actor.location, target.location)
#Apply the force to the creature's movement vector.
target.vector += Vector.new(push_force, push_angle)
end
end | ruby | def do(actor, targets)
#Acceleration will be limited by elapsed time.
push_force = delta
targets.each do |target|
#Angle to target is also angle of push force.
push_angle = Utility.find_angle(actor.location, target.location)
#Apply the force to the creature's movement vector.
target.vector += Vector.new(push_force, push_angle)
end
end | [
"def",
"do",
"(",
"actor",
",",
"targets",
")",
"#Acceleration will be limited by elapsed time.",
"push_force",
"=",
"delta",
"targets",
".",
"each",
"do",
"|",
"target",
"|",
"#Angle to target is also angle of push force.",
"push_angle",
"=",
"Utility",
".",
"find_angle",
"(",
"actor",
".",
"location",
",",
"target",
".",
"location",
")",
"#Apply the force to the creature's movement vector.",
"target",
".",
"vector",
"+=",
"Vector",
".",
"new",
"(",
"push_force",
",",
"push_angle",
")",
"end",
"end"
] | Push the targets away from the actor, with force limited by elapsed time. | [
"Push",
"the",
"targets",
"away",
"from",
"the",
"actor",
"with",
"force",
"limited",
"by",
"elapsed",
"time",
"."
] | 7fa9dc497abc30fe2d1a2a17e129628ffb0456fb | https://github.com/jaymcgavren/zyps/blob/7fa9dc497abc30fe2d1a2a17e129628ffb0456fb/lib/zyps/actions.rb#L214-L223 |
3,318 | jaymcgavren/zyps | lib/zyps/actions.rb | Zyps.PullAction.do | def do(actor, targets)
#Acceleration will be limited by elapsed time.
pull_force = delta
targets.each do |target|
#Angle from target to actor is also angle of pull force (opposite of that for push).
pull_angle = Utility.find_angle(target.location, actor.location)
#Apply the force to the creature's movement vector.
target.vector += Vector.new(pull_force, pull_angle)
end
end | ruby | def do(actor, targets)
#Acceleration will be limited by elapsed time.
pull_force = delta
targets.each do |target|
#Angle from target to actor is also angle of pull force (opposite of that for push).
pull_angle = Utility.find_angle(target.location, actor.location)
#Apply the force to the creature's movement vector.
target.vector += Vector.new(pull_force, pull_angle)
end
end | [
"def",
"do",
"(",
"actor",
",",
"targets",
")",
"#Acceleration will be limited by elapsed time.",
"pull_force",
"=",
"delta",
"targets",
".",
"each",
"do",
"|",
"target",
"|",
"#Angle from target to actor is also angle of pull force (opposite of that for push).",
"pull_angle",
"=",
"Utility",
".",
"find_angle",
"(",
"target",
".",
"location",
",",
"actor",
".",
"location",
")",
"#Apply the force to the creature's movement vector.",
"target",
".",
"vector",
"+=",
"Vector",
".",
"new",
"(",
"pull_force",
",",
"pull_angle",
")",
"end",
"end"
] | Pull the targets toward the actor, with force limited by elapsed time. | [
"Pull",
"the",
"targets",
"toward",
"the",
"actor",
"with",
"force",
"limited",
"by",
"elapsed",
"time",
"."
] | 7fa9dc497abc30fe2d1a2a17e129628ffb0456fb | https://github.com/jaymcgavren/zyps/blob/7fa9dc497abc30fe2d1a2a17e129628ffb0456fb/lib/zyps/actions.rb#L232-L241 |
3,319 | jaymcgavren/zyps | lib/zyps/actions.rb | Zyps.SpawnAction.do | def do(actor, targets)
prototypes.each do |prototype|
actor.environment.add_object(generate_child(actor, prototype))
end
end | ruby | def do(actor, targets)
prototypes.each do |prototype|
actor.environment.add_object(generate_child(actor, prototype))
end
end | [
"def",
"do",
"(",
"actor",
",",
"targets",
")",
"prototypes",
".",
"each",
"do",
"|",
"prototype",
"|",
"actor",
".",
"environment",
".",
"add_object",
"(",
"generate_child",
"(",
"actor",
",",
"prototype",
")",
")",
"end",
"end"
] | Add children to environment. | [
"Add",
"children",
"to",
"environment",
"."
] | 7fa9dc497abc30fe2d1a2a17e129628ffb0456fb | https://github.com/jaymcgavren/zyps/blob/7fa9dc497abc30fe2d1a2a17e129628ffb0456fb/lib/zyps/actions.rb#L280-L284 |
3,320 | jaymcgavren/zyps | lib/zyps/actions.rb | Zyps.SpawnAction.generate_child | def generate_child(actor, prototype)
#Copy prototype so it can be spawned repeatedly if need be.
child = prototype.copy
child.location = actor.location.copy
child
end | ruby | def generate_child(actor, prototype)
#Copy prototype so it can be spawned repeatedly if need be.
child = prototype.copy
child.location = actor.location.copy
child
end | [
"def",
"generate_child",
"(",
"actor",
",",
"prototype",
")",
"#Copy prototype so it can be spawned repeatedly if need be.",
"child",
"=",
"prototype",
".",
"copy",
"child",
".",
"location",
"=",
"actor",
".",
"location",
".",
"copy",
"child",
"end"
] | Copy prototype to actor's location. | [
"Copy",
"prototype",
"to",
"actor",
"s",
"location",
"."
] | 7fa9dc497abc30fe2d1a2a17e129628ffb0456fb | https://github.com/jaymcgavren/zyps/blob/7fa9dc497abc30fe2d1a2a17e129628ffb0456fb/lib/zyps/actions.rb#L286-L291 |
3,321 | jaymcgavren/zyps | lib/zyps/actions.rb | Zyps.ExplodeAction.generate_child | def generate_child(actor, prototype)
child = super
child.vector += actor.vector
child.size = actor.size / prototypes.length
child
end | ruby | def generate_child(actor, prototype)
child = super
child.vector += actor.vector
child.size = actor.size / prototypes.length
child
end | [
"def",
"generate_child",
"(",
"actor",
",",
"prototype",
")",
"child",
"=",
"super",
"child",
".",
"vector",
"+=",
"actor",
".",
"vector",
"child",
".",
"size",
"=",
"actor",
".",
"size",
"/",
"prototypes",
".",
"length",
"child",
"end"
] | Calls super method.
Also adds actor's vector to child's.
Finally, reduces child's size to actor's size divided by number of shrapnel pieces. | [
"Calls",
"super",
"method",
".",
"Also",
"adds",
"actor",
"s",
"vector",
"to",
"child",
"s",
".",
"Finally",
"reduces",
"child",
"s",
"size",
"to",
"actor",
"s",
"size",
"divided",
"by",
"number",
"of",
"shrapnel",
"pieces",
"."
] | 7fa9dc497abc30fe2d1a2a17e129628ffb0456fb | https://github.com/jaymcgavren/zyps/blob/7fa9dc497abc30fe2d1a2a17e129628ffb0456fb/lib/zyps/actions.rb#L319-L324 |
3,322 | jaymcgavren/zyps | lib/zyps/actions.rb | Zyps.ShootAction.do | def do(actor, targets)
return if targets.empty?
#If next item is a collection of prototypes, copy them all in at once.
if prototypes[@prototype_index].respond_to?(:each)
prototypes[@prototype_index].each do |prototype|
actor.environment.add_object(generate_child(actor, prototype, targets[@target_index]))
end
#Otherwise copy the single prototype.
else
targets[@target_index].environment.add_object(generate_child(actor, prototypes[@prototype_index], targets[@target_index]))
end
#Move to next target and prototype group, wrapping to start of array if need be.
@target_index = (@target_index + 1) % targets.length
@prototype_index = (@prototype_index + 1) % prototypes.length
end | ruby | def do(actor, targets)
return if targets.empty?
#If next item is a collection of prototypes, copy them all in at once.
if prototypes[@prototype_index].respond_to?(:each)
prototypes[@prototype_index].each do |prototype|
actor.environment.add_object(generate_child(actor, prototype, targets[@target_index]))
end
#Otherwise copy the single prototype.
else
targets[@target_index].environment.add_object(generate_child(actor, prototypes[@prototype_index], targets[@target_index]))
end
#Move to next target and prototype group, wrapping to start of array if need be.
@target_index = (@target_index + 1) % targets.length
@prototype_index = (@prototype_index + 1) % prototypes.length
end | [
"def",
"do",
"(",
"actor",
",",
"targets",
")",
"return",
"if",
"targets",
".",
"empty?",
"#If next item is a collection of prototypes, copy them all in at once.",
"if",
"prototypes",
"[",
"@prototype_index",
"]",
".",
"respond_to?",
"(",
":each",
")",
"prototypes",
"[",
"@prototype_index",
"]",
".",
"each",
"do",
"|",
"prototype",
"|",
"actor",
".",
"environment",
".",
"add_object",
"(",
"generate_child",
"(",
"actor",
",",
"prototype",
",",
"targets",
"[",
"@target_index",
"]",
")",
")",
"end",
"#Otherwise copy the single prototype.",
"else",
"targets",
"[",
"@target_index",
"]",
".",
"environment",
".",
"add_object",
"(",
"generate_child",
"(",
"actor",
",",
"prototypes",
"[",
"@prototype_index",
"]",
",",
"targets",
"[",
"@target_index",
"]",
")",
")",
"end",
"#Move to next target and prototype group, wrapping to start of array if need be.",
"@target_index",
"=",
"(",
"@target_index",
"+",
"1",
")",
"%",
"targets",
".",
"length",
"@prototype_index",
"=",
"(",
"@prototype_index",
"+",
"1",
")",
"%",
"prototypes",
".",
"length",
"end"
] | Copies next prototype into environment. | [
"Copies",
"next",
"prototype",
"into",
"environment",
"."
] | 7fa9dc497abc30fe2d1a2a17e129628ffb0456fb | https://github.com/jaymcgavren/zyps/blob/7fa9dc497abc30fe2d1a2a17e129628ffb0456fb/lib/zyps/actions.rb#L342-L356 |
3,323 | jaymcgavren/zyps | lib/zyps/actions.rb | Zyps.ShootAction.generate_child | def generate_child(actor, prototype, target)
child = super(actor, prototype)
child.vector.pitch = Utility.find_angle(actor.location, target.location) + child.vector.pitch
child
end | ruby | def generate_child(actor, prototype, target)
child = super(actor, prototype)
child.vector.pitch = Utility.find_angle(actor.location, target.location) + child.vector.pitch
child
end | [
"def",
"generate_child",
"(",
"actor",
",",
"prototype",
",",
"target",
")",
"child",
"=",
"super",
"(",
"actor",
",",
"prototype",
")",
"child",
".",
"vector",
".",
"pitch",
"=",
"Utility",
".",
"find_angle",
"(",
"actor",
".",
"location",
",",
"target",
".",
"location",
")",
"+",
"child",
".",
"vector",
".",
"pitch",
"child",
"end"
] | Calls super method.
Also adds angle to target to child's vector angle. | [
"Calls",
"super",
"method",
".",
"Also",
"adds",
"angle",
"to",
"target",
"to",
"child",
"s",
"vector",
"angle",
"."
] | 7fa9dc497abc30fe2d1a2a17e129628ffb0456fb | https://github.com/jaymcgavren/zyps/blob/7fa9dc497abc30fe2d1a2a17e129628ffb0456fb/lib/zyps/actions.rb#L359-L363 |
3,324 | carsomyr/percolate | lib/percolate/percolator.rb | Percolate.Percolator.find | def find(context, facet_name, *args)
facet = find_facet(context, facet_name)
if !facet
return nil
end
case result = facet.find(*args)
when Array
result.map { |item| @entities[item] }
when String
@entities[result]
when NilClass
nil
else
raise "Bad facet return type #{result.class.name.dump}"
end
end | ruby | def find(context, facet_name, *args)
facet = find_facet(context, facet_name)
if !facet
return nil
end
case result = facet.find(*args)
when Array
result.map { |item| @entities[item] }
when String
@entities[result]
when NilClass
nil
else
raise "Bad facet return type #{result.class.name.dump}"
end
end | [
"def",
"find",
"(",
"context",
",",
"facet_name",
",",
"*",
"args",
")",
"facet",
"=",
"find_facet",
"(",
"context",
",",
"facet_name",
")",
"if",
"!",
"facet",
"return",
"nil",
"end",
"case",
"result",
"=",
"facet",
".",
"find",
"(",
"args",
")",
"when",
"Array",
"result",
".",
"map",
"{",
"|",
"item",
"|",
"@entities",
"[",
"item",
"]",
"}",
"when",
"String",
"@entities",
"[",
"result",
"]",
"when",
"NilClass",
"nil",
"else",
"raise",
"\"Bad facet return type #{result.class.name.dump}\"",
"end",
"end"
] | Finds an entity or entities.
@param context [String] the lookup context.
@param facet_name [Symbol] the facet name.
@param args [Array] the argument splat passed to the facet.
@return [Object] the retrieved entity or entities. | [
"Finds",
"an",
"entity",
"or",
"entities",
"."
] | 7c9e38ca5e3b62a7a6c6d470945c694499316dc9 | https://github.com/carsomyr/percolate/blob/7c9e38ca5e3b62a7a6c6d470945c694499316dc9/lib/percolate/percolator.rb#L71-L88 |
3,325 | carsomyr/percolate | lib/percolate/percolator.rb | Percolate.Percolator.find_facet | def find_facet(context, facet_name)
cache_key = [context, facet_name]
if @facet_cache.include?(cache_key)
facet = @facet_cache[cache_key]
else
begin
require "percolate/facet/#{facet_name}_facet"
rescue LoadError
# Do nothing. Give the benefit of the doubt if the file doesn't exist.
end
if facet = @adapter.load_facet(context, facet_name)
@facet_cache[cache_key] = facet
end
end
facet
end | ruby | def find_facet(context, facet_name)
cache_key = [context, facet_name]
if @facet_cache.include?(cache_key)
facet = @facet_cache[cache_key]
else
begin
require "percolate/facet/#{facet_name}_facet"
rescue LoadError
# Do nothing. Give the benefit of the doubt if the file doesn't exist.
end
if facet = @adapter.load_facet(context, facet_name)
@facet_cache[cache_key] = facet
end
end
facet
end | [
"def",
"find_facet",
"(",
"context",
",",
"facet_name",
")",
"cache_key",
"=",
"[",
"context",
",",
"facet_name",
"]",
"if",
"@facet_cache",
".",
"include?",
"(",
"cache_key",
")",
"facet",
"=",
"@facet_cache",
"[",
"cache_key",
"]",
"else",
"begin",
"require",
"\"percolate/facet/#{facet_name}_facet\"",
"rescue",
"LoadError",
"# Do nothing. Give the benefit of the doubt if the file doesn't exist.",
"end",
"if",
"facet",
"=",
"@adapter",
".",
"load_facet",
"(",
"context",
",",
"facet_name",
")",
"@facet_cache",
"[",
"cache_key",
"]",
"=",
"facet",
"end",
"end",
"facet",
"end"
] | Finds a facet.
@param context [String] the lookup context.
@param facet_name [Symbol] the facet name.
@return [Object] the facet. | [
"Finds",
"a",
"facet",
"."
] | 7c9e38ca5e3b62a7a6c6d470945c694499316dc9 | https://github.com/carsomyr/percolate/blob/7c9e38ca5e3b62a7a6c6d470945c694499316dc9/lib/percolate/percolator.rb#L96-L114 |
3,326 | tsonntag/gitter | lib/gitter/utils.rb | Gitter.Utils.url_for | def url_for params
p = params.dup
query = p.map{|key, value| value.to_query(key) } * '&'
"#{h.url_for({})}?#{query}"
end | ruby | def url_for params
p = params.dup
query = p.map{|key, value| value.to_query(key) } * '&'
"#{h.url_for({})}?#{query}"
end | [
"def",
"url_for",
"params",
"p",
"=",
"params",
".",
"dup",
"query",
"=",
"p",
".",
"map",
"{",
"|",
"key",
",",
"value",
"|",
"value",
".",
"to_query",
"(",
"key",
")",
"}",
"*",
"'&'",
"\"#{h.url_for({})}?#{query}\"",
"end"
] | dirty hack to avoid rails' sorted query in url | [
"dirty",
"hack",
"to",
"avoid",
"rails",
"sorted",
"query",
"in",
"url"
] | 55c79a5d8012129517510d1d1758621f4baf5344 | https://github.com/tsonntag/gitter/blob/55c79a5d8012129517510d1d1758621f4baf5344/lib/gitter/utils.rb#L5-L9 |
3,327 | drish/hyperb | lib/hyperb/services/services.rb | Hyperb.Services.create_service | def create_service(params = {})
valid = check_arguments(params, 'name', 'image', 'replicas', 'serviceport', 'labels')
raise ArgumentError, 'Invalid arguments.' unless valid
path = '/services/create'
body = {}
body.merge!(params)
downcase_symbolize(JSON.parse(Hyperb::Request.new(self, path, {}, 'post', body).perform))
end | ruby | def create_service(params = {})
valid = check_arguments(params, 'name', 'image', 'replicas', 'serviceport', 'labels')
raise ArgumentError, 'Invalid arguments.' unless valid
path = '/services/create'
body = {}
body.merge!(params)
downcase_symbolize(JSON.parse(Hyperb::Request.new(self, path, {}, 'post', body).perform))
end | [
"def",
"create_service",
"(",
"params",
"=",
"{",
"}",
")",
"valid",
"=",
"check_arguments",
"(",
"params",
",",
"'name'",
",",
"'image'",
",",
"'replicas'",
",",
"'serviceport'",
",",
"'labels'",
")",
"raise",
"ArgumentError",
",",
"'Invalid arguments.'",
"unless",
"valid",
"path",
"=",
"'/services/create'",
"body",
"=",
"{",
"}",
"body",
".",
"merge!",
"(",
"params",
")",
"downcase_symbolize",
"(",
"JSON",
".",
"parse",
"(",
"Hyperb",
"::",
"Request",
".",
"new",
"(",
"self",
",",
"path",
",",
"{",
"}",
",",
"'post'",
",",
"body",
")",
".",
"perform",
")",
")",
"end"
] | create a service
@see https://docs.hyper.sh/Reference/API/2016-04-04%20[Ver.%201.23]/Service/create.html
@raise [Hyperb::Error::Unauthorized] raised when credentials are not valid.
@return [Hash] Hash containing service information.
@param params [Hash] A customizable set of params.
@param params [String] :image service name
@param params [String] :name image name
@param params [Fixnum] :replicas numer of replicas
@param params [Fixnum] :serviceport service port
@param params [Fixnum] :containerport container port
@param params [Hash] :labels hash containing labels
@param params [String] :entrypoint entrypoint
@param params [String] :cmd command
@param params [Boolean] :stdin keep STDIN open even if not attached.
@param params [Array] :env array of envs ["env=value", ["env2=value"]]
@param params [String] :algorithm algorithm of the service, 'roundrobin', 'leastconn'
@param params [String] :protocol prot
@param params [String] :workingdir working directory
@param params [Boolean] :sessionaffinity whether the service uses sticky sessions.
@param params [String] :securitygroups security group for the container. | [
"create",
"a",
"service"
] | 637de68dc304d8d07470a771f499e33f227955f4 | https://github.com/drish/hyperb/blob/637de68dc304d8d07470a771f499e33f227955f4/lib/hyperb/services/services.rb#L36-L43 |
3,328 | Sage/hash_kit | lib/hash_kit/helper.rb | HashKit.Helper.symbolize | def symbolize(hash)
{}.tap do |h|
hash.each { |key, value| h[key.to_sym] = map_value_symbol(value) }
end
end | ruby | def symbolize(hash)
{}.tap do |h|
hash.each { |key, value| h[key.to_sym] = map_value_symbol(value) }
end
end | [
"def",
"symbolize",
"(",
"hash",
")",
"{",
"}",
".",
"tap",
"do",
"|",
"h",
"|",
"hash",
".",
"each",
"{",
"|",
"key",
",",
"value",
"|",
"h",
"[",
"key",
".",
"to_sym",
"]",
"=",
"map_value_symbol",
"(",
"value",
")",
"}",
"end",
"end"
] | This method is called to convert all the keys of a hash into symbols to allow consistent usage of hashes within your Ruby application. | [
"This",
"method",
"is",
"called",
"to",
"convert",
"all",
"the",
"keys",
"of",
"a",
"hash",
"into",
"symbols",
"to",
"allow",
"consistent",
"usage",
"of",
"hashes",
"within",
"your",
"Ruby",
"application",
"."
] | b46019965325c51df3f53985a8c22e15037d9b8c | https://github.com/Sage/hash_kit/blob/b46019965325c51df3f53985a8c22e15037d9b8c/lib/hash_kit/helper.rb#L50-L54 |
3,329 | Sage/hash_kit | lib/hash_kit/helper.rb | HashKit.Helper.stringify | def stringify(hash)
{}.tap do |h|
hash.each { |key, value| h[key.to_s] = map_value_string(value) }
end
end | ruby | def stringify(hash)
{}.tap do |h|
hash.each { |key, value| h[key.to_s] = map_value_string(value) }
end
end | [
"def",
"stringify",
"(",
"hash",
")",
"{",
"}",
".",
"tap",
"do",
"|",
"h",
"|",
"hash",
".",
"each",
"{",
"|",
"key",
",",
"value",
"|",
"h",
"[",
"key",
".",
"to_s",
"]",
"=",
"map_value_string",
"(",
"value",
")",
"}",
"end",
"end"
] | This method is called to convert all the keys of a hash into strings to allow consistent usage of hashes within your Ruby application. | [
"This",
"method",
"is",
"called",
"to",
"convert",
"all",
"the",
"keys",
"of",
"a",
"hash",
"into",
"strings",
"to",
"allow",
"consistent",
"usage",
"of",
"hashes",
"within",
"your",
"Ruby",
"application",
"."
] | b46019965325c51df3f53985a8c22e15037d9b8c | https://github.com/Sage/hash_kit/blob/b46019965325c51df3f53985a8c22e15037d9b8c/lib/hash_kit/helper.rb#L57-L61 |
3,330 | Sage/hash_kit | lib/hash_kit/helper.rb | HashKit.Helper.to_hash | def to_hash(obj)
return nil unless obj
return obj if obj.is_a?(Hash)
hash = {}
obj.instance_variables.each do |key|
hash[key[1..-1].to_sym] = deeply_to_hash(obj.instance_variable_get(key))
end
hash
end | ruby | def to_hash(obj)
return nil unless obj
return obj if obj.is_a?(Hash)
hash = {}
obj.instance_variables.each do |key|
hash[key[1..-1].to_sym] = deeply_to_hash(obj.instance_variable_get(key))
end
hash
end | [
"def",
"to_hash",
"(",
"obj",
")",
"return",
"nil",
"unless",
"obj",
"return",
"obj",
"if",
"obj",
".",
"is_a?",
"(",
"Hash",
")",
"hash",
"=",
"{",
"}",
"obj",
".",
"instance_variables",
".",
"each",
"do",
"|",
"key",
"|",
"hash",
"[",
"key",
"[",
"1",
"..",
"-",
"1",
"]",
".",
"to_sym",
"]",
"=",
"deeply_to_hash",
"(",
"obj",
".",
"instance_variable_get",
"(",
"key",
")",
")",
"end",
"hash",
"end"
] | Convert an object to a hash representation of its instance variables.
@return [Hash] if the object is not nil, otherwise nil is returned. | [
"Convert",
"an",
"object",
"to",
"a",
"hash",
"representation",
"of",
"its",
"instance",
"variables",
"."
] | b46019965325c51df3f53985a8c22e15037d9b8c | https://github.com/Sage/hash_kit/blob/b46019965325c51df3f53985a8c22e15037d9b8c/lib/hash_kit/helper.rb#L65-L74 |
3,331 | agoragames/amico | lib/amico/relationships.rb | Amico.Relationships.follow | def follow(from_id, to_id, scope = Amico.default_scope_key)
return if from_id == to_id
return if blocked?(to_id, from_id, scope)
return if Amico.pending_follow && pending?(from_id, to_id, scope)
if Amico.pending_follow
Amico.redis.multi do |transaction|
transaction.zadd("#{Amico.namespace}:#{Amico.pending_key}:#{scope}:#{to_id}", Time.now.to_i, from_id)
transaction.zadd("#{Amico.namespace}:#{Amico.pending_with_key}:#{scope}:#{from_id}", Time.now.to_i, to_id)
end
else
add_following_followers_reciprocated(from_id, to_id, scope)
end
end | ruby | def follow(from_id, to_id, scope = Amico.default_scope_key)
return if from_id == to_id
return if blocked?(to_id, from_id, scope)
return if Amico.pending_follow && pending?(from_id, to_id, scope)
if Amico.pending_follow
Amico.redis.multi do |transaction|
transaction.zadd("#{Amico.namespace}:#{Amico.pending_key}:#{scope}:#{to_id}", Time.now.to_i, from_id)
transaction.zadd("#{Amico.namespace}:#{Amico.pending_with_key}:#{scope}:#{from_id}", Time.now.to_i, to_id)
end
else
add_following_followers_reciprocated(from_id, to_id, scope)
end
end | [
"def",
"follow",
"(",
"from_id",
",",
"to_id",
",",
"scope",
"=",
"Amico",
".",
"default_scope_key",
")",
"return",
"if",
"from_id",
"==",
"to_id",
"return",
"if",
"blocked?",
"(",
"to_id",
",",
"from_id",
",",
"scope",
")",
"return",
"if",
"Amico",
".",
"pending_follow",
"&&",
"pending?",
"(",
"from_id",
",",
"to_id",
",",
"scope",
")",
"if",
"Amico",
".",
"pending_follow",
"Amico",
".",
"redis",
".",
"multi",
"do",
"|",
"transaction",
"|",
"transaction",
".",
"zadd",
"(",
"\"#{Amico.namespace}:#{Amico.pending_key}:#{scope}:#{to_id}\"",
",",
"Time",
".",
"now",
".",
"to_i",
",",
"from_id",
")",
"transaction",
".",
"zadd",
"(",
"\"#{Amico.namespace}:#{Amico.pending_with_key}:#{scope}:#{from_id}\"",
",",
"Time",
".",
"now",
".",
"to_i",
",",
"to_id",
")",
"end",
"else",
"add_following_followers_reciprocated",
"(",
"from_id",
",",
"to_id",
",",
"scope",
")",
"end",
"end"
] | Establish a follow relationship between two IDs. After adding the follow
relationship, it checks to see if the relationship is reciprocated and establishes that
relationship if so.
@param from_id [String] The ID of the individual establishing the follow relationship.
@param to_id [String] The ID of the individual to be followed.
@param scope [String] Scope for the call.
Examples
Amico.follow(1, 11) | [
"Establish",
"a",
"follow",
"relationship",
"between",
"two",
"IDs",
".",
"After",
"adding",
"the",
"follow",
"relationship",
"it",
"checks",
"to",
"see",
"if",
"the",
"relationship",
"is",
"reciprocated",
"and",
"establishes",
"that",
"relationship",
"if",
"so",
"."
] | 60309bd2f9466bce3ec42235c44f4dae55f6f45e | https://github.com/agoragames/amico/blob/60309bd2f9466bce3ec42235c44f4dae55f6f45e/lib/amico/relationships.rb#L14-L27 |
3,332 | agoragames/amico | lib/amico/relationships.rb | Amico.Relationships.unfollow | def unfollow(from_id, to_id, scope = Amico.default_scope_key)
return if from_id == to_id
Amico.redis.multi do
Amico.redis.zrem("#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{from_id}", to_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{to_id}", from_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{from_id}", to_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{to_id}", from_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.pending_key}:#{scope}:#{to_id}", from_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.pending_with_key}:#{scope}:#{from_id}", to_id)
end
end | ruby | def unfollow(from_id, to_id, scope = Amico.default_scope_key)
return if from_id == to_id
Amico.redis.multi do
Amico.redis.zrem("#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{from_id}", to_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{to_id}", from_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{from_id}", to_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{to_id}", from_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.pending_key}:#{scope}:#{to_id}", from_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.pending_with_key}:#{scope}:#{from_id}", to_id)
end
end | [
"def",
"unfollow",
"(",
"from_id",
",",
"to_id",
",",
"scope",
"=",
"Amico",
".",
"default_scope_key",
")",
"return",
"if",
"from_id",
"==",
"to_id",
"Amico",
".",
"redis",
".",
"multi",
"do",
"Amico",
".",
"redis",
".",
"zrem",
"(",
"\"#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{from_id}\"",
",",
"to_id",
")",
"Amico",
".",
"redis",
".",
"zrem",
"(",
"\"#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{to_id}\"",
",",
"from_id",
")",
"Amico",
".",
"redis",
".",
"zrem",
"(",
"\"#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{from_id}\"",
",",
"to_id",
")",
"Amico",
".",
"redis",
".",
"zrem",
"(",
"\"#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{to_id}\"",
",",
"from_id",
")",
"Amico",
".",
"redis",
".",
"zrem",
"(",
"\"#{Amico.namespace}:#{Amico.pending_key}:#{scope}:#{to_id}\"",
",",
"from_id",
")",
"Amico",
".",
"redis",
".",
"zrem",
"(",
"\"#{Amico.namespace}:#{Amico.pending_with_key}:#{scope}:#{from_id}\"",
",",
"to_id",
")",
"end",
"end"
] | Remove a follow relationship between two IDs. After removing the follow
relationship, if a reciprocated relationship was established, it is
also removed.
@param from_id [String] The ID of the individual removing the follow relationship.
@param to_id [String] The ID of the individual to be unfollowed.
@param scope [String] Scope for the call.
Examples
Amico.follow(1, 11)
Amico.unfollow(1, 11) | [
"Remove",
"a",
"follow",
"relationship",
"between",
"two",
"IDs",
".",
"After",
"removing",
"the",
"follow",
"relationship",
"if",
"a",
"reciprocated",
"relationship",
"was",
"established",
"it",
"is",
"also",
"removed",
"."
] | 60309bd2f9466bce3ec42235c44f4dae55f6f45e | https://github.com/agoragames/amico/blob/60309bd2f9466bce3ec42235c44f4dae55f6f45e/lib/amico/relationships.rb#L41-L52 |
3,333 | agoragames/amico | lib/amico/relationships.rb | Amico.Relationships.block | def block(from_id, to_id, scope = Amico.default_scope_key)
return if from_id == to_id
Amico.redis.multi do
Amico.redis.zrem("#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{from_id}", to_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{to_id}", from_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{to_id}", from_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{from_id}", to_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{from_id}", to_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{to_id}", from_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.pending_key}:#{scope}:#{from_id}", to_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.pending_with_key}:#{scope}:#{to_id}", from_id)
Amico.redis.zadd("#{Amico.namespace}:#{Amico.blocked_key}:#{scope}:#{from_id}", Time.now.to_i, to_id)
Amico.redis.zadd("#{Amico.namespace}:#{Amico.blocked_by_key}:#{scope}:#{to_id}", Time.now.to_i, from_id)
end
end | ruby | def block(from_id, to_id, scope = Amico.default_scope_key)
return if from_id == to_id
Amico.redis.multi do
Amico.redis.zrem("#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{from_id}", to_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{to_id}", from_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{to_id}", from_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{from_id}", to_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{from_id}", to_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{to_id}", from_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.pending_key}:#{scope}:#{from_id}", to_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.pending_with_key}:#{scope}:#{to_id}", from_id)
Amico.redis.zadd("#{Amico.namespace}:#{Amico.blocked_key}:#{scope}:#{from_id}", Time.now.to_i, to_id)
Amico.redis.zadd("#{Amico.namespace}:#{Amico.blocked_by_key}:#{scope}:#{to_id}", Time.now.to_i, from_id)
end
end | [
"def",
"block",
"(",
"from_id",
",",
"to_id",
",",
"scope",
"=",
"Amico",
".",
"default_scope_key",
")",
"return",
"if",
"from_id",
"==",
"to_id",
"Amico",
".",
"redis",
".",
"multi",
"do",
"Amico",
".",
"redis",
".",
"zrem",
"(",
"\"#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{from_id}\"",
",",
"to_id",
")",
"Amico",
".",
"redis",
".",
"zrem",
"(",
"\"#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{to_id}\"",
",",
"from_id",
")",
"Amico",
".",
"redis",
".",
"zrem",
"(",
"\"#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{to_id}\"",
",",
"from_id",
")",
"Amico",
".",
"redis",
".",
"zrem",
"(",
"\"#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{from_id}\"",
",",
"to_id",
")",
"Amico",
".",
"redis",
".",
"zrem",
"(",
"\"#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{from_id}\"",
",",
"to_id",
")",
"Amico",
".",
"redis",
".",
"zrem",
"(",
"\"#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{to_id}\"",
",",
"from_id",
")",
"Amico",
".",
"redis",
".",
"zrem",
"(",
"\"#{Amico.namespace}:#{Amico.pending_key}:#{scope}:#{from_id}\"",
",",
"to_id",
")",
"Amico",
".",
"redis",
".",
"zrem",
"(",
"\"#{Amico.namespace}:#{Amico.pending_with_key}:#{scope}:#{to_id}\"",
",",
"from_id",
")",
"Amico",
".",
"redis",
".",
"zadd",
"(",
"\"#{Amico.namespace}:#{Amico.blocked_key}:#{scope}:#{from_id}\"",
",",
"Time",
".",
"now",
".",
"to_i",
",",
"to_id",
")",
"Amico",
".",
"redis",
".",
"zadd",
"(",
"\"#{Amico.namespace}:#{Amico.blocked_by_key}:#{scope}:#{to_id}\"",
",",
"Time",
".",
"now",
".",
"to_i",
",",
"from_id",
")",
"end",
"end"
] | Block a relationship between two IDs. This method also has the side effect
of removing any follower or following relationship between the two IDs.
@param from_id [String] The ID of the individual blocking the relationship.
@param to_id [String] The ID of the individual being blocked.
@param scope [String] Scope for the call.
Examples
Amico.block(1, 11) | [
"Block",
"a",
"relationship",
"between",
"two",
"IDs",
".",
"This",
"method",
"also",
"has",
"the",
"side",
"effect",
"of",
"removing",
"any",
"follower",
"or",
"following",
"relationship",
"between",
"the",
"two",
"IDs",
"."
] | 60309bd2f9466bce3ec42235c44f4dae55f6f45e | https://github.com/agoragames/amico/blob/60309bd2f9466bce3ec42235c44f4dae55f6f45e/lib/amico/relationships.rb#L64-L79 |
3,334 | agoragames/amico | lib/amico/relationships.rb | Amico.Relationships.accept | def accept(from_id, to_id, scope = Amico.default_scope_key)
return if from_id == to_id
add_following_followers_reciprocated(from_id, to_id, scope)
end | ruby | def accept(from_id, to_id, scope = Amico.default_scope_key)
return if from_id == to_id
add_following_followers_reciprocated(from_id, to_id, scope)
end | [
"def",
"accept",
"(",
"from_id",
",",
"to_id",
",",
"scope",
"=",
"Amico",
".",
"default_scope_key",
")",
"return",
"if",
"from_id",
"==",
"to_id",
"add_following_followers_reciprocated",
"(",
"from_id",
",",
"to_id",
",",
"scope",
")",
"end"
] | Accept a relationship that is pending between two IDs.
@param from_id [String] The ID of the individual accepting the relationship.
@param to_id [String] The ID of the individual to be accepted.
@param scope [String] Scope for the call.
Example
Amico.follow(1, 11)
Amico.pending?(1, 11) # true
Amico.accept(1, 11)
Amico.pending?(1, 11) # false
Amico.following?(1, 11) #true | [
"Accept",
"a",
"relationship",
"that",
"is",
"pending",
"between",
"two",
"IDs",
"."
] | 60309bd2f9466bce3ec42235c44f4dae55f6f45e | https://github.com/agoragames/amico/blob/60309bd2f9466bce3ec42235c44f4dae55f6f45e/lib/amico/relationships.rb#L113-L117 |
3,335 | agoragames/amico | lib/amico/relationships.rb | Amico.Relationships.deny | def deny(from_id, to_id, scope = Amico.default_scope_key)
return if from_id == to_id
Amico.redis.multi do
Amico.redis.zrem("#{Amico.namespace}:#{Amico.pending_key}:#{scope}:#{to_id}", from_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.pending_with_key}:#{scope}:#{from_id}", to_id)
end
end | ruby | def deny(from_id, to_id, scope = Amico.default_scope_key)
return if from_id == to_id
Amico.redis.multi do
Amico.redis.zrem("#{Amico.namespace}:#{Amico.pending_key}:#{scope}:#{to_id}", from_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.pending_with_key}:#{scope}:#{from_id}", to_id)
end
end | [
"def",
"deny",
"(",
"from_id",
",",
"to_id",
",",
"scope",
"=",
"Amico",
".",
"default_scope_key",
")",
"return",
"if",
"from_id",
"==",
"to_id",
"Amico",
".",
"redis",
".",
"multi",
"do",
"Amico",
".",
"redis",
".",
"zrem",
"(",
"\"#{Amico.namespace}:#{Amico.pending_key}:#{scope}:#{to_id}\"",
",",
"from_id",
")",
"Amico",
".",
"redis",
".",
"zrem",
"(",
"\"#{Amico.namespace}:#{Amico.pending_with_key}:#{scope}:#{from_id}\"",
",",
"to_id",
")",
"end",
"end"
] | Deny a relationship that is pending between two IDs.
@param from_id [String] The ID of the individual denying the relationship.
@param to_id [String] The ID of the individual to be denied.
@param scope [String] Scope for the call.
Example
Amico.follow(1, 11)
Amico.pending?(1, 11) # true
Amico.deny(1, 11)
Amico.pending?(1, 11) # false
Amico.following?(1, 11) #false | [
"Deny",
"a",
"relationship",
"that",
"is",
"pending",
"between",
"two",
"IDs",
"."
] | 60309bd2f9466bce3ec42235c44f4dae55f6f45e | https://github.com/agoragames/amico/blob/60309bd2f9466bce3ec42235c44f4dae55f6f45e/lib/amico/relationships.rb#L132-L139 |
3,336 | agoragames/amico | lib/amico/relationships.rb | Amico.Relationships.following? | def following?(id, following_id, scope = Amico.default_scope_key)
!Amico.redis.zscore("#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{id}", following_id).nil?
end | ruby | def following?(id, following_id, scope = Amico.default_scope_key)
!Amico.redis.zscore("#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{id}", following_id).nil?
end | [
"def",
"following?",
"(",
"id",
",",
"following_id",
",",
"scope",
"=",
"Amico",
".",
"default_scope_key",
")",
"!",
"Amico",
".",
"redis",
".",
"zscore",
"(",
"\"#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{id}\"",
",",
"following_id",
")",
".",
"nil?",
"end"
] | Check to see if one individual is following another individual.
@param id [String] ID of the individual checking the following status.
@param following_id [String] ID of the individual to see if they are being followed by id.
@param scope [String] Scope for the call.
Examples
Amico.follow(1, 11)
Amico.following?(1, 11)
@return true if id is following following_id, false otherwise | [
"Check",
"to",
"see",
"if",
"one",
"individual",
"is",
"following",
"another",
"individual",
"."
] | 60309bd2f9466bce3ec42235c44f4dae55f6f45e | https://github.com/agoragames/amico/blob/60309bd2f9466bce3ec42235c44f4dae55f6f45e/lib/amico/relationships.rb#L286-L288 |
3,337 | agoragames/amico | lib/amico/relationships.rb | Amico.Relationships.follower? | def follower?(id, follower_id, scope = Amico.default_scope_key)
!Amico.redis.zscore("#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{id}", follower_id).nil?
end | ruby | def follower?(id, follower_id, scope = Amico.default_scope_key)
!Amico.redis.zscore("#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{id}", follower_id).nil?
end | [
"def",
"follower?",
"(",
"id",
",",
"follower_id",
",",
"scope",
"=",
"Amico",
".",
"default_scope_key",
")",
"!",
"Amico",
".",
"redis",
".",
"zscore",
"(",
"\"#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{id}\"",
",",
"follower_id",
")",
".",
"nil?",
"end"
] | Check to see if one individual is a follower of another individual.
@param id [String] ID of the individual checking the follower status.
@param following_id [String] ID of the individual to see if they are following id.
@param scope [String] Scope for the call.
Examples
Amico.follow(11, 1)
Amico.follower?(1, 11)
@return true if follower_id is following id, false otherwise | [
"Check",
"to",
"see",
"if",
"one",
"individual",
"is",
"a",
"follower",
"of",
"another",
"individual",
"."
] | 60309bd2f9466bce3ec42235c44f4dae55f6f45e | https://github.com/agoragames/amico/blob/60309bd2f9466bce3ec42235c44f4dae55f6f45e/lib/amico/relationships.rb#L302-L304 |
3,338 | agoragames/amico | lib/amico/relationships.rb | Amico.Relationships.blocked? | def blocked?(id, blocked_id, scope = Amico.default_scope_key)
!Amico.redis.zscore("#{Amico.namespace}:#{Amico.blocked_key}:#{scope}:#{id}", blocked_id).nil?
end | ruby | def blocked?(id, blocked_id, scope = Amico.default_scope_key)
!Amico.redis.zscore("#{Amico.namespace}:#{Amico.blocked_key}:#{scope}:#{id}", blocked_id).nil?
end | [
"def",
"blocked?",
"(",
"id",
",",
"blocked_id",
",",
"scope",
"=",
"Amico",
".",
"default_scope_key",
")",
"!",
"Amico",
".",
"redis",
".",
"zscore",
"(",
"\"#{Amico.namespace}:#{Amico.blocked_key}:#{scope}:#{id}\"",
",",
"blocked_id",
")",
".",
"nil?",
"end"
] | Check to see if one individual has blocked another individual.
@param id [String] ID of the individual checking the blocked status.
@param blocked_id [String] ID of the individual to see if they are blocked by id.
@param scope [String] Scope for the call.
Examples
Amico.block(1, 11)
Amico.blocked?(1, 11)
@return true if id has blocked blocked_id, false otherwise | [
"Check",
"to",
"see",
"if",
"one",
"individual",
"has",
"blocked",
"another",
"individual",
"."
] | 60309bd2f9466bce3ec42235c44f4dae55f6f45e | https://github.com/agoragames/amico/blob/60309bd2f9466bce3ec42235c44f4dae55f6f45e/lib/amico/relationships.rb#L318-L320 |
3,339 | agoragames/amico | lib/amico/relationships.rb | Amico.Relationships.blocked_by? | def blocked_by?(id, blocked_by_id, scope = Amico.default_scope_key)
!Amico.redis.zscore("#{Amico.namespace}:#{Amico.blocked_by_key}:#{scope}:#{id}", blocked_by_id).nil?
end | ruby | def blocked_by?(id, blocked_by_id, scope = Amico.default_scope_key)
!Amico.redis.zscore("#{Amico.namespace}:#{Amico.blocked_by_key}:#{scope}:#{id}", blocked_by_id).nil?
end | [
"def",
"blocked_by?",
"(",
"id",
",",
"blocked_by_id",
",",
"scope",
"=",
"Amico",
".",
"default_scope_key",
")",
"!",
"Amico",
".",
"redis",
".",
"zscore",
"(",
"\"#{Amico.namespace}:#{Amico.blocked_by_key}:#{scope}:#{id}\"",
",",
"blocked_by_id",
")",
".",
"nil?",
"end"
] | Check to see if one individual is blocked by another individual.
@param id [String] ID of the individual checking the blocked by status.
@param blocked_id [String] ID of the individual to see if they have blocked id.
@param scope [String] Scope for the call.
Examples
Amico.block(1, 11)
Amico.blocked_by?(11, 1)
@return true if id is blocked by blocked_by_id, false otherwise | [
"Check",
"to",
"see",
"if",
"one",
"individual",
"is",
"blocked",
"by",
"another",
"individual",
"."
] | 60309bd2f9466bce3ec42235c44f4dae55f6f45e | https://github.com/agoragames/amico/blob/60309bd2f9466bce3ec42235c44f4dae55f6f45e/lib/amico/relationships.rb#L334-L336 |
3,340 | agoragames/amico | lib/amico/relationships.rb | Amico.Relationships.reciprocated? | def reciprocated?(from_id, to_id, scope = Amico.default_scope_key)
following?(from_id, to_id, scope) && following?(to_id, from_id, scope)
end | ruby | def reciprocated?(from_id, to_id, scope = Amico.default_scope_key)
following?(from_id, to_id, scope) && following?(to_id, from_id, scope)
end | [
"def",
"reciprocated?",
"(",
"from_id",
",",
"to_id",
",",
"scope",
"=",
"Amico",
".",
"default_scope_key",
")",
"following?",
"(",
"from_id",
",",
"to_id",
",",
"scope",
")",
"&&",
"following?",
"(",
"to_id",
",",
"from_id",
",",
"scope",
")",
"end"
] | Check to see if one individual has reciprocated in following another individual.
@param from_id [String] ID of the individual checking the reciprocated relationship.
@param to_id [String] ID of the individual to see if they are following from_id.
@param scope [String] Scope for the call.
Examples
Amico.follow(1, 11)
Amico.follow(11, 1)
Amico.reciprocated?(1, 11)
@return true if both individuals are following each other, false otherwise | [
"Check",
"to",
"see",
"if",
"one",
"individual",
"has",
"reciprocated",
"in",
"following",
"another",
"individual",
"."
] | 60309bd2f9466bce3ec42235c44f4dae55f6f45e | https://github.com/agoragames/amico/blob/60309bd2f9466bce3ec42235c44f4dae55f6f45e/lib/amico/relationships.rb#L351-L353 |
3,341 | agoragames/amico | lib/amico/relationships.rb | Amico.Relationships.pending_with? | def pending_with?(from_id, to_id, scope = Amico.default_scope_key)
!Amico.redis.zscore("#{Amico.namespace}:#{Amico.pending_with_key}:#{scope}:#{to_id}", from_id).nil?
end | ruby | def pending_with?(from_id, to_id, scope = Amico.default_scope_key)
!Amico.redis.zscore("#{Amico.namespace}:#{Amico.pending_with_key}:#{scope}:#{to_id}", from_id).nil?
end | [
"def",
"pending_with?",
"(",
"from_id",
",",
"to_id",
",",
"scope",
"=",
"Amico",
".",
"default_scope_key",
")",
"!",
"Amico",
".",
"redis",
".",
"zscore",
"(",
"\"#{Amico.namespace}:#{Amico.pending_with_key}:#{scope}:#{to_id}\"",
",",
"from_id",
")",
".",
"nil?",
"end"
] | Check to see if one individual has a pending relationship with another.
@param from_id [String] ID of the individual checking the pending relationships.
@param to_id [String] ID of the individual to see if they are pending an approval from from_id.
@param scope [String] Scope for the call.
Examples
Amico.follow(1, 11)
Amico.pending_with?(11, 1) # true
@return true if the relationship is pending, false otherwise | [
"Check",
"to",
"see",
"if",
"one",
"individual",
"has",
"a",
"pending",
"relationship",
"with",
"another",
"."
] | 60309bd2f9466bce3ec42235c44f4dae55f6f45e | https://github.com/agoragames/amico/blob/60309bd2f9466bce3ec42235c44f4dae55f6f45e/lib/amico/relationships.rb#L383-L385 |
3,342 | agoragames/amico | lib/amico/relationships.rb | Amico.Relationships.following_page_count | def following_page_count(id, page_size = Amico.page_size, scope = Amico.default_scope_key)
total_pages("#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{id}", page_size)
end | ruby | def following_page_count(id, page_size = Amico.page_size, scope = Amico.default_scope_key)
total_pages("#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{id}", page_size)
end | [
"def",
"following_page_count",
"(",
"id",
",",
"page_size",
"=",
"Amico",
".",
"page_size",
",",
"scope",
"=",
"Amico",
".",
"default_scope_key",
")",
"total_pages",
"(",
"\"#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{id}\"",
",",
"page_size",
")",
"end"
] | Count the number of pages of following relationships for an individual.
@param id [String] ID of the individual.
@param page_size [int] Page size.
@param scope [String] Scope for the call.
Examples
Amico.follow(1, 11)
Amico.follow(1, 12)
Amico.following_page_count(1)
@return the number of pages of following relationships for an individual. | [
"Count",
"the",
"number",
"of",
"pages",
"of",
"following",
"relationships",
"for",
"an",
"individual",
"."
] | 60309bd2f9466bce3ec42235c44f4dae55f6f45e | https://github.com/agoragames/amico/blob/60309bd2f9466bce3ec42235c44f4dae55f6f45e/lib/amico/relationships.rb#L521-L523 |
3,343 | agoragames/amico | lib/amico/relationships.rb | Amico.Relationships.followers_page_count | def followers_page_count(id, page_size = Amico.page_size, scope = Amico.default_scope_key)
total_pages("#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{id}", page_size)
end | ruby | def followers_page_count(id, page_size = Amico.page_size, scope = Amico.default_scope_key)
total_pages("#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{id}", page_size)
end | [
"def",
"followers_page_count",
"(",
"id",
",",
"page_size",
"=",
"Amico",
".",
"page_size",
",",
"scope",
"=",
"Amico",
".",
"default_scope_key",
")",
"total_pages",
"(",
"\"#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{id}\"",
",",
"page_size",
")",
"end"
] | Count the number of pages of follower relationships for an individual.
@param id [String] ID of the individual.
@param page_size [int] Page size (default: Amico.page_size).
@param scope [String] Scope for the call.
Examples
Amico.follow(11, 1)
Amico.follow(12, 1)
Amico.followers_page_count(1)
@return the number of pages of follower relationships for an individual. | [
"Count",
"the",
"number",
"of",
"pages",
"of",
"follower",
"relationships",
"for",
"an",
"individual",
"."
] | 60309bd2f9466bce3ec42235c44f4dae55f6f45e | https://github.com/agoragames/amico/blob/60309bd2f9466bce3ec42235c44f4dae55f6f45e/lib/amico/relationships.rb#L538-L540 |
3,344 | agoragames/amico | lib/amico/relationships.rb | Amico.Relationships.blocked_page_count | def blocked_page_count(id, page_size = Amico.page_size, scope = Amico.default_scope_key)
total_pages("#{Amico.namespace}:#{Amico.blocked_key}:#{scope}:#{id}", page_size)
end | ruby | def blocked_page_count(id, page_size = Amico.page_size, scope = Amico.default_scope_key)
total_pages("#{Amico.namespace}:#{Amico.blocked_key}:#{scope}:#{id}", page_size)
end | [
"def",
"blocked_page_count",
"(",
"id",
",",
"page_size",
"=",
"Amico",
".",
"page_size",
",",
"scope",
"=",
"Amico",
".",
"default_scope_key",
")",
"total_pages",
"(",
"\"#{Amico.namespace}:#{Amico.blocked_key}:#{scope}:#{id}\"",
",",
"page_size",
")",
"end"
] | Count the number of pages of blocked relationships for an individual.
@param id [String] ID of the individual.
@param page_size [int] Page size (default: Amico.page_size).
@param scope [String] Scope for the call.
Examples
Amico.block(1, 11)
Amico.block(1, 12)
Amico.blocked_page_count(1)
@return the number of pages of blocked relationships for an individual. | [
"Count",
"the",
"number",
"of",
"pages",
"of",
"blocked",
"relationships",
"for",
"an",
"individual",
"."
] | 60309bd2f9466bce3ec42235c44f4dae55f6f45e | https://github.com/agoragames/amico/blob/60309bd2f9466bce3ec42235c44f4dae55f6f45e/lib/amico/relationships.rb#L555-L557 |
3,345 | agoragames/amico | lib/amico/relationships.rb | Amico.Relationships.blocked_by_page_count | def blocked_by_page_count(id, page_size = Amico.page_size, scope = Amico.default_scope_key)
total_pages("#{Amico.namespace}:#{Amico.blocked_by_key}:#{scope}:#{id}", page_size)
end | ruby | def blocked_by_page_count(id, page_size = Amico.page_size, scope = Amico.default_scope_key)
total_pages("#{Amico.namespace}:#{Amico.blocked_by_key}:#{scope}:#{id}", page_size)
end | [
"def",
"blocked_by_page_count",
"(",
"id",
",",
"page_size",
"=",
"Amico",
".",
"page_size",
",",
"scope",
"=",
"Amico",
".",
"default_scope_key",
")",
"total_pages",
"(",
"\"#{Amico.namespace}:#{Amico.blocked_by_key}:#{scope}:#{id}\"",
",",
"page_size",
")",
"end"
] | Count the number of pages of blocked_by relationships for an individual.
@param id [String] ID of the individual.
@param page_size [int] Page size (default: Amico.page_size).
@param scope [String] Scope for the call.
Examples
Amico.block(11, 1)
Amico.block(12, 1)
Amico.blocked_by_page_count(1)
@return the number of pages of blocked_by relationships for an individual. | [
"Count",
"the",
"number",
"of",
"pages",
"of",
"blocked_by",
"relationships",
"for",
"an",
"individual",
"."
] | 60309bd2f9466bce3ec42235c44f4dae55f6f45e | https://github.com/agoragames/amico/blob/60309bd2f9466bce3ec42235c44f4dae55f6f45e/lib/amico/relationships.rb#L572-L574 |
3,346 | agoragames/amico | lib/amico/relationships.rb | Amico.Relationships.reciprocated_page_count | def reciprocated_page_count(id, page_size = Amico.page_size, scope = Amico.default_scope_key)
total_pages("#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{id}", page_size)
end | ruby | def reciprocated_page_count(id, page_size = Amico.page_size, scope = Amico.default_scope_key)
total_pages("#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{id}", page_size)
end | [
"def",
"reciprocated_page_count",
"(",
"id",
",",
"page_size",
"=",
"Amico",
".",
"page_size",
",",
"scope",
"=",
"Amico",
".",
"default_scope_key",
")",
"total_pages",
"(",
"\"#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{id}\"",
",",
"page_size",
")",
"end"
] | Count the number of pages of reciprocated relationships for an individual.
@param id [String] ID of the individual.
@param page_size [int] Page size (default: Amico.page_size).
@param scope [String] Scope for the call.
Examples
Amico.follow(1, 11)
Amico.follow(1, 12)
Amico.follow(11, 1)
Amico.follow(12, 1)
Amico.reciprocated_page_count(1)
@return the number of pages of reciprocated relationships for an individual. | [
"Count",
"the",
"number",
"of",
"pages",
"of",
"reciprocated",
"relationships",
"for",
"an",
"individual",
"."
] | 60309bd2f9466bce3ec42235c44f4dae55f6f45e | https://github.com/agoragames/amico/blob/60309bd2f9466bce3ec42235c44f4dae55f6f45e/lib/amico/relationships.rb#L591-L593 |
3,347 | agoragames/amico | lib/amico/relationships.rb | Amico.Relationships.pending_page_count | def pending_page_count(id, page_size = Amico.page_size, scope = Amico.default_scope_key)
total_pages("#{Amico.namespace}:#{Amico.pending_key}:#{scope}:#{id}", page_size)
end | ruby | def pending_page_count(id, page_size = Amico.page_size, scope = Amico.default_scope_key)
total_pages("#{Amico.namespace}:#{Amico.pending_key}:#{scope}:#{id}", page_size)
end | [
"def",
"pending_page_count",
"(",
"id",
",",
"page_size",
"=",
"Amico",
".",
"page_size",
",",
"scope",
"=",
"Amico",
".",
"default_scope_key",
")",
"total_pages",
"(",
"\"#{Amico.namespace}:#{Amico.pending_key}:#{scope}:#{id}\"",
",",
"page_size",
")",
"end"
] | Count the number of pages of pending relationships for an individual.
@param id [String] ID of the individual.
@param page_size [int] Page size (default: Amico.page_size).
@param scope [String] Scope for the call.
Examples
Amico.follow(11, 1)
Amico.follow(12, 1)
Amico.pending_page_count(1) # 1
@return the number of pages of pending relationships for an individual. | [
"Count",
"the",
"number",
"of",
"pages",
"of",
"pending",
"relationships",
"for",
"an",
"individual",
"."
] | 60309bd2f9466bce3ec42235c44f4dae55f6f45e | https://github.com/agoragames/amico/blob/60309bd2f9466bce3ec42235c44f4dae55f6f45e/lib/amico/relationships.rb#L608-L610 |
3,348 | agoragames/amico | lib/amico/relationships.rb | Amico.Relationships.pending_with_page_count | def pending_with_page_count(id, page_size = Amico.page_size, scope = Amico.default_scope_key)
total_pages("#{Amico.namespace}:#{Amico.pending_with_key}:#{scope}:#{id}", page_size)
end | ruby | def pending_with_page_count(id, page_size = Amico.page_size, scope = Amico.default_scope_key)
total_pages("#{Amico.namespace}:#{Amico.pending_with_key}:#{scope}:#{id}", page_size)
end | [
"def",
"pending_with_page_count",
"(",
"id",
",",
"page_size",
"=",
"Amico",
".",
"page_size",
",",
"scope",
"=",
"Amico",
".",
"default_scope_key",
")",
"total_pages",
"(",
"\"#{Amico.namespace}:#{Amico.pending_with_key}:#{scope}:#{id}\"",
",",
"page_size",
")",
"end"
] | Count the number of pages of individuals waiting to approve another individual.
@param id [String] ID of the individual.
@param page_size [int] Page size (default: Amico.page_size).
@param scope [String] Scope for the call.
Examples
Amico.follow(1, 11)
Amico.follow(1, 12)
Amico.pending_with_page_count(1) # 1
@return the number of pages of individuals waiting to approve another individual. | [
"Count",
"the",
"number",
"of",
"pages",
"of",
"individuals",
"waiting",
"to",
"approve",
"another",
"individual",
"."
] | 60309bd2f9466bce3ec42235c44f4dae55f6f45e | https://github.com/agoragames/amico/blob/60309bd2f9466bce3ec42235c44f4dae55f6f45e/lib/amico/relationships.rb#L625-L627 |
3,349 | agoragames/amico | lib/amico/relationships.rb | Amico.Relationships.count | def count(id, type, scope = Amico.default_scope_key)
validate_relationship_type(type)
self.send("#{type.to_s}_count".to_sym, id, scope)
end | ruby | def count(id, type, scope = Amico.default_scope_key)
validate_relationship_type(type)
self.send("#{type.to_s}_count".to_sym, id, scope)
end | [
"def",
"count",
"(",
"id",
",",
"type",
",",
"scope",
"=",
"Amico",
".",
"default_scope_key",
")",
"validate_relationship_type",
"(",
"type",
")",
"self",
".",
"send",
"(",
"\"#{type.to_s}_count\"",
".",
"to_sym",
",",
"id",
",",
"scope",
")",
"end"
] | Retrieve a count of all of a given type of relationship for the specified id.
@param id [String] ID of the individual.
@param type [Symbol] One of :following, :followers, :reciprocated, :blocked, :blocked_by, :pending, :pending_with.
@param scope [String] Scope for the call.
@return Count of all of a given type of relationship for the specified id. | [
"Retrieve",
"a",
"count",
"of",
"all",
"of",
"a",
"given",
"type",
"of",
"relationship",
"for",
"the",
"specified",
"id",
"."
] | 60309bd2f9466bce3ec42235c44f4dae55f6f45e | https://github.com/agoragames/amico/blob/60309bd2f9466bce3ec42235c44f4dae55f6f45e/lib/amico/relationships.rb#L647-L650 |
3,350 | agoragames/amico | lib/amico/relationships.rb | Amico.Relationships.page_count | def page_count(id, type, page_size = Amico.page_size, scope = Amico.default_scope_key)
validate_relationship_type(type)
self.send("#{type.to_s}_page_count".to_sym, id, page_size, scope)
end | ruby | def page_count(id, type, page_size = Amico.page_size, scope = Amico.default_scope_key)
validate_relationship_type(type)
self.send("#{type.to_s}_page_count".to_sym, id, page_size, scope)
end | [
"def",
"page_count",
"(",
"id",
",",
"type",
",",
"page_size",
"=",
"Amico",
".",
"page_size",
",",
"scope",
"=",
"Amico",
".",
"default_scope_key",
")",
"validate_relationship_type",
"(",
"type",
")",
"self",
".",
"send",
"(",
"\"#{type.to_s}_page_count\"",
".",
"to_sym",
",",
"id",
",",
"page_size",
",",
"scope",
")",
"end"
] | Retrieve a page count of a given type of relationship for the specified id.
@param id [String] ID of the individual.
@param type [Symbol] One of :following, :followers, :reciprocated, :blocked, :blocked_by, :pending, :pending_with.
@param page_size [int] Page size (default: Amico.page_size).
@param scope [String] Scope for the call.
@return Page count of a given type of relationship for the specified id. | [
"Retrieve",
"a",
"page",
"count",
"of",
"a",
"given",
"type",
"of",
"relationship",
"for",
"the",
"specified",
"id",
"."
] | 60309bd2f9466bce3ec42235c44f4dae55f6f45e | https://github.com/agoragames/amico/blob/60309bd2f9466bce3ec42235c44f4dae55f6f45e/lib/amico/relationships.rb#L660-L663 |
3,351 | agoragames/amico | lib/amico/relationships.rb | Amico.Relationships.add_following_followers_reciprocated | def add_following_followers_reciprocated(from_id, to_id, scope)
Amico.redis.multi do
Amico.redis.zadd("#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{from_id}", Time.now.to_i, to_id)
Amico.redis.zadd("#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{to_id}", Time.now.to_i, from_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.pending_key}:#{scope}:#{to_id}", from_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.pending_with_key}:#{scope}:#{from_id}", to_id)
end
if reciprocated?(from_id, to_id, scope)
Amico.redis.multi do
Amico.redis.zadd("#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{from_id}", Time.now.to_i, to_id)
Amico.redis.zadd("#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{to_id}", Time.now.to_i, from_id)
end
end
end | ruby | def add_following_followers_reciprocated(from_id, to_id, scope)
Amico.redis.multi do
Amico.redis.zadd("#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{from_id}", Time.now.to_i, to_id)
Amico.redis.zadd("#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{to_id}", Time.now.to_i, from_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.pending_key}:#{scope}:#{to_id}", from_id)
Amico.redis.zrem("#{Amico.namespace}:#{Amico.pending_with_key}:#{scope}:#{from_id}", to_id)
end
if reciprocated?(from_id, to_id, scope)
Amico.redis.multi do
Amico.redis.zadd("#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{from_id}", Time.now.to_i, to_id)
Amico.redis.zadd("#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{to_id}", Time.now.to_i, from_id)
end
end
end | [
"def",
"add_following_followers_reciprocated",
"(",
"from_id",
",",
"to_id",
",",
"scope",
")",
"Amico",
".",
"redis",
".",
"multi",
"do",
"Amico",
".",
"redis",
".",
"zadd",
"(",
"\"#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{from_id}\"",
",",
"Time",
".",
"now",
".",
"to_i",
",",
"to_id",
")",
"Amico",
".",
"redis",
".",
"zadd",
"(",
"\"#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{to_id}\"",
",",
"Time",
".",
"now",
".",
"to_i",
",",
"from_id",
")",
"Amico",
".",
"redis",
".",
"zrem",
"(",
"\"#{Amico.namespace}:#{Amico.pending_key}:#{scope}:#{to_id}\"",
",",
"from_id",
")",
"Amico",
".",
"redis",
".",
"zrem",
"(",
"\"#{Amico.namespace}:#{Amico.pending_with_key}:#{scope}:#{from_id}\"",
",",
"to_id",
")",
"end",
"if",
"reciprocated?",
"(",
"from_id",
",",
"to_id",
",",
"scope",
")",
"Amico",
".",
"redis",
".",
"multi",
"do",
"Amico",
".",
"redis",
".",
"zadd",
"(",
"\"#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{from_id}\"",
",",
"Time",
".",
"now",
".",
"to_i",
",",
"to_id",
")",
"Amico",
".",
"redis",
".",
"zadd",
"(",
"\"#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{to_id}\"",
",",
"Time",
".",
"now",
".",
"to_i",
",",
"from_id",
")",
"end",
"end",
"end"
] | Add the following, followers and check for a reciprocated relationship. To be used from the
+follow+ and +accept+ methods.
@param from_id [String] The ID of the individual establishing the follow relationship.
@param to_id [String] The ID of the individual to be followed. | [
"Add",
"the",
"following",
"followers",
"and",
"check",
"for",
"a",
"reciprocated",
"relationship",
".",
"To",
"be",
"used",
"from",
"the",
"+",
"follow",
"+",
"and",
"+",
"accept",
"+",
"methods",
"."
] | 60309bd2f9466bce3ec42235c44f4dae55f6f45e | https://github.com/agoragames/amico/blob/60309bd2f9466bce3ec42235c44f4dae55f6f45e/lib/amico/relationships.rb#L690-L704 |
3,352 | agoragames/amico | lib/amico/relationships.rb | Amico.Relationships.total_pages | def total_pages(key, page_size)
(Amico.redis.zcard(key) / page_size.to_f).ceil
end | ruby | def total_pages(key, page_size)
(Amico.redis.zcard(key) / page_size.to_f).ceil
end | [
"def",
"total_pages",
"(",
"key",
",",
"page_size",
")",
"(",
"Amico",
".",
"redis",
".",
"zcard",
"(",
"key",
")",
"/",
"page_size",
".",
"to_f",
")",
".",
"ceil",
"end"
] | Count the total number of pages for a given key in a Redis sorted set.
@param key [String] Redis key.
@param page_size [int] Page size from which to calculate total pages.
@return total number of pages for a given key in a Redis sorted set. | [
"Count",
"the",
"total",
"number",
"of",
"pages",
"for",
"a",
"given",
"key",
"in",
"a",
"Redis",
"sorted",
"set",
"."
] | 60309bd2f9466bce3ec42235c44f4dae55f6f45e | https://github.com/agoragames/amico/blob/60309bd2f9466bce3ec42235c44f4dae55f6f45e/lib/amico/relationships.rb#L727-L729 |
3,353 | agoragames/amico | lib/amico/relationships.rb | Amico.Relationships.members | def members(key, options = default_paging_options)
options = default_paging_options.dup.merge!(options)
if options[:page] < 1
options[:page] = 1
end
if options[:page] > total_pages(key, options[:page_size])
options[:page] = total_pages(key, options[:page_size])
end
index_for_redis = options[:page] - 1
starting_offset = (index_for_redis * options[:page_size])
if starting_offset < 0
starting_offset = 0
end
ending_offset = (starting_offset + options[:page_size]) - 1
Amico.redis.zrevrange(key, starting_offset, ending_offset, :with_scores => false)
end | ruby | def members(key, options = default_paging_options)
options = default_paging_options.dup.merge!(options)
if options[:page] < 1
options[:page] = 1
end
if options[:page] > total_pages(key, options[:page_size])
options[:page] = total_pages(key, options[:page_size])
end
index_for_redis = options[:page] - 1
starting_offset = (index_for_redis * options[:page_size])
if starting_offset < 0
starting_offset = 0
end
ending_offset = (starting_offset + options[:page_size]) - 1
Amico.redis.zrevrange(key, starting_offset, ending_offset, :with_scores => false)
end | [
"def",
"members",
"(",
"key",
",",
"options",
"=",
"default_paging_options",
")",
"options",
"=",
"default_paging_options",
".",
"dup",
".",
"merge!",
"(",
"options",
")",
"if",
"options",
"[",
":page",
"]",
"<",
"1",
"options",
"[",
":page",
"]",
"=",
"1",
"end",
"if",
"options",
"[",
":page",
"]",
">",
"total_pages",
"(",
"key",
",",
"options",
"[",
":page_size",
"]",
")",
"options",
"[",
":page",
"]",
"=",
"total_pages",
"(",
"key",
",",
"options",
"[",
":page_size",
"]",
")",
"end",
"index_for_redis",
"=",
"options",
"[",
":page",
"]",
"-",
"1",
"starting_offset",
"=",
"(",
"index_for_redis",
"*",
"options",
"[",
":page_size",
"]",
")",
"if",
"starting_offset",
"<",
"0",
"starting_offset",
"=",
"0",
"end",
"ending_offset",
"=",
"(",
"starting_offset",
"+",
"options",
"[",
":page_size",
"]",
")",
"-",
"1",
"Amico",
".",
"redis",
".",
"zrevrange",
"(",
"key",
",",
"starting_offset",
",",
"ending_offset",
",",
":with_scores",
"=>",
"false",
")",
"end"
] | Retrieve a page of items from a Redis sorted set without scores.
@param key [String] Redis key.
@param options [Hash] Default options for paging.
@return a page of items from a Redis sorted set without scores. | [
"Retrieve",
"a",
"page",
"of",
"items",
"from",
"a",
"Redis",
"sorted",
"set",
"without",
"scores",
"."
] | 60309bd2f9466bce3ec42235c44f4dae55f6f45e | https://github.com/agoragames/amico/blob/60309bd2f9466bce3ec42235c44f4dae55f6f45e/lib/amico/relationships.rb#L737-L756 |
3,354 | weenhanceit/gaapi | lib/gaapi/response.rb | GAAPI.Response.csv | def csv
@csv ||= CSV.generate do |csv|
reports.each(&:report).each do |report|
# If there are no dimensions, but totals, we need to put an extra
# column at the start for the word "Total".
# I don't see how totals will be different than the metrics if you
# don't specify dimensions, but whatever.
totals_column = report.totals? && !report.dimensions? ? [nil] : []
csv << totals_column + report.headers
report.rows.each { |row| csv << totals_column + row.to_a }
next unless report.totals? # Rubocop did this. Not sure I like it.
csv << ["Totals"] + if !report.dimensions?
report.totals
else
report.totals[1..-1]
end
end
end
end | ruby | def csv
@csv ||= CSV.generate do |csv|
reports.each(&:report).each do |report|
# If there are no dimensions, but totals, we need to put an extra
# column at the start for the word "Total".
# I don't see how totals will be different than the metrics if you
# don't specify dimensions, but whatever.
totals_column = report.totals? && !report.dimensions? ? [nil] : []
csv << totals_column + report.headers
report.rows.each { |row| csv << totals_column + row.to_a }
next unless report.totals? # Rubocop did this. Not sure I like it.
csv << ["Totals"] + if !report.dimensions?
report.totals
else
report.totals[1..-1]
end
end
end
end | [
"def",
"csv",
"@csv",
"||=",
"CSV",
".",
"generate",
"do",
"|",
"csv",
"|",
"reports",
".",
"each",
"(",
":report",
")",
".",
"each",
"do",
"|",
"report",
"|",
"# If there are no dimensions, but totals, we need to put an extra",
"# column at the start for the word \"Total\".",
"# I don't see how totals will be different than the metrics if you",
"# don't specify dimensions, but whatever.",
"totals_column",
"=",
"report",
".",
"totals?",
"&&",
"!",
"report",
".",
"dimensions?",
"?",
"[",
"nil",
"]",
":",
"[",
"]",
"csv",
"<<",
"totals_column",
"+",
"report",
".",
"headers",
"report",
".",
"rows",
".",
"each",
"{",
"|",
"row",
"|",
"csv",
"<<",
"totals_column",
"+",
"row",
".",
"to_a",
"}",
"next",
"unless",
"report",
".",
"totals?",
"# Rubocop did this. Not sure I like it.",
"csv",
"<<",
"[",
"\"Totals\"",
"]",
"+",
"if",
"!",
"report",
".",
"dimensions?",
"report",
".",
"totals",
"else",
"report",
".",
"totals",
"[",
"1",
"..",
"-",
"1",
"]",
"end",
"end",
"end",
"end"
] | Convert a response from Google Analytics into a comma-separated values
format file.
@return [String] The result of the query formatted as a comma-separated
values string. | [
"Convert",
"a",
"response",
"from",
"Google",
"Analytics",
"into",
"a",
"comma",
"-",
"separated",
"values",
"format",
"file",
"."
] | 20d25bd06b2e0cccc86ca1ea1baaac6be045355a | https://github.com/weenhanceit/gaapi/blob/20d25bd06b2e0cccc86ca1ea1baaac6be045355a/lib/gaapi/response.rb#L25-L43 |
3,355 | drish/hyperb | lib/hyperb/containers/containers.rb | Hyperb.Containers.containers | def containers(params = {})
path = '/containers/json'
query = {}
query.merge!(params)
response = JSON.parse(Hyperb::Request.new(self, path, query, 'get').perform)
response.map { |container| Hyperb::Container.new(container) }
end | ruby | def containers(params = {})
path = '/containers/json'
query = {}
query.merge!(params)
response = JSON.parse(Hyperb::Request.new(self, path, query, 'get').perform)
response.map { |container| Hyperb::Container.new(container) }
end | [
"def",
"containers",
"(",
"params",
"=",
"{",
"}",
")",
"path",
"=",
"'/containers/json'",
"query",
"=",
"{",
"}",
"query",
".",
"merge!",
"(",
"params",
")",
"response",
"=",
"JSON",
".",
"parse",
"(",
"Hyperb",
"::",
"Request",
".",
"new",
"(",
"self",
",",
"path",
",",
"query",
",",
"'get'",
")",
".",
"perform",
")",
"response",
".",
"map",
"{",
"|",
"container",
"|",
"Hyperb",
"::",
"Container",
".",
"new",
"(",
"container",
")",
"}",
"end"
] | list existing containers
@see https://docs.hyper.sh/Reference/API/2016-04-04%20[Ver.%201.23]/Container/list.html
@raise [Hyperb::Error::Unauthorized] raised when credentials are not valid.
@raise [Hyperb::Error::InternalServerError] raised when 5xx is returned from hyper.
@return [Hyperb::Container] Array of Hyperb::Container.
@param params [Hash] A customizable set of params.
@option params [Boolean] :all show all containers, false by default
@option params [Boolean] :size show containers size
@option params [String] :limit show `limit` last created containers.
@option params [String] :since show only containers created since Id.
@option params [String] :before only containers created before Id.
TODO: @option params [Hash] :filters JSON encoded value of the filters. | [
"list",
"existing",
"containers"
] | 637de68dc304d8d07470a771f499e33f227955f4 | https://github.com/drish/hyperb/blob/637de68dc304d8d07470a771f499e33f227955f4/lib/hyperb/containers/containers.rb#L31-L37 |
3,356 | drish/hyperb | lib/hyperb/containers/containers.rb | Hyperb.Containers.remove_container | def remove_container(params = {})
raise ArgumentError, 'Invalid arguments.' unless check_arguments(params, 'id')
path = '/containers/' + params[:id]
query = {}
query[:v] = params[:v] if params.key?(:v)
query[:force] = params[:force] if params.key?(:force)
response = JSON.parse(Hyperb::Request.new(self, path, query, 'delete').perform)
downcase_symbolize(response)
end | ruby | def remove_container(params = {})
raise ArgumentError, 'Invalid arguments.' unless check_arguments(params, 'id')
path = '/containers/' + params[:id]
query = {}
query[:v] = params[:v] if params.key?(:v)
query[:force] = params[:force] if params.key?(:force)
response = JSON.parse(Hyperb::Request.new(self, path, query, 'delete').perform)
downcase_symbolize(response)
end | [
"def",
"remove_container",
"(",
"params",
"=",
"{",
"}",
")",
"raise",
"ArgumentError",
",",
"'Invalid arguments.'",
"unless",
"check_arguments",
"(",
"params",
",",
"'id'",
")",
"path",
"=",
"'/containers/'",
"+",
"params",
"[",
":id",
"]",
"query",
"=",
"{",
"}",
"query",
"[",
":v",
"]",
"=",
"params",
"[",
":v",
"]",
"if",
"params",
".",
"key?",
"(",
":v",
")",
"query",
"[",
":force",
"]",
"=",
"params",
"[",
":force",
"]",
"if",
"params",
".",
"key?",
"(",
":force",
")",
"response",
"=",
"JSON",
".",
"parse",
"(",
"Hyperb",
"::",
"Request",
".",
"new",
"(",
"self",
",",
"path",
",",
"query",
",",
"'delete'",
")",
".",
"perform",
")",
"downcase_symbolize",
"(",
"response",
")",
"end"
] | remove the container id
@see https://docs.hyper.sh/Reference/API/2016-04-04%20[Ver.%201.23]/Container/remove.html
@raise [Hyperb::Error::Unauthorized] raised when credentials are not valid.
@raise [Hyperb::Error::NotFound] raised when container can't be found.
@raise [Hyperb::Error::Conflict] raised when container is running and can't be removed.
@raise [Hyperb::Error::InternalServerError] raised when a 5xx is returned.
@return [Hash] downcased symbolized json response.
@param params [Hash] A customizable set of params.
@option params [Boolean] :v remove volumes attached. default false
@option params [Boolean] :force force remove. default false | [
"remove",
"the",
"container",
"id"
] | 637de68dc304d8d07470a771f499e33f227955f4 | https://github.com/drish/hyperb/blob/637de68dc304d8d07470a771f499e33f227955f4/lib/hyperb/containers/containers.rb#L74-L82 |
3,357 | drish/hyperb | lib/hyperb/containers/containers.rb | Hyperb.Containers.create_container | def create_container(params = {})
raise ArgumentError, 'Invalid arguments.' unless check_arguments(params, 'image')
path = '/containers/create'
query = {}
# set default size, otherwise container can't be started
body = { labels: { sh_hyper_instancetype: 's1' } }
# parse host_config options
if params.key?(:host_config)
body[camelize(:host_config)] = setup_host_config(params)
params.delete(:host_config)
end
query[:name] = params[:name] if params.key?(:name)
params.delete(:name)
body.merge!(params)
downcase_symbolize(JSON.parse(Hyperb::Request.new(self, path, query, 'post', body).perform))
end | ruby | def create_container(params = {})
raise ArgumentError, 'Invalid arguments.' unless check_arguments(params, 'image')
path = '/containers/create'
query = {}
# set default size, otherwise container can't be started
body = { labels: { sh_hyper_instancetype: 's1' } }
# parse host_config options
if params.key?(:host_config)
body[camelize(:host_config)] = setup_host_config(params)
params.delete(:host_config)
end
query[:name] = params[:name] if params.key?(:name)
params.delete(:name)
body.merge!(params)
downcase_symbolize(JSON.parse(Hyperb::Request.new(self, path, query, 'post', body).perform))
end | [
"def",
"create_container",
"(",
"params",
"=",
"{",
"}",
")",
"raise",
"ArgumentError",
",",
"'Invalid arguments.'",
"unless",
"check_arguments",
"(",
"params",
",",
"'image'",
")",
"path",
"=",
"'/containers/create'",
"query",
"=",
"{",
"}",
"# set default size, otherwise container can't be started",
"body",
"=",
"{",
"labels",
":",
"{",
"sh_hyper_instancetype",
":",
"'s1'",
"}",
"}",
"# parse host_config options",
"if",
"params",
".",
"key?",
"(",
":host_config",
")",
"body",
"[",
"camelize",
"(",
":host_config",
")",
"]",
"=",
"setup_host_config",
"(",
"params",
")",
"params",
".",
"delete",
"(",
":host_config",
")",
"end",
"query",
"[",
":name",
"]",
"=",
"params",
"[",
":name",
"]",
"if",
"params",
".",
"key?",
"(",
":name",
")",
"params",
".",
"delete",
"(",
":name",
")",
"body",
".",
"merge!",
"(",
"params",
")",
"downcase_symbolize",
"(",
"JSON",
".",
"parse",
"(",
"Hyperb",
"::",
"Request",
".",
"new",
"(",
"self",
",",
"path",
",",
"query",
",",
"'post'",
",",
"body",
")",
".",
"perform",
")",
")",
"end"
] | create a container
@see https://docs.hyper.sh/Reference/API/2016-04-04%20[Ver.%201.23]/Container/create.html
@raise [Hyperb::Error::Unauthorized] raised when credentials are not valid.
@raise [Hyperb::Error::Conflict] raised container with the same name is already created.
@raise [Hyperb::Error::InternalServerError] raised when a 5xx is returned
@return [Hash] hash containing downcased symbolized json response.
@param params [Hash] A customizable set of params.
@option params [String] :name container name
@option params [String] :image image to be used
@option params [String] :hostname container hostname
@option params [String] :entrypoint container entrypoint
@option params [String] :cmd container command
@option params [String] :user add user to container
@option params [String] :workingdir working directory for commands to run in.
@option params [Array] :mounts array of strings with mount directories.
@option params [String] :networkmode network mode, ie 'bridge'.
@option params [Hash] :exposedports ports to expose.
@option params [Hash] :exposedports ports to expose.
@option params [Hash] :labels hash containing key: value
@option params labels [String] :sh_hyper_instancetype container size: s1, s2, s3 ... | [
"create",
"a",
"container"
] | 637de68dc304d8d07470a771f499e33f227955f4 | https://github.com/drish/hyperb/blob/637de68dc304d8d07470a771f499e33f227955f4/lib/hyperb/containers/containers.rb#L111-L129 |
3,358 | drish/hyperb | lib/hyperb/containers/containers.rb | Hyperb.Containers.rename_container | def rename_container(params = {})
raise ArgumentError, 'Invalid arguments.' unless check_arguments(params, 'name', 'id')
path = '/containers/' + params[:id] + '/rename'
query = {}
query[:name] = params[:name] if params.key?(:name)
Hyperb::Request.new(self, path, query, 'post').perform
end | ruby | def rename_container(params = {})
raise ArgumentError, 'Invalid arguments.' unless check_arguments(params, 'name', 'id')
path = '/containers/' + params[:id] + '/rename'
query = {}
query[:name] = params[:name] if params.key?(:name)
Hyperb::Request.new(self, path, query, 'post').perform
end | [
"def",
"rename_container",
"(",
"params",
"=",
"{",
"}",
")",
"raise",
"ArgumentError",
",",
"'Invalid arguments.'",
"unless",
"check_arguments",
"(",
"params",
",",
"'name'",
",",
"'id'",
")",
"path",
"=",
"'/containers/'",
"+",
"params",
"[",
":id",
"]",
"+",
"'/rename'",
"query",
"=",
"{",
"}",
"query",
"[",
":name",
"]",
"=",
"params",
"[",
":name",
"]",
"if",
"params",
".",
"key?",
"(",
":name",
")",
"Hyperb",
"::",
"Request",
".",
"new",
"(",
"self",
",",
"path",
",",
"query",
",",
"'post'",
")",
".",
"perform",
"end"
] | rename a container
@see https://docs.hyper.sh/Reference/API/2016-04-04%20[Ver.%201.23]/Container/rename.html
@raise [Hyperb::Error::Unauthorized] raised when credentials are not valid.
@raise [Hyperb::Error::NotFound] raised when the container can't be found.
@raise [Hyperb::Error::InternalServerError] raised when 5xx is returned.
@param params [Hash] A customizable set of params.
@option params [String] :id new name
@option params [String] :name new name | [
"rename",
"a",
"container"
] | 637de68dc304d8d07470a771f499e33f227955f4 | https://github.com/drish/hyperb/blob/637de68dc304d8d07470a771f499e33f227955f4/lib/hyperb/containers/containers.rb#L251-L257 |
3,359 | egonbraun/logmsg | lib/logmsg.rb | Logmsg.LogMsg.load | def load
close if @loaded
@path.each do |file|
next unless File.exist?(file)
@settings = Psych.load_file(file)
next unless @settings.include?(@namespace)
parse(@settings[@namespace])
@loaded = true
break
end
fail unless @loaded
end | ruby | def load
close if @loaded
@path.each do |file|
next unless File.exist?(file)
@settings = Psych.load_file(file)
next unless @settings.include?(@namespace)
parse(@settings[@namespace])
@loaded = true
break
end
fail unless @loaded
end | [
"def",
"load",
"close",
"if",
"@loaded",
"@path",
".",
"each",
"do",
"|",
"file",
"|",
"next",
"unless",
"File",
".",
"exist?",
"(",
"file",
")",
"@settings",
"=",
"Psych",
".",
"load_file",
"(",
"file",
")",
"next",
"unless",
"@settings",
".",
"include?",
"(",
"@namespace",
")",
"parse",
"(",
"@settings",
"[",
"@namespace",
"]",
")",
"@loaded",
"=",
"true",
"break",
"end",
"fail",
"unless",
"@loaded",
"end"
] | Load the configuration file
@private | [
"Load",
"the",
"configuration",
"file"
] | 7ca139edb856ada08cb7465acd68bd60bc2837fa | https://github.com/egonbraun/logmsg/blob/7ca139edb856ada08cb7465acd68bd60bc2837fa/lib/logmsg.rb#L59-L72 |
3,360 | egonbraun/logmsg | lib/logmsg.rb | Logmsg.LogMsg.parse | def parse(settings, logfile = nil)
settings.each do |key, value|
if value.is_a?(Hash)
logfile = Logmsg::LogFile.new(key)
logfiles[key.to_sym] = logfile
parse(value, logfile)
logfile.register
else
logfile.public_send("#{key}=", value)
end
end
end | ruby | def parse(settings, logfile = nil)
settings.each do |key, value|
if value.is_a?(Hash)
logfile = Logmsg::LogFile.new(key)
logfiles[key.to_sym] = logfile
parse(value, logfile)
logfile.register
else
logfile.public_send("#{key}=", value)
end
end
end | [
"def",
"parse",
"(",
"settings",
",",
"logfile",
"=",
"nil",
")",
"settings",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"if",
"value",
".",
"is_a?",
"(",
"Hash",
")",
"logfile",
"=",
"Logmsg",
"::",
"LogFile",
".",
"new",
"(",
"key",
")",
"logfiles",
"[",
"key",
".",
"to_sym",
"]",
"=",
"logfile",
"parse",
"(",
"value",
",",
"logfile",
")",
"logfile",
".",
"register",
"else",
"logfile",
".",
"public_send",
"(",
"\"#{key}=\"",
",",
"value",
")",
"end",
"end",
"end"
] | Recursively parses the loaded settings and creating log file destinations
@param [Hash] the loaded settings
@param [LogFile] the logfile object
@see Logmsg:LogFile
@private | [
"Recursively",
"parses",
"the",
"loaded",
"settings",
"and",
"creating",
"log",
"file",
"destinations"
] | 7ca139edb856ada08cb7465acd68bd60bc2837fa | https://github.com/egonbraun/logmsg/blob/7ca139edb856ada08cb7465acd68bd60bc2837fa/lib/logmsg.rb#L155-L166 |
3,361 | spudtrooper/rdiorb | lib/rdio/api.rb | Rdio.Api.addFriend | def addFriend(user)
method = 'addFriend'
type = true
args = {:user=>user}
return_object type,method,args,true
end | ruby | def addFriend(user)
method = 'addFriend'
type = true
args = {:user=>user}
return_object type,method,args,true
end | [
"def",
"addFriend",
"(",
"user",
")",
"method",
"=",
"'addFriend'",
"type",
"=",
"true",
"args",
"=",
"{",
":user",
"=>",
"user",
"}",
"return_object",
"type",
",",
"method",
",",
"args",
",",
"true",
"end"
] | Add a friend to the current user. | [
"Add",
"a",
"friend",
"to",
"the",
"current",
"user",
"."
] | e137fd016bfba42d9e50f421b009b2ad3c41baaf | https://github.com/spudtrooper/rdiorb/blob/e137fd016bfba42d9e50f421b009b2ad3c41baaf/lib/rdio/api.rb#L25-L30 |
3,362 | spudtrooper/rdiorb | lib/rdio/api.rb | Rdio.Api.addToCollection | def addToCollection(objs)
method = 'addToCollection'
type = true
args = {:keys=>Rdio::keys(objs)}
return_object type,method,args,true
end | ruby | def addToCollection(objs)
method = 'addToCollection'
type = true
args = {:keys=>Rdio::keys(objs)}
return_object type,method,args,true
end | [
"def",
"addToCollection",
"(",
"objs",
")",
"method",
"=",
"'addToCollection'",
"type",
"=",
"true",
"args",
"=",
"{",
":keys",
"=>",
"Rdio",
"::",
"keys",
"(",
"objs",
")",
"}",
"return_object",
"type",
",",
"method",
",",
"args",
",",
"true",
"end"
] | Add tracks or playlists to the current user's collection. | [
"Add",
"tracks",
"or",
"playlists",
"to",
"the",
"current",
"user",
"s",
"collection",
"."
] | e137fd016bfba42d9e50f421b009b2ad3c41baaf | https://github.com/spudtrooper/rdiorb/blob/e137fd016bfba42d9e50f421b009b2ad3c41baaf/lib/rdio/api.rb#L33-L38 |
3,363 | spudtrooper/rdiorb | lib/rdio/api.rb | Rdio.Api.addToPlaylist | def addToPlaylist(playlist,tracks)
method = 'addToPlaylist'
type = true
args = {:playlist=>playlist, :tracks=>Rdio::keys(tracks)}
return_object type,method,args,true
end | ruby | def addToPlaylist(playlist,tracks)
method = 'addToPlaylist'
type = true
args = {:playlist=>playlist, :tracks=>Rdio::keys(tracks)}
return_object type,method,args,true
end | [
"def",
"addToPlaylist",
"(",
"playlist",
",",
"tracks",
")",
"method",
"=",
"'addToPlaylist'",
"type",
"=",
"true",
"args",
"=",
"{",
":playlist",
"=>",
"playlist",
",",
":tracks",
"=>",
"Rdio",
"::",
"keys",
"(",
"tracks",
")",
"}",
"return_object",
"type",
",",
"method",
",",
"args",
",",
"true",
"end"
] | Add a track to a playlist. | [
"Add",
"a",
"track",
"to",
"a",
"playlist",
"."
] | e137fd016bfba42d9e50f421b009b2ad3c41baaf | https://github.com/spudtrooper/rdiorb/blob/e137fd016bfba42d9e50f421b009b2ad3c41baaf/lib/rdio/api.rb#L41-L46 |
3,364 | spudtrooper/rdiorb | lib/rdio/api.rb | Rdio.Api.createPlaylist | def createPlaylist(name,description,tracks,extras=nil)
method = 'createPlaylist'
type = Playlist
args = {:name=>name,:description=>description,
:tracks=>Rdio::keys(tracks)}
args[:extras] = extras if extras
return_object type,method,args,true
end | ruby | def createPlaylist(name,description,tracks,extras=nil)
method = 'createPlaylist'
type = Playlist
args = {:name=>name,:description=>description,
:tracks=>Rdio::keys(tracks)}
args[:extras] = extras if extras
return_object type,method,args,true
end | [
"def",
"createPlaylist",
"(",
"name",
",",
"description",
",",
"tracks",
",",
"extras",
"=",
"nil",
")",
"method",
"=",
"'createPlaylist'",
"type",
"=",
"Playlist",
"args",
"=",
"{",
":name",
"=>",
"name",
",",
":description",
"=>",
"description",
",",
":tracks",
"=>",
"Rdio",
"::",
"keys",
"(",
"tracks",
")",
"}",
"args",
"[",
":extras",
"]",
"=",
"extras",
"if",
"extras",
"return_object",
"type",
",",
"method",
",",
"args",
",",
"true",
"end"
] | Create a new playlist in the current user's collection. The new
playlist will be returned if the creation is successful, otherwise
null will be returned. | [
"Create",
"a",
"new",
"playlist",
"in",
"the",
"current",
"user",
"s",
"collection",
".",
"The",
"new",
"playlist",
"will",
"be",
"returned",
"if",
"the",
"creation",
"is",
"successful",
"otherwise",
"null",
"will",
"be",
"returned",
"."
] | e137fd016bfba42d9e50f421b009b2ad3c41baaf | https://github.com/spudtrooper/rdiorb/blob/e137fd016bfba42d9e50f421b009b2ad3c41baaf/lib/rdio/api.rb#L51-L58 |
3,365 | spudtrooper/rdiorb | lib/rdio/api.rb | Rdio.Api.currentUser | def currentUser(extras=nil)
method = 'currentUser'
type = User
args = {}
args[:extras] = extras if extras
return_object type,method,args,true
end | ruby | def currentUser(extras=nil)
method = 'currentUser'
type = User
args = {}
args[:extras] = extras if extras
return_object type,method,args,true
end | [
"def",
"currentUser",
"(",
"extras",
"=",
"nil",
")",
"method",
"=",
"'currentUser'",
"type",
"=",
"User",
"args",
"=",
"{",
"}",
"args",
"[",
":extras",
"]",
"=",
"extras",
"if",
"extras",
"return_object",
"type",
",",
"method",
",",
"args",
",",
"true",
"end"
] | Get information about the currently logged in user. | [
"Get",
"information",
"about",
"the",
"currently",
"logged",
"in",
"user",
"."
] | e137fd016bfba42d9e50f421b009b2ad3c41baaf | https://github.com/spudtrooper/rdiorb/blob/e137fd016bfba42d9e50f421b009b2ad3c41baaf/lib/rdio/api.rb#L61-L67 |
3,366 | spudtrooper/rdiorb | lib/rdio/api.rb | Rdio.Api.deletePlaylist | def deletePlaylist(playlist)
method = 'deletePlaylist'
type = Boolean
args = {:playlist=>playlist}
return_object type,method,args,true
end | ruby | def deletePlaylist(playlist)
method = 'deletePlaylist'
type = Boolean
args = {:playlist=>playlist}
return_object type,method,args,true
end | [
"def",
"deletePlaylist",
"(",
"playlist",
")",
"method",
"=",
"'deletePlaylist'",
"type",
"=",
"Boolean",
"args",
"=",
"{",
":playlist",
"=>",
"playlist",
"}",
"return_object",
"type",
",",
"method",
",",
"args",
",",
"true",
"end"
] | Delete a playlist. | [
"Delete",
"a",
"playlist",
"."
] | e137fd016bfba42d9e50f421b009b2ad3c41baaf | https://github.com/spudtrooper/rdiorb/blob/e137fd016bfba42d9e50f421b009b2ad3c41baaf/lib/rdio/api.rb#L70-L75 |
3,367 | spudtrooper/rdiorb | lib/rdio/api.rb | Rdio.Api.getActivityStream | def getActivityStream(user,scope,last_id=nil)
method = 'getActivityStream'
type = ActivityStream
args = {:user=>user,:scope=>scope}
args[:last_id] = last_id if last_id
auth = user
return_object type,method,args,auth
end | ruby | def getActivityStream(user,scope,last_id=nil)
method = 'getActivityStream'
type = ActivityStream
args = {:user=>user,:scope=>scope}
args[:last_id] = last_id if last_id
auth = user
return_object type,method,args,auth
end | [
"def",
"getActivityStream",
"(",
"user",
",",
"scope",
",",
"last_id",
"=",
"nil",
")",
"method",
"=",
"'getActivityStream'",
"type",
"=",
"ActivityStream",
"args",
"=",
"{",
":user",
"=>",
"user",
",",
":scope",
"=>",
"scope",
"}",
"args",
"[",
":last_id",
"]",
"=",
"last_id",
"if",
"last_id",
"auth",
"=",
"user",
"return_object",
"type",
",",
"method",
",",
"args",
",",
"auth",
"end"
] | Get the activity events for a user, a user's friends, or
everyone on Rdio. | [
"Get",
"the",
"activity",
"events",
"for",
"a",
"user",
"a",
"user",
"s",
"friends",
"or",
"everyone",
"on",
"Rdio",
"."
] | e137fd016bfba42d9e50f421b009b2ad3c41baaf | https://github.com/spudtrooper/rdiorb/blob/e137fd016bfba42d9e50f421b009b2ad3c41baaf/lib/rdio/api.rb#L113-L120 |
3,368 | spudtrooper/rdiorb | lib/rdio/api.rb | Rdio.Api.getAlbumsForArtistInCollection | def getAlbumsForArtistInCollection(artist,user=nil,extras=nil)
method = 'getAlbumsForArtistInCollection'
type = Album
args = {:artist=>artist}
args[:user] = user if user
args[:extras] = extras if extras
auth = !!user
return_object type,method,args,auth
end | ruby | def getAlbumsForArtistInCollection(artist,user=nil,extras=nil)
method = 'getAlbumsForArtistInCollection'
type = Album
args = {:artist=>artist}
args[:user] = user if user
args[:extras] = extras if extras
auth = !!user
return_object type,method,args,auth
end | [
"def",
"getAlbumsForArtistInCollection",
"(",
"artist",
",",
"user",
"=",
"nil",
",",
"extras",
"=",
"nil",
")",
"method",
"=",
"'getAlbumsForArtistInCollection'",
"type",
"=",
"Album",
"args",
"=",
"{",
":artist",
"=>",
"artist",
"}",
"args",
"[",
":user",
"]",
"=",
"user",
"if",
"user",
"args",
"[",
":extras",
"]",
"=",
"extras",
"if",
"extras",
"auth",
"=",
"!",
"!",
"user",
"return_object",
"type",
",",
"method",
",",
"args",
",",
"auth",
"end"
] | Get the albums in the user's collection by a particular artist. | [
"Get",
"the",
"albums",
"in",
"the",
"user",
"s",
"collection",
"by",
"a",
"particular",
"artist",
"."
] | e137fd016bfba42d9e50f421b009b2ad3c41baaf | https://github.com/spudtrooper/rdiorb/blob/e137fd016bfba42d9e50f421b009b2ad3c41baaf/lib/rdio/api.rb#L135-L143 |
3,369 | spudtrooper/rdiorb | lib/rdio/api.rb | Rdio.Api.getHeavyRotation | def getHeavyRotation(user=nil,type=nil,friends=nil,limit=nil,extras=nil)
method = 'getHeavyRotation'
cls = TODO
if type == 'artist'
cls = Artist
elsif type == 'album'
cls = Album
end
args = {}
args[:user] = user if user
args[:type] = type if type
args[:friends] = friends if friends
args[:limit] = limit if limit
args[:extras] = extras if extras
return_object cls,method,args
end | ruby | def getHeavyRotation(user=nil,type=nil,friends=nil,limit=nil,extras=nil)
method = 'getHeavyRotation'
cls = TODO
if type == 'artist'
cls = Artist
elsif type == 'album'
cls = Album
end
args = {}
args[:user] = user if user
args[:type] = type if type
args[:friends] = friends if friends
args[:limit] = limit if limit
args[:extras] = extras if extras
return_object cls,method,args
end | [
"def",
"getHeavyRotation",
"(",
"user",
"=",
"nil",
",",
"type",
"=",
"nil",
",",
"friends",
"=",
"nil",
",",
"limit",
"=",
"nil",
",",
"extras",
"=",
"nil",
")",
"method",
"=",
"'getHeavyRotation'",
"cls",
"=",
"TODO",
"if",
"type",
"==",
"'artist'",
"cls",
"=",
"Artist",
"elsif",
"type",
"==",
"'album'",
"cls",
"=",
"Album",
"end",
"args",
"=",
"{",
"}",
"args",
"[",
":user",
"]",
"=",
"user",
"if",
"user",
"args",
"[",
":type",
"]",
"=",
"type",
"if",
"type",
"args",
"[",
":friends",
"]",
"=",
"friends",
"if",
"friends",
"args",
"[",
":limit",
"]",
"=",
"limit",
"if",
"limit",
"args",
"[",
":extras",
"]",
"=",
"extras",
"if",
"extras",
"return_object",
"cls",
",",
"method",
",",
"args",
"end"
] | Find the most popular artists or albums for a user, their friends
or the whole site. | [
"Find",
"the",
"most",
"popular",
"artists",
"or",
"albums",
"for",
"a",
"user",
"their",
"friends",
"or",
"the",
"whole",
"site",
"."
] | e137fd016bfba42d9e50f421b009b2ad3c41baaf | https://github.com/spudtrooper/rdiorb/blob/e137fd016bfba42d9e50f421b009b2ad3c41baaf/lib/rdio/api.rb#L179-L194 |
3,370 | spudtrooper/rdiorb | lib/rdio/api.rb | Rdio.Api.getNewReleases | def getNewReleases(time=nil,start=nil,count=nil,extras=nil)
method = 'getNewReleases'
type = Album
args = {}
args[:time] = time if time
args[:start] = start if start
args[:count] = count if count
args[:extras] = extras if extras
return_object type,method,args
end | ruby | def getNewReleases(time=nil,start=nil,count=nil,extras=nil)
method = 'getNewReleases'
type = Album
args = {}
args[:time] = time if time
args[:start] = start if start
args[:count] = count if count
args[:extras] = extras if extras
return_object type,method,args
end | [
"def",
"getNewReleases",
"(",
"time",
"=",
"nil",
",",
"start",
"=",
"nil",
",",
"count",
"=",
"nil",
",",
"extras",
"=",
"nil",
")",
"method",
"=",
"'getNewReleases'",
"type",
"=",
"Album",
"args",
"=",
"{",
"}",
"args",
"[",
":time",
"]",
"=",
"time",
"if",
"time",
"args",
"[",
":start",
"]",
"=",
"start",
"if",
"start",
"args",
"[",
":count",
"]",
"=",
"count",
"if",
"count",
"args",
"[",
":extras",
"]",
"=",
"extras",
"if",
"extras",
"return_object",
"type",
",",
"method",
",",
"args",
"end"
] | Return new albums released across a timeframe. | [
"Return",
"new",
"albums",
"released",
"across",
"a",
"timeframe",
"."
] | e137fd016bfba42d9e50f421b009b2ad3c41baaf | https://github.com/spudtrooper/rdiorb/blob/e137fd016bfba42d9e50f421b009b2ad3c41baaf/lib/rdio/api.rb#L197-L206 |
3,371 | spudtrooper/rdiorb | lib/rdio/api.rb | Rdio.Api.getObjectFromShortCode | def getObjectFromShortCode(short_code,type=nil)
method = 'getObjectFromShortCode'
type = BaseObj if not type
args = {:short_code=>short_code}
return_object type,method,args,true
end | ruby | def getObjectFromShortCode(short_code,type=nil)
method = 'getObjectFromShortCode'
type = BaseObj if not type
args = {:short_code=>short_code}
return_object type,method,args,true
end | [
"def",
"getObjectFromShortCode",
"(",
"short_code",
",",
"type",
"=",
"nil",
")",
"method",
"=",
"'getObjectFromShortCode'",
"type",
"=",
"BaseObj",
"if",
"not",
"type",
"args",
"=",
"{",
":short_code",
"=>",
"short_code",
"}",
"return_object",
"type",
",",
"method",
",",
"args",
",",
"true",
"end"
] | Return the object that the supplied Rdio short-code is a
representation of, or null if the short-code is invalid. | [
"Return",
"the",
"object",
"that",
"the",
"supplied",
"Rdio",
"short",
"-",
"code",
"is",
"a",
"representation",
"of",
"or",
"null",
"if",
"the",
"short",
"-",
"code",
"is",
"invalid",
"."
] | e137fd016bfba42d9e50f421b009b2ad3c41baaf | https://github.com/spudtrooper/rdiorb/blob/e137fd016bfba42d9e50f421b009b2ad3c41baaf/lib/rdio/api.rb#L210-L215 |
3,372 | spudtrooper/rdiorb | lib/rdio/api.rb | Rdio.Api.getObjectFromUrl | def getObjectFromUrl(url,type=nil)
method = 'getObjectFromUrl'
type = BaseObj if not type
args = {:url=>url}
return_object type,method,args,true
end | ruby | def getObjectFromUrl(url,type=nil)
method = 'getObjectFromUrl'
type = BaseObj if not type
args = {:url=>url}
return_object type,method,args,true
end | [
"def",
"getObjectFromUrl",
"(",
"url",
",",
"type",
"=",
"nil",
")",
"method",
"=",
"'getObjectFromUrl'",
"type",
"=",
"BaseObj",
"if",
"not",
"type",
"args",
"=",
"{",
":url",
"=>",
"url",
"}",
"return_object",
"type",
",",
"method",
",",
"args",
",",
"true",
"end"
] | Return the object that the supplied Rdio url is a representation
of, or null if the url doesn't represent an object. | [
"Return",
"the",
"object",
"that",
"the",
"supplied",
"Rdio",
"url",
"is",
"a",
"representation",
"of",
"or",
"null",
"if",
"the",
"url",
"doesn",
"t",
"represent",
"an",
"object",
"."
] | e137fd016bfba42d9e50f421b009b2ad3c41baaf | https://github.com/spudtrooper/rdiorb/blob/e137fd016bfba42d9e50f421b009b2ad3c41baaf/lib/rdio/api.rb#L219-L224 |
3,373 | spudtrooper/rdiorb | lib/rdio/api.rb | Rdio.Api.getPlaybackToken | def getPlaybackToken(domain=nil)
method = 'getPlaybackToken'
type = String
args = {}
args[:domain] = domain if domain
return_object type,method,args,true
end | ruby | def getPlaybackToken(domain=nil)
method = 'getPlaybackToken'
type = String
args = {}
args[:domain] = domain if domain
return_object type,method,args,true
end | [
"def",
"getPlaybackToken",
"(",
"domain",
"=",
"nil",
")",
"method",
"=",
"'getPlaybackToken'",
"type",
"=",
"String",
"args",
"=",
"{",
"}",
"args",
"[",
":domain",
"]",
"=",
"domain",
"if",
"domain",
"return_object",
"type",
",",
"method",
",",
"args",
",",
"true",
"end"
] | Get an playback token. If you are using this for web playback you
must supply a domain. | [
"Get",
"an",
"playback",
"token",
".",
"If",
"you",
"are",
"using",
"this",
"for",
"web",
"playback",
"you",
"must",
"supply",
"a",
"domain",
"."
] | e137fd016bfba42d9e50f421b009b2ad3c41baaf | https://github.com/spudtrooper/rdiorb/blob/e137fd016bfba42d9e50f421b009b2ad3c41baaf/lib/rdio/api.rb#L228-L234 |
3,374 | spudtrooper/rdiorb | lib/rdio/api.rb | Rdio.Api.getPlaylists | def getPlaylists(extras=nil)
method = 'getPlaylists'
type = Playlist
args = {}
args[:extras] = extras if extras
return_object type,method,args,true
end | ruby | def getPlaylists(extras=nil)
method = 'getPlaylists'
type = Playlist
args = {}
args[:extras] = extras if extras
return_object type,method,args,true
end | [
"def",
"getPlaylists",
"(",
"extras",
"=",
"nil",
")",
"method",
"=",
"'getPlaylists'",
"type",
"=",
"Playlist",
"args",
"=",
"{",
"}",
"args",
"[",
":extras",
"]",
"=",
"extras",
"if",
"extras",
"return_object",
"type",
",",
"method",
",",
"args",
",",
"true",
"end"
] | Get the current user's playlists. | [
"Get",
"the",
"current",
"user",
"s",
"playlists",
"."
] | e137fd016bfba42d9e50f421b009b2ad3c41baaf | https://github.com/spudtrooper/rdiorb/blob/e137fd016bfba42d9e50f421b009b2ad3c41baaf/lib/rdio/api.rb#L237-L243 |
3,375 | spudtrooper/rdiorb | lib/rdio/api.rb | Rdio.Api.getTopCharts | def getTopCharts(type,start=nil,count=nil,extras=nil)
method = 'getTopCharts'
cls = TODO
case type
when 'Artist'
cls = Artist
when 'Album'
cls = Album
when 'Track'
cls = Track
when 'Playlist'
cls = Playlist
end
args = {:type=>type}
return_object cls,method,args
end | ruby | def getTopCharts(type,start=nil,count=nil,extras=nil)
method = 'getTopCharts'
cls = TODO
case type
when 'Artist'
cls = Artist
when 'Album'
cls = Album
when 'Track'
cls = Track
when 'Playlist'
cls = Playlist
end
args = {:type=>type}
return_object cls,method,args
end | [
"def",
"getTopCharts",
"(",
"type",
",",
"start",
"=",
"nil",
",",
"count",
"=",
"nil",
",",
"extras",
"=",
"nil",
")",
"method",
"=",
"'getTopCharts'",
"cls",
"=",
"TODO",
"case",
"type",
"when",
"'Artist'",
"cls",
"=",
"Artist",
"when",
"'Album'",
"cls",
"=",
"Album",
"when",
"'Track'",
"cls",
"=",
"Track",
"when",
"'Playlist'",
"cls",
"=",
"Playlist",
"end",
"args",
"=",
"{",
":type",
"=>",
"type",
"}",
"return_object",
"cls",
",",
"method",
",",
"args",
"end"
] | Return the site-wide most popular items for a given type. | [
"Return",
"the",
"site",
"-",
"wide",
"most",
"popular",
"items",
"for",
"a",
"given",
"type",
"."
] | e137fd016bfba42d9e50f421b009b2ad3c41baaf | https://github.com/spudtrooper/rdiorb/blob/e137fd016bfba42d9e50f421b009b2ad3c41baaf/lib/rdio/api.rb#L246-L261 |
3,376 | spudtrooper/rdiorb | lib/rdio/api.rb | Rdio.Api.getTracksForAlbumInCollection | def getTracksForAlbumInCollection(album,user=nil,extras=nil)
method = 'getTracksForAlbumInCollection'
type = Track
args = {:album=>album}
args[:user] = user if user
args[:extras] = extras if extras
return_object type,method,args
end | ruby | def getTracksForAlbumInCollection(album,user=nil,extras=nil)
method = 'getTracksForAlbumInCollection'
type = Track
args = {:album=>album}
args[:user] = user if user
args[:extras] = extras if extras
return_object type,method,args
end | [
"def",
"getTracksForAlbumInCollection",
"(",
"album",
",",
"user",
"=",
"nil",
",",
"extras",
"=",
"nil",
")",
"method",
"=",
"'getTracksForAlbumInCollection'",
"type",
"=",
"Track",
"args",
"=",
"{",
":album",
"=>",
"album",
"}",
"args",
"[",
":user",
"]",
"=",
"user",
"if",
"user",
"args",
"[",
":extras",
"]",
"=",
"extras",
"if",
"extras",
"return_object",
"type",
",",
"method",
",",
"args",
"end"
] | Which tracks on the given album are in the user's collection. | [
"Which",
"tracks",
"on",
"the",
"given",
"album",
"are",
"in",
"the",
"user",
"s",
"collection",
"."
] | e137fd016bfba42d9e50f421b009b2ad3c41baaf | https://github.com/spudtrooper/rdiorb/blob/e137fd016bfba42d9e50f421b009b2ad3c41baaf/lib/rdio/api.rb#L264-L271 |
3,377 | spudtrooper/rdiorb | lib/rdio/api.rb | Rdio.Api.getTracksForArtistInCollection | def getTracksForArtistInCollection(artist,user=nil,extras=nil)
method = 'getTracksForArtistInCollection'
type = Track
args = {:artist=>artist}
args[:user] = user if user
args[:extras] = extras if extras
return_object type,method,args
end | ruby | def getTracksForArtistInCollection(artist,user=nil,extras=nil)
method = 'getTracksForArtistInCollection'
type = Track
args = {:artist=>artist}
args[:user] = user if user
args[:extras] = extras if extras
return_object type,method,args
end | [
"def",
"getTracksForArtistInCollection",
"(",
"artist",
",",
"user",
"=",
"nil",
",",
"extras",
"=",
"nil",
")",
"method",
"=",
"'getTracksForArtistInCollection'",
"type",
"=",
"Track",
"args",
"=",
"{",
":artist",
"=>",
"artist",
"}",
"args",
"[",
":user",
"]",
"=",
"user",
"if",
"user",
"args",
"[",
":extras",
"]",
"=",
"extras",
"if",
"extras",
"return_object",
"type",
",",
"method",
",",
"args",
"end"
] | Which tracks from the given artist are in the user's collection. | [
"Which",
"tracks",
"from",
"the",
"given",
"artist",
"are",
"in",
"the",
"user",
"s",
"collection",
"."
] | e137fd016bfba42d9e50f421b009b2ad3c41baaf | https://github.com/spudtrooper/rdiorb/blob/e137fd016bfba42d9e50f421b009b2ad3c41baaf/lib/rdio/api.rb#L286-L293 |
3,378 | spudtrooper/rdiorb | lib/rdio/api.rb | Rdio.Api.removeFriend | def removeFriend(user)
method = 'removeFriend'
type = Boolean
args = {:user=>user}
return_object type,method,args,true
end | ruby | def removeFriend(user)
method = 'removeFriend'
type = Boolean
args = {:user=>user}
return_object type,method,args,true
end | [
"def",
"removeFriend",
"(",
"user",
")",
"method",
"=",
"'removeFriend'",
"type",
"=",
"Boolean",
"args",
"=",
"{",
":user",
"=>",
"user",
"}",
"return_object",
"type",
",",
"method",
",",
"args",
",",
"true",
"end"
] | Remove a friend from the current user. | [
"Remove",
"a",
"friend",
"from",
"the",
"current",
"user",
"."
] | e137fd016bfba42d9e50f421b009b2ad3c41baaf | https://github.com/spudtrooper/rdiorb/blob/e137fd016bfba42d9e50f421b009b2ad3c41baaf/lib/rdio/api.rb#L310-L315 |
3,379 | spudtrooper/rdiorb | lib/rdio/api.rb | Rdio.Api.removeFromCollection | def removeFromCollection(objs)
method = 'removeFromCollection'
type = Boolean
args = {:keys=>Rdio::keys(objs)}
return_object type,method,args
end | ruby | def removeFromCollection(objs)
method = 'removeFromCollection'
type = Boolean
args = {:keys=>Rdio::keys(objs)}
return_object type,method,args
end | [
"def",
"removeFromCollection",
"(",
"objs",
")",
"method",
"=",
"'removeFromCollection'",
"type",
"=",
"Boolean",
"args",
"=",
"{",
":keys",
"=>",
"Rdio",
"::",
"keys",
"(",
"objs",
")",
"}",
"return_object",
"type",
",",
"method",
",",
"args",
"end"
] | Remove tracks or playlists from the current user's collection. | [
"Remove",
"tracks",
"or",
"playlists",
"from",
"the",
"current",
"user",
"s",
"collection",
"."
] | e137fd016bfba42d9e50f421b009b2ad3c41baaf | https://github.com/spudtrooper/rdiorb/blob/e137fd016bfba42d9e50f421b009b2ad3c41baaf/lib/rdio/api.rb#L318-L323 |
3,380 | spudtrooper/rdiorb | lib/rdio/api.rb | Rdio.Api.removeFromPlaylist | def removeFromPlaylist(playlist,index,count,tracks)
method = 'removeFromPlaylist'
type = TODO
args = {:playlist=>playlist,:index=>index,
:count=>count,:tracks=>Rdio::keys(tracks)}
return_object type,method,args,true
end | ruby | def removeFromPlaylist(playlist,index,count,tracks)
method = 'removeFromPlaylist'
type = TODO
args = {:playlist=>playlist,:index=>index,
:count=>count,:tracks=>Rdio::keys(tracks)}
return_object type,method,args,true
end | [
"def",
"removeFromPlaylist",
"(",
"playlist",
",",
"index",
",",
"count",
",",
"tracks",
")",
"method",
"=",
"'removeFromPlaylist'",
"type",
"=",
"TODO",
"args",
"=",
"{",
":playlist",
"=>",
"playlist",
",",
":index",
"=>",
"index",
",",
":count",
"=>",
"count",
",",
":tracks",
"=>",
"Rdio",
"::",
"keys",
"(",
"tracks",
")",
"}",
"return_object",
"type",
",",
"method",
",",
"args",
",",
"true",
"end"
] | Remove an item from a playlist by its position in the playlist. | [
"Remove",
"an",
"item",
"from",
"a",
"playlist",
"by",
"its",
"position",
"in",
"the",
"playlist",
"."
] | e137fd016bfba42d9e50f421b009b2ad3c41baaf | https://github.com/spudtrooper/rdiorb/blob/e137fd016bfba42d9e50f421b009b2ad3c41baaf/lib/rdio/api.rb#L326-L332 |
3,381 | spudtrooper/rdiorb | lib/rdio/api.rb | Rdio.Api.setPlaylistFields | def setPlaylistFields(playlist,name,description)
method = 'setPlaylistFields'
type = Boolean
args = {:playlist=>playlist,:name=>name,:description=>description}
return_object type,method,args,true
end | ruby | def setPlaylistFields(playlist,name,description)
method = 'setPlaylistFields'
type = Boolean
args = {:playlist=>playlist,:name=>name,:description=>description}
return_object type,method,args,true
end | [
"def",
"setPlaylistFields",
"(",
"playlist",
",",
"name",
",",
"description",
")",
"method",
"=",
"'setPlaylistFields'",
"type",
"=",
"Boolean",
"args",
"=",
"{",
":playlist",
"=>",
"playlist",
",",
":name",
"=>",
"name",
",",
":description",
"=>",
"description",
"}",
"return_object",
"type",
",",
"method",
",",
"args",
",",
"true",
"end"
] | Sets the name and description for a playlist. | [
"Sets",
"the",
"name",
"and",
"description",
"for",
"a",
"playlist",
"."
] | e137fd016bfba42d9e50f421b009b2ad3c41baaf | https://github.com/spudtrooper/rdiorb/blob/e137fd016bfba42d9e50f421b009b2ad3c41baaf/lib/rdio/api.rb#L361-L366 |
3,382 | spudtrooper/rdiorb | lib/rdio/api.rb | Rdio.Api.searchSuggestions | def searchSuggestions(query,extras)
method = 'searchSuggestions'
type = TODO
args = {:query=>query}
args[:extras] = extras if extras
return_object type,method,args
end | ruby | def searchSuggestions(query,extras)
method = 'searchSuggestions'
type = TODO
args = {:query=>query}
args[:extras] = extras if extras
return_object type,method,args
end | [
"def",
"searchSuggestions",
"(",
"query",
",",
"extras",
")",
"method",
"=",
"'searchSuggestions'",
"type",
"=",
"TODO",
"args",
"=",
"{",
":query",
"=>",
"query",
"}",
"args",
"[",
":extras",
"]",
"=",
"extras",
"if",
"extras",
"return_object",
"type",
",",
"method",
",",
"args",
"end"
] | Match the supplied prefix against artists, albums, tracks and
people in the Rdio system. Return the first ten matches. | [
"Match",
"the",
"supplied",
"prefix",
"against",
"artists",
"albums",
"tracks",
"and",
"people",
"in",
"the",
"Rdio",
"system",
".",
"Return",
"the",
"first",
"ten",
"matches",
"."
] | e137fd016bfba42d9e50f421b009b2ad3c41baaf | https://github.com/spudtrooper/rdiorb/blob/e137fd016bfba42d9e50f421b009b2ad3c41baaf/lib/rdio/api.rb#L398-L404 |
3,383 | rudical/linkshare-oauth2-api | lib/linkshare/strategy.rb | Linkshare.Strategy.get_token | def get_token(username, password, sid, params = {}, opts = {})
request_body = opts.delete('auth_scheme') == 'request_body'
params = {'grant_type' => 'password',
'username' => username,
'password' => password,
'scope' => sid
}.merge(client_params).merge(params)
params.merge!('client_params' => {
:headers => {
'Authorization' => authorization(client_params['client_id'], client_params['client_secret']),
'Accept' => 'application/xml'}
})
# params.merge(:parse => :xml)
@client.get_token(params, opts)
end | ruby | def get_token(username, password, sid, params = {}, opts = {})
request_body = opts.delete('auth_scheme') == 'request_body'
params = {'grant_type' => 'password',
'username' => username,
'password' => password,
'scope' => sid
}.merge(client_params).merge(params)
params.merge!('client_params' => {
:headers => {
'Authorization' => authorization(client_params['client_id'], client_params['client_secret']),
'Accept' => 'application/xml'}
})
# params.merge(:parse => :xml)
@client.get_token(params, opts)
end | [
"def",
"get_token",
"(",
"username",
",",
"password",
",",
"sid",
",",
"params",
"=",
"{",
"}",
",",
"opts",
"=",
"{",
"}",
")",
"request_body",
"=",
"opts",
".",
"delete",
"(",
"'auth_scheme'",
")",
"==",
"'request_body'",
"params",
"=",
"{",
"'grant_type'",
"=>",
"'password'",
",",
"'username'",
"=>",
"username",
",",
"'password'",
"=>",
"password",
",",
"'scope'",
"=>",
"sid",
"}",
".",
"merge",
"(",
"client_params",
")",
".",
"merge",
"(",
"params",
")",
"params",
".",
"merge!",
"(",
"'client_params'",
"=>",
"{",
":headers",
"=>",
"{",
"'Authorization'",
"=>",
"authorization",
"(",
"client_params",
"[",
"'client_id'",
"]",
",",
"client_params",
"[",
"'client_secret'",
"]",
")",
",",
"'Accept'",
"=>",
"'application/xml'",
"}",
"}",
")",
"# params.merge(:parse => :xml)",
"@client",
".",
"get_token",
"(",
"params",
",",
"opts",
")",
"end"
] | Retrieve an access token given the specified End User username, password and Linkshare AccountID.
@param [String] username the End User username
@param [String] password the End User password
@param [String] sid the Account ID
@param [Hash] params additional params | [
"Retrieve",
"an",
"access",
"token",
"given",
"the",
"specified",
"End",
"User",
"username",
"password",
"and",
"Linkshare",
"AccountID",
"."
] | f135ed40f38de9add1c4bba34b85fe7083a66c0e | https://github.com/rudical/linkshare-oauth2-api/blob/f135ed40f38de9add1c4bba34b85fe7083a66c0e/lib/linkshare/strategy.rb#L11-L27 |
3,384 | socialcast/socialcast-git-extensions | lib/socialcast-git-extensions.rb | Socialcast.Gitx.run_cmd | def run_cmd(cmd)
raise "Unstubbed git command #{cmd}" if ENV['SCGITX_TEST'] == 'true'
say "\n$ "
say cmd.gsub("'", ''), :red
raise "#{cmd} failed" unless system cmd
end | ruby | def run_cmd(cmd)
raise "Unstubbed git command #{cmd}" if ENV['SCGITX_TEST'] == 'true'
say "\n$ "
say cmd.gsub("'", ''), :red
raise "#{cmd} failed" unless system cmd
end | [
"def",
"run_cmd",
"(",
"cmd",
")",
"raise",
"\"Unstubbed git command #{cmd}\"",
"if",
"ENV",
"[",
"'SCGITX_TEST'",
"]",
"==",
"'true'",
"say",
"\"\\n$ \"",
"say",
"cmd",
".",
"gsub",
"(",
"\"'\"",
",",
"''",
")",
",",
":red",
"raise",
"\"#{cmd} failed\"",
"unless",
"system",
"cmd",
"end"
] | execute a shell command and raise an error if non-zero exit code is returned | [
"execute",
"a",
"shell",
"command",
"and",
"raise",
"an",
"error",
"if",
"non",
"-",
"zero",
"exit",
"code",
"is",
"returned"
] | d2c6dfc88b2683de90011127c7d3787a4561bfa1 | https://github.com/socialcast/socialcast-git-extensions/blob/d2c6dfc88b2683de90011127c7d3787a4561bfa1/lib/socialcast-git-extensions.rb#L17-L22 |
3,385 | fabn/google_authentication | lib/google_authentication/acts_as_google_user.rb | GoogleAuthentication.ActsAsGoogleUser.acts_as_google_user | def acts_as_google_user *modules
# assign devise modules to module variable
if modules.empty?
self.devise_modules_to_include = [:omniauthable]
else
# restrict modules given to devise
self.devise_modules_to_include = (modules + [:omniauthable] - FORBIDDEN_MODULES) & ALLOWED_MODULES
end
# include model methods
include ActsAsGoogleUser::Model
end | ruby | def acts_as_google_user *modules
# assign devise modules to module variable
if modules.empty?
self.devise_modules_to_include = [:omniauthable]
else
# restrict modules given to devise
self.devise_modules_to_include = (modules + [:omniauthable] - FORBIDDEN_MODULES) & ALLOWED_MODULES
end
# include model methods
include ActsAsGoogleUser::Model
end | [
"def",
"acts_as_google_user",
"*",
"modules",
"# assign devise modules to module variable",
"if",
"modules",
".",
"empty?",
"self",
".",
"devise_modules_to_include",
"=",
"[",
":omniauthable",
"]",
"else",
"# restrict modules given to devise",
"self",
".",
"devise_modules_to_include",
"=",
"(",
"modules",
"+",
"[",
":omniauthable",
"]",
"-",
"FORBIDDEN_MODULES",
")",
"&",
"ALLOWED_MODULES",
"end",
"# include model methods",
"include",
"ActsAsGoogleUser",
"::",
"Model",
"end"
] | Configure a model to be used with devise and google authentication
@param [Array] modules a list of symbols used with a devise call | [
"Configure",
"a",
"model",
"to",
"be",
"used",
"with",
"devise",
"and",
"google",
"authentication"
] | 4f2277faeaea778a3ad2b066628ca25f8fa1f6ab | https://github.com/fabn/google_authentication/blob/4f2277faeaea778a3ad2b066628ca25f8fa1f6ab/lib/google_authentication/acts_as_google_user.rb#L20-L30 |
3,386 | stvvan/hoiio-ruby | lib/hoiio-ruby/client.rb | Hoiio.Client.set_up_resources | def set_up_resources
@user = Hoiio::User.new self
@sms = Hoiio::SMS.new self
@voice = Hoiio::Voice.new self
@fax = Hoiio::Fax.new self
@number = Hoiio::Number.new self
@ivr = Hoiio::IVR.new self
end | ruby | def set_up_resources
@user = Hoiio::User.new self
@sms = Hoiio::SMS.new self
@voice = Hoiio::Voice.new self
@fax = Hoiio::Fax.new self
@number = Hoiio::Number.new self
@ivr = Hoiio::IVR.new self
end | [
"def",
"set_up_resources",
"@user",
"=",
"Hoiio",
"::",
"User",
".",
"new",
"self",
"@sms",
"=",
"Hoiio",
"::",
"SMS",
".",
"new",
"self",
"@voice",
"=",
"Hoiio",
"::",
"Voice",
".",
"new",
"self",
"@fax",
"=",
"Hoiio",
"::",
"Fax",
".",
"new",
"self",
"@number",
"=",
"Hoiio",
"::",
"Number",
".",
"new",
"self",
"@ivr",
"=",
"Hoiio",
"::",
"IVR",
".",
"new",
"self",
"end"
] | Set up sub resources to be used to call Hoiio API
This method passes the @client object to the initialize block of all API request. | [
"Set",
"up",
"sub",
"resources",
"to",
"be",
"used",
"to",
"call",
"Hoiio",
"API",
"This",
"method",
"passes",
"the"
] | 7f6840b94c5f61c221619ca069bc008d502dd339 | https://github.com/stvvan/hoiio-ruby/blob/7f6840b94c5f61c221619ca069bc008d502dd339/lib/hoiio-ruby/client.rb#L61-L68 |
3,387 | lmullen/omeka_client | lib/omeka_client/client.rb | OmekaClient.Client.put_item | def put_item(omeka_item)
self.put("items", omeka_item.data.id, omeka_item.data.to_h.to_json)
end | ruby | def put_item(omeka_item)
self.put("items", omeka_item.data.id, omeka_item.data.to_h.to_json)
end | [
"def",
"put_item",
"(",
"omeka_item",
")",
"self",
".",
"put",
"(",
"\"items\"",
",",
"omeka_item",
".",
"data",
".",
"id",
",",
"omeka_item",
".",
"data",
".",
"to_h",
".",
"to_json",
")",
"end"
] | Update an item using an OmekaItem instance
@param omeka_item [OmekaItem] An instance of OmekaItem
@since 0.0.4 | [
"Update",
"an",
"item",
"using",
"an",
"OmekaItem",
"instance"
] | abd7e8d38d91b1a5904eb7e068b066f0ac8b1074 | https://github.com/lmullen/omeka_client/blob/abd7e8d38d91b1a5904eb7e068b066f0ac8b1074/lib/omeka_client/client.rb#L167-L169 |
3,388 | lmullen/omeka_client | lib/omeka_client/client.rb | OmekaClient.Client.build_request | def build_request(method, resource = nil, id = nil, body =nil, query = {})
url = self.endpoint
url += "/" + resource unless resource.nil?
url += "/" + id.to_s unless id.nil?
query[:key] = self.api_key unless self.api_key.nil?
case method
when "get"
self.connection.get(url, :params => query)
when "post"
self.connection.post(url, :body => body, :params => query)
when "put"
self.connection.put(url, :body => body, :params => query)
when "delete"
begin
self.connection.delete(url, :params => query)
rescue TypeError
# Not putting the error to stdout
end
end
end | ruby | def build_request(method, resource = nil, id = nil, body =nil, query = {})
url = self.endpoint
url += "/" + resource unless resource.nil?
url += "/" + id.to_s unless id.nil?
query[:key] = self.api_key unless self.api_key.nil?
case method
when "get"
self.connection.get(url, :params => query)
when "post"
self.connection.post(url, :body => body, :params => query)
when "put"
self.connection.put(url, :body => body, :params => query)
when "delete"
begin
self.connection.delete(url, :params => query)
rescue TypeError
# Not putting the error to stdout
end
end
end | [
"def",
"build_request",
"(",
"method",
",",
"resource",
"=",
"nil",
",",
"id",
"=",
"nil",
",",
"body",
"=",
"nil",
",",
"query",
"=",
"{",
"}",
")",
"url",
"=",
"self",
".",
"endpoint",
"url",
"+=",
"\"/\"",
"+",
"resource",
"unless",
"resource",
".",
"nil?",
"url",
"+=",
"\"/\"",
"+",
"id",
".",
"to_s",
"unless",
"id",
".",
"nil?",
"query",
"[",
":key",
"]",
"=",
"self",
".",
"api_key",
"unless",
"self",
".",
"api_key",
".",
"nil?",
"case",
"method",
"when",
"\"get\"",
"self",
".",
"connection",
".",
"get",
"(",
"url",
",",
":params",
"=>",
"query",
")",
"when",
"\"post\"",
"self",
".",
"connection",
".",
"post",
"(",
"url",
",",
":body",
"=>",
"body",
",",
":params",
"=>",
"query",
")",
"when",
"\"put\"",
"self",
".",
"connection",
".",
"put",
"(",
"url",
",",
":body",
"=>",
"body",
",",
":params",
"=>",
"query",
")",
"when",
"\"delete\"",
"begin",
"self",
".",
"connection",
".",
"delete",
"(",
"url",
",",
":params",
"=>",
"query",
")",
"rescue",
"TypeError",
"# Not putting the error to stdout",
"end",
"end",
"end"
] | Helper method to build an API request
@param method [String] The type of REST request to make: "get", "post",
"put", or "delete".
@param resource [String] The type of resource to request from the Omeka
site, e.g., "items" or "site".
@param id [Integer] The id of the resource to request from the Omeka
site.
@param body [] The body of a request in a PUT or POST request.
@param query [Hash] Additional query parameters for the request.
@return [NetHttpPersistentResponseWrapper] A wrapper around the API's
response, containing the HTTP code and the response body.
@since 1.0.0 | [
"Helper",
"method",
"to",
"build",
"an",
"API",
"request"
] | abd7e8d38d91b1a5904eb7e068b066f0ac8b1074 | https://github.com/lmullen/omeka_client/blob/abd7e8d38d91b1a5904eb7e068b066f0ac8b1074/lib/omeka_client/client.rb#L203-L225 |
3,389 | luikore/markascend | lib/markascend/line_unit.rb | Markascend.LineUnit.parse_inline_code | def parse_inline_code
if s = @src.scan(/
(`{1,})(\ ?)
.*?
\2\1
/x)
s =~ /^
(`{1,})(\ ?)
(.*?)
\2\1
$/x
@out << (::Markascend.hilite $3, env.hi, true)
true
end
end | ruby | def parse_inline_code
if s = @src.scan(/
(`{1,})(\ ?)
.*?
\2\1
/x)
s =~ /^
(`{1,})(\ ?)
(.*?)
\2\1
$/x
@out << (::Markascend.hilite $3, env.hi, true)
true
end
end | [
"def",
"parse_inline_code",
"if",
"s",
"=",
"@src",
".",
"scan",
"(",
"/",
"\\ ",
"\\2",
"\\1",
"/x",
")",
"s",
"=~",
"/",
"\\ ",
"\\2",
"\\1",
"/x",
"@out",
"<<",
"(",
"::",
"Markascend",
".",
"hilite",
"$3",
",",
"env",
".",
"hi",
",",
"true",
")",
"true",
"end",
"end"
] | the same as markdown | [
"the",
"same",
"as",
"markdown"
] | 58a7d9c18bf764dba537f7b4bf52ac550bbccb50 | https://github.com/luikore/markascend/blob/58a7d9c18bf764dba537f7b4bf52ac550bbccb50/lib/markascend/line_unit.rb#L22-L36 |
3,390 | norman/phonology | lib/phonology/sound.rb | Phonology.Sound.<< | def <<(*args)
args.to_a.flatten.each do |feature|
features.subtract Features.set(feature).to_a
add! feature
end
self
end | ruby | def <<(*args)
args.to_a.flatten.each do |feature|
features.subtract Features.set(feature).to_a
add! feature
end
self
end | [
"def",
"<<",
"(",
"*",
"args",
")",
"args",
".",
"to_a",
".",
"flatten",
".",
"each",
"do",
"|",
"feature",
"|",
"features",
".",
"subtract",
"Features",
".",
"set",
"(",
"feature",
")",
".",
"to_a",
"add!",
"feature",
"end",
"self",
"end"
] | Add a feature, replacing either the place or manner of articulation,
or the height or backness. Returns self. | [
"Add",
"a",
"feature",
"replacing",
"either",
"the",
"place",
"or",
"manner",
"of",
"articulation",
"or",
"the",
"height",
"or",
"backness",
".",
"Returns",
"self",
"."
] | 910207237aecbcd8e1a464a9148d9b3fd4d1f3e4 | https://github.com/norman/phonology/blob/910207237aecbcd8e1a464a9148d9b3fd4d1f3e4/lib/phonology/sound.rb#L131-L137 |
3,391 | norman/phonology | lib/phonology/sound.rb | Phonology.Sound.>> | def >>(*args)
args.to_a.flatten.each do |feature|
features.delete feature.to_sym
end
self
end | ruby | def >>(*args)
args.to_a.flatten.each do |feature|
features.delete feature.to_sym
end
self
end | [
"def",
">>",
"(",
"*",
"args",
")",
"args",
".",
"to_a",
".",
"flatten",
".",
"each",
"do",
"|",
"feature",
"|",
"features",
".",
"delete",
"feature",
".",
"to_sym",
"end",
"self",
"end"
] | Remove a feature, and return self. | [
"Remove",
"a",
"feature",
"and",
"return",
"self",
"."
] | 910207237aecbcd8e1a464a9148d9b3fd4d1f3e4 | https://github.com/norman/phonology/blob/910207237aecbcd8e1a464a9148d9b3fd4d1f3e4/lib/phonology/sound.rb#L147-L152 |
3,392 | mrwillihog/unified | lib/unified/chunk.rb | Unified.Chunk.each_line | def each_line
original_line_number = @original_line_number
modified_line_number = @modified_line_number
@lines.each do |line|
if line.addition?
yield line, nil, modified_line_number
modified_line_number += 1
elsif line.deletion?
yield line, original_line_number, nil
original_line_number += 1
elsif line.unchanged?
yield line, original_line_number, modified_line_number
original_line_number += 1
modified_line_number += 1
else
yield line
end
end
end | ruby | def each_line
original_line_number = @original_line_number
modified_line_number = @modified_line_number
@lines.each do |line|
if line.addition?
yield line, nil, modified_line_number
modified_line_number += 1
elsif line.deletion?
yield line, original_line_number, nil
original_line_number += 1
elsif line.unchanged?
yield line, original_line_number, modified_line_number
original_line_number += 1
modified_line_number += 1
else
yield line
end
end
end | [
"def",
"each_line",
"original_line_number",
"=",
"@original_line_number",
"modified_line_number",
"=",
"@modified_line_number",
"@lines",
".",
"each",
"do",
"|",
"line",
"|",
"if",
"line",
".",
"addition?",
"yield",
"line",
",",
"nil",
",",
"modified_line_number",
"modified_line_number",
"+=",
"1",
"elsif",
"line",
".",
"deletion?",
"yield",
"line",
",",
"original_line_number",
",",
"nil",
"original_line_number",
"+=",
"1",
"elsif",
"line",
".",
"unchanged?",
"yield",
"line",
",",
"original_line_number",
",",
"modified_line_number",
"original_line_number",
"+=",
"1",
"modified_line_number",
"+=",
"1",
"else",
"yield",
"line",
"end",
"end",
"end"
] | Iterator for lines passing |line, original_line_number, modified_line_number| as block arguments | [
"Iterator",
"for",
"lines",
"passing",
"|line",
"original_line_number",
"modified_line_number|",
"as",
"block",
"arguments"
] | a1e13d3f865dc89277d7cb11d5f8b1216096ac34 | https://github.com/mrwillihog/unified/blob/a1e13d3f865dc89277d7cb11d5f8b1216096ac34/lib/unified/chunk.rb#L56-L75 |
3,393 | SwagDevOps/sys-proc | lib/sys/proc/concern/static_instance.rb | Sys::Proc::Concern::StaticInstance.ClassMethods.method_missing | def method_missing(method, *args, &block)
if respond_to_missing?(method)
new.public_send(method, *args, &block)
else
super
end
end | ruby | def method_missing(method, *args, &block)
if respond_to_missing?(method)
new.public_send(method, *args, &block)
else
super
end
end | [
"def",
"method_missing",
"(",
"method",
",",
"*",
"args",
",",
"&",
"block",
")",
"if",
"respond_to_missing?",
"(",
"method",
")",
"new",
".",
"public_send",
"(",
"method",
",",
"args",
",",
"block",
")",
"else",
"super",
"end",
"end"
] | Provides access to instance methods | [
"Provides",
"access",
"to",
"instance",
"methods"
] | d0a6d8259ccb63dd7a501dbdef4a501d2cafec27 | https://github.com/SwagDevOps/sys-proc/blob/d0a6d8259ccb63dd7a501dbdef4a501d2cafec27/lib/sys/proc/concern/static_instance.rb#L22-L28 |
3,394 | fabiokr/manageable | app/helpers/manageable/application_helper.rb | Manageable.ApplicationHelper.manageable_content_box | def manageable_content_box(options = {}, &block)
box_buffer = Helpers::BoxBuilder.new(self)
box_content = capture(box_buffer, &block)
options = {
:id => nil,
:class => []
}.merge(options)
block_class = ([ "block" ] + [ options[:class] ].flatten).join(" ")
content_tag(:div, :class => block_class, :id => options[:id]) do
block_out = box_buffer.buffers[:block_header].html_safe
block_out << content_tag(:div, :class => "content") do
content_out = ''.html_safe
content_out = content_tag(:h2, options[:headline]) if options[:headline]
content_out << content_tag(:div, box_content, :class => 'inner')
end
block_out << box_buffer.buffers[:block_footer].html_safe
end
end | ruby | def manageable_content_box(options = {}, &block)
box_buffer = Helpers::BoxBuilder.new(self)
box_content = capture(box_buffer, &block)
options = {
:id => nil,
:class => []
}.merge(options)
block_class = ([ "block" ] + [ options[:class] ].flatten).join(" ")
content_tag(:div, :class => block_class, :id => options[:id]) do
block_out = box_buffer.buffers[:block_header].html_safe
block_out << content_tag(:div, :class => "content") do
content_out = ''.html_safe
content_out = content_tag(:h2, options[:headline]) if options[:headline]
content_out << content_tag(:div, box_content, :class => 'inner')
end
block_out << box_buffer.buffers[:block_footer].html_safe
end
end | [
"def",
"manageable_content_box",
"(",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"box_buffer",
"=",
"Helpers",
"::",
"BoxBuilder",
".",
"new",
"(",
"self",
")",
"box_content",
"=",
"capture",
"(",
"box_buffer",
",",
"block",
")",
"options",
"=",
"{",
":id",
"=>",
"nil",
",",
":class",
"=>",
"[",
"]",
"}",
".",
"merge",
"(",
"options",
")",
"block_class",
"=",
"(",
"[",
"\"block\"",
"]",
"+",
"[",
"options",
"[",
":class",
"]",
"]",
".",
"flatten",
")",
".",
"join",
"(",
"\" \"",
")",
"content_tag",
"(",
":div",
",",
":class",
"=>",
"block_class",
",",
":id",
"=>",
"options",
"[",
":id",
"]",
")",
"do",
"block_out",
"=",
"box_buffer",
".",
"buffers",
"[",
":block_header",
"]",
".",
"html_safe",
"block_out",
"<<",
"content_tag",
"(",
":div",
",",
":class",
"=>",
"\"content\"",
")",
"do",
"content_out",
"=",
"''",
".",
"html_safe",
"content_out",
"=",
"content_tag",
"(",
":h2",
",",
"options",
"[",
":headline",
"]",
")",
"if",
"options",
"[",
":headline",
"]",
"content_out",
"<<",
"content_tag",
"(",
":div",
",",
"box_content",
",",
":class",
"=>",
"'inner'",
")",
"end",
"block_out",
"<<",
"box_buffer",
".",
"buffers",
"[",
":block_footer",
"]",
".",
"html_safe",
"end",
"end"
] | Create a content box.
options - A hash of options to apply to the box.
&block - The content of the box, passed an instance of Helpers::BoxBuilder.
Valid options:
* :headline -- The headline to show in the box.
* :class -- A class to apply to the box.
* :id -- The ID to apply to the box.
Example:
<% content_box :headline => "My Box", :class => "alert", :id => "my_box" do |box| %>
<% box.navigation do |nav| %>
<% nav.item "List People", people_path, :active => true %>
<% nav.item "New Person", new_person_path %>
<% nav.item "Search", search_path(:type => "people") %>
<% end %>
<% box.breadcrumbs do |crumbs| %>
<% crumbs.item "Home", root_path %>
<% crumbs.item "People", people_path %>
<% crumbs.item "Bob Jones", person_path(@person), :active => true %>
<% end %>
<p>This is a really neat box, which will be displayed with a headline and navigation.</p>
<% end %>
Returns the completed box, yields an instance of Helpers::BoxBuilder. | [
"Create",
"a",
"content",
"box",
"."
] | 9db47dea0e2e73e164923de23be20109fe1cf35f | https://github.com/fabiokr/manageable/blob/9db47dea0e2e73e164923de23be20109fe1cf35f/app/helpers/manageable/application_helper.rb#L32-L52 |
3,395 | fabiokr/manageable | app/helpers/manageable/application_helper.rb | Manageable.ApplicationHelper.manageable_icon | def manageable_icon(name, size = :small, options = {})
return "" if name.nil?
dimension = ( (size == :small) ? "16" : "32" ).html_safe
options[:alt] ||= name.capitalize.gsub("_", " ")
image_tag(asset_path("manageable/icons/#{dimension}x#{dimension}/#{name}.png"), {
:alt => options[:alt]
})
end | ruby | def manageable_icon(name, size = :small, options = {})
return "" if name.nil?
dimension = ( (size == :small) ? "16" : "32" ).html_safe
options[:alt] ||= name.capitalize.gsub("_", " ")
image_tag(asset_path("manageable/icons/#{dimension}x#{dimension}/#{name}.png"), {
:alt => options[:alt]
})
end | [
"def",
"manageable_icon",
"(",
"name",
",",
"size",
"=",
":small",
",",
"options",
"=",
"{",
"}",
")",
"return",
"\"\"",
"if",
"name",
".",
"nil?",
"dimension",
"=",
"(",
"(",
"size",
"==",
":small",
")",
"?",
"\"16\"",
":",
"\"32\"",
")",
".",
"html_safe",
"options",
"[",
":alt",
"]",
"||=",
"name",
".",
"capitalize",
".",
"gsub",
"(",
"\"_\"",
",",
"\" \"",
")",
"image_tag",
"(",
"asset_path",
"(",
"\"manageable/icons/#{dimension}x#{dimension}/#{name}.png\"",
")",
",",
"{",
":alt",
"=>",
"options",
"[",
":alt",
"]",
"}",
")",
"end"
] | Display an icon
name - The icon to display
size - One of :small or :large (optional)
options - A hash to be passed to the image_tag helper (optional)
Example:
manageable_icon("add")
# => image_tag("/assets/manageable/icons/16x16/add.png", :alt => "Add")
manageable_icon("new_item", :large)
# => image_tag("/assets/manageable/icons/32x32/new_item.png, :alt => "New Item")
Returns an image tag, ready to be displayed in a template. | [
"Display",
"an",
"icon"
] | 9db47dea0e2e73e164923de23be20109fe1cf35f | https://github.com/fabiokr/manageable/blob/9db47dea0e2e73e164923de23be20109fe1cf35f/app/helpers/manageable/application_helper.rb#L83-L92 |
3,396 | fabiokr/manageable | app/helpers/manageable/application_helper.rb | Manageable.ApplicationHelper.manageable_controls | def manageable_controls(options = {})
options[:class] ||= ""
options[:class] << " control"
options[:class].strip!
items = Helpers::NavigationBuilder.new
yield items if block_given?
content_tag("div", options) do
items.collect { |item|
manageable_button(item[:label], item[:href], item[:link_options].merge(:icon => item[:icon]))
}.join("").html_safe
end
end | ruby | def manageable_controls(options = {})
options[:class] ||= ""
options[:class] << " control"
options[:class].strip!
items = Helpers::NavigationBuilder.new
yield items if block_given?
content_tag("div", options) do
items.collect { |item|
manageable_button(item[:label], item[:href], item[:link_options].merge(:icon => item[:icon]))
}.join("").html_safe
end
end | [
"def",
"manageable_controls",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"[",
":class",
"]",
"||=",
"\"\"",
"options",
"[",
":class",
"]",
"<<",
"\" control\"",
"options",
"[",
":class",
"]",
".",
"strip!",
"items",
"=",
"Helpers",
"::",
"NavigationBuilder",
".",
"new",
"yield",
"items",
"if",
"block_given?",
"content_tag",
"(",
"\"div\"",
",",
"options",
")",
"do",
"items",
".",
"collect",
"{",
"|",
"item",
"|",
"manageable_button",
"(",
"item",
"[",
":label",
"]",
",",
"item",
"[",
":href",
"]",
",",
"item",
"[",
":link_options",
"]",
".",
"merge",
"(",
":icon",
"=>",
"item",
"[",
":icon",
"]",
")",
")",
"}",
".",
"join",
"(",
"\"\"",
")",
".",
"html_safe",
"end",
"end"
] | Creates a set of buttons
options - A hash of attributes to apply to the wrapping div tag
Example:
<div class="block">
<div class="content">
<%= controls do |c|
c.item "Copy", copy_person_path(person), :icon => "copy_person"
c.item "Delete", person_path(person), :method => :delete
end %>
</div>
</div>
Returns a set of controls to be displayed. | [
"Creates",
"a",
"set",
"of",
"buttons"
] | 9db47dea0e2e73e164923de23be20109fe1cf35f | https://github.com/fabiokr/manageable/blob/9db47dea0e2e73e164923de23be20109fe1cf35f/app/helpers/manageable/application_helper.rb#L154-L167 |
3,397 | fabiokr/manageable | app/helpers/manageable/application_helper.rb | Manageable.ApplicationHelper.manageable_breadcrumbs | def manageable_breadcrumbs(options = {})
items = Helpers::NavigationBuilder.new
yield items if block_given?
options[:class] ||= ""
options[:class] << " breadcrumb"
options[:class].strip!
content_tag("div", options) do
content_tag("ul") do
items.collect { |item|
content_tag("li", :class => item[:class]) do
if item[:active]
item[:label]
else
link_to(item[:label], item[:href])
end
end
}.join("").html_safe
end
end
end | ruby | def manageable_breadcrumbs(options = {})
items = Helpers::NavigationBuilder.new
yield items if block_given?
options[:class] ||= ""
options[:class] << " breadcrumb"
options[:class].strip!
content_tag("div", options) do
content_tag("ul") do
items.collect { |item|
content_tag("li", :class => item[:class]) do
if item[:active]
item[:label]
else
link_to(item[:label], item[:href])
end
end
}.join("").html_safe
end
end
end | [
"def",
"manageable_breadcrumbs",
"(",
"options",
"=",
"{",
"}",
")",
"items",
"=",
"Helpers",
"::",
"NavigationBuilder",
".",
"new",
"yield",
"items",
"if",
"block_given?",
"options",
"[",
":class",
"]",
"||=",
"\"\"",
"options",
"[",
":class",
"]",
"<<",
"\" breadcrumb\"",
"options",
"[",
":class",
"]",
".",
"strip!",
"content_tag",
"(",
"\"div\"",
",",
"options",
")",
"do",
"content_tag",
"(",
"\"ul\"",
")",
"do",
"items",
".",
"collect",
"{",
"|",
"item",
"|",
"content_tag",
"(",
"\"li\"",
",",
":class",
"=>",
"item",
"[",
":class",
"]",
")",
"do",
"if",
"item",
"[",
":active",
"]",
"item",
"[",
":label",
"]",
"else",
"link_to",
"(",
"item",
"[",
":label",
"]",
",",
"item",
"[",
":href",
"]",
")",
"end",
"end",
"}",
".",
"join",
"(",
"\"\"",
")",
".",
"html_safe",
"end",
"end",
"end"
] | Displays a breadcrumb trail
options - A hash of attributes to apply to the wrapping div tag
Example:
<div class="block">
<div class="content">
<h2><%= @news_item.title %></h2>
<p><%= @news_item.content %></p>
</div>
<%= breadcrumbs do |b|
b.item "Home", root_path
b.item "News", news_path
b.item "Awesome New Things", news_path(@news_item), :active => true
%>
</div>
Returns the breadcrumb trail. | [
"Displays",
"a",
"breadcrumb",
"trail"
] | 9db47dea0e2e73e164923de23be20109fe1cf35f | https://github.com/fabiokr/manageable/blob/9db47dea0e2e73e164923de23be20109fe1cf35f/app/helpers/manageable/application_helper.rb#L187-L208 |
3,398 | fabiokr/manageable | app/helpers/manageable/application_helper.rb | Manageable.ApplicationHelper.manageable_button | def manageable_button(body, url, html_options = {})
html_options[:class] = [html_options[:class], "button"].compact.join(" ")
icon = manageable_icon(html_options.delete(:icon), :small, :alt => body) if html_options[:icon]
link_to url, html_options do
[icon, body].compact.join(" ").html_safe
end
end | ruby | def manageable_button(body, url, html_options = {})
html_options[:class] = [html_options[:class], "button"].compact.join(" ")
icon = manageable_icon(html_options.delete(:icon), :small, :alt => body) if html_options[:icon]
link_to url, html_options do
[icon, body].compact.join(" ").html_safe
end
end | [
"def",
"manageable_button",
"(",
"body",
",",
"url",
",",
"html_options",
"=",
"{",
"}",
")",
"html_options",
"[",
":class",
"]",
"=",
"[",
"html_options",
"[",
":class",
"]",
",",
"\"button\"",
"]",
".",
"compact",
".",
"join",
"(",
"\" \"",
")",
"icon",
"=",
"manageable_icon",
"(",
"html_options",
".",
"delete",
"(",
":icon",
")",
",",
":small",
",",
":alt",
"=>",
"body",
")",
"if",
"html_options",
"[",
":icon",
"]",
"link_to",
"url",
",",
"html_options",
"do",
"[",
"icon",
",",
"body",
"]",
".",
"compact",
".",
"join",
"(",
"\" \"",
")",
".",
"html_safe",
"end",
"end"
] | Creates a link_to button | [
"Creates",
"a",
"link_to",
"button"
] | 9db47dea0e2e73e164923de23be20109fe1cf35f | https://github.com/fabiokr/manageable/blob/9db47dea0e2e73e164923de23be20109fe1cf35f/app/helpers/manageable/application_helper.rb#L229-L236 |
3,399 | fabiokr/manageable | app/helpers/manageable/application_helper.rb | Manageable.ApplicationHelper.manageable_attributes | def manageable_attributes(record, options = {}, &block)
options[:html] ||= {}
html_class = [ "attrtastic", record.class.to_s.underscore, options[:html][:class] ].compact.join(" ")
output = tag(:div, { :class => html_class}, true)
if block_given?
output << capture(Helpers::AttributesBuilder.new(record, self), &block)
else
output << capture(Helpers::AttributesBuilder.new(record, self)) do |attr|
attr.attributes
end
end
output.safe_concat("</div>")
end | ruby | def manageable_attributes(record, options = {}, &block)
options[:html] ||= {}
html_class = [ "attrtastic", record.class.to_s.underscore, options[:html][:class] ].compact.join(" ")
output = tag(:div, { :class => html_class}, true)
if block_given?
output << capture(Helpers::AttributesBuilder.new(record, self), &block)
else
output << capture(Helpers::AttributesBuilder.new(record, self)) do |attr|
attr.attributes
end
end
output.safe_concat("</div>")
end | [
"def",
"manageable_attributes",
"(",
"record",
",",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"options",
"[",
":html",
"]",
"||=",
"{",
"}",
"html_class",
"=",
"[",
"\"attrtastic\"",
",",
"record",
".",
"class",
".",
"to_s",
".",
"underscore",
",",
"options",
"[",
":html",
"]",
"[",
":class",
"]",
"]",
".",
"compact",
".",
"join",
"(",
"\" \"",
")",
"output",
"=",
"tag",
"(",
":div",
",",
"{",
":class",
"=>",
"html_class",
"}",
",",
"true",
")",
"if",
"block_given?",
"output",
"<<",
"capture",
"(",
"Helpers",
"::",
"AttributesBuilder",
".",
"new",
"(",
"record",
",",
"self",
")",
",",
"block",
")",
"else",
"output",
"<<",
"capture",
"(",
"Helpers",
"::",
"AttributesBuilder",
".",
"new",
"(",
"record",
",",
"self",
")",
")",
"do",
"|",
"attr",
"|",
"attr",
".",
"attributes",
"end",
"end",
"output",
".",
"safe_concat",
"(",
"\"</div>\"",
")",
"end"
] | Helper for custom attrtastic like builder | [
"Helper",
"for",
"custom",
"attrtastic",
"like",
"builder"
] | 9db47dea0e2e73e164923de23be20109fe1cf35f | https://github.com/fabiokr/manageable/blob/9db47dea0e2e73e164923de23be20109fe1cf35f/app/helpers/manageable/application_helper.rb#L309-L323 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.