Sha256: 75077327e2a2f353de6bcc8b5f3bab239814f4e5c8006992ed6c3ef7126dfdbc

Contents?: true

Size: 490 Bytes

Versions: 7

Compression:

Stored size: 490 Bytes

Contents

module Microformats2
  module Property
    class DateTime < Foundation

      def value
        ::DateTime.parse(to_s)
      end

      def to_hash
        if formats.empty?
          to_s
        else
          { value: to_s }.merge(formats.first.to_hash)
        end
      end

      protected

      def attr_map
        @attr_map ||= {
          "time" => "datetime",
          "ins" => "datetime",
          "abbr" => "title",
          "data" => "value" }
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
microformats2-2.1.0 lib/microformats2/property/date_time.rb
microformats2-2.0.3 lib/microformats2/property/date_time.rb
microformats2-2.0.2 lib/microformats2/property/date_time.rb
microformats2-2.0.1 lib/microformats2/property/date_time.rb
microformats2-2.0.0 lib/microformats2/property/date_time.rb
microformats2-2.0.0.pre5 lib/microformats2/property/date_time.rb
microformats2-2.0.0.pre4 lib/microformats2/property/date_time.rb