Class: GEPUB::DateMeta
Constant Summary
Constants inherited from Meta
Constants included from DSLUtil
Instance Attribute Summary
Attributes inherited from Meta
Instance Method Summary collapse
- #content=(date) ⇒ Object
-
#initialize(name, content, parent, attributes = {}, refiners = {}) ⇒ DateMeta
constructor
A new instance of DateMeta.
- #to_s(_locale = nil) ⇒ Object
Methods inherited from Meta
#[], #[]=, #add_alternates, #add_refiner, #lang, #lang=, #list_alternates, #refine, #refiner, #refiner_clear, #refiner_list, #to_xml
Constructor Details
#initialize(name, content, parent, attributes = {}, refiners = {}) ⇒ DateMeta
Returns a new instance of DateMeta.
6 7 8 9 10 11 |
# File 'lib/gepub/datemeta.rb', line 6 def initialize(name, content, parent, attributes = {}, refiners = {}) if content.is_a? String content = Time.parse(content) end super(name, content, parent, attributes, refiners) end |
Instance Method Details
#content=(date) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/gepub/datemeta.rb', line 13 def content=(date) if date.is_a? String date = Time.parse(date) end @content = date end |
#to_s(_locale = nil) ⇒ Object
20 21 22 23 |
# File 'lib/gepub/datemeta.rb', line 20 def to_s(_locale = nil) # date type don't have alternate scripts. @content.utc.iso8601 end |