Sha256: 261a3ef99496082772fb6adef54276d498a2eef9be606fed7189091631243e4f

Contents?: true

Size: 885 Bytes

Versions: 9

Compression:

Stored size: 885 Bytes

Contents

# frozen_string_literal: true

require 'dry/types/coercions/json'

module Dry
  module Types
    register('json.nil') do
      self['nominal.nil'].constructor(Coercions::JSON.method(:to_nil))
    end

    register('json.date') do
      self['nominal.date'].constructor(Coercions::JSON.method(:to_date))
    end

    register('json.date_time') do
      self['nominal.date_time'].constructor(Coercions::JSON.method(:to_date_time))
    end

    register('json.time') do
      self['nominal.time'].constructor(Coercions::JSON.method(:to_time))
    end

    register('json.decimal') do
      self['nominal.decimal'].constructor(Coercions::JSON.method(:to_decimal))
    end

    register('json.symbol') do
      self['nominal.symbol'].constructor(Coercions::JSON.method(:to_symbol))
    end

    register('json.array') { self['array'] }

    register('json.hash') { self['hash'] }
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/dry-types-1.4.0/lib/dry/types/json.rb
dry-types-1.4.0 lib/dry/types/json.rb
dry-types-1.3.1 lib/dry/types/json.rb
dry-types-1.3.0 lib/dry/types/json.rb
dry-types-1.2.2 lib/dry/types/json.rb
dry-types-1.2.1 lib/dry/types/json.rb
dry-types-1.2.0 lib/dry/types/json.rb
dry-types-1.1.1 lib/dry/types/json.rb
dry-types-1.1.0 lib/dry/types/json.rb