Sha256: 273054fc672089f18ee10ff164771767f7aa19fd7e71c8ff793bfd733f52b53f

Contents?: true

Size: 710 Bytes

Versions: 2

Compression:

Stored size: 710 Bytes

Contents

class Code
  class Object
    class Json < Object
      def self.to_code(json)
        if json.is_an?(Object)
          json
        elsif json.is_a?(::Hash)
          Dictionary.new(json)
        elsif json.is_a?(::Array)
          List.new(json)
        elsif json.is_a?(::String)
          String.new(json)
        elsif json.is_a?(::Float)
          Decimal.new(json)
        elsif json.is_an?(::Integer)
          Integer.new(json)
        elsif json.is_a?(::TrueClass)
          Boolean.new(json)
        elsif json.is_a?(::FalseClass)
          Boolean.new(json)
        elsif json.is_a?(::NilClass)
          Nothing.new(json)
        else
          Nothing.new
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
code-ruby-0.13.1 lib/code/object/json.rb
code-ruby-0.13.0 lib/code/object/json.rb