Class: ModSpox::Messages::Incoming::Whois

Inherits:
Message
  • Object
show all
Defined in:
lib/mod_spox/messages/incoming/Whois.rb

Instance Attribute Summary collapse

Attributes inherited from Message

#raw_content, #time

Instance Method Summary collapse

Constructor Details

#initialize(nick) ⇒ Whois

Returns a new instance of Whois.



13
14
15
16
17
18
# File 'lib/mod_spox/messages/incoming/Whois.rb', line 13

def initialize(nick)
    @nick = nick
    @channels = Array.new
    @raw = Array.new
    @locked = false
end

Instance Attribute Details

#channelsObject

Channels user is found in



9
10
11
# File 'lib/mod_spox/messages/incoming/Whois.rb', line 9

def channels
  @channels
end

#nickObject (readonly)

Nick of user



7
8
9
# File 'lib/mod_spox/messages/incoming/Whois.rb', line 7

def nick
  @nick
end

#rawObject

Raw whois string



11
12
13
# File 'lib/mod_spox/messages/incoming/Whois.rb', line 11

def raw
  @raw
end

Instance Method Details

#channels_push(channel) ⇒ Object

channel

Channel

Adds channel to list



22
23
24
25
# File 'lib/mod_spox/messages/incoming/Whois.rb', line 22

def channels_push(channel)
    restricted if @locked
    @channels << channel
end

#lockObject

Locks the object’s custom methods



35
36
37
38
39
# File 'lib/mod_spox/messages/incoming/Whois.rb', line 35

def lock
    @locked = true
    @raw_content = @raw.join("\n")
    @nick.refresh
end

#raw_push(string) ⇒ Object

string

string

Adds string to raw whois info



29
30
31
32
# File 'lib/mod_spox/messages/incoming/Whois.rb', line 29

def raw_push(string)
    restricted if @locked
    @raw << string
end