class Cassandra::FunctionCollection

@private This class encapsulates a collection of functions or aggregates. Really used internally, so it should not be documented.

Public Class Methods

new() click to toggle source
   # File lib/cassandra/function_collection.rb
24 def initialize
25   @function_hash = {}
26 end

Public Instance Methods

==(other)
Alias for: eql?
add_or_update(function) click to toggle source
   # File lib/cassandra/function_collection.rb
37 def add_or_update(function)
38   @function_hash[[function.name, function.argument_types]] = function
39 end
delete(name, argument_types) click to toggle source
   # File lib/cassandra/function_collection.rb
41 def delete(name, argument_types)
42   @function_hash.delete([name, argument_types])
43 end
each_function(&block) click to toggle source

Yield or enumerate each function defined in this collection @overload each_function

@yieldparam function [Cassandra::Function or Cassandra::Aggregate]
      current function or aggregate
@return [Cassandra::FunctionCollection] self

@overload each_function

@return [Array<Cassandra::Function> or Array<Cassandra::Aggregate>]
    a list of functions or aggregates.
   # File lib/cassandra/function_collection.rb
64 def each_function(&block)
65   if block_given?
66     @function_hash.each_value(&block)
67     self
68   else
69     @function_hash.values
70   end
71 end
Also aliased as: functions
eql?(other) click to toggle source

@return [Boolean] whether this FunctionCollection is equal to the other

   # File lib/cassandra/function_collection.rb
46 def eql?(other)
47   other.is_a?(FunctionCollection) &&
48     @function_hash == other.raw_functions
49 end
Also aliased as: ==
functions(&block)
Alias for: each_function
get(name, argument_types) click to toggle source

Get the Function or Aggregate with the given name and argument-types. @param name [String] the name of the function/aggregate. @param argument_types [Array<Cassandra::Type>] list of argument-types. @return [Cassandra::Function] or [Cassandra::Aggregate] if found;

nil otherwise.
   # File lib/cassandra/function_collection.rb
33 def get(name, argument_types)
34   @function_hash[[name, argument_types]]
35 end
hash() click to toggle source
   # File lib/cassandra/function_collection.rb
52 def hash
53   @function_hash.hash
54 end
inspect() click to toggle source
   # File lib/cassandra/function_collection.rb
74 def inspect
75   "#<Cassandra::FunctionCollection:0x#{object_id.to_s(16)} " \
76       "@function_hash=#{@function_hash.inspect}>"
77 end

Protected Instance Methods

raw_functions() click to toggle source
   # File lib/cassandra/function_collection.rb
81 def raw_functions
82   @function_hash
83 end