Class: Store::Mongodb::EqualFilter
- Inherits:
-
Object
- Object
- Store::Mongodb::EqualFilter
- Defined in:
- lib/store/mongodb.rb
Instance Method Summary collapse
- #add_filter(hash) ⇒ Object
-
#initialize(field, value) ⇒ EqualFilter
constructor
A new instance of EqualFilter.
Constructor Details
#initialize(field, value) ⇒ EqualFilter
Returns a new instance of EqualFilter.
227 228 229 |
# File 'lib/store/mongodb.rb', line 227 def initialize(field, value) @field = field; @value = value end |
Instance Method Details
#add_filter(hash) ⇒ Object
231 232 233 234 235 236 237 238 239 |
# File 'lib/store/mongodb.rb', line 231 def add_filter(hash) if @value == 'unknown' hash[@field] = nil elsif @value.kind_of?(BSON::ObjectId) hash[@field] = @value else hash[@field] = @value end end |