Method: MicroMicro::Collections::ItemsCollection#where
- Defined in:
- lib/micro_micro/collections/items_collection.rb
#where(**args) {|item| ... } ⇒ MicroMicro::Collections::ItemsCollection
Recursively search this collection for Items matching the given conditions.
If a Hash is supplied, the returned collection will include Items matching all conditions. Keys must be Symbols matching an instance method on Item and values may be either a String or an Array of Strings.
When passing a block, each Item in this collection is yielded to the block and the returned collection will include Items that cause the block to return a value other than false or nil.
91 92 93 94 95 |
# File 'lib/micro_micro/collections/items_collection.rb', line 91 def where(**args, &block) return self if args.none? && !block self.class.new(ItemsCollectionSearch.new.search(self, **args, &block)) end |