Class: Robut::Plugin::Status
- Inherits:
-
Object
- Object
- Robut::Plugin::Status
- Includes:
- Robut::Plugin
- Defined in:
- lib/robit/plugins/status.rb
Instance Method Summary collapse
- #handle(time, sender, message) ⇒ Object
- #handle_color(time, sender, message) ⇒ Object
- #handle_partition(time, sender, message) ⇒ Object
- #usage ⇒ Object
Instance Method Details
#handle(time, sender, message) ⇒ Object
68 69 70 71 72 73 74 |
# File 'lib/robit/plugins/status.rb', line 68 def handle time, sender, if sent_to_me?() && words()[0] =~ /^partitions?$/i handle_partition time, sender, elsif sent_to_me?() && words()[0] =~ /^colors?$/i handle_color time, sender, end end |
#handle_color(time, sender, message) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/robit/plugins/status.rb', line 53 def handle_color time, sender, pname = words()[1] if pname.nil? || pname.empty? partitions.each do |_, partition| reply "%{name} %{environment} - %{color}" % partition end else begin reply "%{name} %{environment} - %{color}" % partitions[pname.downcase] rescue reply "Sorry, I don't know of any partition named '#{pname}'" end end end |
#handle_partition(time, sender, message) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/robit/plugins/status.rb', line 38 def handle_partition time, sender, pname = words()[1] if pname.nil? or pname.empty? partitions.each do |_, partition| reply "%{name} %{environment} - %{release} %{branch}" % partition end else begin reply "%{name} %{environment} - %{release} %{branch}" % partitions[pname.downcase] rescue reply "Sorry, I don't know of any partition named '#{pname}'" end end end |
#usage ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/robit/plugins/status.rb', line 29 def usage [ "#{at_nick} partition - Return the configuration for all partitions", "#{at_nick} partition <name> - Return the configuration for the given partition", "#{at_nick} color - Return the plugin color for all paritions", "#{at_nick} color <name> - Return the plugin color for the given partition" ].join("\n") end |