Sha256: 54b3e85c922182ca077aa012e3c2aa080e7d71c8c4b04d23f226abbb4277e715

Contents?: true

Size: 421 Bytes

Versions: 27

Compression:

Stored size: 421 Bytes

Contents

module Superstore
  module Types
    class TimeType < BaseType
      def encode(time)
        raise ArgumentError.new("#{time.inspect} does not respond to #to_time") unless time.is_a?(Time) || time.respond_to?(:to_time)
        time = time.to_time unless time.is_a?(Time)
        time.utc.xmlschema(6)
      end

      def decode(str)
        Time.parse(str).in_time_zone if str
      rescue

      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
superstore-1.0.11 lib/superstore/types/time_type.rb
superstore-1.0.10 lib/superstore/types/time_type.rb
superstore-1.0.9 lib/superstore/types/time_type.rb
superstore-1.0.8 lib/superstore/types/time_type.rb
superstore-1.0.7 lib/superstore/types/time_type.rb
superstore-1.0.6 lib/superstore/types/time_type.rb
superstore-1.0.5 lib/superstore/types/time_type.rb