Class: FlexiView::Formatter
- Inherits:
-
Object
- Object
- FlexiView::Formatter
- Defined in:
- lib/flexi_view/formatter.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #format(value) ⇒ Object
-
#initialize(name, &block) ⇒ Formatter
constructor
A new instance of Formatter.
Constructor Details
#initialize(name, &block) ⇒ Formatter
Returns a new instance of Formatter.
7 8 9 10 |
# File 'lib/flexi_view/formatter.rb', line 7 def initialize(name, &block) @name = name.to_sym @formater_block = block end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/flexi_view/formatter.rb', line 5 def name @name end |
Instance Method Details
#format(value) ⇒ Object
12 13 14 |
# File 'lib/flexi_view/formatter.rb', line 12 def format(value) @formater_block.call(value) end |