Class: Tell
- Inherits:
-
Object
- Object
- Tell
- Defined in:
- lib/tell.rb
Constant Summary collapse
- VERSION =
"0.0.1"
- FORMAT =
ANSI Colors for a better user experience. 1;32m - Green 1;37m - White
"\e[1;32m %10s\e[1;37m %s"
Instance Attribute Summary collapse
-
#servers ⇒ Object
readonly
Returns the value of attribute servers.
Instance Method Summary collapse
- #execute(command) ⇒ Object
-
#initialize(servers = [], &block) ⇒ Tell
constructor
A new instance of Tell.
- #run ⇒ Object
Constructor Details
#initialize(servers = [], &block) ⇒ Tell
Returns a new instance of Tell.
11 12 13 14 15 16 |
# File 'lib/tell.rb', line 11 def initialize(servers = [], &block) @servers = servers @commands = [] instance_eval(&block) if block_given? end |
Instance Attribute Details
#servers ⇒ Object (readonly)
Returns the value of attribute servers.
9 10 11 |
# File 'lib/tell.rb', line 9 def servers @servers end |
Instance Method Details
#execute(command) ⇒ Object
18 19 20 |
# File 'lib/tell.rb', line 18 def execute(command) @commands << command end |
#run ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/tell.rb', line 22 def run silence! servers.each do |server| log :connect, server @commands.each do |command| log :run, command display exec(server, command) end end end |