class ActiveMocker::Queries::Find
Public Class Methods
new(record)
click to toggle source
# File lib/active_mocker/mock/queries.rb, line 7 def initialize(record) @record = record end
Public Instance Methods
is_of(conditions = {})
click to toggle source
# File lib/active_mocker/mock/queries.rb, line 11 def is_of(conditions = {}) conditions.all? do |col, match| if match.is_a? Enumerable any_match(col, match) else compare(col, match) end end end
Private Instance Methods
any_match(col, match)
click to toggle source
# File lib/active_mocker/mock/queries.rb, line 23 def any_match(col, match) match.any? { |m| compare(col, m) } end
compare(col, match)
click to toggle source
# File lib/active_mocker/mock/queries.rb, line 27 def compare(col, match) @record.send(col) == match end