Class: Druid::SectionCollection
- Inherits:
-
Array
- Object
- Array
- Druid::SectionCollection
- Defined in:
- lib/druid/section_collection.rb
Instance Method Summary collapse
Instance Method Details
#find_by(values_hash) ⇒ Object
4 5 6 7 8 |
# File 'lib/druid/section_collection.rb', line 4 def find_by values_hash find do |section| values_hash.all? { |key, value| value === section.public_send(key) } end end |
#select_by(values_hash) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/druid/section_collection.rb', line 10 def select_by values_hash matches = select do |section| values_hash.all? { |key, value| value === section.public_send(key) } end self.class[*matches] end |