Class: FlexiView::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/flexi_view/formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject

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