Class: HumanAttributes::Formatters::Datetime

Inherits:
Base
  • Object
show all
Defined in:
lib/human_attributes/formatters/datetime.rb

Constant Summary

Constants included from Config

Config::TYPES

Instance Attribute Summary

Attributes inherited from Base

#attribute, #default, #options, #suffix, #type

Instance Method Summary collapse

Methods inherited from Base

#initialize, #method_name

Methods included from Config

#category_by_type, #formatter_by_type, #known_type?, #raise_error, #suffix_by_type, #type_config

Constructor Details

This class inherits a constructor from HumanAttributes::Formatters::Base

Instance Method Details

#apply(_instance, value) ⇒ Object



4
5
6
7
8
# File 'lib/human_attributes/formatters/datetime.rb', line 4

def apply(_instance, value)
  I18n.l(value.to_datetime, options)
rescue
  nil
end