Module: IIRC::ISupport

Included in:
Batteries
Defined in:
lib/iirc/modules/isupport.rb

Overview

Parses RPL_ISUPPORT (005) events into a Hash.

These are sent by servers after registration to provide info about the network, what the server supports, and how it behaves.

Provides a Hash of the raw values, extended with helper methods which process them.

Defined Under Namespace

Modules: Inquiry

Instance Method Summary collapse

Instance Method Details

#clear_isupportObject (private)



27
28
29
# File 'lib/iirc/modules/isupport.rb', line 27

def clear_isupport
  @isupport = nil
end

#configure_isupportObject (private)



22
23
24
25
# File 'lib/iirc/modules/isupport.rb', line 22

def configure_isupport
  on :'001', :clear_isupport
  on :'005', :store_isupport
end

#isupportHash#extend(Inquiry)

Hash of tokens sent by the server after registration indicating feature support and limits.

Returns:

  • (Hash#extend(Inquiry))

    the raw isupport key=>value pairs. keys with no value are assigned +true+.



17
18
19
# File 'lib/iirc/modules/isupport.rb', line 17

def isupport
  @isupport ||= {}.extend(Inquiry)
end

#store_isupport(evt) ⇒ Object (private)



31
32
33
34
35
36
37
38
# File 'lib/iirc/modules/isupport.rb', line 31

def store_isupport(evt)
  tokens = evt.args[1..-2]

  for token in tokens
    name, value = token.split('=', 2)
    isupport[name] = value.freeze || true
  end
end