Sha256: 60452ea2e4c16a613bd1434181e83f1a1a892005f6b661716d4f1ffede23edfc

Contents?: true

Size: 464 Bytes

Versions: 5

Compression:

Stored size: 464 Bytes

Contents

module HorizonClient
  class Collection
    include Enumerable

    attr_reader :node

    def initialize(node)
      @node = node
      @rows = @node.locate('row').map do |row|
        Entity.new(row)
      end
    end

    def build
      row = Ox::Element.new('row')
      node << row
      entity = Entity.new(row)
      @rows.push(entity)
      entity
    end

    def rows
      @rows
    end

    def each(&block)
      @rows.each(&block)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
horizon_client-0.2.4 lib/horizon_client/collection.rb
horizon_client-0.2.3 lib/horizon_client/collection.rb
horizon_client-0.2.2 lib/horizon_client/collection.rb
horizon_client-0.2.1 lib/horizon_client/collection.rb
horizon_client-0.2.0 lib/horizon_client/collection.rb