Class: Blueprinter::DateTimeFormatter Private
- Inherits:
-
Object
- Object
- Blueprinter::DateTimeFormatter
- Defined in:
- lib/blueprinter/formatters/date_time_formatter.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- InvalidDateTimeFormatterError =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Class.new(BlueprinterError)
Instance Method Summary collapse
- #format(value, options) ⇒ Object private
Instance Method Details
#format(value, options) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/blueprinter/formatters/date_time_formatter.rb', line 7 def format(value, ) return value if value.nil? field_format = [:datetime_format] if value.respond_to?(:strftime) value = format_datetime(value, field_format) elsif field_format raise InvalidDateTimeFormatterError, 'Cannot format invalid DateTime object' end value end |