Class: Tablemaker::Column

Inherits:
Node show all
Defined in:
lib/tablemaker/frame.rb

Instance Attribute Summary

Attributes inherited from Node

#items

Attributes inherited from Frame

#parent

Instance Method Summary collapse

Methods inherited from Node

#cell, #cells, #each_row, #initialize

Methods inherited from Frame

#dimensions, #initialize, #last?, #real_cols, #real_dimensions, #real_rows

Constructor Details

This class inherits a constructor from Tablemaker::Node

Instance Method Details

#cell_iterator(&blk) ⇒ Object



109
110
111
112
113
114
115
# File 'lib/tablemaker/frame.rb', line 109

def cell_iterator(&blk)
  @items.each do |i|
    i.cell_iterator(&blk)
    Fiber.yield(Fiber.current)
  end
  nil
end

#columnsObject



102
103
104
# File 'lib/tablemaker/frame.rb', line 102

def columns
  @items.map(&:columns).max || 0
end

#row(&blk) ⇒ Object



99
100
101
# File 'lib/tablemaker/frame.rb', line 99

def row(&blk)
  Row.new(self, @items.length, &blk).tap { |r| @items << r }
end

#rowsObject



105
106
107
# File 'lib/tablemaker/frame.rb', line 105

def rows
  @items.map(&:rows).inject(0, &:+)
end