Class: IRC::RFC2812::Whois

Inherits:
Object
  • Object
show all
Defined in:
lib/irc/rfc2812/whois.rb

Overview

Public: Represents a WHOIS response.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(messages) ⇒ Whois

Public: Initializes the …

messages - An Array of IRC::Messages.


15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/irc/rfc2812/whois.rb', line 15

def initialize(messages)
  @channels = []
  @statuses = {}

  messages.each do |message|
    method = "parse_#{message.command}"
    
    if self.respond_to? method, true
      self.send method, message
    end
  end
end

Instance Attribute Details

#channels(status = false) ⇒ Object (readonly)

Public: Gets the channels. If a `status` is given, it returns only the channels with that status.

status - A status Symbol (default: false).

Returns an Array.


43
44
45
# File 'lib/irc/rfc2812/whois.rb', line 43

def channels
  @channels
end

#hostObject (readonly)

Returns the value of attribute host


5
6
7
# File 'lib/irc/rfc2812/whois.rb', line 5

def host
  @host
end

#nickObject (readonly)

Returns the value of attribute nick


5
6
7
# File 'lib/irc/rfc2812/whois.rb', line 5

def nick
  @nick
end

#realnameObject (readonly)

Returns the value of attribute realname


5
6
7
# File 'lib/irc/rfc2812/whois.rb', line 5

def realname
  @realname
end

#seconds_idleObject (readonly)

Returns the value of attribute seconds_idle


5
6
7
# File 'lib/irc/rfc2812/whois.rb', line 5

def seconds_idle
  @seconds_idle
end

#serverObject (readonly)

Returns the value of attribute server


5
6
7
# File 'lib/irc/rfc2812/whois.rb', line 5

def server
  @server
end

#server_infoObject (readonly)

Returns the value of attribute server_info


5
6
7
# File 'lib/irc/rfc2812/whois.rb', line 5

def server_info
  @server_info
end

#statusesObject (readonly)

Public: Gets the statuses Hash (`{ “#channel” => :status }`). The status is `nil` if there is no status.


10
11
12
# File 'lib/irc/rfc2812/whois.rb', line 10

def statuses
  @statuses
end

#userObject (readonly)

Returns the value of attribute user


5
6
7
# File 'lib/irc/rfc2812/whois.rb', line 5

def user
  @user
end

Instance Method Details

#away?Boolean

Returns:

  • (Boolean)

28
29
30
# File 'lib/irc/rfc2812/whois.rb', line 28

def away?
  @away || false
end

#operator?Boolean

Public: Operator means IRC operator, not channel operator.

Returns:

  • (Boolean)

33
34
35
# File 'lib/irc/rfc2812/whois.rb', line 33

def operator?
  @operator || false
end