Class: Tableasy::Formatter::Column
- Inherits:
-
Object
- Object
- Tableasy::Formatter::Column
- Defined in:
- lib/tableasy/formatter.rb
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
Instance Method Summary collapse
- #execute(cell) ⇒ Object
-
#initialize(context, formatter, column, *args) ⇒ Column
constructor
A new instance of Column.
- #to_sym ⇒ Object
Constructor Details
#initialize(context, formatter, column, *args) ⇒ Column
Returns a new instance of Column.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/tableasy/formatter.rb', line 6 def initialize(context, formatter, column, *args) = args. @context = context @formatter = formatter @args = args if [:no_initial] @args.unshift(column) else @column = column end end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
4 5 6 |
# File 'lib/tableasy/formatter.rb', line 4 def column @column end |
Instance Method Details
#execute(cell) ⇒ Object
18 19 20 |
# File 'lib/tableasy/formatter.rb', line 18 def execute(cell) @context.instance_exec(cell, *@args, &@formatter.block) end |
#to_sym ⇒ Object
22 23 24 |
# File 'lib/tableasy/formatter.rb', line 22 def to_sym @formatter.format_header(@column || @args.first) end |