Class: IRC::User

Inherits:
Object
  • Object
show all
Defined in:
lib/wires/ircbot/user.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ User

Returns a new instance of User.



11
12
13
# File 'lib/wires/ircbot/user.rb', line 11

def initialize(*args)
  @string, @nick, @user, @host = *args
end

Instance Attribute Details

#hostObject

Returns the value of attribute host.



5
6
7
# File 'lib/wires/ircbot/user.rb', line 5

def host
  @host
end

#nickObject

Returns the value of attribute nick.



5
6
7
# File 'lib/wires/ircbot/user.rb', line 5

def nick
  @nick
end

#stringObject

Returns the value of attribute string.



5
6
7
# File 'lib/wires/ircbot/user.rb', line 5

def string
  @string
end

#userObject

Returns the value of attribute user.



5
6
7
# File 'lib/wires/ircbot/user.rb', line 5

def user
  @user
end

Class Method Details

.new(str) ⇒ Object



7
8
9
# File 'lib/wires/ircbot/user.rb', line 7

def self.new(str)
  (m = str.match /^(.+?)(?:(?:!(.+?))?@(.+?))?$/) ? super(*m.to_a) : nil
end

Instance Method Details

#to_sObject



15
# File 'lib/wires/ircbot/user.rb', line 15

def to_s; @string; end