Sha256: 80fcacec94637ecfbade865328fc658534dc80ba760576c3eb25ab151c803384

Contents?: true

Size: 343 Bytes

Versions: 2

Compression:

Stored size: 343 Bytes

Contents

module PureForm
  module Types
    class DateType < BaseType
      def typecast(value)
        value.to_date
      rescue TypeError, ArgumentError, NoMethodError
        nil
      end

      def complex_typecast(year, month, day)
        Date.new(year, month, day)
      rescue TypeError, ArgumentError
        nil
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pure_form-0.0.2 lib/pure_form/types/date.rb
pure_form-0.0.1 lib/pure_form/types/date.rb