module Origin::Extensions::Symbol::ClassMethods
Public Instance Methods
add_key(name, strategy, operator, additional = nil, &block)
click to toggle source
Adds a method on symbol as a convenience for the MongoDB operator.
@example Add the $in method.
Symbol.add_key(:in, "$in")
@param [ Symbol ] name The name of the method. @param [ Symbol ] strategy The name of the merge strategy. @param [ String ] operator The MongoDB operator. @param [ String ] additional The additional MongoDB operator.
@since 1.0.0
# File lib/origin/extensions/symbol.rb, line 47 def add_key(name, strategy, operator, additional = nil, &block) define_method(name) do method = "__#{strategy}__".to_sym Key.new(self, method, operator, additional, &block) end end
evolve(object)
click to toggle source
Evolves the symbol into a MongoDB friendly value - in this case a symbol.
@example Evolve the symbol
Symbol.evolve("test")
@param [ Object ] object The object to convert.
@return [ Symbol ] The value as a symbol.
@since 1.0.0
# File lib/origin/extensions/symbol.rb, line 65 def evolve(object) __evolve__(object) { |obj| obj.to_sym } end