Class: EPUBInfo::Models::Date
- Inherits:
-
Object
- Object
- EPUBInfo::Models::Date
- Defined in:
- lib/epubinfo/models/date.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
Date (EPUB2 reference).
-
#date_str ⇒ Object
Date as a string (EPUB2 reference).
-
#event ⇒ Object
Event (EPUB2 reference).
Instance Method Summary collapse
-
#initialize(node) ⇒ Date
constructor
Should never be called directly, go through EPUBInfo.get.
-
#to_hash ⇒ Hash
Returns Hash representation of a date.
Constructor Details
#initialize(node) ⇒ Date
Should never be called directly, go through EPUBInfo.get
17 18 19 20 21 |
# File 'lib/epubinfo/models/date.rb', line 17 def initialize(node) self.date = Utils.parse_iso_8601_date(node.content) rescue nil self.date_str = node.content self.event = node.attribute('event').content rescue nil end |
Instance Attribute Details
#date ⇒ Object
Date (EPUB2 reference)
8 9 10 |
# File 'lib/epubinfo/models/date.rb', line 8 def date @date end |
#date_str ⇒ Object
Date as a string (EPUB2 reference)
11 12 13 |
# File 'lib/epubinfo/models/date.rb', line 11 def date_str @date_str end |
#event ⇒ Object
Event (EPUB2 reference)
14 15 16 |
# File 'lib/epubinfo/models/date.rb', line 14 def event @event end |
Instance Method Details
#to_hash ⇒ Hash
Returns Hash representation of a date
25 26 27 28 29 30 |
# File 'lib/epubinfo/models/date.rb', line 25 def to_hash { :time => @time, :event => @event } end |