Sha256: 4a086a7956042d0ef92b3f657bcc9c95c1cfecbf95b5462affdfff3d49c5470a

Contents?: true

Size: 486 Bytes

Versions: 1

Compression:

Stored size: 486 Bytes

Contents

module Microformats2
  module Property
    class DateTime < Foundation

      def value
        ::DateTime.parse(to_s)
      end

      def to_hash
        if items.empty?
          to_s
        else
          { value: to_s }.merge(items.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

1 entries across 1 versions & 1 rubygems

Version Path
microformats2-2.9.0 lib/microformats2/property/date_time.rb