Sha256: 47e984dabf3f7950dc26bfa16eea63f58ec2d78eaf0d00e14f146f01651c4dc3

Contents?: true

Size: 1.3 KB

Versions: 17

Compression:

Stored size: 1.3 KB

Contents

require 'dry/types/coercions/form'

module Dry
  module Types
    register('form.nil') do
      self['nil'].constructor(Coercions::Form.method(:to_nil))
    end

    register('form.date') do
      self['date'].constructor(Coercions::Form.method(:to_date))
    end

    register('form.date_time') do
      self['date_time'].constructor(Coercions::Form.method(:to_date_time))
    end

    register('form.time') do
      self['time'].constructor(Coercions::Form.method(:to_time))
    end

    register('form.true') do
      self['true'].constructor(Coercions::Form.method(:to_true))
    end

    register('form.false') do
      self['false'].constructor(Coercions::Form.method(:to_false))
    end

    register('form.bool') do
      (self['form.true'] | self['form.false']).safe
    end

    register('form.int') do
      self['int'].constructor(Coercions::Form.method(:to_int))
    end

    register('form.float') do
      self['float'].constructor(Coercions::Form.method(:to_float))
    end

    register('form.decimal') do
      self['decimal'].constructor(Coercions::Form.method(:to_decimal))
    end

    register('form.array') do
      self['array'].constructor(Coercions::Form.method(:to_ary)).safe
    end

    register('form.hash') do
      self['hash'].constructor(Coercions::Form.method(:to_hash)).safe
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
dry-types-0.12.3 lib/dry/types/form.rb
dry-types-0.12.2 lib/dry/types/form.rb
dry-types-0.12.1 lib/dry/types/form.rb
dry-types-0.12.0 lib/dry/types/form.rb
dry-types-0.11.1 lib/dry/types/form.rb
dry-types-0.11.0 lib/dry/types/form.rb
dry-types-0.10.3 lib/dry/types/form.rb
dry-types-0.10.2 lib/dry/types/form.rb
dry-types-0.10.1 lib/dry/types/form.rb
dry-types-0.10.0 lib/dry/types/form.rb
dry-types-0.9.4 lib/dry/types/form.rb
dry-types-0.9.3 lib/dry/types/form.rb
dry-types-0.9.2 lib/dry/types/form.rb
dry-types-0.9.1 lib/dry/types/form.rb
dry-types-0.9.0 lib/dry/types/form.rb
dry-types-0.8.1 lib/dry/types/form.rb
dry-types-0.8.0 lib/dry/types/form.rb