Sha256: d8bc325d87952306b6d4342a4fea467e4c0c7a1ac81d716c8c3867d591c32abd

Contents?: true

Size: 533 Bytes

Versions: 1

Compression:

Stored size: 533 Bytes

Contents

module Tokamak
  module Representation
  class Json
    module Base
      module ClassMethods
        
        # creates a json unmarshalled version of this object
        def create(obj = nil)
          @json = {}
          return @json.extend(KeysAsMethods) unless obj
          
          if obj.kind_of?(Hash) || obj.kind_of?(Array)
            @json = obj
          else 
            @json = ::JSON.parse(obj)
          end
          
          @json.extend(KeysAsMethods)
        end
        
      end
    end
  end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tokamak-1.0.0.beta2 lib/tokamak/representation/json/base.rb