Sha256: db2bcb47a5082021258423ab26b5e0141f6fb3b18d2f901358c7d20920aaf2a4

Contents?: true

Size: 533 Bytes

Versions: 9

Compression:

Stored size: 533 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

9 entries across 9 versions & 1 rubygems

Version Path
gepub-1.0.0 lib/gepub/datemeta.rb
gepub-1.0.0rc1 lib/gepub/datemeta.rb
gepub-1.0.0beta1 lib/gepub/datemeta.rb
gepub-0.7.1 lib/gepub/datemeta.rb
gepub-0.7.0 lib/gepub/datemeta.rb
gepub-0.7.0beta4 lib/gepub/datemeta.rb
gepub-0.7.0beta3 lib/gepub/datemeta.rb
gepub-0.7.0beta2 lib/gepub/datemeta.rb
gepub-0.7.0beta1 lib/gepub/datemeta.rb