Class: Flexo::Data::Hostmask
- Inherits:
-
Object
- Object
- Flexo::Data::Hostmask
- Defined in:
- lib/flexo/data.rb
Overview
For added fun, we have a small, separate class for hostmasks. And, being very creative, we call it… Data::Hostmask!
Instance Attribute Summary collapse
-
#hostmask ⇒ Object
(also: #mask)
readonly
Returns the value of attribute hostmask.
-
#hostname ⇒ Object
(also: #host, #ip)
readonly
Returns the value of attribute hostname.
-
#nickname ⇒ Object
(also: #nick, #from, #by)
readonly
Returns the value of attribute nickname.
-
#username ⇒ Object
(also: #user, #ident)
readonly
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(nickname, username, hostname) ⇒ Hostmask
constructor
The only function in this class.
- #inspect ⇒ Object
Constructor Details
#initialize(nickname, username, hostname) ⇒ Hostmask
The only function in this class. When instanciated, this populates some instance variables with sensible values, and then allow us to access those using attr_readers
89 90 91 92 93 94 |
# File 'lib/flexo/data.rb', line 89 def initialize(nickname, username, hostname) @nickname = nickname @username = username @hostname = hostname @hostmask = "#{@nickname}!#{@username}@#{@hostname}".sub(/!?@?$/, '') end |
Instance Attribute Details
#hostmask ⇒ Object (readonly) Also known as: mask
Returns the value of attribute hostmask.
71 72 73 |
# File 'lib/flexo/data.rb', line 71 def hostmask @hostmask end |
#hostname ⇒ Object (readonly) Also known as: host, ip
Returns the value of attribute hostname.
69 70 71 |
# File 'lib/flexo/data.rb', line 69 def hostname @hostname end |
#nickname ⇒ Object (readonly) Also known as: nick, from, by
Returns the value of attribute nickname.
68 69 70 |
# File 'lib/flexo/data.rb', line 68 def nickname @nickname end |
#username ⇒ Object (readonly) Also known as: user, ident
Returns the value of attribute username.
70 71 72 |
# File 'lib/flexo/data.rb', line 70 def username @username end |
Instance Method Details
#inspect ⇒ Object
96 97 98 |
# File 'lib/flexo/data.rb', line 96 def inspect "#<#{self.class}:#{@hostmask}>" end |