class HorizonClient::Collection

Attributes

node[R]

Public Class Methods

new(node) click to toggle source
# File lib/horizon_client/collection.rb, line 7
def initialize(node)
  @node = node
  @rows = @node.locate(row_element_name).map do |row|
    Entity.new(row)
  end
end

Public Instance Methods

build() click to toggle source
# File lib/horizon_client/collection.rb, line 14
def build
  row = Ox::Element.new(row_element_name)
  node << row
  entity = Entity.new(row)
  @rows.push(entity)
  entity
end
each(&block) click to toggle source
# File lib/horizon_client/collection.rb, line 26
def each(&block)
  @rows.each(&block)
end
rows() click to toggle source
# File lib/horizon_client/collection.rb, line 22
def rows
  @rows
end

Private Instance Methods

row_element_name() click to toggle source
# File lib/horizon_client/collection.rb, line 32
def row_element_name
  'row'
end