Sha256: b58f91e4ef12530cefb8abcafe9d4d4231d97f2974d05cd818dadd9da47d54a8

Contents?: true

Size: 937 Bytes

Versions: 15

Compression:

Stored size: 937 Bytes

Contents

module RestfulResource
  class OpenObject
    def initialize(attributes = {}, _hack_for_activeresource = false)
      @inner_object = StrictOpenStruct.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

15 entries across 15 versions & 1 rubygems

Version Path
restful_resource-2.18.2 lib/restful_resource/open_object.rb
restful_resource-2.18.1 lib/restful_resource/open_object.rb
restful_resource-2.18.0 lib/restful_resource/open_object.rb
restful_resource-2.17.0 lib/restful_resource/open_object.rb
restful_resource-2.16.0 lib/restful_resource/open_object.rb
restful_resource-2.15.0 lib/restful_resource/open_object.rb
restful_resource-2.14.0 lib/restful_resource/open_object.rb
restful_resource-2.13.4 lib/restful_resource/open_object.rb
restful_resource-2.13.3 lib/restful_resource/open_object.rb
restful_resource-2.13.2 lib/restful_resource/open_object.rb
restful_resource-2.13.1 lib/restful_resource/open_object.rb
restful_resource-2.13.0 lib/restful_resource/open_object.rb
restful_resource-2.12.1 lib/restful_resource/open_object.rb
restful_resource-2.12.0 lib/restful_resource/open_object.rb
restful_resource-2.11.0 lib/restful_resource/open_object.rb