Class: Net::IRC::Message::Prefix

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

Constant Summary collapse

PREFIX_REGEX =
/^([^!@]+)(?:(?:!([^@]+))?@(.+))?/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prefix) ⇒ Prefix

Returns a new instance of Prefix.



167
168
169
170
# File 'lib/net/irc.rb', line 167

def initialize(prefix)
  @prefix = prefix
  @matches = prefix.match(PREFIX_REGEX)
end

Instance Attribute Details

#prefixObject

Returns the value of attribute prefix.



163
164
165
# File 'lib/net/irc.rb', line 163

def prefix
  @prefix
end

Instance Method Details

#hostObject



184
185
186
# File 'lib/net/irc.rb', line 184

def host
  @matches[3]
end

#nicknameObject



176
177
178
# File 'lib/net/irc.rb', line 176

def nickname
  @matches[1]
end

#serverObject



172
173
174
# File 'lib/net/irc.rb', line 172

def server
  @prefix
end

#to_sObject



188
189
190
# File 'lib/net/irc.rb', line 188

def to_s
  @prefix
end

#userObject



180
181
182
# File 'lib/net/irc.rb', line 180

def user
  @matches[2]
end