Class: Moodwall::Executable
- Inherits:
-
Object
- Object
- Moodwall::Executable
- Defined in:
- lib/moodwall/executable.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#command ⇒ Object
readonly
Returns the value of attribute command.
Instance Method Summary collapse
- #error_if_missing ⇒ Object
- #execute(path) ⇒ Object
-
#initialize(options = {}) ⇒ Executable
constructor
A new instance of Executable.
Constructor Details
#initialize(options = {}) ⇒ Executable
Returns a new instance of Executable.
7 8 9 10 11 |
# File 'lib/moodwall/executable.rb', line 7 def initialize( = {}) @command = .fetch(:command, nil) @arguments = .fetch(:arguments, nil) error_if_missing end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
5 6 7 |
# File 'lib/moodwall/executable.rb', line 5 def arguments @arguments end |
#command ⇒ Object (readonly)
Returns the value of attribute command.
5 6 7 |
# File 'lib/moodwall/executable.rb', line 5 def command @command end |
Instance Method Details
#error_if_missing ⇒ Object
13 14 15 |
# File 'lib/moodwall/executable.rb', line 13 def error_if_missing raise(MissingExecutableError, "Can't find the `#{ command }`") unless installed? end |
#execute(path) ⇒ Object
17 18 19 |
# File 'lib/moodwall/executable.rb', line 17 def execute(path) system "#{ command } #{ arguments } #{ path }" end |