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-2.4.4 lib/superstore/types/time_type.rb
superstore-2.4.3 lib/superstore/types/time_type.rb
superstore-2.4.2 lib/superstore/types/time_type.rb
superstore-2.4.1 lib/superstore/types/time_type.rb
superstore-2.4.0 lib/superstore/types/time_type.rb
superstore-2.3.0 lib/superstore/types/time_type.rb
superstore-2.2.0 lib/superstore/types/time_type.rb
superstore-2.1.3 lib/superstore/types/time_type.rb
superstore-2.1.2 lib/superstore/types/time_type.rb
superstore-2.1.1 lib/superstore/types/time_type.rb
superstore-2.1.0 lib/superstore/types/time_type.rb
superstore-2.0.1 lib/superstore/types/time_type.rb
superstore-2.0.0 lib/superstore/types/time_type.rb
superstore-1.2.0 lib/superstore/types/time_type.rb
superstore-1.1.4 lib/superstore/types/time_type.rb
superstore-1.1.3 lib/superstore/types/time_type.rb
superstore-1.1.2 lib/superstore/types/time_type.rb
superstore-1.1.1 lib/superstore/types/time_type.rb
superstore-1.1.0 lib/superstore/types/time_type.rb
superstore-1.0.12 lib/superstore/types/time_type.rb