Class: Net::IRC::Message::Prefix
- Inherits:
-
Object
- Object
- Net::IRC::Message::Prefix
- Defined in:
- lib/net/irc.rb
Constant Summary collapse
- PREFIX_REGEX =
/^([^!@]+)(?:(?:!([^@]+))?@(.+))?/
Instance Attribute Summary collapse
-
#prefix ⇒ Object
Returns the value of attribute prefix.
Instance Method Summary collapse
- #host ⇒ Object
-
#initialize(prefix) ⇒ Prefix
constructor
A new instance of Prefix.
- #nickname ⇒ Object
- #server ⇒ Object
- #to_s ⇒ Object
- #user ⇒ Object
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
#prefix ⇒ Object
Returns the value of attribute prefix.
163 164 165 |
# File 'lib/net/irc.rb', line 163 def prefix @prefix end |
Instance Method Details
#host ⇒ Object
184 185 186 |
# File 'lib/net/irc.rb', line 184 def host @matches[3] end |
#nickname ⇒ Object
176 177 178 |
# File 'lib/net/irc.rb', line 176 def nickname @matches[1] end |
#server ⇒ Object
172 173 174 |
# File 'lib/net/irc.rb', line 172 def server @prefix end |
#to_s ⇒ Object
188 189 190 |
# File 'lib/net/irc.rb', line 188 def to_s @prefix end |
#user ⇒ Object
180 181 182 |
# File 'lib/net/irc.rb', line 180 def user @matches[2] end |