Class: Nazar::CellFormatter
- Inherits:
-
Object
- Object
- Nazar::CellFormatter
- Defined in:
- lib/nazar/cell_formatter.rb
Instance Method Summary collapse
- #format ⇒ Object
-
#initialize(value, type: :string) ⇒ CellFormatter
constructor
A new instance of CellFormatter.
Constructor Details
#initialize(value, type: :string) ⇒ CellFormatter
Returns a new instance of CellFormatter.
5 6 7 8 |
# File 'lib/nazar/cell_formatter.rb', line 5 def initialize(value, type: :string) @value = value @type = type end |
Instance Method Details
#format ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/nazar/cell_formatter.rb', line 10 def format case type when :boolean format_boolean when :integer format_number else value.nil? ? format_nil : inteligent_format end end |