Sha256: b26c6e813e43ba28915bbd36ab08e655a10cd2bb45f54d477e4b010eef83f5cb

Contents?: true

Size: 455 Bytes

Versions: 6

Compression:

Stored size: 455 Bytes

Contents

require 'mida_vocabulary/datatype/generic'
require 'date'

module Mida
  module DataType

    # ISO 8601 Date data type
    # Provides access to DateTime methods
    class ISO8601Date < Generic

      # Raises +ArgumentError+ if value not valid
      def initialize(value)
        @parsedValue = ::DateTime.iso8601(value)
      rescue => e
        raise ArgumentError, e
      end

      def to_s
        @parsedValue.rfc822
      end

    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mida_vocabulary-0.2.2 lib/mida_vocabulary/datatype/iso8601date.rb
mida_vocabulary-0.2 lib/mida_vocabulary/datatype/iso8601date.rb
mida_vocabulary-0.1.3 lib/mida_vocabulary/datatype/iso8601date.rb
mida_vocabulary-0.1.2 lib/mida_vocabulary/datatype/iso8601date.rb
mida_vocabulary-0.1.1 lib/mida_vocabulary/datatype/iso8601date.rb
mida_vocabulary-0.1 lib/mida_vocabulary/datatype/iso8601date.rb