Class: Tablemaker::Frame
- Inherits:
-
Object
- Object
- Tablemaker::Frame
- Defined in:
- lib/tablemaker/frame.rb
Instance Attribute Summary collapse
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
- #dimensions ⇒ Object
-
#initialize(parent, idx) ⇒ Frame
constructor
A new instance of Frame.
- #last? ⇒ Boolean
- #real_cols ⇒ Object
- #real_dimensions ⇒ Object
- #real_rows ⇒ Object
Constructor Details
#initialize(parent, idx) ⇒ Frame
Returns a new instance of Frame.
5 6 7 8 |
# File 'lib/tablemaker/frame.rb', line 5 def initialize(parent, idx) @parent = parent @index = idx end |
Instance Attribute Details
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
4 5 6 |
# File 'lib/tablemaker/frame.rb', line 4 def parent @parent end |
Instance Method Details
#dimensions ⇒ Object
13 14 15 |
# File 'lib/tablemaker/frame.rb', line 13 def dimensions [columns, rows] end |
#last? ⇒ Boolean
9 10 11 12 |
# File 'lib/tablemaker/frame.rb', line 9 def last? return nil unless @parent @index == @parent.items.length-1 end |
#real_cols ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/tablemaker/frame.rb', line 25 def real_cols return columns unless @parent if @parent.is_a?(Column) @parent.real_cols else return columns unless last? return columns + @parent.real_cols - @parent.columns end end |
#real_dimensions ⇒ Object
34 35 36 |
# File 'lib/tablemaker/frame.rb', line 34 def real_dimensions [real_cols, real_rows] end |
#real_rows ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/tablemaker/frame.rb', line 16 def real_rows return rows unless @parent if @parent.is_a?(Column) return rows unless last? return rows + @parent.real_rows - @parent.rows else @parent.real_rows end end |