Class: Rlyeh::Target
- Inherits:
-
Object
- Object
- Rlyeh::Target
- Defined in:
- lib/rlyeh/target.rb
Instance Method Summary collapse
-
#initialize(env, target) ⇒ Target
constructor
A new instance of Target.
- #notice(text, prefix = nil) ⇒ Object
- #privmsg(text, prefix = nil) ⇒ Object
- #send_message(command, text, prefix) ⇒ Object
Constructor Details
#initialize(env, target) ⇒ Target
Returns a new instance of Target.
3 4 5 6 |
# File 'lib/rlyeh/target.rb', line 3 def initialize(env, target) @env = env @target = target end |
Instance Method Details
#notice(text, prefix = nil) ⇒ Object
23 24 25 |
# File 'lib/rlyeh/target.rb', line 23 def notice(text, prefix = nil) 'NOTICE', text, prefix end |
#privmsg(text, prefix = nil) ⇒ Object
19 20 21 |
# File 'lib/rlyeh/target.rb', line 19 def privmsg(text, prefix = nil) 'PRIVMSG', text, prefix end |
#send_message(command, text, prefix) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/rlyeh/target.rb', line 8 def (command, text, prefix) prefix = {:nick => prefix.to_s} unless prefix.is_a?(Hash) unless prefix.key? :servername prefix[:nick] ||= 'rlyeh' prefix[:user] ||= 'rlyeh' prefix[:host] ||= @env.settings.server_name end @env.connection. command, @target, ":#{text}", :prefix => prefix end |