Class: Weechat::IRC::Prefix
- Inherits:
-
Object
- Object
- Weechat::IRC::Prefix
- Defined in:
- lib/weechat/irc/host.rb
Instance Attribute Summary (collapse)
-
- (Object) host
readonly
Returns the value of attribute host.
-
- (Object) nick
readonly
Returns the value of attribute nick.
-
- (Object) user
readonly
Returns the value of attribute user.
Instance Method Summary (collapse)
-
- (Prefix) initialize(string)
constructor
A new instance of Prefix.
- - (Object) to_s
Constructor Details
- (Prefix) initialize(string)
A new instance of Prefix
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/weechat/irc/host.rb', line 24 def initialize(string) @host, @nick, @user = nil, nil, nil parts = string.split("@") if parts.size == 1 @nick = parts.first else @host = parts.last @nick, @user = parts.first.split("!") end end |
Instance Attribute Details
- (Object) host (readonly)
Returns the value of attribute host
22 23 24 |
# File 'lib/weechat/irc/host.rb', line 22 def host @host end |
- (Object) nick (readonly)
Returns the value of attribute nick
20 21 22 |
# File 'lib/weechat/irc/host.rb', line 20 def nick @nick end |
- (Object) user (readonly)
Returns the value of attribute user
21 22 23 |
# File 'lib/weechat/irc/host.rb', line 21 def user @user end |
Instance Method Details
- (Object) to_s
35 36 37 38 39 40 41 |
# File 'lib/weechat/irc/host.rb', line 35 def to_s if @host.empty? @nick else "#{@nick}!#{@user}@#{@host}" end end |