Class: SimpleAttribute::Attributes::Date
- Defined in:
- lib/simple_attribute/attributes/date.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
#attribute, #options, #record, #value
Instance Method Summary collapse
-
#date_format ⇒ Object
Date format.
-
#default_format ⇒ Object
Date default format.
-
#render_attribute ⇒ Object
Render attribute.
Methods inherited from Base
#attribute_name, #default_value, #defaults, #html_options, #initialize, #label_method, #method_missing, #render, #render_default_value, #render_with_default, #render_wrapper, #renderer_name, #value?, #wrapper, #wrapper?, #wrapper_html
Constructor Details
This class inherits a constructor from SimpleAttribute::Attributes::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class SimpleAttribute::Attributes::Base
Instance Method Details
#date_format ⇒ Object
Date format
10 11 12 |
# File 'lib/simple_attribute/attributes/date.rb', line 10 def date_format .fetch :format, default_format end |
#default_format ⇒ Object
Date default format
5 6 7 |
# File 'lib/simple_attribute/attributes/date.rb', line 5 def default_format '<date>%d %b %Y</date>' end |
#render_attribute ⇒ Object
Render attribute
15 16 17 |
# File 'lib/simple_attribute/attributes/date.rb', line 15 def render_attribute value.try :strftime, date_format end |