Sha256: 2c17954558ae3e5117488417d244ccdd40e416eb40286aece557fc2733432947

Contents?: true

Size: 931 Bytes

Versions: 12

Compression:

Stored size: 931 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

12 entries across 12 versions & 1 rubygems

Version Path
restful_resource-2.10.3 lib/restful_resource/open_object.rb
restful_resource-2.10.1 lib/restful_resource/open_object.rb
restful_resource-2.10.0 lib/restful_resource/open_object.rb
restful_resource-2.9.1 lib/restful_resource/open_object.rb
restful_resource-2.8.0 lib/restful_resource/open_object.rb
restful_resource-2.7.0 lib/restful_resource/open_object.rb
restful_resource-2.6.1 lib/restful_resource/open_object.rb
restful_resource-2.5.3 lib/restful_resource/open_object.rb
restful_resource-2.5.2 lib/restful_resource/open_object.rb
restful_resource-2.5.1 lib/restful_resource/open_object.rb
restful_resource-2.5.0 lib/restful_resource/open_object.rb
restful_resource-2.4.0 lib/restful_resource/open_object.rb