Class: Groundskeeper::Executable
- Inherits:
-
Object
- Object
- Groundskeeper::Executable
- Defined in:
- lib/groundskeeper/executable.rb
Overview
Class to execute commands for other classes
Class Attribute Summary collapse
-
.verbose ⇒ Object
Returns the value of attribute verbose.
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
Instance Method Summary collapse
- #execute(arguments) ⇒ Object
-
#initialize(command) ⇒ Executable
constructor
A new instance of Executable.
Constructor Details
#initialize(command) ⇒ Executable
Returns a new instance of Executable.
18 19 20 21 22 23 24 |
# File 'lib/groundskeeper/executable.rb', line 18 def initialize(command) if `which #{command}`.empty? raise "#{command} not found, is it installed on your PATH?" end @command = command end |
Class Attribute Details
.verbose ⇒ Object
Returns the value of attribute verbose.
15 16 17 |
# File 'lib/groundskeeper/executable.rb', line 15 def verbose @verbose end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
6 7 8 |
# File 'lib/groundskeeper/executable.rb', line 6 def command @command end |
Instance Method Details
#execute(arguments) ⇒ Object
26 27 28 29 |
# File 'lib/groundskeeper/executable.rb', line 26 def execute(arguments) puts "#{command} #{arguments}" if self.class.verbose `#{command} #{arguments}` end |