Sha256: 1ee0b9e4f77bcca487c941a794712071af0768a88c71009514d8e046d1b27307

Contents?: true

Size: 928 Bytes

Versions: 47

Compression:

Stored size: 928 Bytes

Contents

module RestfulResource
  class OpenObject
    def initialize(attributes = {}, hack_for_activeresource = false)
      @inner_object = OpenStruct.new(attributes)
    end

    def method_missing(method, *args, &block)
      if @inner_object.respond_to?(method)
        @inner_object.send(method, *args, &block)
      else
        super(method)
      end
    end

    def respond_to?(method, include_private = false)
      super || @inner_object.respond_to?(method, include_private)
    end

    def as_json(options=nil)
      @inner_object.send(:table).as_json(options)
    end

    def ==(other)
      @inner_object == other.instance_variable_get(:@inner_object)
    end

    def eql?(other)
      @inner_object.eql?(other.instance_variable_get(:@inner_object))
    end

    def equal?(other)
      @inner_object.equal?(other.instance_variable_get(:@inner_object))
    end

    def hash
      @inner_object.hash
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
restful_resource-2.3.0 lib/restful_resource/open_object.rb
restful_resource-2.2.8 lib/restful_resource/open_object.rb
restful_resource-2.2.7 lib/restful_resource/open_object.rb
restful_resource-2.2.6 lib/restful_resource/open_object.rb
restful_resource-2.2.5 lib/restful_resource/open_object.rb
restful_resource-2.2.4 lib/restful_resource/open_object.rb
restful_resource-2.2.3 lib/restful_resource/open_object.rb
restful_resource-2.2.2 lib/restful_resource/open_object.rb
restful_resource-2.2.1 lib/restful_resource/open_object.rb
restful_resource-2.2.0 lib/restful_resource/open_object.rb
restful_resource-2.0.2 lib/restful_resource/open_object.rb
restful_resource-2.0.1 lib/restful_resource/open_object.rb
restful_resource-1.6.0 lib/restful_resource/open_object.rb
restful_resource-1.5.0 lib/restful_resource/open_object.rb
restful_resource-1.4.3 lib/restful_resource/open_object.rb
restful_resource-1.4.2 lib/restful_resource/open_object.rb
restful_resource-1.4.1 lib/restful_resource/open_object.rb
restful_resource-1.4.0 lib/restful_resource/open_object.rb
restful_resource-1.3.0 lib/restful_resource/open_object.rb
restful_resource-1.2.2 lib/restful_resource/open_object.rb