Sha256: c37138ff4630a50fd88e8c1cc3eb59949cf70c7b6409e41e8af7e103f629bf6c

Contents?: true

Size: 400 Bytes

Versions: 3

Compression:

Stored size: 400 Bytes

Contents

require "ostruct"

module Axie
  class Object
    def initialize(attributes)
      @attributes = OpenStruct.new(attributes)
    end

    def method_missing(method, *args, &block)
      attribute = @attributes.send(method, *args, &block)
      attribute.is_a?(Hash) ? Object.new(attribute) : attribute
    end

    def respond_to_missing?(method, include_private = false)
      true
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
axie-ruby-0.2.1 lib/axie/object.rb
axie-ruby-0.2.0 lib/axie/object.rb
axie-0.1.0 lib/axie/object.rb