Class: IRC::Modes

Inherits:
ThreadSafeHash show all
Defined in:
lib/failirc/modes.rb

Instance Method Summary collapse

Methods inherited from ThreadSafeHash

#[], #[]=, #delete

Methods inherited from CaseInsensitiveHash

#[], #[]=, #delete

Constructor Details

#initialize(string = nil) ⇒ Modes

Returns a new instance of Modes.



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/failirc/modes.rb', line 25

def initialize (string=nil)
    super()

    self[:extended] = ThreadSafeHash.new

    if string
        string.each_char {|char|
            @modes[char.to_sym] = true
        }
    end
end

Instance Method Details

#to_sObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/failirc/modes.rb', line 37

def to_s
    result = '+'

    each_key {|mode|
        if mode
            mode = mode.to_s

            if mode.length == 1
                result << mode
            end
        end
    }

    return result
end