Sha256: 80822a19d9320e1f632936769c12a5012f4a98f92af196170e398fddde3c18c4

Contents?: true

Size: 444 Bytes

Versions: 3

Compression:

Stored size: 444 Bytes

Contents

require 'ostruct'

module Ipay
  module Rest
    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
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ipay-rest-0.1.3 lib/ipay/rest/object.rb
ipay-rest-0.1.2 lib/ipay/rest/object.rb
ipay-rest-0.1.1 lib/ipay/rest/object.rb