Class: Tableasy::Formatter
- Inherits:
-
Object
- Object
- Tableasy::Formatter
- Defined in:
- lib/tableasy/formatter.rb
Defined Under Namespace
Classes: Column
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
Instance Method Summary collapse
- #format_header(header = nil, &block) ⇒ Object
-
#initialize(&block) ⇒ Formatter
constructor
A new instance of Formatter.
Constructor Details
#initialize(&block) ⇒ Formatter
Returns a new instance of Formatter.
29 30 31 32 |
# File 'lib/tableasy/formatter.rb', line 29 def initialize(&block) @block = block @format_header = Proc.new {|header| header.to_sym } end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
27 28 29 |
# File 'lib/tableasy/formatter.rb', line 27 def block @block end |
Instance Method Details
#format_header(header = nil, &block) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/tableasy/formatter.rb', line 34 def format_header(header = nil, &block) if block @format_header = block else @format_header.call(header) end end |