class ActiveAny::Relation::WhereClause
Attributes
conditions[R]
Public Class Methods
empty()
click to toggle source
# File lib/active_any/relation/where_clause.rb, line 48 def self.empty new end
new(hash = {}, conditions = nil)
click to toggle source
# File lib/active_any/relation/where_clause.rb, line 44 def initialize(hash = {}, conditions = nil) @conditions = conditions ? conditions : hash.map { |key, value| Condition.new(key, value) } end
Public Instance Methods
+(other)
click to toggle source
# File lib/active_any/relation/where_clause.rb, line 56 def +(other) WhereClause.new({}, (conditions + other.conditions).flatten) end
Also aliased as: merge
==(other)
click to toggle source
# File lib/active_any/relation/where_clause.rb, line 52 def ==(other) other.conditions.sort_by(&:key) == conditions.sort_by(&:key) end
each(&block)
click to toggle source
# File lib/active_any/relation/where_clause.rb, line 70 def each(&block) conditions.each(&block) end
merge!(hash)
click to toggle source
# File lib/active_any/relation/where_clause.rb, line 62 def merge!(hash) hash.each do |key, value| conditions << Condition.new(key, value) end end