Module: ALD::API::Conditioned
- Included in:
- ItemCollection, UserCollection
- Defined in:
- lib/ALD/conditioned.rb
Overview
Internal: used by Collection classes to work with special conditions in #where.
Requires @conditions to be the instance’s condition Hash.
Instance Method Summary collapse
-
#where(conditions) ⇒ Object
Public: Filter the Collection’s data.
Instance Method Details
#where(conditions) ⇒ Object
Public: Filter the Collection’s data. See the documentation on the individual classes for more information.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ALD/conditioned.rb', line 11 def where(conditions) return self if conditions.nil? || conditions.empty? new_conditions = merge_conditions(conditions) if initialized? && Collection::LocalFilter.can_apply?(conditions, self.class::LOCAL_CONDITIONS) self.class::new( @api, new_conditions, Collection::LocalFilter.apply_conditions(@data, conditions) ) else self.class::new(@api, new_conditions) end end |