Class: TablePrint::TimeFormatter
- Inherits:
-
Object
- Object
- TablePrint::TimeFormatter
- Defined in:
- lib/table_print/formatter.rb
Instance Method Summary collapse
- #format(value) ⇒ Object
-
#initialize(time_format = nil) ⇒ TimeFormatter
constructor
A new instance of TimeFormatter.
Constructor Details
#initialize(time_format = nil) ⇒ TimeFormatter
Returns a new instance of TimeFormatter.
3 4 5 6 |
# File 'lib/table_print/formatter.rb', line 3 def initialize(time_format=nil) @format = time_format @format ||= TablePrint::Config.time_format end |
Instance Method Details
#format(value) ⇒ Object
8 9 10 11 |
# File 'lib/table_print/formatter.rb', line 8 def format(value) return value unless value.is_a? Time value.strftime @format end |