id int32 0 24.9k | repo stringlengths 5 58 | path stringlengths 9 168 | func_name stringlengths 9 130 | original_string stringlengths 66 10.5k | language stringclasses 1
value | code stringlengths 66 10.5k | code_tokens list | docstring stringlengths 8 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 94 266 |
|---|---|---|---|---|---|---|---|---|---|---|---|
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 &&... | 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 &&... | [
"def",
"find_with_static_record",
"(",
"*",
"args",
")",
"#:nodoc:",
"if",
"scope",
"(",
":find",
")",
".",
"nil?",
"&&",
"args",
"if",
"args",
".",
"first",
".",
"is_a?",
"(",
"Fixnum",
")",
"&&",
"(",
"(",
"args",
".",
"length",
"==",
"1",
"||",
... | 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
... | 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
... | [
"def",
"calculate_with_static_record",
"(",
"operation",
",",
"column_name",
",",
"options",
"=",
"{",
"}",
")",
"#:nodoc:",
"if",
"scope",
"(",
":find",
")",
".",
"nil?",
"&&",
"!",
"options",
".",
"any?",
"{",
"|",
"k",
",",
"v",
"|",
"k",
".",
"to... | 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
bloc... | 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
bloc... | [
"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... | 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_ke... | 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_ke... | [
"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... | 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.... | 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.... | [
"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",
"attribute... | 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",
... | 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 %{
de... | 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 %{
de... | [
"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_i... | 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$/)) &&
... | 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$/)) &&
... | [
"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... | 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",
".",
"re... | 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] i... | 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] i... | [
"def",
"compose_down",
"(",
"params",
"=",
"{",
"}",
")",
"raise",
"ArgumentError",
",",
"'Invalid arguments.'",
"unless",
"check_arguments",
"(",
"params",
",",
"'project'",
")",
"path",
"=",
"'/compose/down'",
"query",
"=",
"{",
"}",
"query",
"[",
":project"... | 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 respo... | [
"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 libcompo... | 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 libcompo... | [
"def",
"compose_create",
"(",
"params",
"=",
"{",
"}",
")",
"raise",
"ArgumentError",
",",
"'Invalid arguments.'",
"unless",
"check_arguments",
"(",
"params",
",",
"'project'",
")",
"path",
"=",
"'/compose/create'",
"query",
"=",
"{",
"}",
"body",
"=",
"{",
... | 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 o... | [
"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",
... | 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... | 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",... | 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.... | 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.... | [
"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_angl... | 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 cr... | 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 cr... | [
"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",
... | 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[@targ... | 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[@targ... | [
"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",
"... | 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"... | 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
... | 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
... | [
"def",
"find",
"(",
"context",
",",
"facet_name",
",",
"*",
"args",
")",
"facet",
"=",
"find_facet",
"(",
"context",
",",
"facet_name",
")",
"if",
"!",
"facet",
"return",
"nil",
"end",
"case",
"result",
"=",
"facet",
".",
"find",
"(",
"args",
")",
"w... | 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 i... | 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 i... | [
"def",
"find_facet",
"(",
"context",
",",
"facet_name",
")",
"cache_key",
"=",
"[",
"context",
",",
"facet_name",
"]",
"if",
"@facet_cache",
".",
"include?",
"(",
"cache_key",
")",
"facet",
"=",
"@facet_cache",
"[",
"cache_key",
"]",
"else",
"begin",
"requir... | 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,... | 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,... | [
"def",
"create_service",
"(",
"params",
"=",
"{",
"}",
")",
"valid",
"=",
"check_arguments",
"(",
"params",
",",
"'name'",
",",
"'image'",
",",
"'replicas'",
",",
"'serviceport'",
",",
"'labels'",
")",
"raise",
"ArgumentError",
",",
"'Invalid arguments.'",
"un... | 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] :ima... | [
"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",
"[",... | 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("#{Ami... | 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("#{Ami... | [
"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",
".",... | 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 ... | [
"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)
... | 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)
... | [
"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}:... | 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... | [
"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)
... | 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)
... | [
"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}:#{A... | 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 fo... | [
"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.acce... | [
"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)
... | 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)
... | [
"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}:#{Am... | 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... | [
"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?",
"... | 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.foll... | [
"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?... | [
"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)
... | [
"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?",... | 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... | [
"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... | [
"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?",
... | 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.foll... | [
"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 fol... | [
"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 ... | [
"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 n... | [
"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... | [
"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(... | [
"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... | [
"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... | [
"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 o... | [
"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\"",
"... | 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] ... | [
"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)
... | 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)
... | [
"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",
".",
... | 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
... | 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
... | [
"def",
"members",
"(",
"key",
",",
"options",
"=",
"default_paging_options",
")",
"options",
"=",
"default_paging_options",
".",
"dup",
".",
"merge!",
"(",
"options",
")",
"if",
"options",
"[",
":page",
"]",
"<",
"1",
"options",
"[",
":page",
"]",
"=",
"... | 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 sp... | 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 sp... | [
"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 \"T... | 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",
"(",
"se... | 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 Hyp... | [
"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... | 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... | [
"def",
"remove_container",
"(",
"params",
"=",
"{",
"}",
")",
"raise",
"ArgumentError",
",",
"'Invalid arguments.'",
"unless",
"check_arguments",
"(",
"params",
",",
"'id'",
")",
"path",
"=",
"'/containers/'",
"+",
"params",
"[",
":id",
"]",
"query",
"=",
"{... | 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 containe... | [
"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 ... | 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 ... | [
"def",
"create_container",
"(",
"params",
"=",
"{",
"}",
")",
"raise",
"ArgumentError",
",",
"'Invalid arguments.'",
"unless",
"check_arguments",
"(",
"params",
",",
"'image'",
")",
"path",
"=",
"'/containers/create'",
"query",
"=",
"{",
"}",
"# set default size, ... | 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::InternalServerErr... | [
"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
... | 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
... | [
"def",
"rename_container",
"(",
"params",
"=",
"{",
"}",
")",
"raise",
"ArgumentError",
",",
"'Invalid arguments.'",
"unless",
"check_arguments",
"(",
"params",
",",
"'name'",
",",
"'id'",
")",
"path",
"=",
"'/containers/'",
"+",
"params",
"[",
":id",
"]",
"... | 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 whe... | [
"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",
".",
"includ... | 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
... | 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
... | [
"def",
"parse",
"(",
"settings",
",",
"logfile",
"=",
"nil",
")",
"settings",
".",
"each",
"do",
"|",
"key",
",",
"value",
"|",
"if",
"value",
".",
"is_a?",
"(",
"Hash",
")",
"logfile",
"=",
"Logmsg",
"::",
"LogFile",
".",
"new",
"(",
"key",
")",
... | 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... | 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",
",",
":t... | 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",
",",
"tru... | 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"... | 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",
... | 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
arg... | 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
arg... | [
"def",
"getHeavyRotation",
"(",
"user",
"=",
"nil",
",",
"type",
"=",
"nil",
",",
"friends",
"=",
"nil",
",",
"limit",
"=",
"nil",
",",
"extras",
"=",
"nil",
")",
"method",
"=",
"'getHeavyRotation'",
"cls",
"=",
"TODO",
"if",
"type",
"==",
"'artist'",
... | 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",
"]",
"=",
"t... | 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",
",",
"m... | 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",
",",
... | 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",
... | 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",
",",
... | 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}
... | 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}
... | [
"def",
"getTopCharts",
"(",
"type",
",",
"start",
"=",
"nil",
",",
"count",
"=",
"nil",
",",
"extras",
"=",
"nil",
")",
"method",
"=",
"'getTopCharts'",
"cls",
"=",
"TODO",
"case",
"type",
"when",
"'Artist'",
"cls",
"=",
"Artist",
"when",
"'Album'",
"c... | 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",
"]",
... | 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",
... | 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",
"=>",
"c... | 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",
"=>",
"descriptio... | 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",
",... | 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_par... | 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_par... | [
"def",
"get_token",
"(",
"username",
",",
"password",
",",
"sid",
",",
"params",
"=",
"{",
"}",
",",
"opts",
"=",
"{",
"}",
")",
"request_body",
"=",
"opts",
".",
"delete",
"(",
"'auth_scheme'",
")",
"==",
"'request_body'",
"params",
"=",
"{",
"'grant_... | 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\"",
"u... | 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_MODU... | 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_MODU... | [
"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_... | 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... | 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... | 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... | [
"def",
"build_request",
"(",
"method",
",",
"resource",
"=",
"nil",
",",
"id",
"=",
"nil",
",",
"body",
"=",
"nil",
",",
"query",
"=",
"{",
"}",
")",
"url",
"=",
"self",
".",
"endpoint",
"url",
"+=",
"\"/\"",
"+",
"resource",
"unless",
"resource",
... | 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.... | [
"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",
... | 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_... | 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_... | [
"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",
"... | 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_t... | 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_t... | [
"def",
"manageable_content_box",
"(",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"box_buffer",
"=",
"Helpers",
"::",
"BoxBuilder",
".",
"new",
"(",
"self",
")",
"box_content",
"=",
"capture",
"(",
"box_buffer",
",",
"block",
")",
"options",
"=",
"... | 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:
<% conten... | [
"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... | 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... | [
"def",
"manageable_icon",
"(",
"name",
",",
"size",
"=",
":small",
",",
"options",
"=",
"{",
"}",
")",
"return",
"\"\"",
"if",
"name",
".",
"nil?",
"dimension",
"=",
"(",
"(",
"size",
"==",
":small",
")",
"?",
"\"16\"",
":",
"\"32\"",
")",
".",
"ht... | 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_t... | [
"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... | 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... | [
"def",
"manageable_controls",
"(",
"options",
"=",
"{",
"}",
")",
"options",
"[",
":class",
"]",
"||=",
"\"\"",
"options",
"[",
":class",
"]",
"<<",
"\" control\"",
"options",
"[",
":class",
"]",
".",
"strip!",
"items",
"=",
"Helpers",
"::",
"NavigationBui... | 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
... | [
"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|
... | 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|
... | [
"def",
"manageable_breadcrumbs",
"(",
"options",
"=",
"{",
"}",
")",
"items",
"=",
"Helpers",
"::",
"NavigationBuilder",
".",
"new",
"yield",
"items",
"if",
"block_given?",
"options",
"[",
":class",
"]",
"||=",
"\"\"",
"options",
"[",
":class",
"]",
"<<",
... | 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... | [
"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_s... | 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_s... | [
"def",
"manageable_button",
"(",
"body",
",",
"url",
",",
"html_options",
"=",
"{",
"}",
")",
"html_options",
"[",
":class",
"]",
"=",
"[",
"html_options",
"[",
":class",
"]",
",",
"\"button\"",
"]",
".",
"compact",
".",
"join",
"(",
"\" \"",
")",
"ico... | 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::AttributesBui... | 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::AttributesBui... | [
"def",
"manageable_attributes",
"(",
"record",
",",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"options",
"[",
":html",
"]",
"||=",
"{",
"}",
"html_class",
"=",
"[",
"\"attrtastic\"",
",",
"record",
".",
"class",
".",
"to_s",
".",
"underscore",
... | 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.