Sha256: 8bba159bd1800d2ef0044c643c4ca8303d34f9d3689068ed0dd1ce488f82f6e5

Contents?: true

Size: 534 Bytes

Versions: 16

Compression:

Stored size: 534 Bytes

Contents

require 'rubygems'
require 'time'

module GEPUB
  class DateMeta < Meta
    def initialize(name, content, parent, attributes = {}, refiners = {})
      if content.is_a? String
        content = Time.parse(content)
      end
      super(name, content, parent, attributes, refiners)
    end

    def content=(date)
      if date.is_a? String
        date = Time.parse(date)
      end
      @content = date
    end

    def to_s(_locale = nil)
      # date type don't have alternate scripts.
      @content.utc.iso8601
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
gepub-1.0.16 lib/gepub/datemeta.rb
gepub-1.0.15 lib/gepub/datemeta.rb
gepub-1.0.14 lib/gepub/datemeta.rb
gepub-1.0.13 lib/gepub/datemeta.rb
gepub-1.0.12 lib/gepub/datemeta.rb
gepub-1.0.11 lib/gepub/datemeta.rb
gepub-1.0.10 lib/gepub/datemeta.rb
gepub-1.0.9 lib/gepub/datemeta.rb
gepub-1.0.8 lib/gepub/datemeta.rb
gepub-1.0.7 lib/gepub/datemeta.rb
gepub-1.0.6 lib/gepub/datemeta.rb
gepub-1.0.5 lib/gepub/datemeta.rb
gepub-1.0.4 lib/gepub/datemeta.rb
gepub-1.0.3 lib/gepub/datemeta.rb
gepub-1.0.2 lib/gepub/datemeta.rb
gepub-1.0.1 lib/gepub/datemeta.rb