Method: Aliyun::Common::Struct::Base#initialize
- Defined in:
- lib/aliyun/common/struct.rb
#initialize(opts = {}) ⇒ Base
Returns a new instance of Base.
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/aliyun/common/struct.rb', line 34 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 |