class AliyunSDK::Common::Struct::Base

Public Class Methods

new(opts = {}) click to toggle source
# File lib/aliyun_sdk/common/struct.rb, line 33
def initialize(opts = {})
  extra_keys = opts.keys - attrs
  unless extra_keys.empty?
    fail Common::Exception,
         "Unexpected extra keys: #{extra_keys.join(', ')}"
  end

  attrs.each do |attr|
    instance_variable_set("@#{attr}", opts[attr])
  end
end

Public Instance Methods

to_s() click to toggle source
# File lib/aliyun_sdk/common/struct.rb, line 45
def to_s
  attrs.map do |attr|
    v = instance_variable_get("@#{attr}")
    "#{attr.to_s}: #{v}"
  end.join(", ")
end