Class: IRC::Sender
- Inherits:
-
Object
- Object
- IRC::Sender
- Defined in:
- lib/on_irc/sender.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#nick ⇒ Object
Returns the value of attribute nick.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(string) ⇒ Sender
constructor
A new instance of Sender.
- #server? ⇒ Boolean
- #to_s ⇒ Object
- #user? ⇒ Boolean
Constructor Details
#initialize(string) ⇒ Sender
Returns a new instance of Sender.
5 6 7 8 9 10 11 12 13 |
# File 'lib/on_irc/sender.rb', line 5 def initialize(string) if string =~ /^([^!]+)!([^@]+)@(.+)$/ @nick, @user, @host = $1, $2, $3 @server = false else @host = string @server = true end end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
3 4 5 |
# File 'lib/on_irc/sender.rb', line 3 def host @host end |
#nick ⇒ Object
Returns the value of attribute nick.
3 4 5 |
# File 'lib/on_irc/sender.rb', line 3 def nick @nick end |
#user ⇒ Object
Returns the value of attribute user.
3 4 5 |
# File 'lib/on_irc/sender.rb', line 3 def user @user end |
Instance Method Details
#empty? ⇒ Boolean
27 28 29 |
# File 'lib/on_irc/sender.rb', line 27 def empty? to_s.empty? end |
#server? ⇒ Boolean
15 16 17 |
# File 'lib/on_irc/sender.rb', line 15 def server? @server end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/on_irc/sender.rb', line 23 def to_s @server ? @host : @nick + '!' + @user + '@' + @host end |
#user? ⇒ Boolean
19 20 21 |
# File 'lib/on_irc/sender.rb', line 19 def user? !@server end |