Sha256: 31134ba6a9e62a9dbb98b743a7e65289b6dc4ba9c9d6298ae1dfdd592c84fe79

Contents?: true

Size: 164 Bytes

Versions: 8

Compression:

Stored size: 164 Bytes

Contents

require 'json'

module Compel
  module Coercion

    class JSON < Type

      def coerce_value
        ::JSON.parse(value) rescue nil
      end

    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
compel-0.5.1 lib/compel/coercion/types/json.rb
compel-0.5.0 lib/compel/coercion/types/json.rb
compel-0.4.3 lib/compel/coercion/types/json.rb
compel-0.4.2 lib/compel/coercion/types/json.rb
compel-0.4.0 lib/compel/coercion/types/json.rb
compel-0.3.7 lib/compel/coercion/types/json.rb
compel-0.3.6 lib/compel/coercion/types/json.rb
compel-0.3.4 lib/compel/coercion/types/json.rb