Method: Blur::User#merge_modes

Defined in:
library/blur/user.rb

#merge_modes(modes) ⇒ Object

Merge the users mode corresponding to the leading character (+ or -).

Parameters:

  • modes (String)

    the modes to merge with.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'library/blur/user.rb', line 54

def merge_modes modes
  addition = true

  modes.each_char do |char|
    case char
    when ?+
      addition = true
    when ?-
      addition = false
    else
      addition ? @modes.concat(char) : @modes.delete!(char)
    end
  end
end