Sha256: 1070a3c9a594a1164140641700f4e00c4ddef4c17a0f85230ab9e899a61e821c
Contents?: true
Size: 652 Bytes
Versions: 4
Compression:
Stored size: 652 Bytes
Contents
# encoding: utf-8 module Mongoid #:nodoc: module Matchers #:nodoc: class Default # Creating a new matcher only requires the value. def initialize(attribute) @attribute = attribute end # Return true if the attribute and value are equal. def matches?(value) value === @attribute end protected # Return the first value in the hash. def first(value) value.values.first end # If object exists then compare, else return false def determine(value, operator) @attribute ? @attribute.send(operator, first(value)) : false end end end end
Version data entries
4 entries across 4 versions & 1 rubygems