mumble-ruby icon indicating copy to clipboard operation
mumble-ruby copied to clipboard

Calling user.inspect causes the bot to mute itself

Open nogweii opened this issue 9 years ago • 1 comments

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.

nogweii avatar Sep 19 '15 06:09 nogweii

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

nogweii avatar Sep 19 '15 06:09 nogweii