Sha256: 37b3d2e67f4c68ef583a993e2697d12e5a662df9acafde2b86959b523b7cd4a1

Contents?: true

Size: 190 Bytes

Versions: 24

Compression:

Stored size: 190 Bytes

Contents

require 'date'

module Unit
  module Types
    class Date
      def self.cast(value)
        return nil if value.nil?

        ::Date.parse(value).strftime('%F')
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
unit-ruby-0.10.0 lib/unit-ruby/types/date.rb
unit-ruby-0.9.0 lib/unit-ruby/types/date.rb
unit-ruby-0.8.1 lib/unit-ruby/types/date.rb
unit-ruby-0.8.0 lib/unit-ruby/types/date.rb
unit-ruby-0.7.0 lib/unit-ruby/types/date.rb
unit-ruby-0.6.0 lib/unit-ruby/types/date.rb
unit-ruby-0.5.0 lib/unit-ruby/types/date.rb
unit-ruby-0.4.3 lib/unit-ruby/types/date.rb
unit-ruby-0.4.2 lib/unit-ruby/types/date.rb
unit-ruby-0.4.1 lib/unit-ruby/types/date.rb
unit-ruby-0.4.0 lib/unit-ruby/types/date.rb
unit-ruby-0.3.7 lib/unit-ruby/types/date.rb
unit-ruby-0.2.7 lib/unit-ruby/types/date.rb
unit-ruby-0.2.6 lib/unit-ruby/types/date.rb
unit-ruby-0.2.5 lib/unit-ruby/types/date.rb
unit-ruby-0.2.4 lib/unit-ruby/types/date.rb
unit-ruby-0.2.3 lib/unit-ruby/types/date.rb
unit-ruby-0.2.2 lib/unit-ruby/types/date.rb
unit-ruby-0.2.1 lib/unit-ruby/types/date.rb
unit-ruby-0.2.0 lib/unit-ruby/types/date.rb