Sha256: 3bdb53cfced545dfdb4da8d04df3377036262fef046a05bc4ab6827baa3593a2

Contents?: true

Size: 645 Bytes

Versions: 5

Compression:

Stored size: 645 Bytes

Contents

module Restfulie
  module Common
    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
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
restfulie-1.0.0.beta1 lib/restfulie/common/representation/json/base.rb
restfulie-0.1.0.beta1 lib/restfulie/common/representation/json/base.rb
restfulie-0.9.3 lib/restfulie/common/representation/json/base.rb
restfulie-0.9.1 lib/restfulie/common/representation/json/base.rb
restfulie-0.8.1 lib/restfulie/common/representation/json/base.rb