Class: GEPUB::DateMeta

Inherits:
Meta
  • Object
show all
Defined in:
lib/gepub/datemeta.rb

Constant Summary

Constants inherited from Meta

Meta::REFINERS

Constants included from DSLUtil

GEPUB::DSLUtil::UNASSIGNED

Instance Attribute Summary

Attributes inherited from Meta

#content, #name

Instance Method Summary collapse

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