class Aliyun::Log::Common::AttrStruct
Public Class Methods
new(opts = {})
click to toggle source
# File lib/aliyun/log/common/attr_struct.rb, line 16 def initialize(opts = {}) extra_keys = opts.keys - attrs raise "Unexpected extra keys: #{extra_keys.join(', ')}" unless extra_keys.empty? attrs.each do |attr| instance_variable_set("@#{attr}", opts[attr]) end end
Public Instance Methods
to_s()
click to toggle source
# File lib/aliyun/log/common/attr_struct.rb, line 25 def to_s attrs.map do |attr| v = instance_variable_get("@#{attr}") "#{attr}: #{v}" end.join(', ') end