Class: Forme::Serializer::AmericanTime
- Inherits:
-
Forme::Serializer
- Object
- Forme::Serializer
- Forme::Serializer::AmericanTime
- Defined in:
- lib/forme/transformers/serializer.rb
Overview
Overrides formatting of dates and times to use an American format without timezones.
Constant Summary
Constants inherited from Forme::Serializer
ESCAPE_HTML, ESCAPE_HTML_PATTERN, SELF_CLOSING
Instance Method Summary collapse
Methods inherited from Forme::Serializer
#serialize_close, #serialize_open
Instance Method Details
#call(tag) ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/forme/transformers/serializer.rb', line 100 def call(tag) case tag when Tag if tag.type.to_s == 'input' && %w'date datetime datetime-local'.include?((tag.attr[:type] || tag.attr['type']).to_s) attr = tag.attr.dup attr.delete(:type) attr.delete('type') attr['type'] = 'text' "<#{tag.type}#{attr_html(attr)}/>" else super end else super end end |