Sha256: f5558b5ae4eef57e20b45e4ed57dcb1e5cc333a45e4aec0340a8031829b0b9ab

Contents?: true

Size: 586 Bytes

Versions: 5

Compression:

Stored size: 586 Bytes

Contents

module PageObject
  class SectionCollection
    include Enumerable

    def initialize sections
      @sections = sections
    end

    def each &block
      @sections.each &block
    end

    def [] index
      @sections[index]
    end

    def find_by values_hash
      @sections.find {|section|
        values_hash.all? {|method,value| value === section.public_send(method)}
      }
    end

    def select_by values_hash
      SectionCollection.new @sections.select {|section|
        values_hash.all? {|method,value| value === section.public_send(method)}
      }
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
page-object-1.1.1 lib/page-object/sections.rb
page_object-1.1.3 lib/page-object/sections.rb
page_object-1.1.2 lib/page-object/sections.rb
page_object-1.1.1 lib/page-object/sections.rb
page-object-1.1.0 lib/page-object/sections.rb