mumble-ruby
mumble-ruby copied to clipboard
Calling user.inspect causes the bot to mute itself
I believe that it's because Mumble::User#mute
actively mutes the person and you define mute as an attribute. Then, in Mumble::Model#inspect
, you call each attribute as a method with send
-- causing the bot to mute itself whenever inspect is called.
Inspect should probably just iterate through @data
and do nothing else, since any of the attribute methods might have side effects.
As a work around, this monkey patch works to avoid the problem:
module Mumble
class Model
def inspect
rs = @data.map{|a, v| "#{a}=#{v}"}.join(' ')
%Q{#<#{self.class.name} #{rs}>}
end
end
end