class Qapi::Model
Attributes
attrs[RW]
connection[R]
Public Class Methods
attribute(name)
click to toggle source
# File lib/qapi/model.rb, line 10 def self.attribute(name) self.send(:attr_accessor, name) self.attrs ||= [] self.attrs << name.to_s end
new(connection, attrs = {})
click to toggle source
# File lib/qapi/model.rb, line 16 def initialize(connection, attrs = {}) @connection = connection self.class.attrs.each do |attr| self.send("#{attr}=", attrs[attr]) end end
Public Instance Methods
inspect()
click to toggle source
# File lib/qapi/model.rb, line 23 def inspect "<" + self.class.attrs.map do |attr| "#{attr}: #{send(attr)}" end.join(", ") + ">" end