class EPUBMeta::Models::Date

Attributes

date_str[RW]

Date as a string ({idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.2.7 EPUB2 reference}) @return String

event[RW]

Event ({idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.2.7 EPUB2 reference}) @return String

Public Class Methods

new(node) click to toggle source

Should never be called directly, go through EPUBMeta.get

# File lib/epubmeta/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

Public Instance Methods

to_hash() click to toggle source

Returns Hash representation of a date @return [Hash]

# File lib/epubmeta/models/date.rb, line 25
def to_hash
  {
    :time => @time,
    :event => @event
  }
end