Sha256: 9585c17bc2da3a68de545e51b1ed9abda15b9c3732985305c8584692b244dd12

Contents?: true

Size: 898 Bytes

Versions: 8

Compression:

Stored size: 898 Bytes

Contents

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

    def method_missing(method)
      if @inner_object.respond_to?(method)
        @inner_object.send(method)
      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

8 entries across 8 versions & 1 rubygems

Version Path
restful_resource-0.8.20 lib/restful_resource/open_object.rb
restful_resource-0.8.19 lib/restful_resource/open_object.rb
restful_resource-0.8.18 lib/restful_resource/open_object.rb
restful_resource-0.8.17 lib/restful_resource/open_object.rb
restful_resource-0.8.16 lib/restful_resource/open_object.rb
restful_resource-0.8.15 lib/restful_resource/open_object.rb
restful_resource-0.8.14 lib/restful_resource/open_object.rb
restful_resource-0.8.13 lib/restful_resource/open_object.rb