Sha256: 263ca629e0d665b1a1bf6a4a89b9029baa249308e4159f8f7dd55dc9231ea1fc

Contents?: true

Size: 394 Bytes

Versions: 7

Compression:

Stored size: 394 Bytes

Contents

module Druid
  class SectionCollection < Array

    def find_by values_hash
      find do |section|
        values_hash.all? { |key, value| value === section.public_send(key) }
      end
    end

    def select_by values_hash
      matches = select do |section|
        values_hash.all? { |key, value| value === section.public_send(key) }
      end
      self.class[*matches]
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
druid-s-1.0.0 lib/druid/section_collection.rb
druid-ts-1.2.6 lib/druid/section_collection.rb
druid-ts-1.2.5 lib/druid/section_collection.rb
druid-ts-1.2.4 lib/druid/section_collection.rb
druid-ts-1.2.3 lib/druid/section_collection.rb
druid-ts-1.2.2 lib/druid/section_collection.rb
druid-ts-1.2.1 lib/druid/section_collection.rb